diff options
author | Papoteur <papoteur@mageia.org> | 2021-01-05 21:41:18 +0100 |
---|---|---|
committer | Papoteur <papoteur@mageia.org> | 2021-01-05 21:41:18 +0100 |
commit | f4ecf7cd2e1fb0ef21dbfdbcbfc44dc2cb4169d7 (patch) | |
tree | 61e647c3bf96aba62928dd67755917dc118b8a78 | |
parent | fb45e4177862b407e45753d0390bbcd1eb0278b9 (diff) | |
download | isodumper-f4ecf7cd2e1fb0ef21dbfdbcbfc44dc2cb4169d7.tar isodumper-f4ecf7cd2e1fb0ef21dbfdbcbfc44dc2cb4169d7.tar.gz isodumper-f4ecf7cd2e1fb0ef21dbfdbcbfc44dc2cb4169d7.tar.bz2 isodumper-f4ecf7cd2e1fb0ef21dbfdbcbfc44dc2cb4169d7.tar.xz isodumper-f4ecf7cd2e1fb0ef21dbfdbcbfc44dc2cb4169d7.zip |
Restore backup action
-rwxr-xr-x | lib/isodumper.py | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/lib/isodumper.py b/lib/isodumper.py index f164547..f742c7d 100755 --- a/lib/isodumper.py +++ b/lib/isodumper.py @@ -194,6 +194,7 @@ class IsoDumper(basedialog.BaseDialog): return True def active_signal(self): + print("Active") self.u.iface["org.freedesktop.DBus.ObjectManager"].InterfacesAdded.connect(self.refresh_signal) self.u.iface["org.freedesktop.DBus.ObjectManager"].InterfacesRemoved.connect(self.refresh_signal) @@ -245,8 +246,12 @@ class IsoDumper(basedialog.BaseDialog): self.logger(message) logging.info(message) self.partition_cbox.setEnabled() + self.partition_cbox.setChecked(False) self.backup_cbox.setEnabled() + self.backup_cbox.setChecked(False) self.write_cbox.setEnabled() + self.write_cbox.setChecked(False) + self.cryptcb.setChecked(False) break @staticmethod @@ -260,8 +265,8 @@ class IsoDumper(basedialog.BaseDialog): def backup_choosed(self): # Add .img if not specified - self.backup_img_name = yui.YUI.app().askForSaveFileName("", "*.img", _("Backup to:")) - if self.backup_img_name != '': + self.backup_img_name = yui.YUI.app().askForSaveFileName("", "*.img", _("Backup to:")) + if self.backup_img_name != '': if not self.backup_img_name.lower().endswith('.img'): self.backup_img_name = self.backup_img_name + ".img" head, tail = os.path.split(self.backup_img_name) @@ -269,6 +274,9 @@ class IsoDumper(basedialog.BaseDialog): self.backup_select.setLabel(tail) self.dialog.recalcLayout() self.start_bt.setEnabled() + self.backup_is_selected = True + else: + self.backup_is_selected = False def do_format(self): #code, format_type, name = self.ask_format() @@ -306,6 +314,7 @@ class IsoDumper(basedialog.BaseDialog): def initial_state(self): self.image_is_selected = False + self.backup_is_selected = False self.backup_select.setDisabled() self.backup_cbox.setDisabled() self.partition_cbox.setDisabled() @@ -320,7 +329,6 @@ class IsoDumper(basedialog.BaseDialog): #self.persistencecb.setDisabled() self.partition_cb.setDisabled() self.partition_label.setDisabled() - self.cryptcb.setChecked(False) self.cryptcb.setDisabled() self.cryptkey.setDisabled() self.start_bt.setDisabled() @@ -354,6 +362,10 @@ class IsoDumper(basedialog.BaseDialog): def backup_go(self): self.wip_unsensitive() + self.devicelist.setDisabled() + self.backup_select.setDisabled() + self.progress.setEnabled() + 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?")) @@ -406,6 +418,7 @@ class IsoDumper(basedialog.BaseDialog): self.devicelist.setDisabled() self.backup_select.setDisabled() self.progress.setEnabled() + self.progress.setLabel("Writing") source = self.img_name target = self.dev.split('(')[1].split(')')[0] b = os.path.getsize(source) @@ -515,7 +528,7 @@ class IsoDumper(basedialog.BaseDialog): self.warn() else: self.emergency(message) - self.initial_state() + self.initial_state() else: self.emergency(message) else: @@ -566,19 +579,20 @@ class IsoDumper(basedialog.BaseDialog): def final_unsensitive(self): self.ima.setDisabled() self.devicelist.setDisabled() - #self.writebt.setDisabled() + self.select_write.setDisabled() + self.select_backup.setDisabled() self.progress.setDisabled() self.backup_select.setDisabled() - #self.persistencecb.setDisabled() + self.select_partition.setDisabled() def wip_unsensitive(self): self.ima.setDisabled() self.devicelist.setDisabled() - #self.writebt.setDisabled() + self.select_backup.setDisabled() self.backup_select.setDisabled() - #self.backupbt.setDisabled() + self.select_write.setDisabled() self.refreshbt.setDisabled() - #elf.persistencecb.setDisabled() + self.select_partition.setDisabled() def close(self): # to exit from _handleEvents loop @@ -867,12 +881,17 @@ exFAT, NTFS or ext. You can specify a volume name and the format in a new dialog def start(self): if self.backup_cbox.isChecked(): # check that a name is set - pass + if self.backup_is_selected: + self.backup_go() + self.backup_is_selected = False + else: + self.emergency(_("No image for backup is selected.")) if self.write_cbox.isChecked(): if self.image_is_selected: self.do_write() + self.image_is_selected = False else: - self.emergency(_("No image is selected.")) + self.emergency(_("No image to write is selected.")) return if self.partition_cbox.isChecked(): # Create a partition without writing image, will use all the device space. |