Skip to content

Commit

Permalink
add update functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
chipnetics committed Jul 13, 2022
1 parent fc57e01 commit 70c4f92
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 3 deletions.
51 changes: 48 additions & 3 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ void main() {
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);

// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
Expand Down Expand Up @@ -276,6 +275,49 @@ class _MyHomePageState extends State<MyHomePage> {
setState(() {});
}

_cbCheckUpdates() async
{

void _updateSnack(String util) async {

Directory current = Directory.current;
String retString = "";

ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text("Updating $util!"),duration: Duration(milliseconds: 500)));

try {
if (Platform.isWindows) {
retString =await execProcess("${current.path}/$util.exe",["-u","-z"]);
}
else {
retString =await execProcess("${current.path}/$util",["-u","-z"]);
}

ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text("Done updating $util!"),duration: Duration(milliseconds: 500)));
print(retString);
}
on Exception {
showDialog<String>(context: context, builder: (BuildContext context) => AlertDialog(
title: const Text("Error"),
content: Text("Could not find tool '$util'.\nEnsure it is in the same folder."),
));
xerpredWorking = false;
setState(() {});
return;
}


}

_updateSnack("xerdump");
_updateSnack("xertask");
_updateSnack("xerpred");
_updateSnack("xerdiff");


//setState(() {});
}


@override
Widget build(BuildContext context) {
Expand All @@ -290,7 +332,6 @@ class _MyHomePageState extends State<MyHomePage> {
AElevatedButton buttonXERpred = AElevatedButton(buttonText:"XER Pred",onTap:_cbXERpred, buttonTooltip: "Output a list of every task code with its predecessors, descending recursively to the specified depth",);
AElevatedButton buttonXERdiff = AElevatedButton(buttonText:"XER Diff",onTap:_cbXERdiff, buttonTooltip: "Identify what task codes have been added or deleted between 2 or more XER files");


ADropDown ddPredDepth = ADropDown();
XERList ttl = XERList();

Expand All @@ -307,7 +348,11 @@ class _MyHomePageState extends State<MyHomePage> {
actions: <Widget>[
PopupMenuButton(itemBuilder: (BuildContext context) {
return [
const PopupMenuItem(child: Text('Check for Updates'))
PopupMenuItem(
child: Text("Check for Updates"),
onTap: () {
_cbCheckUpdates();
}),
];
})
],
Expand Down
Binary file removed xerdump
Binary file not shown.

0 comments on commit 70c4f92

Please sign in to comment.