[gnome-clocks] Factor out a function to set the timer time label
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-clocks] Factor out a function to set the timer time label
- Date: Sun, 26 Aug 2012 14:37:00 +0000 (UTC)
commit 4f4c2d5fd404b25bfffd5b356529c5d85a85185b
Author: Paolo Borelli <pborelli gnome org>
Date: Sun Aug 26 16:35:19 2012 +0200
Factor out a function to set the timer time label
gnomeclocks/clocks.py | 9 ++-------
gnomeclocks/timer.py | 4 +++-
2 files changed, 5 insertions(+), 8 deletions(-)
---
diff --git a/gnomeclocks/clocks.py b/gnomeclocks/clocks.py
index 69f1763..6ae0121 100644
--- a/gnomeclocks/clocks.py
+++ b/gnomeclocks/clocks.py
@@ -33,9 +33,6 @@ import time
STOPWATCH_LABEL_MARKUP = "<span font_desc=\"64.0\">%02i:%02i</span>"
STOPWATCH_BUTTON_MARKUP = "<span font_desc=\"18.0\">%s</span>"
-TIMER_LABEL_MARKUP = "<span font_desc=\"64.0\">%02i:%02i:%02i</span>"
-TIMER = "<span font_desc=\"64.0\">%02i</span>"
-
class Clock(Gtk.EventBox):
__gsignals__ = {'show-requested': (GObject.SignalFlags.RUN_LAST,
@@ -503,8 +500,7 @@ class Timer(Clock):
hours = self.timer_welcome_screen.hours.get_value()
minutes = self.timer_welcome_screen.minutes.get_value()
seconds = self.timer_welcome_screen.seconds.get_value()
- self.timer_screen.timerLabel.set_markup(TIMER_LABEL_MARKUP %
- (hours, minutes, seconds))
+ self.timer_screen.set_time(hours, minutes, seconds)
self.time = (hours * 60 * 60) + (minutes * 60) + seconds
self.state = Timer.State.RUNNING
self.g_id = GObject.timeout_add(1000, self.count)
@@ -531,8 +527,7 @@ class Timer(Clock):
minutes, seconds = divmod(self.time, 60)
hours, minutes = divmod(minutes, 60)
- self.timer_screen.timerLabel.set_markup(TIMER_LABEL_MARKUP %
- (hours, minutes, seconds))
+ self.timer_screen.set_time(hours, minutes, seconds)
if hours == 00 and minutes == 00 and seconds == 00:
self.alert.show()
self.state = Timer.State.STOPPED
diff --git a/gnomeclocks/timer.py b/gnomeclocks/timer.py
index 9ed34a3..f88cae9 100644
--- a/gnomeclocks/timer.py
+++ b/gnomeclocks/timer.py
@@ -20,7 +20,6 @@ from gi.repository import Gtk, Gio
TIMER = "<span font_desc=\"64.0\">%02i</span>"
TIMER_LABEL_MARKUP = "<span font_desc=\"64.0\">%02i:%02i:%02i</span>"
-TIMER = "<span font_desc=\"64.0\">%02i</span>"
TIMER_BUTTON_MARKUP = "<span font_desc=\"18.0\">% s</span>"
@@ -122,6 +121,9 @@ class TimerScreen(Gtk.Box):
self.pack_start(center, False, False, 6)
self.pack_start(hbox, False, False, 5)
+ def set_time(self, h, m, s):
+ self.timerLabel.set_markup(TIMER_LABEL_MARKUP % (h, m, s))
+
def _on_right_button_clicked(self, data):
self.leftLabel.set_markup(TIMER_BUTTON_MARKUP % (_("Pause")))
self.timer.reset()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]