From daaa45a6e26f78feac13b45306ab9342d06b2d1f Mon Sep 17 00:00:00 2001 From: koraynilay Date: Mon, 8 Feb 2021 19:23:52 +0100 Subject: [PATCH] unsuccessfull try with array for dlm progress bar update_gui() --- legendary/gui/gui.py | 19 +++++++++++-------- legendary/gui/manager2.py | 4 ++-- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/legendary/gui/gui.py b/legendary/gui/gui.py index 514909d..069ec6c 100755 --- a/legendary/gui/gui.py +++ b/legendary/gui/gui.py @@ -595,10 +595,10 @@ def install_gtk(app_name, app_title, parent): ) #return 1 + install_dialog.hide() # TODO: if install_dialog_response != Gtk.ResponseType.OK: return 1 - install_dialog.hide() if core.is_installed(app_name): igame = core.get_installed_game(app_name) @@ -680,7 +680,8 @@ def install_gtk(app_name, app_title, parent): print('Preparing download...') # todo use status queue to print progress from CLI # This has become a little ridiculous hasn't it? - dlm, analysis, igame = core.prepare_download(game=game, base_game=base_game, base_path=args.base_path, + array_dlm = [0] + array_dlm[0], analysis, igame = core.prepare_download(game=game, base_game=base_game, base_path=args.base_path, force=args.force, max_shm=args.shared_memory, max_workers=args.max_workers, game_folder=args.game_folder, disable_patching=args.disable_patching, @@ -761,8 +762,10 @@ def install_gtk(app_name, app_title, parent): try: # set up logging stuff (should be moved somewhere else later) - dlm.logging_queue = cli.logging_queue - dlm.proc_debug = args.dlm_debug + #dlm.logging_queue = cli.logging_queue + #dlm.proc_debug = args.dlm_debug + array_dlm[0].logging_queue = cli.logging_queue + array_dlm[0].proc_debug = args.dlm_debug #print("parent:",parent) # dlm.perc = 0 @@ -771,11 +774,11 @@ def install_gtk(app_name, app_title, parent): # dlm.minutes = 0 # dlm.seconds = 0 #bar.set_text(f"{dlm.dl_speed / 1024 / 1024:.02f} MiB/s - {(dlm.perc*100):.02f}% - ETA: {dlm.hours:02d}:{dlm.minutes:02d}:{dlm.seconds:02d}") - dlm.start() + array_dlm[0].start() #time.sleep(4) - #parent.timeout_id = GLib.timeout_add(1000, update_gui, dlm, parent.progress_bar) - #print("timeout_add -",parent.timeout_id) - dlm.join() + parent.timeout_id = GLib.timeout_add(1000, update_gui, array_dlm[0], parent.progress_bar) + print("timeout_add -",parent.timeout_id) + array_dlm[0].join() except Exception as e: end_t = time.time() #log_gtk(f'Installation failed after {end_t - start_t:.02f} seconds.' diff --git a/legendary/gui/manager2.py b/legendary/gui/manager2.py index 66ceffd..5ac3d67 100644 --- a/legendary/gui/manager2.py +++ b/legendary/gui/manager2.py @@ -672,8 +672,8 @@ class DLManager(Process): self.obj_out = log_dlm.create(self, main_window) print("created obj_out:", self.obj_out) - self.timeout_id = GLib.timeout_add(100, log_dlm.update_gui, self, self.obj_out) - print("timeout_add -",self.timeout_id) + #self.timeout_id = GLib.timeout_add(100, log_dlm.update_gui, self, self.obj_out) + #print("timeout_add -",self.timeout_id) last_update = time.time() print("before loop")