[gnome-clocks] Leave space before AM/PM
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-clocks] Leave space before AM/PM
- Date: Fri, 31 Aug 2012 19:52:46 +0000 (UTC)
commit 395d331b0bf7e2105e7c2b179eb6fed3ba45eef0
Author: Paolo Borelli <pborelli gnome org>
Date: Fri Aug 31 21:19:28 2012 +0200
Leave space before AM/PM
And also clean up related code
gnomeclocks/world.py | 36 +++++++++++++++---------------------
1 files changed, 15 insertions(+), 21 deletions(-)
---
diff --git a/gnomeclocks/world.py b/gnomeclocks/world.py
index 182fb13..cc996c6 100644
--- a/gnomeclocks/world.py
+++ b/gnomeclocks/world.py
@@ -147,19 +147,14 @@ class DigitalClock():
t = time.localtime(t)
return t
- def get_local_time_text(self):
- text = time.strftime("%I:%M%p", self.get_local_time(time.time()))
- if text.startswith("0"):
- text = text[1:]
- return text
-
def update(self):
- t = self.get_local_time_text()
systemClockFormat = SystemSettings.get_clock_format()
if systemClockFormat == '12h':
- t = time.strftime("%I:%M%p", self.get_local_time(time.time()))
+ t = time.strftime("%I:%M %p", self.get_local_time(time.time()))
else:
t = time.strftime("%H:%M", self.get_local_time(time.time()))
+ if t.startswith("0"):
+ t = t[1:]
if not t == self._last_time \
or not self.sunrise == self._last_sunrise \
or not self.sunset == self._last_sunset:
@@ -435,19 +430,18 @@ class StandaloneClock(Gtk.Box):
sunrise != self.sunrise or sunset != self.sunset:
self.sunrise = sunrise
self.sunset = sunset
- sunrise_markup = ""
- sunset_markup = ""
if systemClockFormat == "12h":
- sunrise_markup = sunrise_markup + "<span size ='large'>" +\
- time.strftime("%I:%M%p", sunrise) + "</span>"
-
- sunset_markup = sunset_markup + "<span size ='large'>" +\
- time.strftime("%H:%M", sunset) + "</span>"
+ sunrise_str = time.strftime("%I:%M %p", sunrise)
+ sunset_str = time.strftime("%I:%M %p", sunset)
else:
- sunrise_markup = sunrise_markup + "<span size ='large'>" +\
- time.strftime("%H:%M", sunrise) + "</span>"
- sunset_markup = sunset_markup + "<span size ='large'>" +\
- time.strftime("%H:%M", sunset) + "</span>"
- self.sunrise_time_label.set_markup(sunrise_markup)
- self.sunset_time_label.set_markup(sunset_markup)
+ sunrise_str = time.strftime("%H:%M", sunrise)
+ sunset_str = time.strftime("%H:%M", sunset)
+ if sunrise_str.startswith("0"):
+ sunrise_str = sunrise_str[1:]
+ if sunset_str.startswith("0"):
+ sunset_str = sunset_str[1:]
+ self.sunrise_time_label.set_markup(
+ "<span size ='large'>%s</span>" % sunrise_str)
+ self.sunset_time_label.set_markup(
+ "<span size ='large'>%s</span>" % sunset_str)
self.systemClockFormat = systemClockFormat
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]