diff options
author | Papoteur <papoteur@mageia.org> | 2021-03-26 07:08:42 +0100 |
---|---|---|
committer | Papoteur <papoteur@mageia.org> | 2021-03-27 18:58:25 +0100 |
commit | 6f33ddb8f52132471b9a052d18625fdd753dfd0f (patch) | |
tree | 88a7d7ca56fc3fa69095e521438e3a3206d0856d /lib | |
parent | 122d5f3d29999e9e8179251eed98bdf3fcb6a3d9 (diff) | |
download | isodumper-6f33ddb8f52132471b9a052d18625fdd753dfd0f.tar isodumper-6f33ddb8f52132471b9a052d18625fdd753dfd0f.tar.gz isodumper-6f33ddb8f52132471b9a052d18625fdd753dfd0f.tar.bz2 isodumper-6f33ddb8f52132471b9a052d18625fdd753dfd0f.tar.xz isodumper-6f33ddb8f52132471b9a052d18625fdd753dfd0f.zip |
Init DBus interface only one time
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/isodumper.py | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/lib/isodumper.py b/lib/isodumper.py index fc5ef4d..d91bc3d 100755 --- a/lib/isodumper.py +++ b/lib/isodumper.py @@ -386,16 +386,14 @@ class IsoDumper(basedialog.BaseDialog): message = _('Backup to: {}').format(dest) self.logger(message) logging.info(message) - bus = SystemBus() - iface = bus.get("org.mageia.Magiback", "Isodumper") # Writing step - iface.do_write(source, dest, self.deviceSize) - while not iface.done: - progress = iface.progress + self.iface.do_write(source, dest, self.deviceSize) + while not self.iface.done: + progress = self.iface.progress self.progress.setValue(progress) self.dialog.pollEvent() time.sleep(.2) - success, message = iface.end() + success, message = self.iface.end() if success: #: don't translate source or target message = _('{source} successfully written to {target}').format(source=source.split('/')[-1], target=dest) @@ -445,21 +443,19 @@ class IsoDumper(basedialog.BaseDialog): self.operation = True self.logger(message) logging.info(message) - bus = SystemBus() - iface = bus.get("org.mageia.Magiback", "Isodumper") success, message = self.u.do_unmount(target) self.udev_wait(_("unmounting")) if success: # Writing step - iface.do_write(source, target, b) - iface.get_sum(source) - progress = iface.progress - while not iface.done: - progress = iface.progress + self.iface.do_write(source, target, b) + self.iface.get_sum(source) + progress = self.iface.progress + while not self.iface.done: + progress = self.iface.progress self.progress.setValue(progress) self.dialog.pollEvent() time.sleep(.5) - success, message = iface.end() + success, message = self.iface.end() if success: #: don't translate source or target message = _('Image {source} successfully written to {target}').format(source=source.split('/')[-1], @@ -471,14 +467,14 @@ class IsoDumper(basedialog.BaseDialog): self.progress.setValue(0) self.dialog.pollEvent() # Checking - iface.check_write(target, source) + self.iface.check_write(target, source) progress = 0 while progress < 100: self.progress.setValue(progress) self.dialog.pollEvent() time.sleep(.5) - progress = iface.progress - nowarning, message = iface.end() + progress = self.iface.progress + nowarning, message = self.iface.end() self.progress.setEnabled() self.logger(message) logging.info(message) @@ -492,33 +488,33 @@ class IsoDumper(basedialog.BaseDialog): self.logger(message) logging.warning(message) else: - iface.do_persistence(target, self.partition_label.value(), self.cryptkey.value()) - while not iface.done: - progress = iface.progress + self.iface.do_persistence(target, self.partition_label.value(), self.cryptkey.value()) + while not self.iface.done: + progress = self.iface.progress self.progress.setValue(progress) - self.progress.setLabel(iface.message) + self.progress.setLabel(self.iface.message) self.dialog.pollEvent() time.sleep(.5) - if iface.state: + if self.iface.state: message = _("Added encrypted persistent partition") self.logger(message) logging.warning(message) else: self.logger(_("Adding encrypted persistent partition failed")) - self.logger(iface.message) + self.logger(self.iface.message) nowarning = False else: - iface.do_persistence(target, self.partition_label.value(), "") - while not iface.done: - progress = iface.progress + self.iface.do_persistence(target, self.partition_label.value(), "") + while not self.iface.done: + progress = self.iface.progress self.progress.setValue(progress) self.dialog.pollEvent() time.sleep(.5) - if iface.state: + if self.iface.state: message = _("Added persistent partition") else: message = _("Adding persistent partition failed") - self.logger(iface.message) + self.logger(self.iface.message) nowarning = False self.logger(message) logging.warning(message) @@ -688,6 +684,10 @@ 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") self.ChooseImage = _("Choose an image") self.warning = _("Warning\nThis will destroy all data on the target device,\n\ |