Browse Source

fix timer calling wrong function

master
cinnaboot 8 years ago
parent
commit
c71936c7b1
  1. 7
      pyArchUpdatesTray.py

7
pyArchUpdatesTray.py

@ -38,20 +38,17 @@ class TrayIcon(Gtk.StatusIcon):
menu.popup(None, None, None, self, 3, gtk_time)
def restart_timer(self):
#print("start_timer(), self.lastupdate=" + str(self.lastupdate))
if self.update_timer.is_alive():
self.update_timer.cancel()
self.update_timer = threading.Timer(self.check_interval, self.run_checkupdates)
#self.update_timer = threading.Timer(2, self.restart_timer)
self.update_timer = threading.Timer(self.check_interval, self.restart_timer)
self.update_timer.start()
self.run_checkupdates(None)
def run_checkupdates(self, widget, force_update=False):
def run_checkupdates(self, widget=None, force_update=False):
cur_time = time.mktime(time.localtime())
if cur_time > self.check_interval + self.lastupdate or force_update == True:
print("Checking for updates")
self.lastupdate = cur_time
output = subprocess.run("checkupdates", stdout=subprocess.PIPE)
parsed = output.stdout.decode("utf-8")

Loading…
Cancel
Save