diff options
author | Papoteur <papoteur@mageia.org> | 2023-06-25 10:51:04 +0200 |
---|---|---|
committer | Papoteur <papoteur@mageia.org> | 2023-06-25 10:51:04 +0200 |
commit | 029c91992a632f6d5533c6d5abe48c9f1b7a0ec0 (patch) | |
tree | 7550581887d545039ebcc4d4d5700fe6395a435c /lib | |
parent | 4226df03be52c4b0cb25b79c40449020d45b7cc9 (diff) | |
download | isodumper-029c91992a632f6d5533c6d5abe48c9f1b7a0ec0.tar isodumper-029c91992a632f6d5533c6d5abe48c9f1b7a0ec0.tar.gz isodumper-029c91992a632f6d5533c6d5abe48c9f1b7a0ec0.tar.bz2 isodumper-029c91992a632f6d5533c6d5abe48c9f1b7a0ec0.tar.xz isodumper-029c91992a632f6d5533c6d5abe48c9f1b7a0ec0.zip |
Fix: continue to writing step after backup (mga#32035)
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/isodumper.py | 68 |
1 files changed, 32 insertions, 36 deletions
diff --git a/lib/isodumper.py b/lib/isodumper.py index dbf44b8..85487a0 100755 --- a/lib/isodumper.py +++ b/lib/isodumper.py @@ -393,21 +393,13 @@ class IsoDumper(basedialog.BaseDialog): rc = self.raw_format(target, format_type, name) self.operation = False if rc == 0: - message = _('The device was formatted successfully.') - self.logger(message) - self.success() + return True, _('The device was formatted successfully.') elif rc == 5: - message = _("An error occurred while creating a partition.") - self.logger(message) - self.emergency(message) + return False, _("An error occurred while creating a partition.") elif rc == 127: - message = _('Authentication error.') - self.logger(message) - self.emergency(message) + return False, _('Authentication error.') else: - message = _('An error {} occurred.'.format(rc)) - self.emergency(message) - self.initial_state() + return False, _('An error {} occurred.'.format(rc)) def initial_state(self): self.update_list() @@ -466,7 +458,7 @@ class IsoDumper(basedialog.BaseDialog): self.init_iface() self.wip_unsensitive() self.progress.setEnabled() - self.progress.setLabel("Backup") + self.progress.setLabel(_("Backup")) dest = self.backup_img_name if os.path.exists(dest): info = Info(_("Backup confirmation"), True, _("Do you want to overwrite the file?")) @@ -482,7 +474,7 @@ class IsoDumper(basedialog.BaseDialog): logging.warning(message) self.emergency(message) self.initial_state() - return False + return False, message else: self.operation = True self.returncode = 0 @@ -498,23 +490,12 @@ class IsoDumper(basedialog.BaseDialog): self.dialog.pollEvent() time.sleep(.2) success, message = self.iface.end() - if success: - # I18N: don't translate source nor target - message = _('{source} successfully written to {target}').format(source=source.split('/')[-1], target=dest) - self.logger(message) - logging.info(message) - self.progress.setEnabled() - self.progress.setValue(100) - self.dialog.pollEvent() - self.logger(message) - logging.info(message) - self.success() - self.initial_state() - else: + if not success: self.emergency(message) self.initial_state() - return False - return True + return False, message + # I18N: don't translate source nor target + return True, _('{source} successfully written to {target}').format(source=source.split('/')[-1], target=dest) def do_write(self): self.init_iface() @@ -902,11 +883,8 @@ exFAT, NTFS or ext. You can specify a volume name and the format in a new dialog # Connect events self.eventManager.addWidgetEvent(self.quitbt, self.confirm_close) self.eventManager.addWidgetEvent(self.ima, self.ask_image) - #self.eventManager.addWidgetEvent(self.writebt, self.do_write) self.eventManager.addWidgetEvent(self.cryptcb, self.check_encryt) - #self.eventManager.addWidgetEvent(self.backupbt, self.backup_go) self.eventManager.addWidgetEvent(self.backup_select, self.backup_choosed) - #self.eventManager.addWidgetEvent(self.formatbt, self.do_format) self.eventManager.addWidgetEvent(self.backup_cbox, self.select_backup) self.eventManager.addWidgetEvent(self.write_cbox, self.select_write) self.eventManager.addWidgetEvent(self.partition_cbox, self.select_partition) @@ -1051,14 +1029,17 @@ exFAT, NTFS or ext. You can specify a volume name and the format in a new dialog self.interface_active_state() def start(self): + backup_success = False if self.backup_cbox.isChecked(): # check that a name is set if self.backup_is_selected: - if self.backup_go(): - self.backup_is_selected = False - else: + backup_success, message = self.backup_go() + if not backup_success: # something went wrong, we stop + self.initial_state() return + self.logger(message) + logging.info(message) else: info = Info(_("Error"), True, _("No image for backup is selected.")) self.ask_OK(info) @@ -1073,7 +1054,22 @@ exFAT, NTFS or ext. You can specify a volume name and the format in a new dialog return if self.partition_cbox.isChecked(): # Create a partition without writing image, will use all the device space. - self.do_format() + format_success, message = self.do_format() + if format_success: + self.logger(message) + logging.info(message) + self.success() + else: + self.logger(message) + logging.info(message) + self.emergency(message) + elif backup_success: + # success message when no other operation after backup + self.progress.setEnabled() + self.progress.setValue(100) + self.dialog.pollEvent() + self.success() + self.initial_state() def ask_format(self): |