summaryrefslogtreecommitdiffstats
path: root/iw/timezone_gui.py
blob: 562444b3c0f9e97bc273edffb4df132d1c198b1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#
# timezone_gui.py: gui timezone selection.
#
# Copyright 2000-2002 Red Hat, Inc.
#
# This software may be freely redistributed under the terms of the GNU
# library public license.
#
# You should have received a copy of the GNU Library Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#

import string
import iutil
import gtk
import gobject
from timezone_map_gui import TimezoneMap, ZoneTab
from iw_gui import *
from rhpl.translate import _

class TimezoneWindow(InstallWindow):
    def __init__(self, ics):
	InstallWindow.__init__(self, ics)

        ics.setTitle(_("Time Zone Selection"))
        ics.setNextEnabled(1)
        ics.readHTML("timezone")

    def getNext(self):
        newzone = self.tz.getCurrent().tz
        self.timezone.setTimezoneInfo(newzone, self.systemUTC.get_active())
        return None

    # TimezoneWindow tag="timezone"
    def getScreen(self, instLang, timezone):
	self.timezone = timezone

        try:
            f = open("/usr/share/anaconda/pixmaps/map480.png")
            f.close()
        except:
            path = "pixmaps/map480.png"
        else:
            path = "/usr/share/anaconda/pixmaps/map480.png"
        
        mainBox = gtk.VBox(gtk.FALSE, 5)

        zonetab = ZoneTab()
        self.tz = TimezoneMap(zonetab=zonetab, map=path)

	(self.default, asUTC, asArc) = self.timezone.getTimezoneInfo()

        self.langDefault = instLang.getDefaultTimeZone()

	if not self.default:
            self.default = self.langDefault
	    asUTC = 0

        if (string.find(self.default, "UTC") != -1):
            self.default = "America/New_York"

        self.tz.setCurrent(zonetab.findEntryByTZ(self.default))

        self.systemUTC = gtk.CheckButton(_("System clock uses _UTC"))
        self.systemUTC.set_active(asUTC)

        hbox = gtk.HBox(gtk.FALSE, 5)
        pix = self.ics.readPixmap("timezone.png")
        if pix:
            hbox.pack_start(pix, gtk.FALSE)
        
        hbox.pack_start(gtk.Label(_("Please select the nearest city in your timezone:")), gtk.FALSE)
        mainBox.pack_start(hbox, gtk.FALSE)
        mainBox.pack_start(self.tz, gtk.TRUE, gtk.TRUE)
        mainBox.pack_start(self.systemUTC, gtk.FALSE)
        mainBox.set_border_width(5)

        box = gtk.VBox(gtk.FALSE, 5)
        box.pack_start(mainBox)
        box.set_border_width(5)

        return box