2021-02-24_13-18-03 - array attempt

This commit is contained in:
koraynilay 2021-02-24 13:18:03 +01:00
parent d2fc78b28e
commit aa74875151
2 changed files with 66 additions and 26 deletions

View file

@ -19,7 +19,7 @@ import legendary.cli
core = legendary.core.LegendaryCore() core = legendary.core.LegendaryCore()
cli = legendary.cli.LegendaryCLI() cli = legendary.cli.LegendaryCLI()
def update_gui(dlm, bar): def update_gui(parent, bar):
# perc, # perc,
# processed_chunks, num_chunk_tasks, # processed_chunks, num_chunk_tasks,
# rt_hours, rt_minutes, rt_seconds, # rt_hours, rt_minutes, rt_seconds,
@ -29,9 +29,10 @@ def update_gui(dlm, bar):
print(f"update_gui_{bar}") print(f"update_gui_{bar}")
#print(f"{dlm}") #print(f"{dlm}")
#print(f"dhexid:{hex(id(dlm.perc))}") #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_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() bar.set_tooltip_text("tooltip") # show all infos that are also in update_cli()
print(bar.get_text()) print(bar.get_text())
return True # since this is a timeout function return True # since this is a timeout function
@ -775,7 +776,26 @@ def install_gtk(app_name, app_title, parent):
dlm.start() dlm.start()
#time.sleep(4) #time.sleep(4)
#perch = 0 #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) print("timeout_add -",parent.timeout_id)
#dlm.join() #dlm.join()
except Exception as e: except Exception as e:

View file

@ -35,11 +35,12 @@ class DLManager(Process):
self.proc_debug = False self.proc_debug = False
### ###
self.perc = 1 #self.queue_log =
self.dl_speed = 1 #self.perc = 1
self.hours = 1 #self.dl_speed = 1
self.minutes = 1 #self.hours = 1
self.seconds = 1 #self.minutes = 1
#self.seconds = 1
### ###
self.base_url = base_url self.base_url = base_url
@ -733,23 +734,42 @@ class DLManager(Process):
#self.obj_out = "cli" #self.obj_out = "cli"
#if self.obj_out == "cli": #if self.obj_out == "cli":
log_dlm.update(self) log_dlm.update(self)
#self.perc, main_window.values_dlm = [
#self.processed_chunks, # 0
#self.num_chunk_tasks, self.perc,
#self.rt_hours, # 1
#self.rt_minutes, self.processed_chunks,
#self.rt_seconds, # 2
#self.hours, self.num_chunk_tasks,
#self.minutes, # 3
#self.seconds, self.rt_hours,
#self.total_dl, # 4
#self.total_write, self.rt_minutes,
#self.total_used, # 5
#self.dl_speed, self.rt_seconds,
#self.dl_unc_speed, # 6
#self.w_speed, self.hours,
#self.r_speed, # 7
#self.obj_out 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") print("updated obj_out")
# send status update to back to instantiator (if queue exists) # send status update to back to instantiator (if queue exists)