[Pymoul-svn] SF.net SVN: pymoul: [31] pymoul/trunk
Status: Alpha
Brought to you by:
tiran
From: <ti...@us...> - 2007-01-16 00:03:34
|
Revision: 31 http://pymoul.svn.sourceforge.net/pymoul/?rev=31&view=rev Author: tiran Date: 2007-01-15 16:03:34 -0800 (Mon, 15 Jan 2007) Log Message: ----------- Some UI work to test integration of cavern time into the QT ui Modified Paths: -------------- pymoul/trunk/setup_win32.py pymoul/trunk/src/moul/qt/mainwindow.py pymoul/trunk/src/moul/qt/ui/mainwindow.py pymoul/trunk/src/moul/qt/ui/mainwindow.ui pymoul/trunk/src/moul/qt/ui/moulqt_rc.py pymoul/trunk/src/moul/time/cavern.py Modified: pymoul/trunk/setup_win32.py =================================================================== --- pymoul/trunk/setup_win32.py 2007-01-15 19:55:56 UTC (rev 30) +++ pymoul/trunk/setup_win32.py 2007-01-16 00:03:34 UTC (rev 31) @@ -31,13 +31,19 @@ # PyTz uses some import magic def findPyTz(): - import pytz - pytz_dir = os.path.dirname(pytz.__file__) - if not os.path.isdir(pytz_dir): - raise ValueError('Install pytz with easy_install -Z pytz') - packages = find_packages(pytz_dir) - packages = ['pytz.%s.*' % pack for pack in packages] + packages = ['pytz.zoneinfo'] + for tz in ('GMT', 'UTC'): + packages.append('pytz.zoneinfo.%s' % tz) + for tz in ('America', 'Canada', 'Etc', 'Europe', 'US'): + packages.append('pytz.zoneinfo.%s.*' % tz) return packages +# import pytz +# pytz_dir = os.path.dirname(pytz.__file__) +# if not os.path.isdir(pytz_dir): +# raise ValueError('Install pytz with easy_install -Z pytz') +# packages = find_packages(pytz_dir) +# packages = ['pytz.%s.*' % pack for pack in packages] +# return packages def inEnvPath(name): result = [] @@ -79,7 +85,7 @@ pexe['optimize'] = 0 # 0,1,2 pexe['includes'] = ['sip', 'PyQt4', 'encodings', 'encodings.*'] # not required at the moment - #pexe['includes'].extend(findPyTz()) + pexe['includes'].extend(findPyTz()) kw['zipfile'] = 'library.zip' def updateSetupOptionsQT(kw): Modified: pymoul/trunk/src/moul/qt/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/mainwindow.py 2007-01-15 19:55:56 UTC (rev 30) +++ pymoul/trunk/src/moul/qt/mainwindow.py 2007-01-16 00:03:34 UTC (rev 31) @@ -4,9 +4,14 @@ from PyQt4 import QtGui from moul.qt.ui.mainwindow import Ui_MainWindow +from moul.time import cavern as caverntime class MainWindow(QtGui.QMainWindow, Ui_MainWindow): def __init__(self): QtGui.QMainWindow.__init__(self) # Set up the user interface from Designer. self.setupUi(self) + + # timezone + self.cb_timezone_chooser.addItems(caverntime.TIMEZONE_NAMES) + Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-01-15 19:55:56 UTC (rev 30) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-01-16 00:03:34 UTC (rev 31) @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'src\moul\qt\ui\mainwindow.ui' # -# Created: Mon Jan 15 19:26:00 2007 +# Created: Tue Jan 16 01:02:23 2007 # by: PyQt4 UI code generator 4.1.1 # # WARNING! All changes made in this file will be lost! @@ -58,6 +58,12 @@ self.pushButton.setObjectName("pushButton") self.hboxlayout.addWidget(self.pushButton) + self.buttonbox_rresavcl = QtGui.QDialogButtonBox(self.centralwidget) + self.buttonbox_rresavcl.setGeometry(QtCore.QRect(10,480,441,32)) + self.buttonbox_rresavcl.setOrientation(QtCore.Qt.Horizontal) + self.buttonbox_rresavcl.setStandardButtons(QtGui.QDialogButtonBox.Close|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Reset|QtGui.QDialogButtonBox.Save) + self.buttonbox_rresavcl.setObjectName("buttonbox_rresavcl") + self.label = QtGui.QLabel(self.centralwidget) self.label.setGeometry(QtCore.QRect(15,10,430,58)) self.label.setFrameShape(QtGui.QFrame.StyledPanel) @@ -65,12 +71,6 @@ self.label.setPixmap(QtGui.QPixmap(":/resources/moul_logo.png")) self.label.setObjectName("label") - self.buttonbox_rresavcl = QtGui.QDialogButtonBox(self.centralwidget) - self.buttonbox_rresavcl.setGeometry(QtCore.QRect(10,480,441,32)) - self.buttonbox_rresavcl.setOrientation(QtCore.Qt.Horizontal) - self.buttonbox_rresavcl.setStandardButtons(QtGui.QDialogButtonBox.Close|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Reset|QtGui.QDialogButtonBox.Save) - self.buttonbox_rresavcl.setObjectName("buttonbox_rresavcl") - self.tabWidget = QtGui.QTabWidget(self.centralwidget) self.tabWidget.setGeometry(QtCore.QRect(5,100,450,375)) self.tabWidget.setTabPosition(QtGui.QTabWidget.North) @@ -153,7 +153,7 @@ self.vboxlayout1.addLayout(self.hboxlayout1) self.verticalLayout_6 = QtGui.QWidget(self.groupBox_2) - self.verticalLayout_6.setGeometry(QtCore.QRect(220,130,179,73)) + self.verticalLayout_6.setGeometry(QtCore.QRect(230,140,179,73)) self.verticalLayout_6.setObjectName("verticalLayout_6") self.vboxlayout2 = QtGui.QVBoxLayout(self.verticalLayout_6) @@ -287,6 +287,70 @@ self.tab_audio.setObjectName("tab_audio") self.tabWidget.addTab(self.tab_audio,"") + self.tab_time = QtGui.QWidget() + self.tab_time.setObjectName("tab_time") + + self.gb_caverntime = QtGui.QGroupBox(self.tab_time) + self.gb_caverntime.setGeometry(QtCore.QRect(10,100,421,121)) + self.gb_caverntime.setObjectName("gb_caverntime") + + self.horizontalLayout_2 = QtGui.QWidget(self.gb_caverntime) + self.horizontalLayout_2.setGeometry(QtCore.QRect(20,20,261,31)) + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + + self.hboxlayout5 = QtGui.QHBoxLayout(self.horizontalLayout_2) + self.hboxlayout5.setMargin(0) + self.hboxlayout5.setSpacing(6) + self.hboxlayout5.setObjectName("hboxlayout5") + + self.label_4 = QtGui.QLabel(self.horizontalLayout_2) + self.label_4.setObjectName("label_4") + self.hboxlayout5.addWidget(self.label_4) + + self.dt_cavern = QtGui.QDateTimeEdit(self.horizontalLayout_2) + self.dt_cavern.setReadOnly(True) + self.dt_cavern.setObjectName("dt_cavern") + self.hboxlayout5.addWidget(self.dt_cavern) + + self.label_3 = QtGui.QLabel(self.horizontalLayout_2) + self.label_3.setObjectName("label_3") + self.hboxlayout5.addWidget(self.label_3) + + self.horizontalLayout_3 = QtGui.QWidget(self.gb_caverntime) + self.horizontalLayout_3.setGeometry(QtCore.QRect(20,70,261,31)) + self.horizontalLayout_3.setObjectName("horizontalLayout_3") + + self.hboxlayout6 = QtGui.QHBoxLayout(self.horizontalLayout_3) + self.hboxlayout6.setMargin(0) + self.hboxlayout6.setSpacing(6) + self.hboxlayout6.setObjectName("hboxlayout6") + + self.label_5 = QtGui.QLabel(self.horizontalLayout_3) + self.label_5.setObjectName("label_5") + self.hboxlayout6.addWidget(self.label_5) + + self.dt_local = QtGui.QDateTimeEdit(self.horizontalLayout_3) + self.dt_local.setReadOnly(True) + self.dt_local.setObjectName("dt_local") + self.hboxlayout6.addWidget(self.dt_local) + + self.label_11 = QtGui.QLabel(self.horizontalLayout_3) + self.label_11.setObjectName("label_11") + self.hboxlayout6.addWidget(self.label_11) + + self.gb_dnitime = QtGui.QGroupBox(self.tab_time) + self.gb_dnitime.setGeometry(QtCore.QRect(10,230,421,111)) + self.gb_dnitime.setObjectName("gb_dnitime") + + self.gb_timezone = QtGui.QGroupBox(self.tab_time) + self.gb_timezone.setGeometry(QtCore.QRect(10,10,421,81)) + self.gb_timezone.setObjectName("gb_timezone") + + self.cb_timezone_chooser = QtGui.QComboBox(self.gb_timezone) + self.cb_timezone_chooser.setGeometry(QtCore.QRect(10,30,271,21)) + self.cb_timezone_chooser.setObjectName("cb_timezone_chooser") + self.tabWidget.addTab(self.tab_time,"") + self.tab_4 = QtGui.QWidget() self.tab_4.setObjectName("tab_4") @@ -302,7 +366,7 @@ MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) - self.tabWidget.setCurrentIndex(0) + self.tabWidget.setCurrentIndex(2) QtCore.QObject.connect(self.buttonbox_rresavcl,QtCore.SIGNAL("rejected()"),MainWindow.close) QtCore.QMetaObject.connectSlotsByName(MainWindow) @@ -328,6 +392,14 @@ self.label_7.setText(QtGui.QApplication.translate("MainWindow", "Ultra", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_graphics), QtGui.QApplication.translate("MainWindow", "Graphis", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_audio), QtGui.QApplication.translate("MainWindow", "Audio", None, QtGui.QApplication.UnicodeUTF8)) + self.gb_caverntime.setTitle(QtGui.QApplication.translate("MainWindow", "Cavern Time", None, QtGui.QApplication.UnicodeUTF8)) + self.label_4.setText(QtGui.QApplication.translate("MainWindow", "Cavern time:", None, QtGui.QApplication.UnicodeUTF8)) + self.label_3.setText(QtGui.QApplication.translate("MainWindow", "UTC", None, QtGui.QApplication.UnicodeUTF8)) + self.label_5.setText(QtGui.QApplication.translate("MainWindow", "Local time:", None, QtGui.QApplication.UnicodeUTF8)) + self.label_11.setText(QtGui.QApplication.translate("MainWindow", "UTC", None, QtGui.QApplication.UnicodeUTF8)) + self.gb_dnitime.setTitle(QtGui.QApplication.translate("MainWindow", "D\'ni time", None, QtGui.QApplication.UnicodeUTF8)) + self.gb_timezone.setTitle(QtGui.QApplication.translate("MainWindow", "Time Zone", None, QtGui.QApplication.UnicodeUTF8)) + self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_time), QtGui.QApplication.translate("MainWindow", "Time", None, QtGui.QApplication.UnicodeUTF8)) self.label_6.setText(QtGui.QApplication.translate("MainWindow", "pyMoul tools", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_4), QtGui.QApplication.translate("MainWindow", "About", None, QtGui.QApplication.UnicodeUTF8)) Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.ui =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-01-15 19:55:56 UTC (rev 30) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-01-16 00:03:34 UTC (rev 31) @@ -78,6 +78,22 @@ </item> </layout> </widget> + <widget class="QDialogButtonBox" name="buttonbox_rresavcl" > + <property name="geometry" > + <rect> + <x>10</x> + <y>480</y> + <width>441</width> + <height>32</height> + </rect> + </property> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons" > + <set>QDialogButtonBox::Close|QDialogButtonBox::NoButton|QDialogButtonBox::Reset|QDialogButtonBox::Save</set> + </property> + </widget> <widget class="QLabel" name="label" > <property name="geometry" > <rect> @@ -100,22 +116,6 @@ <pixmap resource="moulqt.qrc" >:/resources/moul_logo.png</pixmap> </property> </widget> - <widget class="QDialogButtonBox" name="buttonbox_rresavcl" > - <property name="geometry" > - <rect> - <x>10</x> - <y>480</y> - <width>441</width> - <height>32</height> - </rect> - </property> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="standardButtons" > - <set>QDialogButtonBox::Close|QDialogButtonBox::NoButton|QDialogButtonBox::Reset|QDialogButtonBox::Save</set> - </property> - </widget> <widget class="QTabWidget" name="tabWidget" > <property name="geometry" > <rect> @@ -129,7 +129,7 @@ <enum>QTabWidget::North</enum> </property> <property name="currentIndex" > - <number>0</number> + <number>2</number> </property> <widget class="QWidget" name="tab_graphics" > <attribute name="title" > @@ -296,8 +296,8 @@ <widget class="QWidget" name="verticalLayout_6" > <property name="geometry" > <rect> - <x>220</x> - <y>130</y> + <x>230</x> + <y>140</y> <width>179</width> <height>73</height> </rect> @@ -560,6 +560,138 @@ <string>Audio</string> </attribute> </widget> + <widget class="QWidget" name="tab_time" > + <attribute name="title" > + <string>Time</string> + </attribute> + <widget class="QGroupBox" name="gb_caverntime" > + <property name="geometry" > + <rect> + <x>10</x> + <y>100</y> + <width>421</width> + <height>121</height> + </rect> + </property> + <property name="title" > + <string>Cavern Time</string> + </property> + <widget class="QWidget" name="horizontalLayout_2" > + <property name="geometry" > + <rect> + <x>20</x> + <y>20</y> + <width>261</width> + <height>31</height> + </rect> + </property> + <layout class="QHBoxLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QLabel" name="label_4" > + <property name="text" > + <string>Cavern time:</string> + </property> + </widget> + </item> + <item> + <widget class="QDateTimeEdit" name="dt_cavern" > + <property name="readOnly" > + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_3" > + <property name="text" > + <string>UTC</string> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="horizontalLayout_3" > + <property name="geometry" > + <rect> + <x>20</x> + <y>70</y> + <width>261</width> + <height>31</height> + </rect> + </property> + <layout class="QHBoxLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QLabel" name="label_5" > + <property name="text" > + <string>Local time:</string> + </property> + </widget> + </item> + <item> + <widget class="QDateTimeEdit" name="dt_local" > + <property name="readOnly" > + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_11" > + <property name="text" > + <string>UTC</string> + </property> + </widget> + </item> + </layout> + </widget> + </widget> + <widget class="QGroupBox" name="gb_dnitime" > + <property name="geometry" > + <rect> + <x>10</x> + <y>230</y> + <width>421</width> + <height>111</height> + </rect> + </property> + <property name="title" > + <string>D'ni time</string> + </property> + </widget> + <widget class="QGroupBox" name="gb_timezone" > + <property name="geometry" > + <rect> + <x>10</x> + <y>10</y> + <width>421</width> + <height>81</height> + </rect> + </property> + <property name="title" > + <string>Time Zone</string> + </property> + <widget class="QComboBox" name="cb_timezone_chooser" > + <property name="geometry" > + <rect> + <x>10</x> + <y>30</y> + <width>271</width> + <height>21</height> + </rect> + </property> + </widget> + </widget> + </widget> <widget class="QWidget" name="tab_4" > <attribute name="title" > <string>About</string> Modified: pymoul/trunk/src/moul/qt/ui/moulqt_rc.py =================================================================== --- pymoul/trunk/src/moul/qt/ui/moulqt_rc.py 2007-01-15 19:55:56 UTC (rev 30) +++ pymoul/trunk/src/moul/qt/ui/moulqt_rc.py 2007-01-16 00:03:34 UTC (rev 31) @@ -2,7 +2,7 @@ # Resource object code # -# Created: Mo 15. Jan 19:26:00 2007 +# Created: Di 16. Jan 01:02:23 2007 # by: The Resource Compiler for PyQt (Qt v4.2.2) # # WARNING! All changes made in this file will be lost! Modified: pymoul/trunk/src/moul/time/cavern.py =================================================================== --- pymoul/trunk/src/moul/time/cavern.py 2007-01-15 19:55:56 UTC (rev 30) +++ pymoul/trunk/src/moul/time/cavern.py 2007-01-16 00:03:34 UTC (rev 31) @@ -22,12 +22,35 @@ from datetime import datetime from datetime import timedelta -from pytz import common_timezones +#from pytz import common_timezones +from pytz import all_timezones from pytz import timezone from pytz import utc as UTC -TIMEZONE_NAMES = common_timezones +SUPPORTED_TZ = ('America', 'Canada', 'Etc', 'Europe', 'US') +ADDITIONAL_TZ = ('GMT', 'UTC') +def _listSupported(tz_list): + supported = [] + unsupported = [] + for tz in tz_list: + if tz.find('/') == -1: + if tz in ADDITIONAL_TZ: + supported.append(tz) + else: + unsupported.append(tz) + continue + prefix, postfix = tz.split('/')[:2] + if prefix in SUPPORTED_TZ: + supported.append(tz) + else: + unsupported.append(tz) + supported.sort() + unsupported.sort() + return supported, unsupported + +TIMEZONE_NAMES, UNSUPPORTED = _listSupported(all_timezones) + # Cyan HQ is near Spokane / Washington # Cavern time is Mountain Time Zone (MDT) with daylight savings (MST) CAVERN_TZ_NAME = 'US/Mountain' # MDT / MST This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |