From 8db876464bf5ac600d00e9d77455d5660217a6b9 Mon Sep 17 00:00:00 2001 From: Papoteur Date: Wed, 10 Jun 2020 19:05:02 +0200 Subject: Add parsing of arguments from command line (use python-manatools) --- lib/isodumper.py | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/lib/isodumper.py b/lib/isodumper.py index b620bf8..984d037 100755 --- a/lib/isodumper.py +++ b/lib/isodumper.py @@ -49,6 +49,10 @@ from pydbus import SystemBus from gi.repository import GLib import psutil +import manatools.args as args + +RELEASE="v1.17" + class NoUDisks2(Exception): pass @@ -116,11 +120,12 @@ class Info(object): self.richtext=richtext self.text=text - +class ParseCLI(args.AppArgs): + def __init(self, command): + super().__init__(command) + class IsoDumper(object): - RELEASE="v1.17" - def get_devices(self): self.list=self.u.find_devices() while len(self.list)==0: @@ -501,7 +506,7 @@ exFAT, NTFS or ext. You can specify a volume name and the format in a new dialog """ Init/Constructor for the 'widgets' """ - yui.YUI.app().setApplicationTitle(_("IsoDumper")+" "+self.RELEASE) + yui.YUI.app().setApplicationTitle(_("IsoDumper") + " " + RELEASE) yui.YUI.app().setApplicationIcon("/usr/share/icons/isodumper.png") self.atelier = yui.YUI.widgetFactory() self.dialog = self.atelier.createPopupDialog() @@ -768,8 +773,12 @@ exFAT, NTFS or ext. You can specify a volume name and the format in a new dialog if __name__ == "__main__": # Send the yui logging outside of the console yui.YUILog.setLogFileName("/dev/null") - app = IsoDumper() - app.run() - # next line seems to be a workaround to prevent the qt-app from crashing - # see https://github.com/libyui/libyui-qt/issues/41 - yui.YUILoader.deleteUI() + parser = ParseCLI('isodumper') + if parser.args.version: + print(RELEASE) + else: + app = IsoDumper() + app.run() + # next line seems to be a workaround to prevent the qt-app from crashing + # see https://github.com/libyui/libyui-qt/issues/41 + yui.YUILoader.deleteUI() -- cgit v1.2.1