diff --git a/legendary/gui/gui.py b/legendary/gui/gui.py index 7b2af4f..2f69344 100755 --- a/legendary/gui/gui.py +++ b/legendary/gui/gui.py @@ -19,7 +19,7 @@ import legendary.cli core = legendary.core.LegendaryCore() cli = legendary.cli.LegendaryCLI() -def update_gui(dlm, bar): +def update_gui(parent, bar): # perc, # processed_chunks, num_chunk_tasks, # rt_hours, rt_minutes, rt_seconds, @@ -29,9 +29,10 @@ def update_gui(dlm, bar): print(f"update_gui_{bar}") #print(f"{dlm}") #print(f"dhexid:{hex(id(dlm.perc))}") - bar.set_fraction(dlm.perc) + bar.set_fraction(parent.values_dlm[0]) #bar.set_fraction(perc) - 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}") + bar.set_text(f"{parent.values_dlm[0] / 1024 / 1024:.02f} MiB/s - {(parent.values_dlm[0]*100):.02f}% - ETA: {parent.values_dlm[6]:02d}:{parent.values_dlm[7]:02d}:{parent.values_dlm[8]:02d}") + #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}") bar.set_tooltip_text("tooltip") # show all infos that are also in update_cli() print(bar.get_text()) return True # since this is a timeout function @@ -775,7 +776,26 @@ def install_gtk(app_name, app_title, parent): dlm.start() #time.sleep(4) #perch = 0 - parent.timeout_id = GLib.timeout_add(500, update_gui, dlm, parent.progress_bar) + parent.values_dlm = [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + parent.timeout_id = GLib.timeout_add(500, update_gui, parent, parent.progress_bar) print("timeout_add -",parent.timeout_id) #dlm.join() except Exception as e: diff --git a/legendary/gui/manager2.py b/legendary/gui/manager2.py index 1f05a99..381401c 100644 --- a/legendary/gui/manager2.py +++ b/legendary/gui/manager2.py @@ -35,11 +35,12 @@ class DLManager(Process): self.proc_debug = False ### - self.perc = 1 - self.dl_speed = 1 - self.hours = 1 - self.minutes = 1 - self.seconds = 1 + #self.queue_log = + #self.perc = 1 + #self.dl_speed = 1 + #self.hours = 1 + #self.minutes = 1 + #self.seconds = 1 ### self.base_url = base_url @@ -733,23 +734,42 @@ class DLManager(Process): #self.obj_out = "cli" #if self.obj_out == "cli": log_dlm.update(self) - #self.perc, - #self.processed_chunks, - #self.num_chunk_tasks, - #self.rt_hours, - #self.rt_minutes, - #self.rt_seconds, - #self.hours, - #self.minutes, - #self.seconds, - #self.total_dl, - #self.total_write, - #self.total_used, - #self.dl_speed, - #self.dl_unc_speed, - #self.w_speed, - #self.r_speed, - #self.obj_out + main_window.values_dlm = [ + # 0 + self.perc, + # 1 + self.processed_chunks, + # 2 + self.num_chunk_tasks, + # 3 + self.rt_hours, + # 4 + self.rt_minutes, + # 5 + self.rt_seconds, + # 6 + self.hours, + # 7 + self.minutes, + # 8 + self.seconds, + # 9 + self.total_dl, + # 10 + self.total_write, + # 11 + self.total_used, + # 12 + self.dl_speed, + # 13 + self.dl_unc_speed, + # 14 + self.w_speed, + # 15 + self.r_speed, + # 16 + self.obj_out + ] print("updated obj_out") # send status update to back to instantiator (if queue exists)