/[smeserver]/cdrom.image/updates/timezone_text.py
ViewVC logotype

Annotation of /cdrom.image/updates/timezone_text.py

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (hide annotations) (download) (as text)
Wed Apr 5 01:20:27 2006 UTC (18 years, 7 months ago) by slords
Branch: MAIN
Changes since 1.1: +0 -2 lines
Content type: text/x-python
Update anaconda to be in sync with 4.3 and FC4

1 slords 1.1 # timezone_text.py: text mode timezone selection dialog
2     #
3     # Copyright 2000-2002 Red Hat, Inc.
4     #
5     # This software may be freely redistributed under the terms of the GNU
6     # library public license.
7     #
8     # You should have received a copy of the GNU Library Public License
9     # along with this program; if not, write to the Free Software
10     # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
11     #
12    
13     import string
14     import iutil
15     import os
16     from time import *
17     from snack import *
18     from constants_text import *
19     from rhpl.translate import _, textdomain
20    
21     textdomain("system-config-date")
22    
23     class TimezoneWindow:
24    
25     def getTimezoneList(self):
26     if os.access("/usr/lib/timezones.gz", os.R_OK):
27     cmd = "/usr/bin/gunzip"
28     stdin = os.open("/usr/lib/timezones.gz", 0)
29     else:
30     zoneList = iutil.findtz('/usr/share/zoneinfo', '')
31     cmd = ""
32     stdin = None
33    
34     if cmd != "":
35     zones = iutil.execWithCapture(cmd, [ cmd ], stdin = stdin)
36     zoneList = string.split(zones)
37    
38     if (stdin != None):
39     os.close(stdin)
40    
41     return zoneList
42    
43     def updateSysClock(self):
44     if os.access("/sbin/hwclock", os.X_OK):
45     args = [ "/sbin/hwclock" ]
46     else:
47     args = [ "/usr/sbin/hwclock" ]
48    
49     args.append("--hctosys")
50     args.append("--utc")
51    
52     iutil.execWithRedirect(args[0], args)
53     self.g.setTimer(500)
54     self.updateClock()
55    
56     def updateClock(self):
57     # disable for now
58     return
59    
60     # if os.access("/usr/share/zoneinfo/" + self.l.current(), os.R_OK):
61     # os.environ['TZ'] = self.l.current()
62     # self.label.setText(self.currentTime())
63     # else:
64     # self.label.setText("")
65    
66     def currentTime(self):
67     return "Current time: " + strftime("%X %Z", localtime(time()))
68    
69     def __call__(self, screen, instLang, timezone):
70     timezones = self.getTimezoneList()
71     (default, asUtc, asArc) = timezone.getTimezoneInfo()
72     if not default:
73     default = instLang.getDefaultTimeZone()
74    
75     bb = ButtonBar(screen, [TEXT_OK_BUTTON, TEXT_BACK_BUTTON])
76     t = TextboxReflowed(30,
77     _("What time zone are you located in?"))
78    
79     #
80     # disabling this for now
81     #
82     # self.label = Label(self.currentTime())
83    
84     self.l = Listbox(5, scroll = 1, returnExit = 0)
85    
86     for tz in timezones:
87     self.l.append(_(tz), tz)
88    
89     self.l.setCurrent(default)
90     # self.l.setCallback(self.updateClock)
91    
92     # self.c.setCallback(self.updateSysClock)
93    
94     self.g = GridFormHelp(screen, _("Time Zone Selection"), "timezone",
95     1, 5)
96     self.g.add(t, 0, 0)
97     # self.g.add(self.label, 0, 1, padding = (0, 1, 0, 0), anchorLeft = 1)
98     self.g.add(self.l, 0, 3, padding = (0, 0, 0, 1))
99     self.g.add(bb, 0, 4, growx = 1)
100    
101     # disabling for now
102     # self.updateClock()
103     # self.updateSysClock()
104     #
105     # self.g.setTimer(500)
106     #
107     # result = "TIMER"
108     # while result == "TIMER":
109     # result = self.g.run()
110     # if result == "TIMER":
111     # self.updateClock()
112    
113     result = ""
114     while 1:
115     result = self.g.run()
116     rc = bb.buttonPressed (result)
117    
118     if rc == TEXT_BACK_CHECK:
119     screen.popWindow()
120     return INSTALL_BACK
121     else:
122     break
123    
124     screen.popWindow()
125     timezone.setTimezoneInfo(self.l.current(), asUtc = 1)
126    
127     return INSTALL_OK
128    
129    

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed