Pause gui updates when iconized/withdrawn
This commit is contained in:
parent
9e0dddcb9f
commit
1fe0cf1b84
2
TODO
2
TODO
|
@ -42,7 +42,7 @@ Misc:
|
|||
☐ Save torrent & resume data periodically
|
||||
http://libtorrent.org/reference-Core.html#save_resume_data()
|
||||
http://libtorrent.org/reference-Core.html#need_save_resume_data()
|
||||
☐ Pause gui updates when iconized
|
||||
✔ Pause gui updates when iconized/withdrawn @done (13:58 20.07.2014)
|
||||
Error handling:
|
||||
☐ Torrent errors
|
||||
http://libtorrent.org/reference-Alerts.html#torrent_error_alert
|
||||
|
|
|
@ -25,7 +25,7 @@ import os
|
|||
import pipes
|
||||
from datetime import datetime, timedelta
|
||||
import logging
|
||||
log = logging.getLogger("epour")
|
||||
log = logging.getLogger("epour.gui")
|
||||
|
||||
import libtorrent as lt
|
||||
|
||||
|
@ -222,12 +222,17 @@ class TorrentFiles(StandardWindow):
|
|||
filelist.data["progress"] = h.file_progress()
|
||||
|
||||
def update_progress(h):
|
||||
#log.debug("File progress TICK")
|
||||
filelist.data["progress"] = h.file_progress()
|
||||
for it in filelist.realized_items:
|
||||
it.fields_update("*", ELM_GENLIST_ITEM_FIELD_TEXT)
|
||||
return True
|
||||
|
||||
ecore.Timer(5.0, update_progress, h)
|
||||
timer = ecore.Timer(5.0, update_progress, h)
|
||||
self.on_del_add(lambda x: timer.delete())
|
||||
self.callback_withdrawn_add(lambda x: timer.freeze())
|
||||
self.callback_iconified_add(lambda x: timer.freeze())
|
||||
self.callback_normal_add(lambda x: timer.thaw())
|
||||
|
||||
filelist.callback_expand_request_add(self.expand_request_cb)
|
||||
filelist.callback_contract_request_add(self.contract_request_cb)
|
||||
|
@ -616,6 +621,7 @@ class TorrentStatus(Table):
|
|||
i += 1
|
||||
|
||||
def update():
|
||||
#log.debug("Torrent status TICK")
|
||||
s = h.status()
|
||||
for w in self.widgets:
|
||||
key = w.data["key"]
|
||||
|
@ -626,6 +632,9 @@ class TorrentStatus(Table):
|
|||
|
||||
timer = ecore.Timer(5.0, update)
|
||||
self.on_del_add(lambda x: timer.delete())
|
||||
self.top_widget.callback_withdrawn_add(lambda x: timer.freeze())
|
||||
self.top_widget.callback_iconified_add(lambda x: timer.freeze())
|
||||
self.top_widget.callback_normal_add(lambda x: timer.thaw())
|
||||
|
||||
@staticmethod
|
||||
def populate(w, v):
|
||||
|
|
|
@ -234,10 +234,14 @@ class MainInterface(object):
|
|||
|
||||
self.timer = Timer(1.0, self.update)
|
||||
self.win.on_del_add(lambda x: self.timer.delete())
|
||||
self.win.callback_withdrawn_add(lambda x: self.timer.freeze())
|
||||
self.win.callback_iconified_add(lambda x: self.timer.freeze())
|
||||
self.win.callback_normal_add(lambda x: self.timer.thaw())
|
||||
elm.run()
|
||||
elm.shutdown()
|
||||
|
||||
def update(self):
|
||||
#log.debug("Torrent list TICK")
|
||||
for v in self.tlist.realized_items_get():
|
||||
v.fields_update("*", ELM_GENLIST_ITEM_FIELD_TEXT)
|
||||
return True
|
||||
|
@ -373,8 +377,16 @@ class SessionStatus(Table):
|
|||
|
||||
self.update_timer = Timer(1.0, self.update)
|
||||
self.on_del_add(lambda x: self.update_timer.delete())
|
||||
self.top_widget.callback_withdrawn_add(
|
||||
lambda x: self.update_timer.freeze()
|
||||
)
|
||||
self.top_widget.callback_iconified_add(
|
||||
lambda x: self.update_timer.freeze()
|
||||
)
|
||||
self.top_widget.callback_normal_add(lambda x: self.update_timer.thaw())
|
||||
|
||||
def update(self):
|
||||
#log.debug("Session status TICK")
|
||||
s = self.session.status()
|
||||
self.d_l.text = "{}/s".format(intrepr(s.payload_download_rate))
|
||||
self.u_l.text = "{}/s".format(intrepr(s.payload_upload_rate))
|
||||
|
@ -644,6 +656,7 @@ class TorrentTooltip(Table):
|
|||
|
||||
@staticmethod
|
||||
def update(h, items, value_labels, g):
|
||||
#log.debug("Tooltip TICK")
|
||||
s = h.status(8)
|
||||
for i, l in enumerate(value_labels):
|
||||
conv, attr_name = items[i][1:]
|
||||
|
|
|
@ -385,6 +385,7 @@ class AlertManager(object):
|
|||
def __init__(self, session):
|
||||
self.session = session
|
||||
|
||||
# TODO: Use the lt alert interval from session settings here?
|
||||
self.timer = Timer(self.update_interval, self.update)
|
||||
|
||||
def callback_add(self, alert_type, cb, *args, **kwargs):
|
||||
|
@ -411,6 +412,8 @@ class AlertManager(object):
|
|||
self.log.exception("Exception while handling alerts")
|
||||
|
||||
def update(self):
|
||||
# TODO: Use pop_alerts()
|
||||
#self.log.debug("Alerts TICK")
|
||||
while 1:
|
||||
a = self.session.pop_alert()
|
||||
if not a:
|
||||
|
|
Loading…
Reference in New Issue