diff options
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/isodumper.py | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/lib/isodumper.py b/lib/isodumper.py index d868cfb..12b3eb5 100755 --- a/lib/isodumper.py +++ b/lib/isodumper.py @@ -149,7 +149,6 @@ class UDisks2(object): i_drive = self.bus.get(self.SERVICE, drive) i_drive.Eject({}) - class Info(object): def __init__(self, title, richtext, text): self.title = title @@ -178,6 +177,16 @@ class IsoDumper(basedialog.BaseDialog): self.devicelist.addItem(str(name + ' (' + path.lstrip() + ') ' + self.sizeof_fmt(size)), False) 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) + + def deactive_signal(self): + print("Désactive") + #self.u.iface["org.freedesktop.DBus.ObjectManager"].onInterfacesAdded = None + #self.u.iface["org.freedesktop.DBus.ObjectManager"].onInterfacesRemoved = None + def udev_wait(self, operation): wait = Popen(["udevadm", "settle", "--timeout=15"], stderr=PIPE) wait.communicate() @@ -204,6 +213,12 @@ class IsoDumper(basedialog.BaseDialog): self.dialog.recalcLayout() self.restore() + def refresh_signal(self, device, params): + print("Refresh ", device) + self.devicelist.deleteAllItems() + self.get_devices() + self.dialog.recalcLayout() + def device_selected(self): selitem = self.devicelist.selectedItem() if selitem is not None: @@ -212,8 +227,9 @@ class IsoDumper(basedialog.BaseDialog): if self.dev.startswith(name + ' (' + path.lstrip()): self.deviceSize = size self.device_name = name.rstrip().replace(' ', '') - self.logger(_('Target Device: ') + self.dev) - logging.info(_('Target Device: {}').format(self.dev)) + message = _('Target Device: {}').format(self.dev) + self.logger(message) + logging.info(message) self.formatbt.setEnabled() self.ima.setEnabled() self.backup_select.setEnabled() @@ -391,6 +407,7 @@ class IsoDumper(basedialog.BaseDialog): message = _('Executing copy from {source} to {target}').format(source=source, target=target) self.logger(message) logging.info(message) + self.deactive_signal() bus = SystemBus() iface = bus.get("org.mageia.Magiback", "Isodumper") success, message = self.u.do_unmount(target) @@ -479,6 +496,7 @@ class IsoDumper(basedialog.BaseDialog): self.restore() else: self.restore() + self.active_signal() def success(self): self.operation = False @@ -715,12 +733,12 @@ exFAT, NTFS or ext. You can specify a volume name and the format in a new dialog except: message = _('UDisks2 is not available on your system') logging.error(message) - self.logger(message) self.emergency(message) if not self.get_devices(): self.dialog.destroy() yui.YUILoader.deleteUI() exit() + self.active_signal() self.device_selected() self.dialog.recalcLayout() self.uEventQueue = SimpleQueue() |