diff options
author | Papoteur <papoteur@mageia.org> | 2020-12-23 18:30:18 +0100 |
---|---|---|
committer | Papoteur <papoteur@mageia.org> | 2020-12-23 18:30:18 +0100 |
commit | 59b94d431df1c7efc733cdd49bbc4b44a0153418 (patch) | |
tree | e7f4bd9ad04c3b8920fe5fd11b62ab8c5cdd740a /lib | |
parent | 0481230a0c998c553845354d2407232b46649741 (diff) | |
parent | 80de1c22c863634cd8dafbf2eb8416d60d2579de (diff) | |
download | isodumper-59b94d431df1c7efc733cdd49bbc4b44a0153418.tar isodumper-59b94d431df1c7efc733cdd49bbc4b44a0153418.tar.gz isodumper-59b94d431df1c7efc733cdd49bbc4b44a0153418.tar.bz2 isodumper-59b94d431df1c7efc733cdd49bbc4b44a0153418.tar.xz isodumper-59b94d431df1c7efc733cdd49bbc4b44a0153418.zip |
Merge branch 'master' into topic/newgui
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/isodumper.py | 48 |
1 files changed, 39 insertions, 9 deletions
diff --git a/lib/isodumper.py b/lib/isodumper.py index 12b3eb5..2f58d6b 100755 --- a/lib/isodumper.py +++ b/lib/isodumper.py @@ -25,11 +25,9 @@ # Requires python3-parted -# ensure we're using the latest build, if called from our build environment + import sys import importlib -import logging - try: from isodumper import version except: @@ -49,6 +47,10 @@ import gettext from subprocess import Popen, PIPE from pydbus import SystemBus +import logging +import threading +from gi.repository import GLib +from queue import SimpleQueue import psutil import manatools.args as args import manatools.ui.common as common @@ -163,7 +165,7 @@ class ParseCLI(args.AppArgs): class IsoDumper(basedialog.BaseDialog): - def get_devices(self): + def get_devices(self, selected=None): self.list = self.u.find_devices() while len(self.list) == 0: if self.nodevDialog(): @@ -174,7 +176,9 @@ class IsoDumper(basedialog.BaseDialog): if len(self.list) > 0: for name, path, size in self.list: if size != 0: - self.devicelist.addItem(str(name + ' (' + path.lstrip() + ') ' + self.sizeof_fmt(size)), False) + label = str(name + ' (' + path.lstrip() + ') ' + self.sizeof_fmt(size)) + sel = (label == selected) if selected else False + self.devicelist.addItem(label, sel) return True def active_signal(self): @@ -213,10 +217,19 @@ class IsoDumper(basedialog.BaseDialog): self.dialog.recalcLayout() self.restore() +<<<<<<< HEAD def refresh_signal(self, device, params): print("Refresh ", device) self.devicelist.deleteAllItems() self.get_devices() +======= + def update_list_on_event(self): + selitem = self.devicelist.selectedItem().label() + self.devicelist.deleteAllItems() + self.get_devices(selected = selitem) + if self.devicelist.selectedItem().label() != selitem: + self.restore() +>>>>>>> master self.dialog.recalcLayout() def device_selected(self): @@ -435,13 +448,13 @@ class IsoDumper(basedialog.BaseDialog): self.dialog.pollEvent() # Checking iface.check_write(target, source) - progress = iface.progress + progress = 0 while progress < 100: - progress = iface.progress self.progress.setValue(progress) self.dialog.pollEvent() time.sleep(.5) - success, message = iface.end() + progress = iface.progress + nowarning, message = iface.end() self.progress.setEnabled() self.logger(message) logging.info(message) @@ -485,7 +498,10 @@ class IsoDumper(basedialog.BaseDialog): self.udev_wait(_("unmounting")) if success: self.u.eject(target) - self.success() + if nowarning : + self.success() + else: + self.warn() else: self.emergency(message) self.restore() @@ -507,6 +523,16 @@ class IsoDumper(basedialog.BaseDialog): if self.ask_OK(info): return + def warn(self): + self.operation = False + self.final_unsensitive() + info = Info(_("Warning"), True, _("The operation completed, but with anomalies.\n\ + Check carefully the messages in log view.\n\ + You are free to unplug it now, a logfile \n\ +(/home/-user- or /root)/.isodumper/isodumper.log will be saved when\n\ + you close the application.")) + if self.ask_OK(info): + return def confirm_close(self, *args): if not self.operation: # no writing , backup nor format running self.close() @@ -546,6 +572,8 @@ class IsoDumper(basedialog.BaseDialog): def close(self): self.dialog.destroy() self.dialog = None + self.glib_loop.quit() + self.glib_thread.join() def logger(self, text): self.logview.appendLines(text + "\n") @@ -741,6 +769,7 @@ exFAT, NTFS or ext. You can specify a volume name and the format in a new dialog self.active_signal() self.device_selected() self.dialog.recalcLayout() + self.uEventQueue = SimpleQueue() self.glib_loop = GLib.MainLoop() self.glib_thread = threading.Thread(target=self.glib_mainloop, args=(self.glib_loop,)) @@ -879,6 +908,7 @@ exFAT, NTFS or ext. You can specify a volume name and the format in a new dialog self._running = True self.timeout = 100 + try: self._handleEvents() except Exception: |