parsing for /etc/timezone.xml added
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Thu, 17 Nov 2005 15:46:54 +0000 (15:46 +0000)
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Thu, 17 Nov 2005 15:46:54 +0000 (15:46 +0000)
lib/python/Components/Makefile.am
lib/python/Components/SetupDevices.py
lib/python/Components/Timezones.py [new file with mode: 0644]
lib/python/Components/__init__.py

index 1507374..0e1894a 100644 (file)
@@ -9,4 +9,4 @@ install_PYTHON = \
        GUIComponent.py MenuList.py TextInput.py __init__.py MovieList.py                               \
        InputDevice.py ServicePosition.py SetupDevices.py Harddisk.py                                           \
        AVSwitch.py Network.py RFmod.py DiskInfo.py NimManager.py Lcd.py                                \
        GUIComponent.py MenuList.py TextInput.py __init__.py MovieList.py                               \
        InputDevice.py ServicePosition.py SetupDevices.py Harddisk.py                                           \
        AVSwitch.py Network.py RFmod.py DiskInfo.py NimManager.py Lcd.py                                \
-       EpgList.py ScrollLabel.py
+       EpgList.py ScrollLabel.py Timezones.py
index cb2badb..003bba5 100644 (file)
@@ -5,6 +5,7 @@ from config import ConfigSubsection
 from config import ConfigSlider
 from config import configSelection
 from config import configText
 from config import ConfigSlider
 from config import configSelection
 from config import configText
+from Components.Timezones import timezones
 
 def InitSetupDevices():
        config.timezone = ConfigSubsection();
 
 def InitSetupDevices():
        config.timezone = ConfigSubsection();
diff --git a/lib/python/Components/Timezones.py b/lib/python/Components/Timezones.py
new file mode 100644 (file)
index 0000000..90b227f
--- /dev/null
@@ -0,0 +1,33 @@
+from xml.sax import make_parser
+from xml.sax.handler import ContentHandler
+
+class Timezones:
+       class parseTimezones(ContentHandler):
+               def __init__(self, timezones):
+                       self.isPointsElement, self.isReboundsElement = 0, 0
+                       self.timezones = timezones
+       
+               def startElement(self, name, attrs):
+                       print "Name: " + str(name)
+                       if (name == "zone"):
+                               self.timezones[attrs.get('name',"")] = attrs.get('zone',"")
+                               #print "found sat " + attrs.get('name',"") + " " + str(attrs.get('position',""))
+                               #tpos = attrs.get('position',"")
+                               #tname = attrs.get('name',"")
+                               #self.satellites[tpos] = tname
+                               #self.satList.append( (tname, tpos) )
+                               #self.parsedSat = int(tpos)
+       
+       def __init__(self):
+               self.timezones = {}
+               
+               self.readTimezonesFromFile()
+
+       def readTimezonesFromFile(self):
+               parser = make_parser()
+               timezonesHandler = self.parseTimezones(self.timezones)
+               parser.setContentHandler(timezonesHandler)
+               parser.parse('/etc/timezone.xml')
+               
+
+timezones = Timezones()
index ebc7f49..ed74427 100644 (file)
@@ -6,4 +6,4 @@ __all__ = ["ActionMap", "Button", "Clock", "ConfigList", "EventInfo",
        "components", "config", "TimerList", "TimeInput", "MovieList", 
        "InputDevice",  "ServicePosition", "IPAddress", "VariableIP", "IPGateway",
        "IPNameserver", "Network", "RFmon", "DiskInfo", "NimManager", "TimerEntry",
        "components", "config", "TimerList", "TimeInput", "MovieList", 
        "InputDevice",  "ServicePosition", "IPAddress", "VariableIP", "IPGateway",
        "IPNameserver", "Network", "RFmon", "DiskInfo", "NimManager", "TimerEntry",
-       "Lcd", "EpgList" "ScrollLabel"]
+       "Lcd", "EpgList" "ScrollLabel", "Timezones"]