From 6a39813ec92b528182b064e6792f2f1b1694d0f9 Mon Sep 17 00:00:00 2001 From: Papoteur Date: Fri, 1 Jan 2021 11:22:21 +0100 Subject: Set initial state, used also for restoration --- lib/isodumper.py | 43 ++++++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 23 deletions(-) (limited to 'lib') diff --git a/lib/isodumper.py b/lib/isodumper.py index 5220a0d..b4ab9e0 100755 --- a/lib/isodumper.py +++ b/lib/isodumper.py @@ -215,7 +215,7 @@ class IsoDumper(basedialog.BaseDialog): self.ima.setLabel(self.ChooseImage) self.backup_select.setLabel(self.ChooseImage) self.dialog.recalcLayout() - self.restore() + self.initial_state() def refresh_signal(self, device, params): self.devicelist.deleteAllItems() @@ -233,7 +233,7 @@ class IsoDumper(basedialog.BaseDialog): message = _('Target Device: {}').format(self.dev) self.logger(message) logging.info(message) - self.formatbt.setEnabled() + #self.formatbt.setEnabled() self.ima.setEnabled() self.backup_select.setEnabled() break @@ -282,14 +282,14 @@ class IsoDumper(basedialog.BaseDialog): else: message = _('An error occurred.') self.emergency(message) - self.restore() + self.initial_state() - def restore(self): + def initial_state(self): self.backup_select.setDisabled() - self.backupbt.setDisabled() - self.formatbt.setDisabled() + #self.backupbt.setDisabled() + #self.formatbt.setDisabled() self.ima.setDisabled() - self.writebt.setDisabled() + #self.writebt.setDisabled() self.devicelist.setEnabled() self.progress.setLabel(_("Progress")) self.progress.setValue(0) @@ -297,9 +297,14 @@ class IsoDumper(basedialog.BaseDialog): self.refreshbt.setEnabled() #self.persistencecb.setChecked(False) #self.persistencecb.setDisabled() + self.partition_cb.setDisabled() + self.partition_label.setDisabled() + self.revealcb.setChecked(False) + self.revealcb.setDisabled() self.cryptcb.setChecked(False) self.cryptcb.setDisabled() self.cryptkey.setDisabled() + self.start_bt.setDisabled() def raw_format(self, usb_path, fstype, label): self.u.do_unmount(usb_path) @@ -371,10 +376,10 @@ class IsoDumper(basedialog.BaseDialog): self.logger(message) logging.info(message) self.success() - self.restore() + self.initial_state() else: self.emergency(message) - self.restore() + self.initial_state() def do_write(self): self.wip_unsensitive() @@ -494,14 +499,14 @@ class IsoDumper(basedialog.BaseDialog): self.warn() else: self.emergency(message) - self.restore() + self.initial_state() else: self.emergency(message) else: self.emergency(message) - self.restore() + self.initial_state() else: - self.restore() + self.initial_state() self.active_signal() def success(self): @@ -690,17 +695,14 @@ exFAT, NTFS or ext. You can specify a volume name and the format in a new dialog # add file picker for backup file name self.backup_select = self.factory.createPushButton(self.backupbox, self.ChooseImage) self.backup_select.setStretchable(0, True) - self.backup_select.setDisabled() self.factory.createHStretch(self.backupbox) self.writebox = self.factory.createHBox(self.operationbox) self.factory.createCheckBox(self.writebox, _("Write Image from:")) # add file picker for image file self.ima = self.factory.createPushButton(self.writebox, self.ChooseImage) self.ima.setStretchable(0, True) - self.ima.setDisabled() self.factory.createHStretch(self.writebox) #self.writebt = self.factory.createPushButton(self.writebox, _("&Write to device")) - #self.writebt.setDisabled() self.partitionbox = self.factory.createHBox(self.operationbox) self.factory.createCheckBox(self.partitionbox, _("Create partition of type:")) self.partition_cb = self.factory.createComboBox(self.partitionbox, _("Type:")) @@ -718,16 +720,9 @@ exFAT, NTFS or ext. You can specify a volume name and the format in a new dialog self.cryptkey = self.factory.createInputField(self.persistencebox, _("Key:"), passwordMode=True) self.cryptkey.setStretchable(0, True) self.revealcb = self.factory.createCheckBox(self.persistencebox, _("Reveal key")) - #self.persistencecb.setDisabled() - #self.persistencecb.setNotify() - self.cryptcb.setDisabled() + self.revealcb.setNotify() self.cryptcb.setNotify() - self.cryptkey.setDisabled() - #self.formatbox = self.factory.createHBox(self.box) - #self.factory.createLabel(self.formatbox, _("Format the device in FAT, exFAT, NTFS or ext:")) - #self.factory.createHStretch(self.formatbox) #self.formatbt = self.factory.createPushButton(self.formatbox, _("Format the device")) - #self.formatbt.setDisabled() self.execute_frame = self.factory.createFrame(self.box, _("Execution")) self.execute_framevb = self.factory.createVBox(self.execute_frame) self.execute_label = self.factory.createLabel(self.execute_framevb, _("When you are sure all options are correct, start:")) @@ -746,6 +741,8 @@ exFAT, NTFS or ext. You can specify a volume name and the format in a new dialog self.helpbt.setStretchable(0, True) self.quitbt = self.factory.createPushButton(self.buttonsbox, _("Quit")) self.quitbt.setStretchable(0, True) + # Set the initial state, active, disabled + self.initial_state() # Connect events self.eventManager.addWidgetEvent(self.quitbt, self.confirm_close) self.eventManager.addWidgetEvent(self.ima, self.ask_image) -- cgit v1.2.1