[Pymoul-svn] SF.net SVN: pymoul: [264] pymoul/trunk/src/moul
Status: Alpha
Brought to you by:
tiran
From: <ti...@us...> - 2007-03-19 09:35:03
|
Revision: 264 http://pymoul.svn.sourceforge.net/pymoul/?rev=264&view=rev Author: tiran Date: 2007-03-19 02:10:53 -0700 (Mon, 19 Mar 2007) Log Message: ----------- Integration of Eder Gira and Pod age times in the UI Modified Paths: -------------- pymoul/trunk/src/moul/qt/dninumbers.py pymoul/trunk/src/moul/qt/i18n/pymoul_de.ts pymoul/trunk/src/moul/qt/i18n/pymoul_es.ts pymoul/trunk/src/moul/qt/i18n/pymoul_fr.ts pymoul/trunk/src/moul/qt/i18n/pymoul_it.ts pymoul/trunk/src/moul/qt/i18n/pymoul_nl.ts pymoul/trunk/src/moul/qt/ui/mainwindow.py pymoul/trunk/src/moul/qt/ui/mainwindow.ui pymoul/trunk/src/moul/time/edergira.py pymoul/trunk/src/moul/time/podage.py Modified: pymoul/trunk/src/moul/qt/dninumbers.py =================================================================== --- pymoul/trunk/src/moul/qt/dninumbers.py 2007-03-18 22:50:45 UTC (rev 263) +++ pymoul/trunk/src/moul/qt/dninumbers.py 2007-03-19 09:10:53 UTC (rev 264) @@ -17,6 +17,9 @@ # """Moul QT D'ni Number renderer + +This module started as a renderer for D'ni numbers and turned into a +time display module 8-) """ __author__ = "Christian Heimes" __version__ = "$Id$" @@ -39,6 +42,9 @@ from moul.time.dni import FACTOR_SP from moul.time.dni import VAILEETEE from moul.time.dni import decimal2dni +from moul.time.edergira import EderGiraDayCalculator +from moul.time.podage import PodAgeTime +from moul.time.podage import listPodAges from moul.time.utils import utcnow from moul.qt.utils import QNamespaceContainer @@ -108,6 +114,104 @@ # setup defaults self.rb_earthtime.click() + # pod age timers + self.minute_timer = QtCore.QTimer(self.context) + self.minute_timer.setInterval(60000) # 1 minute + self.connect(self.minute_timer, SIGNAL('timeout()'), + self.on_podage_timeout) + header = self.tw_pods.horizontalHeader() + header.setResizeMode(QtGui.QHeaderView.Stretch) + + # Eder Gira day cycle timer + header = self.tw_eg.horizontalHeader() + header.setResizeMode(QtGui.QHeaderView.Stretch) + self.connect(self.minute_timer, SIGNAL('timeout()'), + self.on_edergira_timeout) + self.minute_timer.start() + self.minute_timer.emit(SIGNAL('timeout()')) + + def _fmtdate(self, dt, spec=Qt.LocalTime): + fmt = self.trUtf8("MMM dd, hh:mm:ss") + qdt = QtCore.QDateTime(dt).toTimeSpec(spec) + return qdt.toString(fmt) + + @skipLogging + @pyqtSignature("") + def on_edergira_timeout(self): + """ + SIGNAL: QTimer timeout + """ + rows = 5 + eg = EderGiraDayCalculator() + + tw = self.tw_eg + tw.clearContents() + tw.setRowCount(rows) + + proto = QtGui.QTableWidgetItem() + #font = QtGui.QFont() + #font.setPointSize(7) + #proto.setFont(font) + proto.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter) + header = QtGui.QTableWidgetItem() + header.setSizeHint(QtCore.QSize(0,0)) + + for n, midnight, dawn, dusk in iter(eg): + if n > rows: + break + tw.setVerticalHeaderItem(n, QtGui.QTableWidgetItem(header)) + for i, dt in enumerate((midnight, dawn, dusk)): + item = QtGui.QTableWidgetItem(proto) + item.setText(self._fmtdate(dt)) + tw.setItem(n, i, item) + + tw.resizeRowsToContents() + + day = eg.getDayInfo() + self.le_eg_time.setText(str(day.hour)) + self.le_eg_status.setText(str(day.state)) + self.le_eg_light.setText("%i%%" % (day.light * 100)) + self.le_eg_length.setText(self.trUtf8("10 hours")) + + @skipLogging + @pyqtSignature("") + def on_podage_timeout(self): + """ + SIGNAL: QTimer timeout + """ + rows = 5 + cols = len(listPodAges()) + + tw = self.tw_pods + tw.clearContents() + tw.setRowCount(rows) + tw.setColumnCount(cols) + + proto = QtGui.QTableWidgetItem() + #font = QtGui.QFont() + #font.setPointSize(7) + #proto.setFont(font) + proto.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter) + + for n in range(rows): + h = QtGui.QTableWidgetItem() + h.setSizeHint(QtCore.QSize(0,0)) + tw.setVerticalHeaderItem(n, h) + + for i, name in enumerate(listPodAges()): + pat = PodAgeTime(name) + hheader = QtGui.QTableWidgetItem() + hheader.setText(name) + tw.setHorizontalHeaderItem(i, hheader) + for n, dt in iter(pat): + if n > rows: + break + item = QtGui.QTableWidgetItem(proto) + item.setText(self._fmtdate(dt)) + tw.setItem(n, i, item) + + tw.resizeRowsToContents() + @pyqtSignature("bool") def on_timer_timerEnable(self, value=True): value = bool(value) @@ -194,7 +298,7 @@ self.update_earthtime() @pyqtSignature("int") - def on_cb_earthtime_tz_currentIndeChanged(self, idx): + def on_cb_earthtime_tz_currentIndexChanged(self, idx): if idx == 0: spec = Qt.LoalTime elif idx == 1: Modified: pymoul/trunk/src/moul/qt/i18n/pymoul_de.ts =================================================================== --- pymoul/trunk/src/moul/qt/i18n/pymoul_de.ts 2007-03-18 22:50:45 UTC (rev 263) +++ pymoul/trunk/src/moul/qt/i18n/pymoul_de.ts 2007-03-19 09:10:53 UTC (rev 264) @@ -5,6 +5,14 @@ <source>cyclic 0</source> <translation>zyklische 0</translation> </message> + <message> + <source>MMM dd, hh:mm:ss</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>10 hours</source> + <translation type="unfinished"></translation> + </message> </context> <context> <name>IniFileContainer</name> @@ -520,17 +528,13 @@ <translation type="unfinished"></translation> </message> <message> - <source>Negilahn</source> + <source>Pod Ages</source> <translation type="unfinished"></translation> </message> <message> - <source>Negilahn Gate appearence</source> + <source>Gate appearence</source> <translation type="unfinished"></translation> </message> - <message> - <source>Gate</source> - <translation type="unfinished"></translation> - </message> </context> <context> <name>SimpleProgressbar</name> Modified: pymoul/trunk/src/moul/qt/i18n/pymoul_es.ts =================================================================== --- pymoul/trunk/src/moul/qt/i18n/pymoul_es.ts 2007-03-18 22:50:45 UTC (rev 263) +++ pymoul/trunk/src/moul/qt/i18n/pymoul_es.ts 2007-03-19 09:10:53 UTC (rev 264) @@ -5,6 +5,14 @@ <source>cyclic 0</source> <translation type="unfinished"></translation> </message> + <message> + <source>MMM dd, hh:mm:ss</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>10 hours</source> + <translation type="unfinished"></translation> + </message> </context> <context> <name>IniFileContainer</name> @@ -506,17 +514,13 @@ <translation type="unfinished"></translation> </message> <message> - <source>Negilahn</source> + <source>Pod Ages</source> <translation type="unfinished"></translation> </message> <message> - <source>Negilahn Gate appearence</source> + <source>Gate appearence</source> <translation type="unfinished"></translation> </message> - <message> - <source>Gate</source> - <translation type="unfinished"></translation> - </message> </context> <context> <name>SimpleProgressbar</name> Modified: pymoul/trunk/src/moul/qt/i18n/pymoul_fr.ts =================================================================== --- pymoul/trunk/src/moul/qt/i18n/pymoul_fr.ts 2007-03-18 22:50:45 UTC (rev 263) +++ pymoul/trunk/src/moul/qt/i18n/pymoul_fr.ts 2007-03-19 09:10:53 UTC (rev 264) @@ -5,6 +5,14 @@ <source>cyclic 0</source> <translation type="unfinished"></translation> </message> + <message> + <source>MMM dd, hh:mm:ss</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>10 hours</source> + <translation type="unfinished"></translation> + </message> </context> <context> <name>IniFileContainer</name> @@ -506,17 +514,13 @@ <translation type="unfinished"></translation> </message> <message> - <source>Negilahn</source> + <source>Pod Ages</source> <translation type="unfinished"></translation> </message> <message> - <source>Negilahn Gate appearence</source> + <source>Gate appearence</source> <translation type="unfinished"></translation> </message> - <message> - <source>Gate</source> - <translation type="unfinished"></translation> - </message> </context> <context> <name>SimpleProgressbar</name> Modified: pymoul/trunk/src/moul/qt/i18n/pymoul_it.ts =================================================================== --- pymoul/trunk/src/moul/qt/i18n/pymoul_it.ts 2007-03-18 22:50:45 UTC (rev 263) +++ pymoul/trunk/src/moul/qt/i18n/pymoul_it.ts 2007-03-19 09:10:53 UTC (rev 264) @@ -5,6 +5,14 @@ <source>cyclic 0</source> <translation type="unfinished"></translation> </message> + <message> + <source>MMM dd, hh:mm:ss</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>10 hours</source> + <translation type="unfinished"></translation> + </message> </context> <context> <name>IniFileContainer</name> @@ -506,17 +514,13 @@ <translation type="unfinished"></translation> </message> <message> - <source>Negilahn</source> + <source>Pod Ages</source> <translation type="unfinished"></translation> </message> <message> - <source>Negilahn Gate appearence</source> + <source>Gate appearence</source> <translation type="unfinished"></translation> </message> - <message> - <source>Gate</source> - <translation type="unfinished"></translation> - </message> </context> <context> <name>SimpleProgressbar</name> Modified: pymoul/trunk/src/moul/qt/i18n/pymoul_nl.ts =================================================================== --- pymoul/trunk/src/moul/qt/i18n/pymoul_nl.ts 2007-03-18 22:50:45 UTC (rev 263) +++ pymoul/trunk/src/moul/qt/i18n/pymoul_nl.ts 2007-03-19 09:10:53 UTC (rev 264) @@ -5,6 +5,14 @@ <source>cyclic 0</source> <translation type="unfinished"></translation> </message> + <message> + <source>MMM dd, hh:mm:ss</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>10 hours</source> + <translation type="unfinished"></translation> + </message> </context> <context> <name>IniFileContainer</name> @@ -506,17 +514,13 @@ <translation type="unfinished"></translation> </message> <message> - <source>Negilahn</source> + <source>Pod Ages</source> <translation type="unfinished"></translation> </message> <message> - <source>Negilahn Gate appearence</source> + <source>Gate appearence</source> <translation type="unfinished"></translation> </message> - <message> - <source>Gate</source> - <translation type="unfinished"></translation> - </message> </context> <context> <name>SimpleProgressbar</name> Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-03-18 22:50:45 UTC (rev 263) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-03-19 09:10:53 UTC (rev 264) @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file 'src\moul\qt\ui\mainwindow.ui' +# Form implementation generated from reading ui file 'src/moul/qt/ui/mainwindow.ui' # -# Created: Thu Mar 15 09:09:39 2007 +# Created: Mon Mar 19 10:09:02 2007 # by: PyQt4 UI code generator 4.1.1 # # WARNING! All changes made in this file will be lost! @@ -524,6 +524,15 @@ self.cb_aud_eax.setGeometry(QtCore.QRect(20,20,191,22)) self.cb_aud_eax.setObjectName("cb_aud_eax") + self.groupBox_voicechat = QtGui.QGroupBox(self.tab_audio) + self.groupBox_voicechat.setEnabled(True) + self.groupBox_voicechat.setGeometry(QtCore.QRect(10,190,451,51)) + self.groupBox_voicechat.setObjectName("groupBox_voicechat") + + self.cb_aud_voicechat = QtGui.QCheckBox(self.groupBox_voicechat) + self.cb_aud_voicechat.setGeometry(QtCore.QRect(20,20,171,19)) + self.cb_aud_voicechat.setObjectName("cb_aud_voicechat") + self.groupBox_aud_level = QtGui.QGroupBox(self.tab_audio) self.groupBox_aud_level.setEnabled(True) self.groupBox_aud_level.setGeometry(QtCore.QRect(10,0,451,181)) @@ -658,15 +667,6 @@ self.cb_aud_mute = QtGui.QCheckBox(self.groupBox_aud_level) self.cb_aud_mute.setGeometry(QtCore.QRect(20,20,189,22)) self.cb_aud_mute.setObjectName("cb_aud_mute") - - self.groupBox_voicechat = QtGui.QGroupBox(self.tab_audio) - self.groupBox_voicechat.setEnabled(True) - self.groupBox_voicechat.setGeometry(QtCore.QRect(10,190,451,51)) - self.groupBox_voicechat.setObjectName("groupBox_voicechat") - - self.cb_aud_voicechat = QtGui.QCheckBox(self.groupBox_voicechat) - self.cb_aud_voicechat.setGeometry(QtCore.QRect(20,20,171,19)) - self.cb_aud_voicechat.setObjectName("cb_aud_voicechat") self.tab_sub_settings.addTab(self.tab_audio,"") self.tabwidget.addTab(self.tab_settings,"") @@ -694,9 +694,9 @@ self.tab_time = QtGui.QWidget() self.tab_time.setObjectName("tab_time") - self.tabWidget_2 = QtGui.QTabWidget(self.tab_time) - self.tabWidget_2.setGeometry(QtCore.QRect(0,0,471,411)) - self.tabWidget_2.setObjectName("tabWidget_2") + self.tab_sub_time = QtGui.QTabWidget(self.tab_time) + self.tab_sub_time.setGeometry(QtCore.QRect(0,0,471,411)) + self.tab_sub_time.setObjectName("tab_sub_time") self.tab_time_dni = QtGui.QWidget() self.tab_time_dni.setObjectName("tab_time_dni") @@ -950,7 +950,7 @@ self.rb_dnitime = QtGui.QRadioButton(self.gridLayout_5) self.rb_dnitime.setObjectName("rb_dnitime") self.gridlayout2.addWidget(self.rb_dnitime,2,0,1,1) - self.tabWidget_2.addTab(self.tab_time_dni,"") + self.tab_sub_time.addTab(self.tab_time_dni,"") self.tab_time_eder = QtGui.QWidget() self.tab_time_eder.setObjectName("tab_time_eder") @@ -1011,7 +1011,7 @@ self.gridlayout3.addItem(spacerItem10,0,5,1,1) self.tw_eg = QtGui.QTableWidget(self.groupBox_4) - self.tw_eg.setGeometry(QtCore.QRect(10,90,431,141)) + self.tw_eg.setGeometry(QtCore.QRect(10,90,431,131)) font = QtGui.QFont(self.tw_eg.font()) font.setPointSize(8) @@ -1020,8 +1020,13 @@ self.tw_eg.setDragDropOverwriteMode(False) self.tw_eg.setAlternatingRowColors(True) self.tw_eg.setObjectName("tw_eg") - self.tabWidget_2.addTab(self.tab_time_eder,"") + self.lb_localtime = QtGui.QLabel(self.groupBox_4) + self.lb_localtime.setGeometry(QtCore.QRect(360,230,81,20)) + self.lb_localtime.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) + self.lb_localtime.setObjectName("lb_localtime") + self.tab_sub_time.addTab(self.tab_time_eder,"") + self.tab_time_podages = QtGui.QWidget() self.tab_time_podages.setObjectName("tab_time_podages") @@ -1030,17 +1035,22 @@ self.groupBox_6.setGeometry(QtCore.QRect(10,0,451,371)) self.groupBox_6.setObjectName("groupBox_6") - self.tw_eg_2 = QtGui.QTableWidget(self.groupBox_6) - self.tw_eg_2.setGeometry(QtCore.QRect(10,30,431,141)) + self.tw_pods = QtGui.QTableWidget(self.groupBox_6) + self.tw_pods.setGeometry(QtCore.QRect(10,30,431,131)) - font = QtGui.QFont(self.tw_eg_2.font()) + font = QtGui.QFont(self.tw_pods.font()) font.setPointSize(8) - self.tw_eg_2.setFont(font) - self.tw_eg_2.setProperty("showDropIndicator",QtCore.QVariant(False)) - self.tw_eg_2.setDragDropOverwriteMode(False) - self.tw_eg_2.setAlternatingRowColors(True) - self.tw_eg_2.setObjectName("tw_eg_2") - self.tabWidget_2.addTab(self.tab_time_podages,"") + self.tw_pods.setFont(font) + self.tw_pods.setProperty("showDropIndicator",QtCore.QVariant(False)) + self.tw_pods.setDragDropOverwriteMode(False) + self.tw_pods.setAlternatingRowColors(True) + self.tw_pods.setObjectName("tw_pods") + + self.lb_localtime_2 = QtGui.QLabel(self.groupBox_6) + self.lb_localtime_2.setGeometry(QtCore.QRect(360,170,81,20)) + self.lb_localtime_2.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) + self.lb_localtime_2.setObjectName("lb_localtime_2") + self.tab_sub_time.addTab(self.tab_time_podages,"") self.tabwidget.addTab(self.tab_time,"") self.tab_browse = QtGui.QWidget() @@ -1206,8 +1216,8 @@ self.retranslateUi(MainWindow) self.tabwidget.setCurrentIndex(0) - self.tab_sub_settings.setCurrentIndex(1) - self.tabWidget_2.setCurrentIndex(0) + self.tab_sub_settings.setCurrentIndex(0) + self.tab_sub_time.setCurrentIndex(0) self.tabWidget.setCurrentIndex(2) self.tabwidget_about.setCurrentIndex(0) QtCore.QObject.connect(self.main_buttonbox,QtCore.SIGNAL("rejected()"),MainWindow.close) @@ -1255,14 +1265,14 @@ self.lb_aud_device.setText(QtGui.QApplication.translate("MainWindow", "Generic Software", None, QtGui.QApplication.UnicodeUTF8)) self.lb_aud_priority.setText(QtGui.QApplication.translate("MainWindow", "Sound priority", None, QtGui.QApplication.UnicodeUTF8)) self.cb_aud_eax.setText(QtGui.QApplication.translate("MainWindow", "Enable EAX", None, QtGui.QApplication.UnicodeUTF8)) + self.groupBox_voicechat.setTitle(QtGui.QApplication.translate("MainWindow", "Voice chat", None, QtGui.QApplication.UnicodeUTF8)) + self.cb_aud_voicechat.setText(QtGui.QApplication.translate("MainWindow", "Enable Voice Chat", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_aud_level.setTitle(QtGui.QApplication.translate("MainWindow", "Level", None, QtGui.QApplication.UnicodeUTF8)) self.lb_aud_fx_3.setText(QtGui.QApplication.translate("MainWindow", "Sound FX", None, QtGui.QApplication.UnicodeUTF8)) self.lb_aud_music.setText(QtGui.QApplication.translate("MainWindow", "Music", None, QtGui.QApplication.UnicodeUTF8)) self.lb_aud_ambience.setText(QtGui.QApplication.translate("MainWindow", "Ambience Sound", None, QtGui.QApplication.UnicodeUTF8)) self.lb_aud_npc.setText(QtGui.QApplication.translate("MainWindow", "NPC Voices", None, QtGui.QApplication.UnicodeUTF8)) self.cb_aud_mute.setText(QtGui.QApplication.translate("MainWindow", "Mute all", None, QtGui.QApplication.UnicodeUTF8)) - self.groupBox_voicechat.setTitle(QtGui.QApplication.translate("MainWindow", "Voice chat", None, QtGui.QApplication.UnicodeUTF8)) - self.cb_aud_voicechat.setText(QtGui.QApplication.translate("MainWindow", "Enable Voice Chat", None, QtGui.QApplication.UnicodeUTF8)) self.tab_sub_settings.setTabText(self.tab_sub_settings.indexOf(self.tab_audio), QtGui.QApplication.translate("MainWindow", "Audio", None, QtGui.QApplication.UnicodeUTF8)) self.tabwidget.setTabText(self.tabwidget.indexOf(self.tab_settings), QtGui.QApplication.translate("MainWindow", "Settings", None, QtGui.QApplication.UnicodeUTF8)) self.gb_servers.setTitle(QtGui.QApplication.translate("MainWindow", "Ping servers", None, QtGui.QApplication.UnicodeUTF8)) @@ -1300,7 +1310,7 @@ self.cb_earthtime_tz.addItem(QtGui.QApplication.translate("MainWindow", "local time", None, QtGui.QApplication.UnicodeUTF8)) self.cb_earthtime_tz.addItem(QtGui.QApplication.translate("MainWindow", "UTC", None, QtGui.QApplication.UnicodeUTF8)) self.rb_dnitime.setText(QtGui.QApplication.translate("MainWindow", "D\'ni Time", None, QtGui.QApplication.UnicodeUTF8)) - self.tabWidget_2.setTabText(self.tabWidget_2.indexOf(self.tab_time_dni), QtGui.QApplication.translate("MainWindow", "D\'ni Time", None, QtGui.QApplication.UnicodeUTF8)) + self.tab_sub_time.setTabText(self.tab_sub_time.indexOf(self.tab_time_dni), QtGui.QApplication.translate("MainWindow", "D\'ni Time", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_4.setTitle(QtGui.QApplication.translate("MainWindow", "Eder Gira day cycle", None, QtGui.QApplication.UnicodeUTF8)) self.label_6.setText(QtGui.QApplication.translate("MainWindow", "Sun", None, QtGui.QApplication.UnicodeUTF8)) self.label_13.setText(QtGui.QApplication.translate("MainWindow", "Light level", None, QtGui.QApplication.UnicodeUTF8)) @@ -1321,22 +1331,20 @@ headerItem5 = QtGui.QTableWidgetItem() headerItem5.setText(QtGui.QApplication.translate("MainWindow", "Dusk", None, QtGui.QApplication.UnicodeUTF8)) self.tw_eg.setHorizontalHeaderItem(2,headerItem5) - self.tabWidget_2.setTabText(self.tabWidget_2.indexOf(self.tab_time_eder), QtGui.QApplication.translate("MainWindow", "Eder Gira", None, QtGui.QApplication.UnicodeUTF8)) - self.groupBox_6.setTitle(QtGui.QApplication.translate("MainWindow", "Negilahn Gate appearence", None, QtGui.QApplication.UnicodeUTF8)) - self.tw_eg_2.clear() - self.tw_eg_2.setColumnCount(1) - self.tw_eg_2.setRowCount(0) - - headerItem6 = QtGui.QTableWidgetItem() - headerItem6.setText(QtGui.QApplication.translate("MainWindow", "Gate", None, QtGui.QApplication.UnicodeUTF8)) - self.tw_eg_2.setHorizontalHeaderItem(0,headerItem6) - self.tabWidget_2.setTabText(self.tabWidget_2.indexOf(self.tab_time_podages), QtGui.QApplication.translate("MainWindow", "Negilahn", None, QtGui.QApplication.UnicodeUTF8)) + self.lb_localtime.setText(QtGui.QApplication.translate("MainWindow", "local time", None, QtGui.QApplication.UnicodeUTF8)) + self.tab_sub_time.setTabText(self.tab_sub_time.indexOf(self.tab_time_eder), QtGui.QApplication.translate("MainWindow", "Eder Gira", None, QtGui.QApplication.UnicodeUTF8)) + self.groupBox_6.setTitle(QtGui.QApplication.translate("MainWindow", "Gate appearence", None, QtGui.QApplication.UnicodeUTF8)) + self.tw_pods.clear() + self.tw_pods.setColumnCount(0) + self.tw_pods.setRowCount(0) + self.lb_localtime_2.setText(QtGui.QApplication.translate("MainWindow", "local time", None, QtGui.QApplication.UnicodeUTF8)) + self.tab_sub_time.setTabText(self.tab_sub_time.indexOf(self.tab_time_podages), QtGui.QApplication.translate("MainWindow", "Pod Ages", None, QtGui.QApplication.UnicodeUTF8)) self.tabwidget.setTabText(self.tabwidget.indexOf(self.tab_time), QtGui.QApplication.translate("MainWindow", "Time", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_5.setTitle(QtGui.QApplication.translate("MainWindow", "Read chatlogs", None, QtGui.QApplication.UnicodeUTF8)) self.tb_chatlog_view.setHtml(QtGui.QApplication.translate("MainWindow", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" - "</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;\">\n" - "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:\'Sans Serif\'; font-size:9pt;\">Not implemented</p></body></html>", None, QtGui.QApplication.UnicodeUTF8)) + "</style></head><body style=\" font-family:\'Sans Serif\'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;\">\n" + "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Not implemented</p></body></html>", None, QtGui.QApplication.UnicodeUTF8)) self.cb_chatlog.addItem(QtGui.QApplication.translate("MainWindow", "Not implemented", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_sub_chatlogs), QtGui.QApplication.translate("MainWindow", "Chat logs", None, QtGui.QApplication.UnicodeUTF8)) self.gb_documents.setTitle(QtGui.QApplication.translate("MainWindow", "Browse journals and notes", None, QtGui.QApplication.UnicodeUTF8)) @@ -1352,13 +1360,13 @@ self.tabwidget.setTabText(self.tabwidget.indexOf(self.tab_browse), QtGui.QApplication.translate("MainWindow", "Browse", None, QtGui.QApplication.UnicodeUTF8)) self.tb_abouttext.setHtml(QtGui.QApplication.translate("MainWindow", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" - "</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;\">\n" - "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:\'Sans Serif\'; font-size:9pt;\"></p></body></html>", None, QtGui.QApplication.UnicodeUTF8)) + "</style></head><body style=\" font-family:\'Sans Serif\'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;\">\n" + "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"></p></body></html>", None, QtGui.QApplication.UnicodeUTF8)) self.tabwidget_about.setTabText(self.tabwidget_about.indexOf(self.tab_sub_about), QtGui.QApplication.translate("MainWindow", "About pyMoul", None, QtGui.QApplication.UnicodeUTF8)) self.tb_license.setHtml(QtGui.QApplication.translate("MainWindow", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" - "</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;\">\n" - "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:\'Sans Serif\'; font-size:9pt;\"></p></body></html>", None, QtGui.QApplication.UnicodeUTF8)) + "</style></head><body style=\" font-family:\'Sans Serif\'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;\">\n" + "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"></p></body></html>", None, QtGui.QApplication.UnicodeUTF8)) self.tabwidget_about.setTabText(self.tabwidget_about.indexOf(self.tab_sub_license), QtGui.QApplication.translate("MainWindow", "License", None, QtGui.QApplication.UnicodeUTF8)) self.tabwidget.setTabText(self.tabwidget.indexOf(self.tab_about), 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-03-18 22:50:45 UTC (rev 263) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-03-19 09:10:53 UTC (rev 264) @@ -358,7 +358,7 @@ </rect> </property> <property name="currentIndex" > - <number>1</number> + <number>0</number> </property> <widget class="QWidget" name="tab_graphics" > <attribute name="title" > @@ -1126,6 +1126,35 @@ </property> </widget> </widget> + <widget class="QGroupBox" name="groupBox_voicechat" > + <property name="enabled" > + <bool>true</bool> + </property> + <property name="geometry" > + <rect> + <x>10</x> + <y>190</y> + <width>451</width> + <height>51</height> + </rect> + </property> + <property name="title" > + <string>Voice chat</string> + </property> + <widget class="QCheckBox" name="cb_aud_voicechat" > + <property name="geometry" > + <rect> + <x>20</x> + <y>20</y> + <width>171</width> + <height>19</height> + </rect> + </property> + <property name="text" > + <string>Enable Voice Chat</string> + </property> + </widget> + </widget> <widget class="QGroupBox" name="groupBox_aud_level" > <property name="enabled" > <bool>true</bool> @@ -1403,35 +1432,6 @@ </property> </widget> </widget> - <widget class="QGroupBox" name="groupBox_voicechat" > - <property name="enabled" > - <bool>true</bool> - </property> - <property name="geometry" > - <rect> - <x>10</x> - <y>190</y> - <width>451</width> - <height>51</height> - </rect> - </property> - <property name="title" > - <string>Voice chat</string> - </property> - <widget class="QCheckBox" name="cb_aud_voicechat" > - <property name="geometry" > - <rect> - <x>20</x> - <y>20</y> - <width>171</width> - <height>19</height> - </rect> - </property> - <property name="text" > - <string>Enable Voice Chat</string> - </property> - </widget> - </widget> </widget> </widget> </widget> @@ -1503,7 +1503,7 @@ <attribute name="title" > <string>Time</string> </attribute> - <widget class="QTabWidget" name="tabWidget_2" > + <widget class="QTabWidget" name="tab_sub_time" > <property name="geometry" > <rect> <x>0</x> @@ -2186,7 +2186,7 @@ <x>10</x> <y>90</y> <width>431</width> - <height>141</height> + <height>131</height> </rect> </property> <property name="font" > @@ -2219,11 +2219,27 @@ </property> </column> </widget> + <widget class="QLabel" name="lb_localtime" > + <property name="geometry" > + <rect> + <x>360</x> + <y>230</y> + <width>81</width> + <height>20</height> + </rect> + </property> + <property name="text" > + <string>local time</string> + </property> + <property name="alignment" > + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> </widget> </widget> <widget class="QWidget" name="tab_time_podages" > <attribute name="title" > - <string>Negilahn</string> + <string>Pod Ages</string> </attribute> <widget class="QGroupBox" name="groupBox_6" > <property name="enabled" > @@ -2238,15 +2254,15 @@ </rect> </property> <property name="title" > - <string>Negilahn Gate appearence</string> + <string>Gate appearence</string> </property> - <widget class="QTableWidget" name="tw_eg_2" > + <widget class="QTableWidget" name="tw_pods" > <property name="geometry" > <rect> <x>10</x> <y>30</y> <width>431</width> - <height>141</height> + <height>131</height> </rect> </property> <property name="font" > @@ -2263,12 +2279,23 @@ <property name="alternatingRowColors" > <bool>true</bool> </property> - <column> - <property name="text" > - <string>Gate</string> - </property> - </column> </widget> + <widget class="QLabel" name="lb_localtime_2" > + <property name="geometry" > + <rect> + <x>360</x> + <y>170</y> + <width>81</width> + <height>20</height> + </rect> + </property> + <property name="text" > + <string>local time</string> + </property> + <property name="alignment" > + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> </widget> </widget> </widget> @@ -2320,8 +2347,8 @@ <property name="html" > <string><html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;">Not implemented</p></body></html></string> +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Not implemented</p></body></html></string> </property> <property name="textInteractionFlags" > <enum>Qt::TextSelectableByMouse</enum> @@ -2564,8 +2591,8 @@ <property name="html" > <string><html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;"> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;"></p></body></html></string> +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p></body></html></string> </property> <property name="textInteractionFlags" > <enum>Qt::TextBrowserInteraction</enum> @@ -2591,8 +2618,8 @@ <property name="html" > <string><html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;"> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;"></p></body></html></string> +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p></body></html></string> </property> <property name="textInteractionFlags" > <enum>Qt::TextSelectableByMouse</enum> Modified: pymoul/trunk/src/moul/time/edergira.py =================================================================== --- pymoul/trunk/src/moul/time/edergira.py 2007-03-18 22:50:45 UTC (rev 263) +++ pymoul/trunk/src/moul/time/edergira.py 2007-03-19 09:10:53 UTC (rev 264) @@ -108,8 +108,8 @@ @return: n, midnight, dawn, dusk """ - base = self.getLastMidnight(dt) + self._delta - n = 1 + base = self.getLastMidnight(dt) + n = 0 while True: yield (n, base, base+self._dawn, base+self._dusk) base += self._delta @@ -118,6 +118,7 @@ def __iter__(self): return self.iterDates() + @property def dayLength(self): return (self._hours, 0, 0) Modified: pymoul/trunk/src/moul/time/podage.py =================================================================== --- pymoul/trunk/src/moul/time/podage.py 2007-03-18 22:50:45 UTC (rev 263) +++ pymoul/trunk/src/moul/time/podage.py 2007-03-19 09:10:53 UTC (rev 264) @@ -59,7 +59,7 @@ # base datetime for calculations #BASE_DT = datetime(2007, 3, 4, 10, 16, 0, tzinfo=UTC) # XXX Uru's main game server is off 3min 35sec -BASE_DT = datetime(2007, 3, 7, 1, 7, 57, tzinfo=UTC) +BASE_DT = datetime(2007, 3, 7, 1, 7, 0, tzinfo=UTC) #BASE_DT = datetime(2007, 3, 7, 1, 10, 9, tzinfo=UTC) class PodAgeRegistry(dict): @@ -122,6 +122,8 @@ class PodAgeTime(object): """A pod age day cycle and gate event timer """ + __slots__ = ('_age', '_name', '_base') + def __init__(self, name): """ @param name: Registered name of a pod age @@ -167,8 +169,7 @@ @return: date and time of next event @rtype: datetime instance """ - delta = count * PODDAY_TD - return self._base + delta + return self._base + count * PODDAY_TD def __iter__(self): """Iterate through events @@ -176,12 +177,11 @@ @return: Iterator that yields (number, date) @rtype: iterator (int, datetime) """ - delta = PODDAY_TD - dt = self._base + delta + dt = self._base + PODDAY_TD n = 0 while True: yield (n, dt) - dt += delta + dt += PODDAY_TD n += 1 # pod ages @@ -236,29 +236,34 @@ def allTzList(limit=50, fmt="%Y-%m-%d %H:%M:%S %Z"): """Small utility function to create a nice list for the forum """ - base = os.path.dirname(__file__) + from pytz import common_timezones + base = os.path.join(os.path.dirname(__file__), 'out') + if not os.path.isdir(base): + os.mkdir(base) for tz in common_timezones: continent = tz.split('/')[0] if continent not in ('UTC', 'US', 'Australia', 'Europe', 'America'): continue tzname = tz.replace('/', '_') - fd = open(os.path.join(base, 'out', "%s.html" % tzname), 'w') + fd = open(os.path.join(base, "%s.html" % tzname), 'w') print >>fd, "<html><head><title>%s</title></head><body><pre>" % tz + print tzname for age in listPodAges(): pat = PodAgeTime(age) - print age, tzname print >>fd, age print >>fd, "--------------------------------------------------------------------" for n, dt in iter(pat): if n > limit: break - dni = DniTime.fromUTC(dt) + #dni = DniTime.fromUTC(dt) ldt = normalizeTZ(tz, dt) - print >>fd, "Earth: %s, D'ni: %s, %i" % (ldt.strftime(fmt), - str(dni), dni.pahrtahvo) + #print >>fd, "Earth: %s, D'ni: %s, %i" % (ldt.strftime(fmt), + # str(dni), dni.pahrtahvo) + print >>fd, ldt.strftime(fmt) print >>fd, "\n" print >>fd, "</pre></body></html>" fd.close() if __name__ == '__main__': forumTimeTable(tzlist=('UTC',)) + #allTzList() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |