From e711651c754a7c5ef5d4b72c68006924197bd0ea Mon Sep 17 00:00:00 2001 From: Papoteur Date: Wed, 25 Jan 2023 21:42:27 +0100 Subject: try to fix ending without exit(), for usage in mpan --- lib/isodumper.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/isodumper.py b/lib/isodumper.py index d153227..4cff6ce 100755 --- a/lib/isodumper.py +++ b/lib/isodumper.py @@ -211,7 +211,7 @@ class IsoDumper(basedialog.BaseDialog): if size != 0: label = str(name + ' (' + path.lstrip() + ') ' + self.sizeof_fmt(size)) sel = (label == selected) if selected else False - self.devicelist.addItem(label, sel) + self.devicelist.addItem(label, sel) return True def udev_wait(self, operation): @@ -364,14 +364,14 @@ class IsoDumper(basedialog.BaseDialog): def do_format(self): #code, format_type, name = self.ask_format() if self.partition_cb.value() != "": - self.operation = True + self.operation = True format_type = list(self.format_type.keys())[list(self.format_type.values()).index(self.partition_cb.value())] if format_type == 'persist': self.emergency(_("Persistence partition is to use when writing a Live ISO image.")) return target = self.dev.split('(')[1].split(')')[0] info = Info(_("Formatting confirmation in {}".format(self.partition_cb.value())), True, self.warning) - if self.ask_YesOrNo(info): + if self.ask_YesOrNo(info): name = self.partition_label.value() if format_type == 'fat32': name = name.upper()[:11] @@ -756,7 +756,8 @@ exFAT, NTFS or ext. You can specify a volume name and the format in a new dialog info = Info(_("Error"), True, _("There is another instance of Isodumper already running.")) self.ask_OK(info) yui.YUILoader.deleteUI() - exit() + self._running = False + return # TODO Read log level from command line level = logging.DEBUG if debug else logging.ERROR @@ -772,7 +773,7 @@ exFAT, NTFS or ext. You can specify a volume name and the format in a new dialog # Operation running self.operation = False - + # Prepare interface on DBus self.bus = SystemBus() self.iface = self.bus.get("org.mageia.Magiback", "Isodumper") @@ -907,7 +908,8 @@ exFAT, NTFS or ext. You can specify a volume name and the format in a new dialog if not self.get_devices(): self.dialog.destroy() yui.YUILoader.deleteUI() - exit() + self._running = False + return # Set the initial state, active, disabled self.initial_state() self.dialog.recalcLayout() @@ -981,7 +983,7 @@ exFAT, NTFS or ext. You can specify a volume name and the format in a new dialog self.write_cbox.setDisabled() self.write_cbox.setChecked(False) self.cryptcb.setChecked(False) - + backup_ready = self.backup_cbox.isChecked() and (self.backup_dest != "") write_ready = self.write_cbox.isChecked() and (self.img_name != "") partition_ready = self.partition_cbox.isChecked() and (self.partition_cb.value() in self.format_type.values()) @@ -996,7 +998,7 @@ exFAT, NTFS or ext. You can specify a volume name and the format in a new dialog else: self.cryptcb.setDisabled() self.cryptkey.setDisabled() - + def select_backup(self): if self.backup_cbox.isChecked(): @@ -1032,7 +1034,7 @@ exFAT, NTFS or ext. You can specify a volume name and the format in a new dialog self.cryptcb.setDisabled() self.cryptkey.setDisabled() self.interface_active_state() - + def check_encryt(self): if self.cryptcb.isChecked(): @@ -1065,7 +1067,7 @@ exFAT, NTFS or ext. You can specify a volume name and the format in a new dialog if self.partition_cbox.isChecked(): # Create a partition without writing image, will use all the device space. self.do_format() - + def ask_format(self): atelier = yui.YUI.widgetFactory() -- cgit v1.2.1