From 67676d2d62252204ad77ee7c866bc8450e72312d Mon Sep 17 00:00:00 2001 From: Bryan Schumaker Date: Mon, 18 Oct 2010 21:05:50 -0400 Subject: [PATCH] TimeLabel() Made a time label that updates ever 5 seconds to show the current time into the song. --- ocarina/label.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 ocarina/label.py diff --git a/ocarina/label.py b/ocarina/label.py new file mode 100644 index 00000000..01c6f7b4 --- /dev/null +++ b/ocarina/label.py @@ -0,0 +1,27 @@ +# Bryan Schumaker (10 / 18 / 2010) +import ocarina + +gtk = ocarina.gtk +gobject = ocarina.gobject + +#update = None +get_time = None + +def set_fns(): + #global update + global get_time + #update = ocarina.libsaria.music.get_progress + get_time = ocarina.libsaria.music.get_time +ocarina.libsaria.event.invite("POSTSTART", set_fns) + + +class TimeLabel(gtk.Label): + def __init__(self): + gtk.Label.__init__(self) + gobject.timeout_add(500, self.update) + self.show() + + def update(self): + global get_time + self.set_text(get_time()) + return True