[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[master] timezones: use more of s-c-date (#520631).



This patch removes our version of timezone selection and uses the entire
widget set from s-c-date instead.
---
 pyanaconda/iw/timezone_gui.py |   76 ++---------------------------------------
 pyanaconda/timezone.py        |    1 +
 2 files changed, 4 insertions(+), 73 deletions(-)

diff --git a/pyanaconda/iw/timezone_gui.py b/pyanaconda/iw/timezone_gui.py
index ca237bc..dcc7720 100644
--- a/pyanaconda/iw/timezone_gui.py
+++ b/pyanaconda/iw/timezone_gui.py
@@ -27,7 +27,7 @@ from scdate.core import zonetab
 import pango
 import sys
 
-from timezone_map_gui import TimezoneMap, Enum
+from timezone_map_gui import TimezoneMap
 from iw_gui import *
 from pyanaconda.booty.bootloaderInfo import dosFilesystems
 from pyanaconda.bootloader import hasWindows
@@ -75,8 +75,8 @@ class TimezoneWindow(InstallWindow):
     def timezone_widget_create (self, str1, str2, int1, int2):
         mappath = "/usr/share/system-config-date/pixmaps/map1440.png"
 
-        self.tz = AnacondaTZMap(self.zonetab, self.default, map=mappath,
-                                viewportWidth=480)
+        self.tz = TimezoneMap(self.zonetab, self.default, map=mappath,
+                              viewportWidth=480)
         self.tz.show_all()
         return self.tz
 
@@ -109,73 +109,3 @@ class TimezoneWindow(InstallWindow):
 
         self.notebook.remove(self.vbox)
         return self.vbox
-
-class AnacondaTZMap(TimezoneMap):
-    def __init__(self, zonetab, default, map="", viewportWidth=480):
-        TimezoneMap.__init__(self, zonetab, default, map=map, viewportWidth=viewportWidth)
-        self.columns = Enum("TRANSLATED", "TZ", "ENTRY")
-
-    def status_bar_init(self):
-        self.status = None
-
-    def load_entries (self, root):
-        iter = self.tzStore.get_iter_first()
-
-        for entry in self.zonetab.getEntries():
-            if entry.lat is not None and entry.long is not None:
-                x, y = self.map2canvas(entry.lat, entry.long)
-                marker = root.add(gnomecanvas.CanvasText, x=x, y=y,
-                                  text=u'\u00B7', fill_color='yellow',
-                                  anchor=gtk.ANCHOR_CENTER,
-                                  weight=pango.WEIGHT_BOLD)
-                self.markers[entry.tz] = marker
-
-                if entry.tz == "America/New York":
-                    # In case the /etc/sysconfig/clock is messed up, use New
-                    # York as the default.
-                    self.fallbackEntry = entry
-
-            iter = self.tzStore.insert_after(iter, [entry.translated_tz, entry.tz, entry])
-
-    def timezone_list_init (self, default):
-        self.hbox = gtk.HBox()
-        self.tzStore = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING,
-                                     gobject.TYPE_PYOBJECT)
-
-        root = self.canvas.root()
-
-        self.load_entries(root)
-
-        # Add the ListStore to the sorted model after the list has been
-        # populated, since otherwise we end up resorting on every addition.
-        self.tzSorted = gtk.TreeModelSort(self.tzStore)
-        self.tzSorted.set_sort_column_id(0, gtk.SORT_ASCENDING)
-        self.tzCombo = gtk.ComboBox(model=self.tzSorted)
-        cell = gtk.CellRendererText()
-        self.tzCombo.pack_start(cell, True)
-        self.tzCombo.add_attribute(cell, 'text', 0)
-        self.tzCombo.connect("changed", self.selectionChanged)
-        self.hbox.pack_start(self.tzCombo, False, False)
-
-        self.pack_start(self.hbox, False, False)
-
-    def selectionChanged(self, widget, *args):
-        iter = widget.get_active_iter()
-        if iter is None:
-            return
-        entry = widget.get_model().get_value(iter, self.columns.ENTRY)
-        if entry:
-            self.setCurrent (entry, skipList=1)
-            if entry.long != None and entry.lat != None:
-                self.move_to (entry.long, entry.lat)
-
-    def updateTimezoneList(self):
-        # Find the currently selected item in the combo box and update both
-        # the combo and the comment label.
-        iter = self.tzCombo.get_model().get_iter_first()
-        while iter:
-            if self.tzCombo.get_model().get_value(iter, 1) == self.currentEntry.tz:
-                self.tzCombo.set_active_iter(iter)
-                break
-
-            iter = self.tzCombo.get_model().iter_next(iter)
diff --git a/pyanaconda/timezone.py b/pyanaconda/timezone.py
index 74d66db..0f90aac 100644
--- a/pyanaconda/timezone.py
+++ b/pyanaconda/timezone.py
@@ -68,6 +68,7 @@ class Timezone:
         return (self.tz, self.utc)
 
     def setTimezoneInfo(self, timezone, asUtc = 0):
+        log.info("set timezone: %s, utc: %d" % (timezone, asUtc))
         self.tz = timezone
         self.utc = asUtc
 
-- 
1.7.1.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]