mirror of
https://github.com/derrod/legendary.git
synced 2025-08-26 20:11:04 +00:00
2021-02-24_17-54-02 - works with queue
This commit is contained in:
parent
a0cbbbd23a
commit
7f51545498
|
@ -38,6 +38,23 @@ class log_dlm:
|
|||
#r_speed)
|
||||
else:
|
||||
print("update_gui")
|
||||
dlm.main_window.bar_queue.put(dlm.perc)
|
||||
dlm.main_window.bar_queue.put(dlm.processed_chunks)
|
||||
dlm.main_window.bar_queue.put(dlm.num_chunk_tasks)
|
||||
dlm.main_window.bar_queue.put(dlm.rt_hours)
|
||||
dlm.main_window.bar_queue.put(dlm.rt_minutes)
|
||||
dlm.main_window.bar_queue.put(dlm.rt_seconds)
|
||||
dlm.main_window.bar_queue.put(dlm.hours)
|
||||
dlm.main_window.bar_queue.put(dlm.minutes)
|
||||
dlm.main_window.bar_queue.put(dlm.seconds)
|
||||
dlm.main_window.bar_queue.put(dlm.total_dl)
|
||||
dlm.main_window.bar_queue.put(dlm.total_write)
|
||||
dlm.main_window.bar_queue.put(dlm.total_used)
|
||||
dlm.main_window.bar_queue.put(dlm.dl_speed)
|
||||
dlm.main_window.bar_queue.put(dlm.dl_unc_speed)
|
||||
dlm.main_window.bar_queue.put(dlm.w_speed)
|
||||
dlm.main_window.bar_queue.put(dlm.r_speed)
|
||||
#dlm.main_window.bar_queue.put(dlm.obj_out)
|
||||
print(f"{dlm.dl_speed / 1024 / 1024:.02f} MiB/s - {(dlm.perc*100):.02f}% - ETA: {dlm.hours:02d}:{dlm.minutes:02d}:{dlm.seconds:02d} - log_dlm")
|
||||
#self.update_gui(dlm, dlm.obj_out)
|
||||
#self.update_gui(
|
||||
|
|
|
@ -19,7 +19,7 @@ import legendary.cli
|
|||
core = legendary.core.LegendaryCore()
|
||||
cli = legendary.cli.LegendaryCLI()
|
||||
|
||||
def update_gui(dlm, bar):
|
||||
def update_gui(par, bar):
|
||||
# perc,
|
||||
# processed_chunks, num_chunk_tasks,
|
||||
# rt_hours, rt_minutes, rt_seconds,
|
||||
|
@ -29,9 +29,27 @@ 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)
|
||||
|
||||
perc = par.bar_queue.get()
|
||||
processed_chunks = par.bar_queue.get()
|
||||
num_chunk_tasks = par.bar_queue.get()
|
||||
rt_hours = par.bar_queue.get()
|
||||
rt_minutes = par.bar_queue.get()
|
||||
rt_seconds = par.bar_queue.get()
|
||||
hours = par.bar_queue.get()
|
||||
minutes = par.bar_queue.get()
|
||||
seconds = par.bar_queue.get()
|
||||
total_dl = par.bar_queue.get()
|
||||
total_write = par.bar_queue.get()
|
||||
total_used = par.bar_queue.get()
|
||||
dl_speed = par.bar_queue.get()
|
||||
dl_unc_speed = par.bar_queue.get()
|
||||
w_speed = par.bar_queue.get()
|
||||
r_speed = par.bar_queue.get()
|
||||
#obj_out = par.bar_queue.get()
|
||||
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"{dl_speed / 1024 / 1024:.02f} MiB/s - {(perc*100):.02f}% - ETA: {hours:02d}:{minutes:02d}:{seconds:02d}")
|
||||
##a## 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_tooltip_text("tooltip") # show all infos that are also in update_cli()
|
||||
print(bar.get_text())
|
||||
|
@ -795,7 +813,7 @@ def install_gtk(app_name, app_title, parent):
|
|||
##a## 0,
|
||||
##a## 0
|
||||
##a## ]
|
||||
parent.timeout_id = GLib.timeout_add(500, update_gui, dlm, parent.progress_bar)
|
||||
parent.timeout_id = GLib.timeout_add(1000, update_gui, parent, parent.progress_bar)
|
||||
print("timeout_add -",parent.timeout_id)
|
||||
#dlm.join()
|
||||
except Exception as e:
|
||||
|
@ -870,6 +888,7 @@ class main_window(Gtk.Window):
|
|||
self.set_default_size(800, 600)
|
||||
self.box = Gtk.Box()
|
||||
self.add(self.box)
|
||||
self.bar_queue = MPQueue(-1)
|
||||
|
||||
logged = False
|
||||
try:
|
||||
|
|
|
@ -688,6 +688,7 @@ class DLManager(Process):
|
|||
print("before loop")
|
||||
|
||||
while processed_tasks < num_tasks:
|
||||
time.sleep(0.250)
|
||||
delta = time.time() - last_update
|
||||
if not delta:
|
||||
time.sleep(self.update_interval)
|
||||
|
|
Loading…
Reference in a new issue