[Pymoul-svn] SF.net SVN: pymoul: [162] pymoul/trunk/src/moul
Status: Alpha
Brought to you by:
tiran
|
From: <ti...@us...> - 2007-02-12 19:34:23
|
Revision: 162
http://pymoul.svn.sourceforge.net/pymoul/?rev=162&view=rev
Author: tiran
Date: 2007-02-12 11:34:10 -0800 (Mon, 12 Feb 2007)
Log Message:
-----------
Show D'ni time
Modified Paths:
--------------
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/time/dni.py
Modified: pymoul/trunk/src/moul/qt/mainwindow.py
===================================================================
--- pymoul/trunk/src/moul/qt/mainwindow.py 2007-02-12 17:15:11 UTC (rev 161)
+++ pymoul/trunk/src/moul/qt/mainwindow.py 2007-02-12 19:34:10 UTC (rev 162)
@@ -42,6 +42,8 @@
from moul.server.ping import isSocketError
from moul.server.ping import fmtSocketError
from moul.time.cavern import CavernTime
+from moul.time.dni import DniTime
+from moul.time.dni import FACTOR_SP
from moul.qt.localization import LocalizationContainer
from moul.qt.wdysini import IniFileContainer
@@ -388,12 +390,21 @@
# create a timer to update the display every second
# TODO: change timer from every second to every minute
- self._timezone_timer = timer = QtCore.QTimer(self)
- timer.setInterval(1000) # 1 sec
+ self._timezone_timer = QtCore.QTimer(self)
+ self._timezone_timer.setInterval(1000) # 1 sec
# TODO: needs optimization? run only when timer tab is active
- self.connect(timer, SIGNAL('timeout()'), self.on_timezone_timer_timeout)
- timer.start()
+ self.connect(self._timezone_timer, SIGNAL('timeout()'),
+ self.on_timezone_timer_timeout)
+ self._timezone_timer.start()
+ self._dnitime = DniTime()
+ self.on_dnitimer_timeout()
+ self._dnitime_timer = QtCore.QTimer(self)
+ self._dnitime_timer.setInterval(FACTOR_SP*1000)
+ self.connect(self._dnitime_timer, SIGNAL('timeout()'),
+ self.on_dnitimer_timeout)
+ self._dnitime_timer.start()
+
def _timezone_update(self):
"""
Update datetime widgets
@@ -421,6 +432,15 @@
self.dt_cavern.setDateTime(ct['cavern'])
self.dt_pacific.setDateTime(ct['pacific'])
+ @pyqtSignature("")
+ @qtutils.skipLogging
+ def on_dnitimer_timeout(self):
+ """
+ SIGNAL: QTimer timeout
+ """
+ dni = self._dnitime.fromUTC() # set to now
+ self.le_dnitime.setText(str(self._dnitime)+", bell: %s" % self._dnitime.bell)
+
# ************************************************************************
# ping
def _ping_init(self):
Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.py
===================================================================
--- pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-02-12 17:15:11 UTC (rev 161)
+++ pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-02-12 19:34:10 UTC (rev 162)
@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file './src/moul/qt/ui/mainwindow.ui'
#
-# Created: Tue Feb 6 04:38:34 2007
+# Created: Mon Feb 12 20:15:18 2007
# by: PyQt4 UI code generator 4.1.1
#
# WARNING! All changes made in this file will be lost!
@@ -117,7 +117,7 @@
self.gridlayout.addWidget(self.lb_log_remove,1,1,1,3)
self.groupBox_2 = QtGui.QGroupBox(self.tab_tasks)
- self.groupBox_2.setGeometry(QtCore.QRect(10,130,451,81))
+ self.groupBox_2.setGeometry(QtCore.QRect(10,120,451,81))
self.groupBox_2.setObjectName("groupBox_2")
self.layoutWidget1 = QtGui.QWidget(self.groupBox_2)
@@ -142,7 +142,7 @@
self.hboxlayout1.addItem(spacerItem3)
self.gb_caverntime = QtGui.QGroupBox(self.tab_tasks)
- self.gb_caverntime.setGeometry(QtCore.QRect(10,220,451,101))
+ self.gb_caverntime.setGeometry(QtCore.QRect(10,200,451,101))
self.gb_caverntime.setObjectName("gb_caverntime")
self.gridLayout = QtGui.QWidget(self.gb_caverntime)
@@ -201,6 +201,16 @@
spacerItem4 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum)
self.gridlayout1.addItem(spacerItem4,0,3,1,1)
+
+ self.gb_dnitime = QtGui.QGroupBox(self.tab_tasks)
+ self.gb_dnitime.setGeometry(QtCore.QRect(10,300,451,101))
+ self.gb_dnitime.setObjectName("gb_dnitime")
+
+ self.le_dnitime = QtGui.QLineEdit(self.gb_dnitime)
+ self.le_dnitime.setGeometry(QtCore.QRect(10,40,281,25))
+ self.le_dnitime.setEchoMode(QtGui.QLineEdit.Normal)
+ self.le_dnitime.setReadOnly(True)
+ self.le_dnitime.setObjectName("le_dnitime")
self.tabwidget.addTab(self.tab_tasks,"")
self.tab_settings = QtGui.QWidget()
@@ -927,6 +937,7 @@
self.lb_pacific_utc.setText(QtGui.QApplication.translate("MainWindow", "UTC -0", None, QtGui.QApplication.UnicodeUTF8))
self.label_4.setText(QtGui.QApplication.translate("MainWindow", "Cavern time:", None, QtGui.QApplication.UnicodeUTF8))
self.label_5.setText(QtGui.QApplication.translate("MainWindow", "Cyan time:", None, QtGui.QApplication.UnicodeUTF8))
+ self.gb_dnitime.setTitle(QtGui.QApplication.translate("MainWindow", "D\'ni time", None, QtGui.QApplication.UnicodeUTF8))
self.tabwidget.setTabText(self.tabwidget.indexOf(self.tab_tasks), QtGui.QApplication.translate("MainWindow", "Tasks", None, QtGui.QApplication.UnicodeUTF8))
self.groupBox_screenres.setTitle(QtGui.QApplication.translate("MainWindow", "Screen Resolution", None, QtGui.QApplication.UnicodeUTF8))
self.lb_screenres.setText(QtGui.QApplication.translate("MainWindow", "800x600 (4:3)", None, QtGui.QApplication.UnicodeUTF8))
Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.ui
===================================================================
--- pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-02-12 17:15:11 UTC (rev 161)
+++ pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-02-12 19:34:10 UTC (rev 162)
@@ -280,7 +280,7 @@
<property name="geometry" >
<rect>
<x>10</x>
- <y>130</y>
+ <y>120</y>
<width>451</width>
<height>81</height>
</rect>
@@ -347,7 +347,7 @@
<property name="geometry" >
<rect>
<x>10</x>
- <y>220</y>
+ <y>200</y>
<width>451</width>
<height>101</height>
</rect>
@@ -466,6 +466,35 @@
</layout>
</widget>
</widget>
+ <widget class="QGroupBox" name="gb_dnitime" >
+ <property name="geometry" >
+ <rect>
+ <x>10</x>
+ <y>300</y>
+ <width>451</width>
+ <height>101</height>
+ </rect>
+ </property>
+ <property name="title" >
+ <string>D'ni time</string>
+ </property>
+ <widget class="QLineEdit" name="le_dnitime" >
+ <property name="geometry" >
+ <rect>
+ <x>10</x>
+ <y>40</y>
+ <width>281</width>
+ <height>25</height>
+ </rect>
+ </property>
+ <property name="echoMode" >
+ <enum>QLineEdit::Normal</enum>
+ </property>
+ <property name="readOnly" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </widget>
</widget>
<widget class="QWidget" name="tab_settings" >
<attribute name="title" >
Modified: pymoul/trunk/src/moul/time/dni.py
===================================================================
--- pymoul/trunk/src/moul/time/dni.py 2007-02-12 17:15:11 UTC (rev 161)
+++ pymoul/trunk/src/moul/time/dni.py 2007-02-12 19:34:10 UTC (rev 162)
@@ -18,10 +18,13 @@
"""pyMoul D'ni time tool
Based on informations from http://www.dpwr.net/archive.php?showarticle=2193
+Verified with http://home.earthlink.net/~seizuretown/myst/ccconverter.html
official sources say that:
00:00:00:00, Leefo 1, 9654 DE = 10:35:18 UTC, April 21, 1998 CE
+>>> from datetime import timedelta
+
>>> LEEFO_1_TABLE = [
... datetime(1998, 4, 21, 10, 35, 18, 0, tzinfo=UTC),
... datetime(1999, 4, 21, 16, 24, 3, 0, tzinfo=UTC),
@@ -118,8 +121,8 @@
BASE_YEAR = 1998
SECONDS_PER_HAHR = 31556925
PRORAHN_PER_HAHR = 22656250
-FACTOR_SP = float(SECONDS_PER_HAHR) / float(PRORAHN_PER_HAHR)
-FACTOR_PS = float(PRORAHN_PER_HAHR) / float(SECONDS_PER_HAHR)
+FACTOR_SP = float(SECONDS_PER_HAHR) / float(PRORAHN_PER_HAHR) # 1.39285737931
+FACTOR_PS = float(PRORAHN_PER_HAHR) / float(SECONDS_PER_HAHR) # 0.717948596069
def valueCheck(typ, minv, maxv):
"""Value and type checking decorator
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|