From 58c207ac3319f147c8866a5a57bc9dc978e31d5b Mon Sep 17 00:00:00 2001 From: Papoteur Date: Sat, 1 Jul 2023 09:55:04 +0200 Subject: New order in checking before operation, to check all at start --- lib/isodumper.py | 57 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 29 deletions(-) (limited to 'lib') diff --git a/lib/isodumper.py b/lib/isodumper.py index 2df00fa..c7a61b4 100755 --- a/lib/isodumper.py +++ b/lib/isodumper.py @@ -618,20 +618,6 @@ class IsoDumper(basedialog.BaseDialog): logging.error(message) self.emergency(message) else: - info = Info(_("Writing confirmation"), True, self.warning) - if self.ask_YesOrNo(info): - if self.deviceSize > 1024 * 1024 * 1024 * 32: - info = Info( - _("Warning"), - True, - _( - "The device is bigger than 32 Gbytes. Are you sure you want use it?" - ), - ) - if self.ask_YesOrNo(info): - pass - else: - return # I18N: don't translate source nor target self.progress.setLabel( _("Writing {source} to {target}").format( @@ -756,9 +742,8 @@ class IsoDumper(basedialog.BaseDialog): else: self.emergency(message) self.initial_state() - else: self.initial_state() - self.operation = False + self.operation = False def success(self): self.operation = False @@ -1286,9 +1271,31 @@ exFAT, NTFS or ext. You can specify a volume name and the format in a new dialog def start(self): backup_success = False - if self.backup_cbox.isChecked(): + if self.backup_cbox.isChecked() and not self.backup_is_selected: + # check that a name is set + info = Info(_("Error"), True, _("No image for backup is selected.")) + self.ask_OK(info) + return + if self.write_cbox.isChecked(): # check that a name is set - if self.backup_is_selected: + if self.image_is_selected: + info = Info(_("Writing confirmation"), True, self.warning) + if self.ask_YesOrNo(info): + if self.deviceSize > 1024 * 1024 * 1024 * 32: + info = Info( + _("Warning"), + True, + _( + "The device is bigger than 32 Gbytes. Are you sure you want use it?" + ), + ) + if not self.ask_YesOrNo(info): + return + else: + info = Info(_("Error"), True, _("No image to write is selected.")) + self.ask_OK(info) + return + if self.backup_cbox.isChecked() and self.backup_is_selected: backup_success, message = self.backup_go() if not backup_success: # something went wrong, we stop @@ -1296,17 +1303,9 @@ exFAT, NTFS or ext. You can specify a volume name and the format in a new dialog return self.logger(message) logging.info(message) - else: - info = Info(_("Error"), True, _("No image for backup is selected.")) - self.ask_OK(info) - return - if self.write_cbox.isChecked(): - if self.image_is_selected: - self.do_write() - self.image_is_selected = False - else: - info = Info(_("Error"), True, _("No image to write is selected.")) - self.ask_OK(info) + if self.write_cbox.isChecked() and self.image_is_selected: + self.do_write() + self.image_is_selected = False return if self.partition_cbox.isChecked(): # Create a partition without writing image, will use all the device space. -- cgit v1.2.1