Commits

Anonymous committed 584f07d

fix disapearing icons problem

Comments (0)

Files changed (1)

 import pygtk
 pygtk.require('2.0')
 import gtk
+import os
 from time import time
 from math import floor
 gtk.gdk.threads_init()
 
 class Pomodoro:
     def __init__(self):
-        self.icon=gtk.status_icon_new_from_file("idle.png")
+        self.icon=gtk.status_icon_new_from_file(self.icon_directory()+"idle.png")
         self.icon.set_tooltip("Idle")
         self.state = "idle"
         self.tick_interval=10 #number of seconds between each poll
             return "%d minute" % minutes
     def set_state(self,state):
         old_state=self.state
-        self.icon.set_from_file(state+".png")
+        self.icon.set_from_file(self.icon_directory()+state+".png")
         if state == "idle":
             delta = time() - self.start_working_time
             if old_state == "ok":
             delta = time() - self.start_working_time
             self.icon.set_tooltip("Working for %s..." % self.format_time(delta))
         self.state=state
+    def icon_directory(self):
+        return os.path.dirname(os.path.realpath(__file__)) + os.path.sep
     def icon_click(self,dummy):
         delta = time() - self.start_working_time
         if self.state == "idle":