2021-02-21_01-54-18

This commit is contained in:
koraynilay 2021-02-21 01:54:18 +01:00
parent cf83a07726
commit 9bef34b1b0

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(dlm, bar, perc):
# perc, # perc,
# processed_chunks, num_chunk_tasks, # processed_chunks, num_chunk_tasks,
# rt_hours, rt_minutes, rt_seconds, # rt_hours, rt_minutes, rt_seconds,
@ -27,10 +27,11 @@ def update_gui(dlm, bar):
# total_dl, total_write, total_used, # total_dl, total_write, total_used,
# dl_speed, dl_unc_speed, w_speed, r_speed, # dl_speed, dl_unc_speed, w_speed, r_speed,
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(dlm.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_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_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
@ -773,8 +774,9 @@ def install_gtk(app_name, app_title, parent):
#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"{dlm.dl_speed / 1024 / 1024:.02f} MiB/s - {(dlm.perc*100):.02f}% - ETA: {dlm.hours:02d}:{dlm.minutes:02d}:{dlm.seconds:02d}")
dlm.start() dlm.start()
#time.sleep(4) #time.sleep(4)
#parent.timeout_id = GLib.timeout_add(1000, update_gui, dlm, parent.progress_bar) perch = 0
#print("timeout_add -",parent.timeout_id) parent.timeout_id = GLib.timeout_add(1000, update_gui, dlm, parent.progress_bar, perch)
print("timeout_add -",parent.timeout_id)
dlm.join() dlm.join()
except Exception as e: except Exception as e:
end_t = time.time() end_t = time.time()