pymoul-svn Mailing List for pyMoul (Page 5)
Status: Alpha
Brought to you by:
tiran
You can subscribe to this list here.
2007 |
Jan
(89) |
Feb
(108) |
Mar
(62) |
Apr
(8) |
May
(9) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|
From: <ti...@us...> - 2007-02-27 03:10:10
|
Revision: 199 http://pymoul.svn.sourceforge.net/pymoul/?rev=199&view=rev Author: tiran Date: 2007-02-26 19:10:11 -0800 (Mon, 26 Feb 2007) Log Message: ----------- Fixed %i -> %s Modified Paths: -------------- pymoul/trunk/src/moul/osdependent/processinfo.py Modified: pymoul/trunk/src/moul/osdependent/processinfo.py =================================================================== --- pymoul/trunk/src/moul/osdependent/processinfo.py 2007-02-27 03:01:53 UTC (rev 198) +++ pymoul/trunk/src/moul/osdependent/processinfo.py 2007-02-27 03:10:11 UTC (rev 199) @@ -251,7 +251,7 @@ mapping = {} try: # read entiry file to avoid race conditions - lines = open('%s/%i/status' % (PROC, pid), 'r').readlines() + lines = open('%s/%s/status' % (PROC, pid), 'r').readlines() except IOError: return None for line in lines: @@ -275,7 +275,7 @@ """ try: # read entiry file to avoid race conditions - data = open('%s/%i/cmdline' % (PROC, pid), 'r').read() + data = open('%s/%s/cmdline' % (PROC, pid), 'r').read() except IOError: return None return data.split(NULL) @@ -287,8 +287,8 @@ exe -> path to executable (may not exist) """ return { - 'cwd' : os.path.realpath('%s/%i/cwd' % (PROC, pid)), - 'exe' : os.path.realpath('%s/%i/exe' % (PROC, pid)), + 'cwd' : os.path.realpath('%s/%s/cwd' % (PROC, pid)), + 'exe' : os.path.realpath('%s/%s/exe' % (PROC, pid)), } class WinEnumProcesses(object): @@ -334,7 +334,7 @@ try: name = u"".join([c for c in modname if c != NULL]) except UnicodeError, msg: - LOG.exception("Can't decode name of pid %i" % pid) + LOG.exception("Can't decode name of pid %s" % pid) else: mapping[pid] = name modname[:] = sizeof(modname) * NULL @@ -362,7 +362,7 @@ try: name = u"".join([c for c in modname if c != NULL]) except UnicodeError, msg: - LOG.exception("Can't decode name of pid %i" % pid) + LOG.exception("Can't decode name of pid %s" % pid) else: name = None This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-02-27 03:02:02
|
Revision: 198 http://pymoul.svn.sourceforge.net/pymoul/?rev=198&view=rev Author: tiran Date: 2007-02-26 19:01:53 -0800 (Mon, 26 Feb 2007) Log Message: ----------- Added ps parser to processinfo Modified Paths: -------------- pymoul/trunk/src/moul/osdependent/processinfo.py Modified: pymoul/trunk/src/moul/osdependent/processinfo.py =================================================================== --- pymoul/trunk/src/moul/osdependent/processinfo.py 2007-02-26 17:43:35 UTC (rev 197) +++ pymoul/trunk/src/moul/osdependent/processinfo.py 2007-02-27 03:01:53 UTC (rev 198) @@ -17,6 +17,13 @@ # """Get process informations +The module contains for implementations: + + - an Unsupported implementation that raises UnsupportedError + - a Linux implementation that read the data from /proc + - a Unix/POSIX implementation that parses the output of ps + - a Windows implementation that uses ctypes to get the infos from psapi.dll + API === getPids() - list of ints/longs @@ -56,11 +63,9 @@ LOG = getLogger("processinfo") _plat = sys.platform.startswith -if _plat('linux'): - PLAT = 'linux' - import os.path -elif _plat('win') or _plat('cygwin'): - PLAT = 'win' +if _plat('win') or _plat('cygwin'): + LOG.debug("Using ctypes on Windows") + IMPL = 'win' from ctypes import windll, c_ulong, sizeof, c_buffer, byref PSAPI = windll.psapi @@ -68,25 +73,147 @@ PROCESS_QUERY_INFORMATION = 0x0400 PROCESS_VM_READ = 0x0010 PROCESS_FLAGS = PROCESS_QUERY_INFORMATION | PROCESS_VM_READ -#elif _plat('darwin'): -# pass else: - raise OSError("OS %s is not supported" % os.name) + import os + PROC = '/proc' + if os.path.isfile("%s/self/status" % PROC): + LOG.debug("Using /proc on Linux") + IMPL = 'proc' + elif os.system('ps') == 0: + LOG.debug("Using the 'ps' command on POSIX os") + IMPL = 'ps' + from subprocess import Popen + from subprocess import PIPE + else: + LOG.warning("Unsupported OS. Neither /proc nor 'ps' works.") + IMPL = "unsupported" NULL = "\x00" +class UnsupportedError(OSError): + pass + +class Unsupported(object): + """Unsupported OS + """ + __slots__ = () + + def supported(self): + return False + supported = property(supported) + + def getPids(self): + """Get a list of pids + """ + raise UnsupportedError + + def getPidNames(self): + """Get a list of pid -> name + """ + raise UnsupportedError + + def getPidDetails(self, pid): + """Get detailed informations about a process + """ + raise UnsupportedError + +class PsParser(object): + """Parse the output of the ps command + """ + __slots__ = () + + CMD = "ps -e --no-header --cols=1024" + PIDNAMES = "%s --format=pid,ucmd" % CMD + PIDS = "%s --format=pid" % CMD + + def supported(self): + return False + supported = property(supported) + + def getPids(self): + """Get a list of pids + """ + stdout = self._exec(self.PIDS) + if stdout is None: + return None + pids = [] + for line in stdout: + try: + pid = int(line.strip()) + except ValueError: + pass + else: + pids.append(pid) + return pids + + def getPidNames(self): + """Get a list of pid -> name + """ + stdout = self._exec(self.PIDNAMES) + if stdout is None: + return None + mapping = {} + for line in stdout: + line = line.strip() + idx = line.find(' ') + pid, name = line[:idx], line[idx+1:] + try: + pid = int(pid) + except ValueError: + pass + else: + mapping[pid] = name + return mapping + + def getPidDetails(self, pid): + """Get detailed informations about a process + + TODO + """ + raise UnsupportedError + + def _exec(self, cmd): + """Execute command cmd + + The method waits until the command has finished. It returns None of + something went wrong. + + @param cmd: Command to execute + @type cmd: str + @return: None or stdin as file like object + """ + try: + popen = Popen(cmd, shell=True, bufsize=-1, stdout=PIPE, + env = {'LC_ALL' : 'C'}) + rc = popen.wait() + except (OSError, ValueError): + LOG.exception("Failed to execute '%s'" % cmd) + return None + else: + if rc != 0: + LOG.error("'%s' returned with error code %i" % (cmd, rc)) + return None + else: + return popen.stdout + class LinuxProcReader(object): """Get process informations under Linux by reading /proc - + Tested under Linux, may work on other POSIX os with /proc, too. """ + __slots__ = () - def getPids(self): + def supported(self): + return True + supported = property(supported) + + @staticmethod + def getPids(): """Get a list of pids """ pids = [] - for name in os.listdir('/proc'): - if os.path.isdir('/proc/' + name): + for name in os.listdir(PROC): + if os.path.isdir(PROC + '/' + name): try: pids.append(int(name)) except ValueError: @@ -113,9 +240,9 @@ def _readProcStatus(self, pid, searchkey=None): """Read and parse status informations for PID pid - + pid - pid as long or int or 'self' - + If searchkey is None the method returns a mapping of lower keys to values (stripped). If searchkey is given than the method immediatly returns the value @@ -124,7 +251,7 @@ mapping = {} try: # read entiry file to avoid race conditions - lines = open('/proc/%s/status' % pid, 'r').readlines() + lines = open('%s/%i/status' % (PROC, pid), 'r').readlines() except IOError: return None for line in lines: @@ -142,34 +269,40 @@ if searchkey is not None: return None return mapping - + def _readProcCmdline(self, pid): """Read cmdline informations for pid and returns a list similar to sys.argv """ try: # read entiry file to avoid race conditions - data = open('/proc/%s/cmdline' % pid, 'r').read() + data = open('%s/%i/cmdline' % (PROC, pid), 'r').read() except IOError: return None return data.split(NULL) def _readProcOther(self, pid): """Read other possible useful things - + cwd -> current work directory (may not exist) exe -> path to executable (may not exist) """ return { - 'cwd' : os.path.realpath('/proc/%s/cwd' % pid), - 'exe' : os.path.realpath('/proc/%s/exe' % pid), + 'cwd' : os.path.realpath('%s/%i/cwd' % (PROC, pid)), + 'exe' : os.path.realpath('%s/%i/exe' % (PROC, pid)), } class WinEnumProcesses(object): """""Get process informations under Win32 with psapi.dll - + Based on enumprocesses from Eric Koome http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/305279 """ + __slots__ = () + + def supported(self): + return True + supported = property(supported) + def getPids(self): """Get a list of pids """ @@ -214,32 +347,44 @@ """ if pid == 'self': pid = os.getpid() - + hModule = c_ulong() count = c_ulong() modname = c_buffer(51) hProcess = KERNEL.OpenProcess(PROCESS_FLAGS, False, pid) if not hProcess: return None - + PSAPI.EnumProcessModules(hProcess, byref(hModule), sizeof(hModule), byref(count)) PSAPI.GetModuleBaseNameA(hProcess, hModule.value, modname, sizeof(modname)) - name = u"".join([c for c in modname if c != NULL]) + try: + name = u"".join([c for c in modname if c != NULL]) + except UnicodeError, msg: + LOG.exception("Can't decode name of pid %i" % pid) + else: + name = None + KERNEL.CloseHandle(hProcess) return {'name' : name} # Initialize global methods -if PLAT == 'linux': +if IMPL == 'proc': _enumProcesses = LinuxProcReader() -elif PLAT == 'win': +elif IMPL == 'ps': + _enumProcesses = PsParser() +elif IMPL == 'win': _enumProcesses = WinEnumProcesses() +else: + LOG.error("System %s is not supported" % sys.platform) + _enumProcesses = Unsupported() getPids = _enumProcesses.getPids getPidNames = _enumProcesses.getPidNames getPidDetails = _enumProcesses.getPidDetails +supportedOS = _enumProcesses.supported if __name__ == '__main__': print getPidNames() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-02-26 17:43:39
|
Revision: 197 http://pymoul.svn.sourceforge.net/pymoul/?rev=197&view=rev Author: tiran Date: 2007-02-26 09:43:35 -0800 (Mon, 26 Feb 2007) Log Message: ----------- It's Log and not Logs\! Modified Paths: -------------- pymoul/trunk/src/moul/file/directory.py Modified: pymoul/trunk/src/moul/file/directory.py =================================================================== --- pymoul/trunk/src/moul/file/directory.py 2007-02-26 17:36:53 UTC (rev 196) +++ pymoul/trunk/src/moul/file/directory.py 2007-02-26 17:43:35 UTC (rev 197) @@ -158,7 +158,7 @@ data. """ _dirmapping = { - 'logs' : 'Logs', + 'log' : 'Log', 'kiimages' : 'KIimages', 'avatars' : 'Avatars', 'ini' : 'init', @@ -168,12 +168,12 @@ } _factories = { - 'logzipper' : (PlasmalogZipper, ('logs', 'zipped')), + 'logzipper' : (PlasmalogZipper, ('log', 'zipped')), 'kiimages' : (KIImageFixer, ('kiimages', 'fixed')), 'avatars' : (KIImageFixer, ('avatars', 'fixed')), 'graphicsini' : (GraphicsIni, ('ini',)), 'audioini' : (AudioIni, ('ini',)), - 'chatmover' : (ChatlogMover, ('logs', 'chatlogs')), + 'chatmover' : (ChatlogMover, ('log', 'chatlogs')), 'chatview' : (ChatlogDirectoryView, ('chatlogs',)), 'zipped' : (DirectoryCount, ('zipped',)), 'fixed' : (DirectoryCount, ('fixed',)), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-02-26 17:36:54
|
Revision: 196 http://pymoul.svn.sourceforge.net/pymoul/?rev=196&view=rev Author: tiran Date: 2007-02-26 09:36:53 -0800 (Mon, 26 Feb 2007) Log Message: ----------- Use own grid layout for D'ni numbers Modified Paths: -------------- pymoul/trunk/src/moul/qt/dninumbers.py pymoul/trunk/src/moul/qt/ui/mainwindow.py pymoul/trunk/src/moul/qt/ui/mainwindow.ui Modified: pymoul/trunk/src/moul/qt/dninumbers.py =================================================================== --- pymoul/trunk/src/moul/qt/dninumbers.py 2007-02-26 17:33:11 UTC (rev 195) +++ pymoul/trunk/src/moul/qt/dninumbers.py 2007-02-26 17:36:53 UTC (rev 196) @@ -193,6 +193,16 @@ if self.rb_earthtime.isChecked(): self.update_earthtime() + @pyqtSignature("int") + def on_cb_earthtime_tz_currentIndeChanged(self, idx): + if idx == 0: + spec = Qt.LoalTime + elif idx == 1: + spec = Qt.UTC + else: + raise ValueError(idx) + #self.dte_earthtime.setTimeSpec(spec) + def update_dni(self): """Update view from D'ni time widgets """ @@ -237,10 +247,17 @@ self.sb_prorahn.setValue(dnitime.prorahn) def setup_dninumbers(self): - # may change! - widget = self.context.gridLayout_3 - grid = self.context.gridlayout3 + widget = QtGui.QWidget(self.gb_dninumbers) + widget.setGeometry(QtCore.QRect(10,20,411,341)) + widget.setObjectName("gridLayoutWidget_Dninumbers") + self.context.glw_dninumbers = widget + grid = QtGui.QGridLayout(widget) + grid.setMargin(0) + grid.setSpacing(6) + grid.setObjectName("gridLayout_Dninumbers") + self.context.gl_dninumbers = grid + alignl = QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter alignc = QtCore.Qt.AlignCenter | QtCore.Qt.AlignVCenter for i in range(0, 5): Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-02-26 17:33:11 UTC (rev 195) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-02-26 17:36:53 UTC (rev 196) @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file './src/moul/qt/ui/mainwindow.ui' # -# Created: Sat Feb 24 20:39:41 2007 +# Created: Mon Feb 26 18:31:00 2007 # by: PyQt4 UI code generator 4.1.1 # # WARNING! All changes made in this file will be lost! @@ -44,6 +44,12 @@ spacerItem1 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout.addItem(spacerItem1) + self.main_buttonbox = QtGui.QDialogButtonBox(self.centralwidget) + self.main_buttonbox.setGeometry(QtCore.QRect(10,520,451,32)) + self.main_buttonbox.setOrientation(QtCore.Qt.Horizontal) + self.main_buttonbox.setStandardButtons(QtGui.QDialogButtonBox.Close|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Reset|QtGui.QDialogButtonBox.Save) + self.main_buttonbox.setObjectName("main_buttonbox") + self.tabwidget = QtGui.QTabWidget(self.centralwidget) self.tabwidget.setGeometry(QtCore.QRect(0,80,471,434)) self.tabwidget.setTabPosition(QtGui.QTabWidget.North) @@ -769,7 +775,7 @@ self.groupBox_3.setObjectName("groupBox_3") self.gridLayout_5 = QtGui.QWidget(self.groupBox_3) - self.gridLayout_5.setGeometry(QtCore.QRect(10,20,451,138)) + self.gridLayout_5.setGeometry(QtCore.QRect(10,20,436,138)) self.gridLayout_5.setObjectName("gridLayout_5") self.gridlayout2 = QtGui.QGridLayout(self.gridLayout_5) @@ -861,9 +867,9 @@ self.hboxlayout11.setObjectName("hboxlayout11") self.sb_fahrah = QtGui.QSpinBox(self.gridLayout_5) - self.sb_fahrah.setMaximumSize(QtCore.QSize(46,16777215)) - self.sb_fahrah.setMaximum(15) - self.sb_fahrah.setMinimum(1) + self.sb_fahrah.setMaximumSize(QtCore.QSize(44,16777215)) + self.sb_fahrah.setMaximum(18) + self.sb_fahrah.setMinimum(11) self.sb_fahrah.setProperty("value",QtCore.QVariant(15)) self.sb_fahrah.setObjectName("sb_fahrah") self.hboxlayout11.addWidget(self.sb_fahrah) @@ -881,8 +887,10 @@ self.hboxlayout11.addWidget(self.label_12) self.sb_hahr = QtGui.QSpinBox(self.gridLayout_5) + self.sb_hahr.setMinimumSize(QtCore.QSize(60,0)) self.sb_hahr.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) - self.sb_hahr.setMaximum(9999) + self.sb_hahr.setMaximum(17654) + self.sb_hahr.setMinimum(7657) self.sb_hahr.setProperty("value",QtCore.QVariant(9662)) self.sb_hahr.setObjectName("sb_hahr") self.hboxlayout11.addWidget(self.sb_hahr) @@ -899,7 +907,7 @@ self.hboxlayout11.addWidget(self.cb_vailee) self.sb_yahr = QtGui.QSpinBox(self.gridLayout_5) - self.sb_yahr.setMaximumSize(QtCore.QSize(46,16777215)) + self.sb_yahr.setMaximumSize(QtCore.QSize(44,16777215)) self.sb_yahr.setMaximum(29) self.sb_yahr.setMinimum(1) self.sb_yahr.setProperty("value",QtCore.QVariant(29)) @@ -916,6 +924,7 @@ self.hboxlayout12.setObjectName("hboxlayout12") self.dte_earthtime = QtGui.QDateTimeEdit(self.gridLayout_5) + self.dte_earthtime.setMinimumDate(QtCore.QDate(1752,9,14)) self.dte_earthtime.setCalendarPopup(True) self.dte_earthtime.setObjectName("dte_earthtime") self.hboxlayout12.addWidget(self.dte_earthtime) @@ -1055,15 +1064,6 @@ self.gb_dninumbers = QtGui.QGroupBox(self.tab) self.gb_dninumbers.setGeometry(QtCore.QRect(10,0,451,371)) self.gb_dninumbers.setObjectName("gb_dninumbers") - - self.gridLayout_3 = QtGui.QWidget(self.gb_dninumbers) - self.gridLayout_3.setGeometry(QtCore.QRect(10,20,411,341)) - self.gridLayout_3.setObjectName("gridLayout_3") - - self.gridlayout4 = QtGui.QGridLayout(self.gridLayout_3) - self.gridlayout4.setMargin(0) - self.gridlayout4.setSpacing(6) - self.gridlayout4.setObjectName("gridlayout4") self.tabWidget.addTab(self.tab,"") self.tabwidget.addTab(self.tab_browse,"") @@ -1095,12 +1095,6 @@ self.tb_license.setObjectName("tb_license") self.tabwidget_about.addTab(self.tab_sub_license,"") self.tabwidget.addTab(self.tab_about,"") - - self.main_buttonbox = QtGui.QDialogButtonBox(self.centralwidget) - self.main_buttonbox.setGeometry(QtCore.QRect(10,520,451,32)) - self.main_buttonbox.setOrientation(QtCore.Qt.Horizontal) - self.main_buttonbox.setStandardButtons(QtGui.QDialogButtonBox.Close|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Reset|QtGui.QDialogButtonBox.Save) - self.main_buttonbox.setObjectName("main_buttonbox") MainWindow.setCentralWidget(self.centralwidget) self.statusbar = QtGui.QStatusBar(MainWindow) @@ -1112,9 +1106,9 @@ self.lb_doc_status.setBuddy(self.pb_doc_loadjournals) self.retranslateUi(MainWindow) - self.tabwidget.setCurrentIndex(2) + self.tabwidget.setCurrentIndex(0) self.tab_sub_settings.setCurrentIndex(0) - self.tabWidget.setCurrentIndex(0) + self.tabWidget.setCurrentIndex(2) self.tabwidget_about.setCurrentIndex(0) QtCore.QObject.connect(self.main_buttonbox,QtCore.SIGNAL("rejected()"),MainWindow.close) QtCore.QMetaObject.connectSlotsByName(MainWindow) @@ -1205,7 +1199,6 @@ self.label_12.setText(QtGui.QApplication.translate("MainWindow", "/", None, QtGui.QApplication.UnicodeUTF8)) self.cb_vailee.addItem(QtGui.QApplication.translate("MainWindow", "8 Leevosahn", None, QtGui.QApplication.UnicodeUTF8)) self.cb_earthtime_tz.addItem(QtGui.QApplication.translate("MainWindow", "local time", None, QtGui.QApplication.UnicodeUTF8)) - self.cb_earthtime_tz.addItem(QtGui.QApplication.translate("MainWindow", "cavern 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.setTabText(self.tabwidget.indexOf(self.tab_time), QtGui.QApplication.translate("MainWindow", "Time", None, QtGui.QApplication.UnicodeUTF8)) Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.ui =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-02-26 17:33:11 UTC (rev 195) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-02-26 17:36:53 UTC (rev 196) @@ -97,6 +97,22 @@ </item> </layout> </widget> + <widget class="QDialogButtonBox" name="main_buttonbox" > + <property name="geometry" > + <rect> + <x>10</x> + <y>520</y> + <width>451</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> @@ -110,7 +126,7 @@ <enum>QTabWidget::North</enum> </property> <property name="currentIndex" > - <number>2</number> + <number>0</number> </property> <widget class="QWidget" name="tab_tasks" > <attribute name="title" > @@ -1672,7 +1688,7 @@ <rect> <x>10</x> <y>20</y> - <width>451</width> + <width>436</width> <height>138</height> </rect> </property> @@ -1857,15 +1873,15 @@ <widget class="QSpinBox" name="sb_fahrah" > <property name="maximumSize" > <size> - <width>46</width> + <width>44</width> <height>16777215</height> </size> </property> <property name="maximum" > - <number>15</number> + <number>18</number> </property> <property name="minimum" > - <number>1</number> + <number>11</number> </property> <property name="value" > <number>15</number> @@ -1900,12 +1916,21 @@ </item> <item> <widget class="QSpinBox" name="sb_hahr" > + <property name="minimumSize" > + <size> + <width>60</width> + <height>0</height> + </size> + </property> <property name="buttonSymbols" > <enum>QAbstractSpinBox::UpDownArrows</enum> </property> <property name="maximum" > - <number>9999</number> + <number>17654</number> </property> + <property name="minimum" > + <number>7657</number> + </property> <property name="value" > <number>9662</number> </property> @@ -1938,7 +1963,7 @@ <widget class="QSpinBox" name="sb_yahr" > <property name="maximumSize" > <size> - <width>46</width> + <width>44</width> <height>16777215</height> </size> </property> @@ -1978,6 +2003,13 @@ </property> <item> <widget class="QDateTimeEdit" name="dte_earthtime" > + <property name="minimumDate" > + <date> + <year>1752</year> + <month>9</month> + <day>14</day> + </date> + </property> <property name="calendarPopup" > <bool>true</bool> </property> @@ -2006,11 +2038,6 @@ </item> <item> <property name="text" > - <string>cavern time</string> - </property> - </item> - <item> - <property name="text" > <string>UTC</string> </property> </item> @@ -2056,7 +2083,7 @@ </rect> </property> <property name="currentIndex" > - <number>0</number> + <number>2</number> </property> <widget class="QWidget" name="tab_sub_chatlogs" > <attribute name="title" > @@ -2294,24 +2321,6 @@ <property name="title" > <string>D'ni Numbers</string> </property> - <widget class="QWidget" name="gridLayout_3" > - <property name="geometry" > - <rect> - <x>10</x> - <y>20</y> - <width>411</width> - <height>341</height> - </rect> - </property> - <layout class="QGridLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - </layout> - </widget> </widget> </widget> </widget> @@ -2392,22 +2401,6 @@ </widget> </widget> </widget> - <widget class="QDialogButtonBox" name="main_buttonbox" > - <property name="geometry" > - <rect> - <x>10</x> - <y>520</y> - <width>451</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> <widget class="QStatusBar" name="statusbar" /> </widget> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-02-26 17:33:15
|
Revision: 195 http://pymoul.svn.sourceforge.net/pymoul/?rev=195&view=rev Author: tiran Date: 2007-02-26 09:33:11 -0800 (Mon, 26 Feb 2007) Log Message: ----------- Adjust min and max year Modified Paths: -------------- pymoul/trunk/src/moul/time/dni.py Modified: pymoul/trunk/src/moul/time/dni.py =================================================================== --- pymoul/trunk/src/moul/time/dni.py 2007-02-26 15:45:48 UTC (rev 194) +++ pymoul/trunk/src/moul/time/dni.py 2007-02-26 17:33:11 UTC (rev 195) @@ -85,6 +85,11 @@ >>> str(dni) '04:21:24:22, Leevotar 4, 9662' +>>> from datetime import MINYEAR +>>> from datetime import MAXYEAR + +#>>> str(DniTime.fromUTC(datetime(MINYEAR, 1, 1, tzinfo=UTC))) +#>>> str(DniTime.fromUTC(datetime(MAXYEAR, 12, 31, tzinfo=UTC))) """ __author__ = "Christian Heimes" __version__ = "$Id$" @@ -101,6 +106,7 @@ from moul.time.utils import timezone from moul.time.utils import utcnow + # list of month names with approx. dates VAILEETEE = ( 'Leefo', # 1: April 21st to May 27th @@ -130,7 +136,6 @@ BASE_GREGORIAN = datetime(1998, 4, 21, 10, 35, 18, 0, tzinfo=UTC) BASE_HAHR = 9654 FAHRAH_1 = -7656 # hahrtee fahrah 1 starts ~April 21st 7656 B.C -#BASE_SEC = td2sec(BASE_GREGORIAN - UNIX_0) # WTF? no tottimestamp in datetime # factors HAHR_PER_HAHRTEE_FAHRAH = 625 # ~ 625 years @@ -296,7 +301,7 @@ def _getHahr(self): return self._hahr - @valueCheck(int, 0, sys.maxint) + @valueCheck(int, 7657, 17654) # datetime.MINYEAR / MAXYEAR def _setHahr(self, value): self._hahr = value hahr = property(_getHahr, _setHahr) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-02-26 15:45:52
|
Revision: 194 http://pymoul.svn.sourceforge.net/pymoul/?rev=194&view=rev Author: tiran Date: 2007-02-26 07:45:48 -0800 (Mon, 26 Feb 2007) Log Message: ----------- Fixed bug in DniTime algorithm. Yahr and vailee start with 1 and not with 0 Modified Paths: -------------- pymoul/trunk/src/moul/time/dni.py Modified: pymoul/trunk/src/moul/time/dni.py =================================================================== --- pymoul/trunk/src/moul/time/dni.py 2007-02-26 15:16:22 UTC (rev 193) +++ pymoul/trunk/src/moul/time/dni.py 2007-02-26 15:45:48 UTC (rev 194) @@ -23,8 +23,6 @@ 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), @@ -36,9 +34,8 @@ >>> def compareDT(dt1, dt2): ... delta = td2sec(dt1 - dt2) -... # smaller than 5 seconds -... if abs(delta) >0: # 1 off is fine -... return delta +... if abs(delta) > 0: +... return dt1 - dt2 ... else: ... return True @@ -67,6 +64,16 @@ >>> dni.secondsToPahrtovo(18) 80964 +>>> dni = DniTime.fromDni(9655, 1, 1, 0, 0, 0, 0) +>>> compareDT(dni.toUTC(), LEEFO_1_TABLE[1]) +True +>>> dni.toUTC() +datetime.datetime(1999, 4, 21, 16, 24, 3, tzinfo=<UTC>) + +>>> dni = DniTime.fromDni(9662, 9, 4, 4, 21, 24, 22) +>>> compareDT(dni.toUTC(), other) +True + >>> CET = timezone('CET') >>> dni = DniTime.fromString("2007-02-12 14:55:10", tzinfo=CET) >>> str(dni) @@ -85,6 +92,7 @@ import sys from datetime import datetime +from datetime import timedelta from time import mktime from moul.time.utils import UNIX_0 @@ -122,7 +130,7 @@ BASE_GREGORIAN = datetime(1998, 4, 21, 10, 35, 18, 0, tzinfo=UTC) BASE_HAHR = 9654 FAHRAH_1 = -7656 # hahrtee fahrah 1 starts ~April 21st 7656 B.C -BASE_SEC = td2sec(BASE_GREGORIAN - UNIX_0) # WTF? no tottimestamp in datetime +#BASE_SEC = td2sec(BASE_GREGORIAN - UNIX_0) # WTF? no tottimestamp in datetime # factors HAHR_PER_HAHRTEE_FAHRAH = 625 # ~ 625 years @@ -210,8 +218,7 @@ """Constructor from D'ni time """ self = cls(_initialize=True) - self.set(hahr=0, vailee=0, yahr=0, gahrtahvo=0, tahvo=0, - gorahn=0, prorahn=0) + self.set(hahr, vailee, yahr, gahrtahvo, tahvo, gorahn, prorahn) return self @classmethod @@ -241,7 +248,7 @@ utc_dt = UTC.normalize(dt.astimezone(UTC)) return cls.fromUTC(utc_dt) - def set(self, hahr=0, vailee=0, yahr=0, gahrtahvo=0, tahvo=0, + def set(self, hahr=0, vailee=1, yahr=1, gahrtahvo=0, tahvo=0, gorahn=0, prorahn=0): self._hahr = 0 self._prorahn = 0 @@ -261,10 +268,11 @@ def toUTC(self): """Convert to UTC datetime value """ + #import pdb; pdb.set_trace() hahr_sec = (self.hahr - BASE_HAHR) * SECONDS_PER_HAHR prorahn_sec = int(round(self._prorahn * FACTOR_SP)) - sec = hahr_sec + BASE_SEC + prorahn_sec - return UTC.localize(datetime.utcfromtimestamp(sec)) + td = timedelta(days=0, seconds=hahr_sec + prorahn_sec) + return UTC.normalize(BASE_GREGORIAN + td) def secondsToPahrtovo(self, bell): """Calculate seconds until bell (pahr-to-vo) @@ -295,9 +303,9 @@ def _getVailee(self): return ((self._prorahn // PRORAHN_PER_VAILEE) % 10) +1 - @valueCheck(int, 0, 10) + @valueCheck(int, 1, 10) def _setVailee(self, value): - self._addProrahn(value * PRORAHN_PER_VAILEE) + self._addProrahn((value-1) * PRORAHN_PER_VAILEE) vailee = property(_getVailee, _setVailee) def getVaileeName(self): @@ -305,9 +313,9 @@ def _getYahr(self): return ((self._prorahn // PRORAHN_PER_YAHR) % 29) +1 - @valueCheck(int, 0, 29) + @valueCheck(int, 1, 29) def _setYahr(self, value): - self._addProrahn(value * PRORAHN_PER_YAHR) + self._addProrahn((value-1) * PRORAHN_PER_YAHR) yahr = property(_getYahr, _setYahr) def _getGahrtahvo(self): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-02-26 15:16:26
|
Revision: 193 http://pymoul.svn.sourceforge.net/pymoul/?rev=193&view=rev Author: tiran Date: 2007-02-26 07:16:22 -0800 (Mon, 26 Feb 2007) Log Message: ----------- Changed the way a DniTime object is constructed. It now uses several class methods as constructor Modified Paths: -------------- pymoul/trunk/src/moul/qt/dninumbers.py pymoul/trunk/src/moul/time/dni.py Modified: pymoul/trunk/src/moul/qt/dninumbers.py =================================================================== --- pymoul/trunk/src/moul/qt/dninumbers.py 2007-02-26 15:05:28 UTC (rev 192) +++ pymoul/trunk/src/moul/qt/dninumbers.py 2007-02-26 15:16:22 UTC (rev 193) @@ -63,7 +63,6 @@ # D'ni numbers self.dninumbers = QDniNumbers() self.caverntime = CavernTime() - self.dnitime = DniTime() self.setup_dninumbers() # D'ni date and time @@ -137,10 +136,10 @@ """ SIGNAL: QTimer timeout """ - self.dnitime.fromUTC() - self.clockscene.setClockFromDniTime(self.dnitime) - self.setWidgetDniTime(self.dnitime) - self.dte_earthtime.setDateTime(dt2qdt(self.dnitime.toUTC())) + dni = DniTime.fromUTC() + self.clockscene.setClockFromDniTime(dni) + self.setWidgetDniTime(dni) + self.dte_earthtime.setDateTime(dt2qdt(dni.toUTC())) @pyqtSignature("bool") def on_rb_curtime_clicked(self, value): @@ -189,6 +188,7 @@ self.update_dniholidays() @pyqtSignature("const QDateTime &") + @skipLogging def on_dte_earthtime_dateTimeChanged(self, qdt): if self.rb_earthtime.isChecked(): self.update_earthtime() @@ -198,17 +198,17 @@ """ if not self.rb_dnitime.isChecked(): return - self.dnitime.set(*self.getWidgetDniTime()) - self.clockscene.setClockFromDniTime(self.dnitime) - self.dte_earthtime.setDateTime(dt2qdt(self.dnitime.toUTC())) + dni = DniTime.fromDni(*self.getWidgetDniTime()) + self.clockscene.setClockFromDniTime(dni) + self.dte_earthtime.setDateTime(dt2qdt(dni.toUTC())) def update_earthtime(self): """Update view from earth time widget """ dt = qdt2dt(self.dte_earthtime.dateTime()) - self.dnitime.fromUTC(dt) - self.clockscene.setClockFromDniTime(self.dnitime) - self.setWidgetDniTime(self.dnitime) + dni = DniTime.fromUTC(dt) + self.clockscene.setClockFromDniTime(dni) + self.setWidgetDniTime(dni) def update_dniholidays(self): """Update view from D'ni holiday widget Modified: pymoul/trunk/src/moul/time/dni.py =================================================================== --- pymoul/trunk/src/moul/time/dni.py 2007-02-26 15:05:28 UTC (rev 192) +++ pymoul/trunk/src/moul/time/dni.py 2007-02-26 15:16:22 UTC (rev 193) @@ -42,8 +42,7 @@ ... else: ... return True ->>> dni = DniTime() ->>> dni.fromUTC(LEEFO_1_TABLE[1]) +>>> dni = DniTime.fromUTC(LEEFO_1_TABLE[1]) >>> dni.get() (9655, 1, 1, 0, 0, 0, 0) >>> str(dni) @@ -52,7 +51,7 @@ True >>> other = datetime(2007, 2, 12, 13, 55, 10, 0, tzinfo=UTC) ->>> dni.fromUTC(other) +>>> dni = DniTime.fromUTC(other) >>> dni.get() (9662, 9, 4, 4, 21, 24, 22) >>> str(dni) @@ -69,13 +68,13 @@ 80964 >>> CET = timezone('CET') ->>> dni.fromString("2007-02-12 14:55:10", tzinfo=CET) +>>> dni = DniTime.fromString("2007-02-12 14:55:10", tzinfo=CET) >>> str(dni) '04:21:24:22, Leevotar 4, 9662' ->>> dni.fromString("2007-02-12 6:55:10", tzinfo='MST') +>>> dni = DniTime.fromString("2007-02-12 6:55:10", tzinfo='MST') >>> str(dni) '04:21:24:22, Leevotar 4, 9662' ->>> dni.fromString("2007-02-12 13:55:10") +>>> dni = DniTime.fromString("2007-02-12 13:55:10") >>> str(dni) '04:21:24:22, Leevotar 4, 9662' @@ -199,46 +198,66 @@ prorahn second about 1.3929 seconds """ - def __init__(self, hahr=0, vailee=0, yahr=0, gahrtahvo=0, tahvo=0, - gorahn=0, prorahn=0): - self.set(hahr, vailee, yahr, gahrtahvo, tahvo, gorahn, prorahn) - - def set(self, hahr=0, vailee=0, yahr=0, gahrtahvo=0, tahvo=0, - gorahn=0, prorahn=0): + def __init__(self, _initialize=False): + if not _initialize: + raise TypeError("You can't construct an instance this way!") self._hahr = 0 self._prorahn = 0 - self.hahr = hahr - self.vailee = vailee - self.yahr = yahr - self.gahrtahvo = gahrtahvo - self.tahvo = tahvo - self.gorahn = gorahn - self._addProrahn(prorahn) + @classmethod + def fromDni(cls, hahr=0, vailee=0, yahr=0, gahrtahvo=0, tahvo=0, + gorahn=0, prorahn=0): + """Constructor from D'ni time + """ + self = cls(_initialize=True) + self.set(hahr=0, vailee=0, yahr=0, gahrtahvo=0, tahvo=0, + gorahn=0, prorahn=0) + return self - def get(self): - return (self.hahr, self.vailee, self.yahr, self.gahrtahvo, self.tahvo, - self.gorahn, self.prorahn) + @classmethod + def fromUTC(cls, utc_dt=None): + """Constructor from UTC date time object - def fromUTC(self, utc_dt=None): - """Convert from UTC datetime + Convert from UTC datetime """ + self = cls(_initialize=True) if utc_dt is None: utc_dt = utcnow() sec = td2sec(utc_dt - BASE_GREGORIAN) prorahn = int(round(sec * FACTOR_PS)) self.set(hahr=BASE_HAHR, prorahn=prorahn) + return self - def fromString(self, s, fmt="%Y-%m-%d %H:%M:%S", tzinfo=UTC): - """Convert date from string to Dni Time + @classmethod + def fromString(cls, s, fmt="%Y-%m-%d %H:%M:%S", tzinfo=UTC): + """Constructor from date time string + + Convert date from string to Dni Time """ if isinstance(tzinfo, basestring): tzinfo = timezone(tzinfo) dt = datetime.strptime(s, fmt) dt = tzinfo.localize(dt) utc_dt = UTC.normalize(dt.astimezone(UTC)) - return self.fromUTC(utc_dt) + return cls.fromUTC(utc_dt) + def set(self, hahr=0, vailee=0, yahr=0, gahrtahvo=0, tahvo=0, + gorahn=0, prorahn=0): + self._hahr = 0 + self._prorahn = 0 + + self.hahr = hahr + self.vailee = vailee + self.yahr = yahr + self.gahrtahvo = gahrtahvo + self.tahvo = tahvo + self.gorahn = gorahn + self._addProrahn(prorahn) + + def get(self): + return (self.hahr, self.vailee, self.yahr, self.gahrtahvo, self.tahvo, + self.gorahn, self.prorahn) + def toUTC(self): """Convert to UTC datetime value """ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-02-26 15:05:36
|
Revision: 192 http://pymoul.svn.sourceforge.net/pymoul/?rev=192&view=rev Author: tiran Date: 2007-02-26 07:05:28 -0800 (Mon, 26 Feb 2007) Log Message: ----------- Added more screen res and fixed unit tests Modified Paths: -------------- pymoul/trunk/src/moul/file/tests/test_wdysini.py pymoul/trunk/src/moul/file/wdysini.py Modified: pymoul/trunk/src/moul/file/tests/test_wdysini.py =================================================================== --- pymoul/trunk/src/moul/file/tests/test_wdysini.py 2007-02-25 23:21:47 UTC (rev 191) +++ pymoul/trunk/src/moul/file/tests/test_wdysini.py 2007-02-26 15:05:28 UTC (rev 192) @@ -140,22 +140,22 @@ def test_property_edit(self): p = self.parserClass(self.tmpdir) eq = self.failUnlessEqual - + p.read() self.failIf(p.isChanged()) - + p.vsync = True eq(p._get('Graphics.EnableVSync'), True) self.failUnless(p.isChanged()) p.vsync = False eq(p._get('Graphics.EnableVSync'), False) #XXX self.failIf(p.isChanged()) - + p.screenres = 0 eq(p._get('Graphics.Width'), 800) eq(p._get('Graphics.Height'), 600) - - p.screenres = 10 + + p.screenres = 11 eq(p._get('Graphics.Width'), 1920) eq(p._get('Graphics.Height'), 1200) self.failUnless(p.isChanged()) Modified: pymoul/trunk/src/moul/file/wdysini.py =================================================================== --- pymoul/trunk/src/moul/file/wdysini.py 2007-02-25 23:21:47 UTC (rev 191) +++ pymoul/trunk/src/moul/file/wdysini.py 2007-02-26 15:05:28 UTC (rev 192) @@ -217,10 +217,10 @@ Traceback (most recent call last): ... ConstrainError: name: -1 < min 0 - >>> v(11, debug="name") + >>> v(13, debug="name") Traceback (most recent call last): ... - ConstrainError: name: 11 > max 10 + ConstrainError: name: 13 > max 12 """ def __init__(self): self._min = 0 @@ -252,16 +252,17 @@ """ # width, height, w ratio, h ratio _videomodes = ( - (800, 600, 4, 3), - (1024, 768, 4, 3), - (1152, 864, 4, 3), - (1280, 720, 16, 9), - (1280, 768, 5, 3), - (1280, 800, 16, 10), - (1280, 960, 4, 3), - (1280, 1024, 5, 4), - (1600, 900, 16, 9), - (1600, 1200, 4, 3), + ( 800, 600, 4, 3), + (1024, 768, 4, 3), + (1152, 864, 4, 3), + (1280, 720, 16, 9), + (1280, 768, 5, 3), + (1280, 800, 16, 10), + (1280, 960, 4, 3), + (1280, 1024, 5, 4), + (1600, 900, 16, 9), + (1680, 1050, 10, 10), + (1600, 1200, 4, 3), (1920, 1200, 16, 10), (2560, 1600, 16, 10), ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-02-25 23:21:56
|
Revision: 191 http://pymoul.svn.sourceforge.net/pymoul/?rev=191&view=rev Author: tiran Date: 2007-02-25 15:21:47 -0800 (Sun, 25 Feb 2007) Log Message: ----------- Fixed audio device bug and added missing res. Thx to Orbmu2k Modified Paths: -------------- pymoul/trunk/src/moul/file/wdysini.py Modified: pymoul/trunk/src/moul/file/wdysini.py =================================================================== --- pymoul/trunk/src/moul/file/wdysini.py 2007-02-24 19:45:36 UTC (rev 190) +++ pymoul/trunk/src/moul/file/wdysini.py 2007-02-25 23:21:47 UTC (rev 191) @@ -263,6 +263,7 @@ (1600, 900, 16, 9), (1600, 1200, 4, 3), (1920, 1200, 16, 10), + (2560, 1600, 16, 10), ) # (w, h) -> idx _reverse_vm = dict([((d[0], d[1]), i) for i, d in enumerate(_videomodes)]) @@ -572,7 +573,7 @@ _devices = ['"Generic Software"', '"Generic Hardware"'] # plus maybe a custom OpenAL v1.1 device - def parserDoneHook(self): + def _parserDoneHook(self): """Hook called after the data is read and parsed """ # check for OpenAL device @@ -580,7 +581,7 @@ if name not in self._devices: LOG.info("Device added: %s" % name) self._devices.append(name) - + def getDeviceIdx(self, name): """Get index by device name """ @@ -608,7 +609,7 @@ """ name = self.getDeviceName(idx) self._set('Audio.SetDeviceName', name) - + def numberOfDevices(self): """Number of devices """ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-02-24 19:45:38
|
Revision: 190 http://pymoul.svn.sourceforge.net/pymoul/?rev=190&view=rev Author: tiran Date: 2007-02-24 11:45:36 -0800 (Sat, 24 Feb 2007) Log Message: ----------- Ping tab changed to use QTableWidget 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/server/serverlist.py Modified: pymoul/trunk/src/moul/qt/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/mainwindow.py 2007-02-23 18:34:10 UTC (rev 189) +++ pymoul/trunk/src/moul/qt/mainwindow.py 2007-02-24 19:45:36 UTC (rev 190) @@ -386,48 +386,80 @@ """ init ping tab """ + header = self.tw_ping.horizontalHeader() + header.setResizeMode(QtGui.QHeaderView.Fixed) + header.setResizeMode(0, QtGui.QHeaderView.Stretch) + self.tw_ping.setColumnCount(3) + self._ping_thread = thread = PingServerThread() - + self.connect(thread, SIGNAL("started()"), self.on_pingthread_started) self.connect(thread, SIGNAL("finished()"), self.on_pingthread_done) - self.connect(thread, SIGNAL("server(const QString&)"), + self.connect(thread, SIGNAL("server(int, const QString&)"), self.on_pingthread_server) - self.connect(thread, SIGNAL("dnserror(const QString&, int, const QString&)"), + self.connect(thread, SIGNAL("dnserror(int, int, const QString &)"), self.on_pingthread_dnserror) - self.connect(thread, SIGNAL("dns(const QString&, float)"), + self.connect(thread, SIGNAL("dns(int, float)"), self.on_pingthread_dns) - self.connect(thread, SIGNAL("pingerror(const QString&, int, const QString&)"), + self.connect(thread, SIGNAL("pingerror(int, int, const QString &)"), self.on_pingthread_pingerror) - self.connect(thread, SIGNAL("ping(const QString&, float)"), + self.connect(thread, SIGNAL("ping(int, float)"), self.on_pingthread_ping) def on_pingthread_started(self): self.button_ping.setEnabled(False) - self.tb_ping_view.clear() + self.tw_ping.clearContents() def on_pingthread_done(self): self.button_ping.setEnabled(True) - def on_pingthread_server(self, name): - pass - #self.tb_ping_view.insertPlainText("%s ... " % name) + def on_pingthread_server(self, i, name): + row = self.tw_ping.rowCount() + if row < (i+1): + self.tw_ping.setRowCount(i + 1) - def on_pingthread_dns(self, name, time): - self.tb_ping_view.insertPlainText("%s ... DNS: %0.3f " % (name, time)) + proto = QtGui.QTableWidgetItem() + font = QtGui.QFont() + font.setPointSize(7) + proto.setFont(font) + proto.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter) - def on_pingthread_ping(self, name, time): - self.tb_ping_view.insertPlainText("PING: %0.3f\n" % time) + header = QtGui.QTableWidgetItem(proto) + header.setText(QtCore.QString.number(row + 1)) - def on_pingthread_dnserror(self, name, errcode, errmsg): - LOG.error('dns error: %s, %i, %s' % (name, errcode, errmsg)) - self.tb_ping_view.insertPlainText("%s ... DNS error: %s\n" % (name, errmsg)) + item0 = QtGui.QTableWidgetItem(proto) + item0.setText(name) - def on_pingthread_pingerror(self, name, errcode, errmsg): - LOG.error('ping error: %s, %i, %s' % (name, errcode, errmsg)) - self.tb_ping_view.insertPlainText("PING error: %s\n" % errmsg) + self.tw_ping.setVerticalHeaderItem(i, header) + self.tw_ping.setItem(i, 0, item0) + self.tw_ping.setItem(i, 1, QtGui.QTableWidgetItem(proto)) + self.tw_ping.setItem(i, 2, QtGui.QTableWidgetItem(proto)) + self.tw_ping.resizeRowsToContents() + def on_pingthread_dns(self, i, time): + item = self.tw_ping.item(i, 1) + item.setText("%0.3f" % time) + + def on_pingthread_ping(self, i, time): + item = self.tw_ping.item(i, 2) + item.setText("%0.3f" % time) + + def on_pingthread_dnserror(self, i, errcode, errmsg): + item = self.tw_ping.item(i, 1) + item.setForeground(QtGui.QBrush(Qt.red)) + item.setText(errmsg) + item.setToolTip("%s (code: %i)" % (errmsg, errcode)) + #self.tw_ping.resizeColumnsToContents() + + def on_pingthread_pingerror(self, i, errcode, errmsg): + item = self.tw_ping.item(i, 2) + item.setForeground(QtGui.QBrush(Qt.red)) + item.setText(errmsg) + item.setToolTip("%s (code: %i)" % (errmsg, errcode)) + #self.tw_ping.resizeColumnsToContents() + @pyqtSignature("bool") def on_button_ping_clicked(self, ignore=False): thread = self._ping_thread @@ -451,26 +483,26 @@ def run(self): # TODO: thread safety! # emit a list of names first - for server in self.servers: - self.emit(SIGNAL("server(const QString&)"), server.name) + for i, server in enumerate(self.servers): + self.emit(SIGNAL("server(int, const QString&)"), i, server.name) - for server in self.servers: + for i, server in enumerate(self.servers): name = server.name dns = server.dns() if isSocketError(dns): errno, msg = fmtSocketError(dns) - self.emit(SIGNAL("dnserror(const QString&, int, const QString&)"), - name, errno, msg) + self.emit(SIGNAL("dnserror(int, int, const QString &)"), + i, errno, msg) continue - self.emit(SIGNAL("dns(const QString&, float)"), name, dns) + self.emit(SIGNAL("dns(int, float)"), i, dns) ping = server.portping() if isSocketError(ping): - errno, msg = fmtSocketError(dns) - self.emit(SIGNAL("pingerror(const QString&, int, const QString&)"), - name, errno, msg) + errno, msg = fmtSocketError(ping) + self.emit(SIGNAL("pingerror(int, int, const QString &)"), + i, errno, msg) continue - self.emit(SIGNAL("ping(const QString&, float)"), name, ping) + self.emit(SIGNAL("ping(int, float)"), i, ping) class MoulRunningThread(QtCore.QThread): def __init__(self, parent=None): @@ -485,7 +517,7 @@ if not self.isRunning(): self._running = True self.start() - + def stopChecker(self): # TODO check this self._running = False Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-02-23 18:34:10 UTC (rev 189) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-02-24 19:45:36 UTC (rev 190) @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file './src/moul/qt/ui/mainwindow.ui' # -# Created: Fri Feb 23 19:22:27 2007 +# Created: Sat Feb 24 20:39:41 2007 # by: PyQt4 UI code generator 4.1.1 # # WARNING! All changes made in this file will be lost! @@ -681,11 +681,9 @@ self.button_ping.setGeometry(QtCore.QRect(370,370,75,24)) self.button_ping.setObjectName("button_ping") - self.tb_ping_view = QtGui.QTextBrowser(self.gb_servers) - self.tb_ping_view.setGeometry(QtCore.QRect(10,20,431,341)) - self.tb_ping_view.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse) - self.tb_ping_view.setOpenExternalLinks(True) - self.tb_ping_view.setObjectName("tb_ping_view") + self.tw_ping = QtGui.QTableWidget(self.gb_servers) + self.tw_ping.setGeometry(QtCore.QRect(10,20,431,341)) + self.tw_ping.setObjectName("tw_ping") self.tabwidget.addTab(self.tab_ping,"") self.tab_time = QtGui.QWidget() @@ -1114,7 +1112,7 @@ self.lb_doc_status.setBuddy(self.pb_doc_loadjournals) self.retranslateUi(MainWindow) - self.tabwidget.setCurrentIndex(3) + self.tabwidget.setCurrentIndex(2) self.tab_sub_settings.setCurrentIndex(0) self.tabWidget.setCurrentIndex(0) self.tabwidget_about.setCurrentIndex(0) @@ -1175,6 +1173,21 @@ 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)) self.button_ping.setText(QtGui.QApplication.translate("MainWindow", "Ping", None, QtGui.QApplication.UnicodeUTF8)) + self.tw_ping.clear() + self.tw_ping.setColumnCount(3) + self.tw_ping.setRowCount(0) + + headerItem = QtGui.QTableWidgetItem() + headerItem.setText(QtGui.QApplication.translate("MainWindow", "Server", None, QtGui.QApplication.UnicodeUTF8)) + self.tw_ping.setHorizontalHeaderItem(0,headerItem) + + headerItem1 = QtGui.QTableWidgetItem() + headerItem1.setText(QtGui.QApplication.translate("MainWindow", "DNS", None, QtGui.QApplication.UnicodeUTF8)) + self.tw_ping.setHorizontalHeaderItem(1,headerItem1) + + headerItem2 = QtGui.QTableWidgetItem() + headerItem2.setText(QtGui.QApplication.translate("MainWindow", "Ping", None, QtGui.QApplication.UnicodeUTF8)) + self.tw_ping.setHorizontalHeaderItem(2,headerItem2) self.tabwidget.setTabText(self.tabwidget.indexOf(self.tab_ping), QtGui.QApplication.translate("MainWindow", "Servers", None, QtGui.QApplication.UnicodeUTF8)) self.gb_dnitime.setTitle(QtGui.QApplication.translate("MainWindow", "D\'ni time", None, QtGui.QApplication.UnicodeUTF8)) self.gb_caverntime.setTitle(QtGui.QApplication.translate("MainWindow", "Time zones", None, QtGui.QApplication.UnicodeUTF8)) Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.ui =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-02-23 18:34:10 UTC (rev 189) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-02-24 19:45:36 UTC (rev 190) @@ -110,7 +110,7 @@ <enum>QTabWidget::North</enum> </property> <property name="currentIndex" > - <number>3</number> + <number>2</number> </property> <widget class="QWidget" name="tab_tasks" > <attribute name="title" > @@ -1464,7 +1464,7 @@ <string>Ping</string> </property> </widget> - <widget class="QTextBrowser" name="tb_ping_view" > + <widget class="QTableWidget" name="tw_ping" > <property name="geometry" > <rect> <x>10</x> @@ -1473,12 +1473,21 @@ <height>341</height> </rect> </property> - <property name="textInteractionFlags" > - <enum>Qt::TextSelectableByMouse</enum> - </property> - <property name="openExternalLinks" > - <bool>true</bool> - </property> + <column> + <property name="text" > + <string>Server</string> + </property> + </column> + <column> + <property name="text" > + <string>DNS</string> + </property> + </column> + <column> + <property name="text" > + <string>Ping</string> + </property> + </column> </widget> </widget> </widget> Modified: pymoul/trunk/src/moul/server/serverlist.py =================================================================== --- pymoul/trunk/src/moul/server/serverlist.py 2007-02-23 18:34:10 UTC (rev 189) +++ pymoul/trunk/src/moul/server/serverlist.py 2007-02-24 19:45:36 UTC (rev 190) @@ -26,6 +26,8 @@ SERVER_LIST = [ 'beta-auth.urulive.com', 'beta-file.urulive.com', + #'bogus.foo.bar', + #'www.mystonline.com', 'uruapp-cw01.ibs.aol.com', 'uruapp-cw02.ibs.aol.com', 'uruapp-cw03.ibs.aol.com', This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-02-23 18:34:12
|
Revision: 189 http://pymoul.svn.sourceforge.net/pymoul/?rev=189&view=rev Author: tiran Date: 2007-02-23 10:34:10 -0800 (Fri, 23 Feb 2007) Log Message: ----------- Some fixes for the new time tab Modified Paths: -------------- pymoul/trunk/src/moul/qt/dninumbers.py pymoul/trunk/src/moul/qt/ui/mainwindow.py pymoul/trunk/src/moul/qt/ui/mainwindow.ui pymoul/trunk/src/moul/qt/utils.py pymoul/trunk/src/moul/time/dni.py Modified: pymoul/trunk/src/moul/qt/dninumbers.py =================================================================== --- pymoul/trunk/src/moul/qt/dninumbers.py 2007-02-23 16:45:46 UTC (rev 188) +++ pymoul/trunk/src/moul/qt/dninumbers.py 2007-02-23 18:34:10 UTC (rev 189) @@ -100,7 +100,7 @@ self.connect(self.context, SIGNAL("timerEnable(bool)"), self.on_timer_timerEnable) # TODO: needs optimization? run only when timer tab is active - for name in ('sb_hahr', 'sb_yahr', 'sb_gahrtahvo', + for name in ('sb_hahr', 'sb_yahr', 'sb_gahrtahvo', 'sb_tahvo', 'sb_gorahn', 'sb_prorahn'): self.connect(getattr(self, name), SIGNAL("valueChanged(int)"), self.update_dni) @@ -140,6 +140,7 @@ self.dnitime.fromUTC() self.clockscene.setClockFromDniTime(self.dnitime) self.setWidgetDniTime(self.dnitime) + self.dte_earthtime.setDateTime(dt2qdt(self.dnitime.toUTC())) @pyqtSignature("bool") def on_rb_curtime_clicked(self, value): @@ -150,45 +151,49 @@ def on_rb_earthtime_clicked(self, value): if value: self.emit(SIGNAL("timerEnable(bool)"), False) - self.update_earthtime(self.dte_earthtime.dateTime()) + self.update_earthtime() @pyqtSignature("bool") def on_rb_dnitime_clicked(self, value): if value: self.emit(SIGNAL("timerEnable(bool)"), False) + self.update_dni() @pyqtSignature("bool") - def on_rb_dniholiday_clicked(self, value): + def on_rb_dniholidays_clicked(self, value): if value: self.emit(SIGNAL("timerEnable(bool)"), False) + self.update_dniholidays() @pyqtSignature("int") - def on_sb_fahrah_valueChanged(self, value): + def on_sb_fahrah_valueChanged(self, fahrah): hahr = self.sb_fahrah_hahr.value() - self.sb_hahr.setValue(value * 625 + hahr) + self.sb_hahr.setValue(fahrah * 625 + hahr) @pyqtSignature("int") - def on_sb_fahrah_hahr_valueChanged(self, value): + def on_sb_fahrah_hahr_valueChanged(self, hahr): fahrah = self.sb_fahrah.value() - self.sb_hahr.setValue(fahrah * 625 + value) + self.sb_hahr.setValue(fahrah * 625 + hahr) @pyqtSignature("int") def on_sb_hahr_valueChanged(self, value): fahrah = value // 625 - hahr = value - fahrah * 625 + hahr = value - (fahrah * 625) + print fahrah, hahr self.sb_fahrah_hahr.setValue(hahr) self.sb_fahrah.setValue(fahrah) @pyqtSignature("int") def on_cb_dniholidays_currentIndexChanged(self, idx): - self.rb_dniholidays.setChecked(True) + if self.rb_dniholidays.isChecked(): + self.update_dniholidays() @pyqtSignature("const QDateTime &") def on_dte_earthtime_dateTimeChanged(self, qdt): - self.rb_earthtime.setChecked(True) - self.update_earthtime(qdt) + if self.rb_earthtime.isChecked(): + self.update_earthtime() - def update_dni(self, ignored=None): + def update_dni(self): """Update view from D'ni time widgets """ if not self.rb_dnitime.isChecked(): @@ -197,15 +202,15 @@ self.clockscene.setClockFromDniTime(self.dnitime) self.dte_earthtime.setDateTime(dt2qdt(self.dnitime.toUTC())) - def update_earthtime(self, qdt): + def update_earthtime(self): """Update view from earth time widget """ - dt = qdt2dt(qdt) + dt = qdt2dt(self.dte_earthtime.dateTime()) self.dnitime.fromUTC(dt) self.clockscene.setClockFromDniTime(self.dnitime) self.setWidgetDniTime(self.dnitime) - def update_holiday(self, idx): + def update_dniholidays(self): """Update view from D'ni holiday widget """ @@ -615,7 +620,13 @@ painter.restore() # outer circle + painter.save() + pen = QtGui.QPen(Qt.black) + pen.setWidthF(1.5) + pen.setCapStyle(Qt.RoundCap) + painter.setPen(pen) painter.drawEllipse(self.outrect) + painter.restore() # inner dot painter.save() painter.setBrush(QtGui.QColor(Qt.black)) @@ -654,10 +665,10 @@ painter.drawPixmap(posx, posy, pm) #painter.restore() - # pointer + # hand painter.save() pen = QtGui.QPen(Qt.black) - pen.setWidth(2) + pen.setWidthF(2.5) pen.setCapStyle(Qt.RoundCap) painter.setPen(pen) rot = self.angel * self._pahrtovo + self.offset Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-02-23 16:45:46 UTC (rev 188) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-02-23 18:34:10 UTC (rev 189) @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file './src/moul/qt/ui/mainwindow.ui' # -# Created: Fri Feb 23 05:05:02 2007 +# Created: Fri Feb 23 19:22:27 2007 # by: PyQt4 UI code generator 4.1.1 # # WARNING! All changes made in this file will be lost! @@ -872,9 +872,9 @@ self.sb_fahrah_hahr = QtGui.QSpinBox(self.gridLayout_5) self.sb_fahrah_hahr.setMaximumSize(QtCore.QSize(46,16777215)) - self.sb_fahrah_hahr.setMaximum(249) + self.sb_fahrah_hahr.setMaximum(624) self.sb_fahrah_hahr.setMinimum(0) - self.sb_fahrah_hahr.setProperty("value",QtCore.QVariant(87)) + self.sb_fahrah_hahr.setProperty("value",QtCore.QVariant(287)) self.sb_fahrah_hahr.setObjectName("sb_fahrah_hahr") self.hboxlayout11.addWidget(self.sb_fahrah_hahr) Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.ui =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-02-23 16:45:46 UTC (rev 188) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-02-23 18:34:10 UTC (rev 189) @@ -1872,13 +1872,13 @@ </size> </property> <property name="maximum" > - <number>249</number> + <number>624</number> </property> <property name="minimum" > <number>0</number> </property> <property name="value" > - <number>87</number> + <number>287</number> </property> </widget> </item> Modified: pymoul/trunk/src/moul/qt/utils.py =================================================================== --- pymoul/trunk/src/moul/qt/utils.py 2007-02-23 16:45:46 UTC (rev 188) +++ pymoul/trunk/src/moul/qt/utils.py 2007-02-23 18:34:10 UTC (rev 189) @@ -524,4 +524,4 @@ udt = normalizeTZ(UTC, dt) qd = QtCore.QDate(udt.year, udt.month, udt.day) qt = QtCore.QTime(udt.hour, udt.minute, udt.second) - return QtCore.QDateTime(qd, qt, QtCore.Qt.UTC) + return QtCore.QDateTime(qd, qt, QtCore.Qt.UTC).toLocalTime() Modified: pymoul/trunk/src/moul/time/dni.py =================================================================== --- pymoul/trunk/src/moul/time/dni.py 2007-02-23 16:45:46 UTC (rev 188) +++ pymoul/trunk/src/moul/time/dni.py 2007-02-23 18:34:10 UTC (rev 189) @@ -205,8 +205,10 @@ def set(self, hahr=0, vailee=0, yahr=0, gahrtahvo=0, tahvo=0, gorahn=0, prorahn=0): + self._hahr = 0 + self._prorahn = 0 + self.hahr = hahr - self._prorahn = 0 self.vailee = vailee self.yahr = yahr self.gahrtahvo = gahrtahvo @@ -332,7 +334,7 @@ if addhahr: self._hahr += addhahr value = value - (addhahr * PRORAHN_PER_HAHR) - self._prorahn = value + self._prorahn += value def prorahnOfYahr(self): """Get numbers of prorahntee since start of yahr This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-02-23 16:45:48
|
Revision: 188 http://pymoul.svn.sourceforge.net/pymoul/?rev=188&view=rev Author: tiran Date: 2007-02-23 08:45:46 -0800 (Fri, 23 Feb 2007) Log Message: ----------- Removed CLI It's outdated and won't be part of the distribution Removed Paths: ------------- pymoul/trunk/src/moul/cli/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-02-23 16:41:53
|
Revision: 187 http://pymoul.svn.sourceforge.net/pymoul/?rev=187&view=rev Author: tiran Date: 2007-02-23 08:41:50 -0800 (Fri, 23 Feb 2007) Log Message: ----------- Import order fixed Modified Paths: -------------- pymoul/trunk/src/moul/crypt/binary.py pymoul/trunk/src/moul/crypt/binaryrecord.py pymoul/trunk/src/moul/crypt/whatdoyousee.py pymoul/trunk/src/moul/crypt/xtea.py pymoul/trunk/src/moul/file/chatlog.py pymoul/trunk/src/moul/file/directory.py pymoul/trunk/src/moul/file/kiimage.py pymoul/trunk/src/moul/file/localization.py pymoul/trunk/src/moul/file/plasmalog.py pymoul/trunk/src/moul/file/utils.py pymoul/trunk/src/moul/file/wdysini.py pymoul/trunk/src/moul/log.py pymoul/trunk/src/moul/osdependent/processinfo.py pymoul/trunk/src/moul/osdependent/tests/test_processinfo.py pymoul/trunk/src/moul/qt/dninumbers.py pymoul/trunk/src/moul/qt/errorhandler.py pymoul/trunk/src/moul/qt/i18n/__init__.py pymoul/trunk/src/moul/qt/localization.py pymoul/trunk/src/moul/qt/mainwindow.py pymoul/trunk/src/moul/qt/moulqt.py pymoul/trunk/src/moul/qt/utils.py pymoul/trunk/src/moul/qt/wdysini.py pymoul/trunk/src/moul/time/cavern.py pymoul/trunk/src/moul/time/dni.py pymoul/trunk/src/moul/time/utils.py pymoul/trunk/utilities/importorder.py Modified: pymoul/trunk/src/moul/crypt/binary.py =================================================================== --- pymoul/trunk/src/moul/crypt/binary.py 2007-02-23 15:19:19 UTC (rev 186) +++ pymoul/trunk/src/moul/crypt/binary.py 2007-02-23 16:41:50 UTC (rev 187) @@ -21,9 +21,9 @@ __version__ = "$Id" __revision__ = "$Revision" +from struct import calcsize from struct import pack from struct import unpack -from struct import calcsize from moul.crypt.binaryrecord import parseRecord from moul.crypt.binaryrecord import registerRecord Modified: pymoul/trunk/src/moul/crypt/binaryrecord.py =================================================================== --- pymoul/trunk/src/moul/crypt/binaryrecord.py 2007-02-23 15:19:19 UTC (rev 186) +++ pymoul/trunk/src/moul/crypt/binaryrecord.py 2007-02-23 16:41:50 UTC (rev 187) @@ -25,9 +25,9 @@ __version__ = "$Id" __revision__ = "$Revision" +from struct import calcsize from struct import pack from struct import unpack -from struct import calcsize _marker = object() Modified: pymoul/trunk/src/moul/crypt/whatdoyousee.py =================================================================== --- pymoul/trunk/src/moul/crypt/whatdoyousee.py 2007-02-23 15:19:19 UTC (rev 186) +++ pymoul/trunk/src/moul/crypt/whatdoyousee.py 2007-02-23 16:41:50 UTC (rev 187) @@ -29,11 +29,11 @@ __revision__ = "$Revision$" import struct +from logging import getLogger +from moul.crypt.binary import BinaryFile from moul.crypt.xtea import xtea_decrypt from moul.crypt.xtea import xtea_encrypt -from moul.crypt.binary import BinaryFile -from logging import getLogger HEADER = "whatdoyousee" Modified: pymoul/trunk/src/moul/crypt/xtea.py =================================================================== --- pymoul/trunk/src/moul/crypt/xtea.py 2007-02-23 15:19:19 UTC (rev 186) +++ pymoul/trunk/src/moul/crypt/xtea.py 2007-02-23 16:41:50 UTC (rev 187) @@ -36,10 +36,10 @@ >>> crypt('0123456789012345',z,iv) 'Hello There' -""" - +""" import struct + def crypt(key,data,iv='\00\00\00\00\00\00\00\00',n=32,endian="!"): """ Encrypt/decrypt variable length string using XTEA cypher as Modified: pymoul/trunk/src/moul/file/chatlog.py =================================================================== --- pymoul/trunk/src/moul/file/chatlog.py 2007-02-23 15:19:19 UTC (rev 186) +++ pymoul/trunk/src/moul/file/chatlog.py 2007-02-23 16:41:50 UTC (rev 187) @@ -35,11 +35,11 @@ import os import re from fnmatch import fnmatch +from logging import getLogger from shutil import move from time import localtime from moul.file.utils import fileModTime -from logging import getLogger RE_FLAGS = re.LOCALE Modified: pymoul/trunk/src/moul/file/directory.py =================================================================== --- pymoul/trunk/src/moul/file/directory.py 2007-02-23 15:19:19 UTC (rev 186) +++ pymoul/trunk/src/moul/file/directory.py 2007-02-23 16:41:50 UTC (rev 187) @@ -22,6 +22,7 @@ __revision__ = "$Revision$" import os +from logging import getLogger from moul.file.chatlog import ChatlogDirectoryView from moul.file.chatlog import ChatlogMover @@ -30,7 +31,6 @@ from moul.file.plasmalog import PlasmalogZipper from moul.file.wdysini import AudioIni from moul.file.wdysini import GraphicsIni -from logging import getLogger LOG = getLogger('moul.file.directory') Modified: pymoul/trunk/src/moul/file/kiimage.py =================================================================== --- pymoul/trunk/src/moul/file/kiimage.py 2007-02-23 15:19:19 UTC (rev 186) +++ pymoul/trunk/src/moul/file/kiimage.py 2007-02-23 16:41:50 UTC (rev 187) @@ -26,11 +26,11 @@ import struct import tempfile from fnmatch import fnmatch +from logging import getLogger + from moul.file.utils import fileModTime from moul.file.utils import fileSize -from logging import getLogger - KINUMBER_RE = re.compile("(\d+)\.jpg$", re.IGNORECASE) JPEG_HEADER = "\377\330\377" Modified: pymoul/trunk/src/moul/file/localization.py =================================================================== --- pymoul/trunk/src/moul/file/localization.py 2007-02-23 15:19:19 UTC (rev 186) +++ pymoul/trunk/src/moul/file/localization.py 2007-02-23 16:41:50 UTC (rev 187) @@ -20,14 +20,13 @@ from __future__ import with_statement import glob import os +from logging import getLogger from sgmllib import SGMLParser from xml.sax import ContentHandler from xml.sax import make_parser from xml.sax.handler import feature_namespaces from xml.sax.saxutils import unescape -from logging import getLogger - __author__ = "Christian Heimes" __version__ = "$Id$" __revision__ = "$Revision$" Modified: pymoul/trunk/src/moul/file/plasmalog.py =================================================================== --- pymoul/trunk/src/moul/file/plasmalog.py 2007-02-23 15:19:19 UTC (rev 186) +++ pymoul/trunk/src/moul/file/plasmalog.py 2007-02-23 16:41:50 UTC (rev 187) @@ -25,11 +25,11 @@ import time import zipfile from fnmatch import fnmatch +from logging import getLogger from stat import ST_MTIME from moul.crypt.elf import decryptElf from moul.file.utils import fileModTime -from logging import getLogger PLASMA_LOG = "plasmalog.txt" Modified: pymoul/trunk/src/moul/file/utils.py =================================================================== --- pymoul/trunk/src/moul/file/utils.py 2007-02-23 15:19:19 UTC (rev 186) +++ pymoul/trunk/src/moul/file/utils.py 2007-02-23 16:41:50 UTC (rev 187) @@ -28,6 +28,7 @@ from stat import ST_MTIME from stat import ST_SIZE + def fileModTime(path, format=None): """Get modification time of file Modified: pymoul/trunk/src/moul/file/wdysini.py =================================================================== --- pymoul/trunk/src/moul/file/wdysini.py 2007-02-23 15:19:19 UTC (rev 186) +++ pymoul/trunk/src/moul/file/wdysini.py 2007-02-23 16:41:50 UTC (rev 187) @@ -23,10 +23,10 @@ import os import shutil +from logging import getLogger from moul.crypt.whatdoyousee import decryptWDYS from moul.crypt.whatdoyousee import encryptWDYS -from logging import getLogger LOG = getLogger('moul.file.wdysini') Modified: pymoul/trunk/src/moul/log.py =================================================================== --- pymoul/trunk/src/moul/log.py 2007-02-23 15:19:19 UTC (rev 186) +++ pymoul/trunk/src/moul/log.py 2007-02-23 16:41:50 UTC (rev 187) @@ -23,8 +23,6 @@ __version__ = "$Id$" __revision__ = "$Revision$" -__all__ = ['LOG', 'getLogger', 'signalLogDecorator'] - import logging import os import platform @@ -35,6 +33,7 @@ from moul.metadata import __version__ as moul_version + LOG = logging.getLogger('pyMoul') class LoggingStdout(object): Modified: pymoul/trunk/src/moul/osdependent/processinfo.py =================================================================== --- pymoul/trunk/src/moul/osdependent/processinfo.py 2007-02-23 15:19:19 UTC (rev 186) +++ pymoul/trunk/src/moul/osdependent/processinfo.py 2007-02-23 16:41:50 UTC (rev 187) @@ -53,7 +53,6 @@ import sys from logging import getLogger - LOG = getLogger("processinfo") _plat = sys.platform.startswith Modified: pymoul/trunk/src/moul/osdependent/tests/test_processinfo.py =================================================================== --- pymoul/trunk/src/moul/osdependent/tests/test_processinfo.py 2007-02-23 15:19:19 UTC (rev 186) +++ pymoul/trunk/src/moul/osdependent/tests/test_processinfo.py 2007-02-23 16:41:50 UTC (rev 187) @@ -24,7 +24,7 @@ import unittest from doctest import DocTestSuite -import moul.osdependent.processinfo +import moul.osdependent.processinfo def test_suite(): Modified: pymoul/trunk/src/moul/qt/dninumbers.py =================================================================== --- pymoul/trunk/src/moul/qt/dninumbers.py 2007-02-23 15:19:19 UTC (rev 186) +++ pymoul/trunk/src/moul/qt/dninumbers.py 2007-02-23 16:41:50 UTC (rev 187) @@ -34,18 +34,19 @@ from logging import getLogger from moul.time.cavern import CavernTime +from moul.time.dni import DNI_HOLIDAYS from moul.time.dni import DniTime from moul.time.dni import FACTOR_SP +from moul.time.dni import VAILEETEE from moul.time.dni import decimal2dni -from moul.time.dni import VAILEETEE -from moul.time.dni import DNI_HOLIDAYS from moul.time.utils import utcnow + from moul.qt.utils import QNamespaceContainer from moul.qt.utils import QSignalLoggerMetaclass -from moul.qt.utils import skipLogging from moul.qt.utils import QTimerThreadlet from moul.qt.utils import dt2qdt from moul.qt.utils import qdt2dt +from moul.qt.utils import skipLogging NUMBER_HEIGHT = 25 Modified: pymoul/trunk/src/moul/qt/errorhandler.py =================================================================== --- pymoul/trunk/src/moul/qt/errorhandler.py 2007-02-23 15:19:19 UTC (rev 186) +++ pymoul/trunk/src/moul/qt/errorhandler.py 2007-02-23 16:41:50 UTC (rev 187) @@ -29,9 +29,9 @@ import os import sys from PyQt4.QtGui import QApplication +from logging import getLogger from traceback import format_exception -from logging import getLogger from moul.qt.utils import criticalMB Modified: pymoul/trunk/src/moul/qt/i18n/__init__.py =================================================================== --- pymoul/trunk/src/moul/qt/i18n/__init__.py 2007-02-23 15:19:19 UTC (rev 186) +++ pymoul/trunk/src/moul/qt/i18n/__init__.py 2007-02-23 16:41:50 UTC (rev 187) @@ -89,7 +89,7 @@ if qm is None: qm = loadTranslationFile(shortname) if qm is None: - if lang != 'en': + if lang not in ('en', 'C'): LOG.warning("No translation found!") else: LOG.info("Loading translation %s" % shortname) @@ -97,6 +97,5 @@ LOG.info("Loading translation %s" % longname) if qm is not None: - LOG.debug("len(%i), type(%s)" % (len(qm), type(qm))) translator.load(qm, len(qm)) app.installTranslator(translator) Modified: pymoul/trunk/src/moul/qt/localization.py =================================================================== --- pymoul/trunk/src/moul/qt/localization.py 2007-02-23 15:19:19 UTC (rev 186) +++ pymoul/trunk/src/moul/qt/localization.py 2007-02-23 16:41:50 UTC (rev 187) @@ -29,14 +29,14 @@ from PyQt4.QtCore import Qt from PyQt4.QtCore import SIGNAL from PyQt4.QtCore import pyqtSignature +from logging import getLogger from moul.file.localization import translationRegistry as tr -from logging import getLogger from moul.qt.simpleprogressbar import SimpleProgressbar -from moul.qt.utils import QYieldingThreadlet from moul.qt.utils import QNamespaceContainer from moul.qt.utils import QSignalLoggerMetaclass +from moul.qt.utils import QYieldingThreadlet LOG = getLogger('moul.loc') Modified: pymoul/trunk/src/moul/qt/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/mainwindow.py 2007-02-23 15:19:19 UTC (rev 186) +++ pymoul/trunk/src/moul/qt/mainwindow.py 2007-02-23 16:41:50 UTC (rev 187) @@ -18,39 +18,38 @@ """Moul QT GUI main windows """ -from __future__ import with_statement - __author__ = "Christian Heimes" __version__ = "$Id$" __revision__ = "$Revision$" import os +import sys from PyQt4 import QtCore from PyQt4 import QtGui from PyQt4.QtCore import Qt from PyQt4.QtCore import SIGNAL from PyQt4.QtCore import pyqtSignature -import sys +from logging import getLogger from moul import metadata from moul.config import lookupDir from moul.file.directory import UruGameDataDirectory from moul.file.directory import UruPersonalDataDirectory -from logging import getLogger from moul.osdependent import isMoulRunning from moul.server.ping import ServerList -from moul.server.ping import isSocketError from moul.server.ping import fmtSocketError +from moul.server.ping import isSocketError +from moul.qt import utils as qtutils from moul.qt.dninumbers import DniTimeNumberContainer from moul.qt.localization import LocalizationContainer -from moul.qt.wdysini import IniFileContainer from moul.qt.simpleprogressbar import SimpleProgressbar -from moul.qt.utils import QYieldingThreadlet -from moul.qt.utils import QThreadlet from moul.qt.ui.mainwindow import Ui_MainWindow -from moul.qt import utils as qtutils +from moul.qt.utils import QThreadlet +from moul.qt.utils import QYieldingThreadlet +from moul.qt.wdysini import IniFileContainer + LOG = getLogger('moul.qt') class MainWindow(QtGui.QMainWindow, Ui_MainWindow): Modified: pymoul/trunk/src/moul/qt/moulqt.py =================================================================== --- pymoul/trunk/src/moul/qt/moulqt.py 2007-02-23 15:19:19 UTC (rev 186) +++ pymoul/trunk/src/moul/qt/moulqt.py 2007-02-23 16:41:50 UTC (rev 187) @@ -23,21 +23,22 @@ __version__ = "$Id$" __revision__ = "$Revision$" -from moul.log import createLogfile - import sys from PyQt4 import QtGui from logging import getLogger +import moul.log # initialize log handler + from moul.config import getPyMoulDataDir +from moul.log import createLogfile from moul.osdependent import isMoulRunning from moul.osdependent.singleapp import SimpleSingleApp from moul.qt.errorhandler import criticalMB from moul.qt.errorhandler import removeQtExceptHook from moul.qt.errorhandler import setupQtExceptHook +from moul.qt.i18n import installTranslator from moul.qt.mainwindow import MainWindow -from moul.qt.i18n import installTranslator LOG = getLogger('moul.qt') Modified: pymoul/trunk/src/moul/qt/utils.py =================================================================== --- pymoul/trunk/src/moul/qt/utils.py 2007-02-23 15:19:19 UTC (rev 186) +++ pymoul/trunk/src/moul/qt/utils.py 2007-02-23 16:41:50 UTC (rev 187) @@ -35,16 +35,16 @@ import re import sip import warnings +from PyQt4 import QtCore +from PyQt4 import QtGui from PyQt4.QtCore import SIGNAL -from PyQt4 import QtGui -from PyQt4 import QtCore from datetime import datetime +from types import FunctionType from types import UnboundMethodType -from types import FunctionType from moul.osdependent import __FROZEN__ +from moul.time.utils import UTC from moul.time.utils import normalizeTZ -from moul.time.utils import UTC LOG = logging.getLogger('moul.qt.utils') Modified: pymoul/trunk/src/moul/qt/wdysini.py =================================================================== --- pymoul/trunk/src/moul/qt/wdysini.py 2007-02-23 15:19:19 UTC (rev 186) +++ pymoul/trunk/src/moul/qt/wdysini.py 2007-02-23 16:41:50 UTC (rev 187) @@ -18,8 +18,6 @@ """Moul QT GUI main windows """ -from __future__ import with_statement - __author__ = "Christian Heimes" __version__ = "$Id$" __revision__ = "$Revision$" @@ -30,18 +28,20 @@ from PyQt4.QtCore import Qt from PyQt4.QtCore import SIGNAL from PyQt4.QtCore import pyqtSignature +from logging import getLogger from moul import metadata from moul.config import lookupDir from moul.file.directory import UruGameDataDirectory from moul.file.directory import UruPersonalDataDirectory from moul.file.wdysini import videoModes -from logging import getLogger + from moul.qt.utils import QNamespaceContainer from moul.qt.utils import QSignalLoggerMetaclass +from moul.qt.utils import criticalMB from moul.qt.utils import questionMB -from moul.qt.utils import criticalMB + LOG = getLogger('moul.qt') class IniFileContainer(QNamespaceContainer): Modified: pymoul/trunk/src/moul/time/cavern.py =================================================================== --- pymoul/trunk/src/moul/time/cavern.py 2007-02-23 15:19:19 UTC (rev 186) +++ pymoul/trunk/src/moul/time/cavern.py 2007-02-23 16:41:50 UTC (rev 187) @@ -25,13 +25,13 @@ from datetime import datetime +from moul.time.utils import UNIX_0 +from moul.time.utils import UTC from moul.time.utils import diffTD from moul.time.utils import normalizeTZ from moul.time.utils import td2sec from moul.time.utils import timezone from moul.time.utils import utcnow -from moul.time.utils import UNIX_0 -from moul.time.utils import UTC ## not used in the current version #SUPPORTED_TZ = ('America', 'Canada', 'Etc', 'Europe', 'US') Modified: pymoul/trunk/src/moul/time/dni.py =================================================================== --- pymoul/trunk/src/moul/time/dni.py 2007-02-23 15:19:19 UTC (rev 186) +++ pymoul/trunk/src/moul/time/dni.py 2007-02-23 16:41:50 UTC (rev 187) @@ -84,15 +84,15 @@ __version__ = "$Id$" __revision__ = "$Revision$" +import sys from datetime import datetime from time import mktime -import sys +from moul.time.utils import UNIX_0 +from moul.time.utils import UTC from moul.time.utils import td2sec from moul.time.utils import timezone from moul.time.utils import utcnow -from moul.time.utils import UNIX_0 -from moul.time.utils import UTC # list of month names with approx. dates VAILEETEE = ( Modified: pymoul/trunk/src/moul/time/utils.py =================================================================== --- pymoul/trunk/src/moul/time/utils.py 2007-02-23 15:19:19 UTC (rev 186) +++ pymoul/trunk/src/moul/time/utils.py 2007-02-23 16:41:50 UTC (rev 187) @@ -21,17 +21,19 @@ __version__ = "$Id$" __revision__ = "$Revision$" +from datetime import datetime +from logging import getLogger + from moul.osdependent import __FROZEN__ + # pytz is an egg if not __FROZEN__: import pkg_resources pkg_resources.require("pytz>=2006p") -from datetime import datetime -from logging import getLogger +from pytz import common_timezones +from pytz import timezone from pytz import utc as UTC -from pytz import timezone -from pytz import common_timezones LOG = getLogger('timeutils') Modified: pymoul/trunk/utilities/importorder.py =================================================================== --- pymoul/trunk/utilities/importorder.py 2007-02-23 15:19:19 UTC (rev 186) +++ pymoul/trunk/utilities/importorder.py 2007-02-23 16:41:50 UTC (rev 187) @@ -1,4 +1,4 @@ -#!/usr/bin/env python2.4 +#!/usr/bin/env python2.5 ############################################################################## # # Copyright (c) 2001, 2002 Zope Corporation and Contributors. @@ -119,9 +119,14 @@ imp_list = filterList(import_list, 'import ') from_list = filterList(import_list, 'from ') + #remove future statements from from_list + future_list = filterList(from_list, 'from __future__ import') + from_list = removeList(from_list, future_list) + #extracting non import content non_import_block = removeList(import_list, imp_list) non_import_block = removeList(non_import_block, from_list) + non_import_block = removeList(non_import_block, future_list) non_import_block_fmt = formateBlock(non_import_block) #comma separated imports into individual import statements @@ -145,7 +150,8 @@ global_from_list = removeList(rem_from_list1, zope_from_list) #formating the global, zope and zope.app package imports - format_import_content = mergeAllBlocks(global_imp_list, + format_import_content = mergeAllBlocks(future_list, + global_imp_list, zope_imp_list, zope_app_imp_list, global_from_list, @@ -158,6 +164,7 @@ non_import_block_fmt += '\n\n' fmt_content = format_import_content + non_import_block_fmt + fmt_content = fmt_content.strip() + '\n' return {'import_order':fmt_content, 'non_import_order':import_content} @@ -253,16 +260,20 @@ return [item for item in list if item not in rem_list] -def mergeAllBlocks(global_imp_list, zope_imp_list, zope_app_imp_list, - global_from_list, zope_from_list, zope_app_from_list): +def mergeAllBlocks(future_list, global_imp_list, zope_imp_list, + zope_app_imp_list, global_from_list, zope_from_list, + zope_app_from_list): """merges global, zope and zope.app imports """ import_block = '' + future_block = formateBlock(future_list) global_imp_block = formateBlock(global_imp_list) global_from_block = formateBlock(global_from_list) zope_imp_block = formateBlock(zope_imp_list) zope_from_block = formateBlock(zope_from_list) zope_app_imp_block = formateBlock(zope_app_imp_list) zope_app_from_block = formateBlock(zope_app_from_list) + + import_block = future_block import_block += formatsFromAndImportBlock(global_imp_block, global_from_block) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-02-23 15:19:18
|
Revision: 186 http://pymoul.svn.sourceforge.net/pymoul/?rev=186&view=rev Author: tiran Date: 2007-02-23 07:19:19 -0800 (Fri, 23 Feb 2007) Log Message: ----------- Working on an enhanced time tab Modified Paths: -------------- pymoul/trunk/src/moul/qt/dninumbers.py pymoul/trunk/src/moul/qt/ui/mainwindow.py pymoul/trunk/src/moul/qt/ui/mainwindow.ui pymoul/trunk/src/moul/qt/utils.py pymoul/trunk/src/moul/time/utils.py Modified: pymoul/trunk/src/moul/qt/dninumbers.py =================================================================== --- pymoul/trunk/src/moul/qt/dninumbers.py 2007-02-23 15:17:20 UTC (rev 185) +++ pymoul/trunk/src/moul/qt/dninumbers.py 2007-02-23 15:19:19 UTC (rev 186) @@ -31,6 +31,7 @@ from PyQt4.QtCore import Qt from PyQt4.QtCore import SIGNAL from PyQt4.QtCore import pyqtSignature +from logging import getLogger from moul.time.cavern import CavernTime from moul.time.dni import DniTime @@ -38,13 +39,13 @@ from moul.time.dni import decimal2dni from moul.time.dni import VAILEETEE from moul.time.dni import DNI_HOLIDAYS -from moul.time.utils import ts2utc from moul.time.utils import utcnow -from logging import getLogger from moul.qt.utils import QNamespaceContainer from moul.qt.utils import QSignalLoggerMetaclass from moul.qt.utils import skipLogging from moul.qt.utils import QTimerThreadlet +from moul.qt.utils import dt2qdt +from moul.qt.utils import qdt2dt NUMBER_HEIGHT = 25 @@ -61,6 +62,7 @@ # D'ni numbers self.dninumbers = QDniNumbers() self.caverntime = CavernTime() + self.dnitime = DniTime() self.setup_dninumbers() # D'ni date and time @@ -83,20 +85,28 @@ self.lb_pacific_utc.setText("UTC %s%i" % (off[0], abs(off[1]))) # chooser - self.dte_earthtime.setDateTime(QtCore.QDateTime(utcnow())) + self.dte_earthtime.setDateTime(dt2qdt(utcnow())) + self.cb_vailee.clear() for i, name in enumerate(VAILEETEE): self.cb_vailee.addItem("%2i %s" % (i+1, name)) for name, date in DNI_HOLIDAYS: self.cb_dniholidays.addItem(self.trUtf8(name)) self.connect(self.timezone_timer, SIGNAL('timeout()'), - self.on_timezone_timer_timeout) + self.on_timezone_timeout) self.connect(self.dnitime_timer, SIGNAL('timeout()'), - self.clockscene.timeEvent) + self.on_dniclock_timeout) self.connect(self.context, SIGNAL("timerEnable(bool)"), self.on_timer_timerEnable) # TODO: needs optimization? run only when timer tab is active - #self.emit(SIGNAL("timerEnable(bool)"), True) + for name in ('sb_hahr', 'sb_yahr', 'sb_gahrtahvo', + 'sb_tahvo', 'sb_gorahn', 'sb_prorahn'): + self.connect(getattr(self, name), SIGNAL("valueChanged(int)"), + self.update_dni) + self.connect(self.cb_vailee, SIGNAL("currentIndexChanged(int)"), + self.update_dni) + # setup defaults + self.rb_earthtime.click() @pyqtSignature("bool") def on_timer_timerEnable(self, value=True): @@ -112,7 +122,7 @@ @pyqtSignature("") @skipLogging - def on_timezone_timer_timeout(self): + def on_timezone_timeout(self): """ SIGNAL: QTimer timeout """ @@ -120,6 +130,16 @@ self.dt_cavern.setDateTime(ct['cavern']) self.dt_pacific.setDateTime(ct['pacific']) + @pyqtSignature("") + @skipLogging + def on_dniclock_timeout(self): + """ + SIGNAL: QTimer timeout + """ + self.dnitime.fromUTC() + self.clockscene.setClockFromDniTime(self.dnitime) + self.setWidgetDniTime(self.dnitime) + @pyqtSignature("bool") def on_rb_curtime_clicked(self, value): if value: @@ -129,6 +149,7 @@ def on_rb_earthtime_clicked(self, value): if value: self.emit(SIGNAL("timerEnable(bool)"), False) + self.update_earthtime(self.dte_earthtime.dateTime()) @pyqtSignature("bool") def on_rb_dnitime_clicked(self, value): @@ -140,22 +161,75 @@ if value: self.emit(SIGNAL("timerEnable(bool)"), False) - @pyqtSignature("") - def on_pb_time_update_clicked(self): - if self.rb_curtime.isChecked(): - pass - elif self.rb_earthtime.isChecked(): - qdt = self.dte_earthtime.dateTime() - utc_dt = ts2utc(qdt.toTime_t()) - self.clockscene.setClockFromUTC(utc_dt) - elif self.rb_dnitime.isChecked(): - pass - elif self.rb_dniholiday.isChecked(): - pass - else: - LOG.warning("Unknown state of time chooser") + @pyqtSignature("int") + def on_sb_fahrah_valueChanged(self, value): + hahr = self.sb_fahrah_hahr.value() + self.sb_hahr.setValue(value * 625 + hahr) + @pyqtSignature("int") + def on_sb_fahrah_hahr_valueChanged(self, value): + fahrah = self.sb_fahrah.value() + self.sb_hahr.setValue(fahrah * 625 + value) + @pyqtSignature("int") + def on_sb_hahr_valueChanged(self, value): + fahrah = value // 625 + hahr = value - fahrah * 625 + self.sb_fahrah_hahr.setValue(hahr) + self.sb_fahrah.setValue(fahrah) + + @pyqtSignature("int") + def on_cb_dniholidays_currentIndexChanged(self, idx): + self.rb_dniholidays.setChecked(True) + + @pyqtSignature("const QDateTime &") + def on_dte_earthtime_dateTimeChanged(self, qdt): + self.rb_earthtime.setChecked(True) + self.update_earthtime(qdt) + + def update_dni(self, ignored=None): + """Update view from D'ni time widgets + """ + if not self.rb_dnitime.isChecked(): + return + self.dnitime.set(*self.getWidgetDniTime()) + self.clockscene.setClockFromDniTime(self.dnitime) + self.dte_earthtime.setDateTime(dt2qdt(self.dnitime.toUTC())) + + def update_earthtime(self, qdt): + """Update view from earth time widget + """ + dt = qdt2dt(qdt) + self.dnitime.fromUTC(dt) + self.clockscene.setClockFromDniTime(self.dnitime) + self.setWidgetDniTime(self.dnitime) + + def update_holiday(self, idx): + """Update view from D'ni holiday widget + """ + + def getWidgetDniTime(self): + """Get D'ni date and time from widgets + """ + return (self.sb_hahr.value(), + self.cb_vailee.currentIndex() + 1, + self.sb_yahr.value(), + self.sb_gahrtahvo.value(), + self.sb_tahvo.value(), + self.sb_gorahn.value(), + self.sb_prorahn.value()) + + def setWidgetDniTime(self, dnitime): + """Set D'ni date and time of widgets + """ + self.sb_hahr.setValue(dnitime.hahr) + self.cb_vailee.setCurrentIndex(dnitime.vailee-1) + self.sb_yahr.setValue(dnitime.yahr) + self.sb_gahrtahvo.setValue(dnitime.gahrtahvo) + self.sb_tahvo.setValue(dnitime.tahvo) + self.sb_gorahn.setValue(dnitime.gorahn) + self.sb_prorahn.setValue(dnitime.prorahn) + def setup_dninumbers(self): # may change! widget = self.context.gridLayout_3 @@ -436,12 +510,14 @@ def __init__(self, parent=None): QtGui.QGraphicsScene.__init__(self, parent) self.dninumbers = QDniNumbers() - self.dnitime = DniTime() + self._prorahn = None + self.setup() - height = 15 + def setup(self): + height = 20 space = 5 xoff = 50 - yoff = 20 + yoff = 40 # set widths from pixmaps width = self.dninumbers.get(0, height=height).width() @@ -475,21 +551,18 @@ # clock text # XXX: parent? - self.clocktext = QtGui.QGraphicsTextItem(None, self) - self.clocktext.setPos(0, yoff+2*height+2*space) + #self.clocktext = QtGui.QGraphicsTextItem(None, self) + #self.clocktext.setPos(0, yoff+2*height+2*space) # circular day clock self.circle = QDniClockCircle(None, self) self.circle.setPos(250, 3) - # initialize view - self.timeEvent(initialize=True) - - def setClockFromDnidate(self, dnitime, initialize=False): - if dnitime.prorahn == self.prorahn.get() and not initialize: + def setClockFromDniTime(self, dnitime): + if dnitime._prorahn == self._prorahn: return + self._prorahn = dnitime._prorahn - self.clocktext.setPlainText(str(self.dnitime)) - + #self.clocktext.setPlainText(str(dnitime)) self.circle.setPahrtovo(dnitime.getPahrtovoFraction()) hahr = decimal2dni(dnitime.hahr, digits=3) @@ -505,23 +578,10 @@ self.gorahn.setNumber(dnitime.gorahn) self.prorahn.setNumber(dnitime.prorahn) - def setClockFromUTC(self, utc_dt): - self.dnitime.fromUTC(utc_dt) - self.setClockFromDnidate(self.dnitime, initialize=True) - - @pyqtSignature("") - @skipLogging - def timeEvent(self, initialize=False): - """ - SIGNAL: QTimer timeout - """ - self.dnitime.fromUTC() # set to now - self.setClockFromDnidate(self.dnitime, initialize) - class QDniClockCircle(QtGui.QGraphicsItem): """Circular part of the D'ni clock """ - r = 70.0 # radios of circle + r = 60.0 # radios of circle rdot = 3.0 # radius of dots rinner = 6.0 # radius of inner circle outrect = QtCore.QRectF(0.0, 0.0, 2.0*r, 2.0*r) @@ -533,7 +593,7 @@ def __init__(self, parent=None, scene=None): QtGui.QGraphicsItem.__init__(self, parent, scene) self._pahrtovo = 0.0 - self._dni =QDniNumbers() + self._dni = QDniNumbers() def boundingRect(self): return self.outrect Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-02-23 15:17:20 UTC (rev 185) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-02-23 15:19:19 UTC (rev 186) @@ -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 Feb 22 16:50:00 2007 +# Created: Fri Feb 23 05:05:02 2007 # by: PyQt4 UI code generator 4.1.1 # # WARNING! All changes made in this file will be lost! @@ -44,12 +44,6 @@ spacerItem1 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout.addItem(spacerItem1) - self.main_buttonbox = QtGui.QDialogButtonBox(self.centralwidget) - self.main_buttonbox.setGeometry(QtCore.QRect(10,520,451,32)) - self.main_buttonbox.setOrientation(QtCore.Qt.Horizontal) - self.main_buttonbox.setStandardButtons(QtGui.QDialogButtonBox.Close|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Reset|QtGui.QDialogButtonBox.Save) - self.main_buttonbox.setObjectName("main_buttonbox") - self.tabwidget = QtGui.QTabWidget(self.centralwidget) self.tabwidget.setGeometry(QtCore.QRect(0,80,471,434)) self.tabwidget.setTabPosition(QtGui.QTabWidget.North) @@ -697,23 +691,97 @@ self.tab_time = QtGui.QWidget() self.tab_time.setObjectName("tab_time") + self.gb_dnitime = QtGui.QGroupBox(self.tab_time) + self.gb_dnitime.setGeometry(QtCore.QRect(10,240,451,161)) + self.gb_dnitime.setObjectName("gb_dnitime") + + self.gv_dniclock = QtGui.QGraphicsView(self.gb_dnitime) + self.gv_dniclock.setGeometry(QtCore.QRect(10,20,431,131)) + self.gv_dniclock.setFocusPolicy(QtCore.Qt.NoFocus) + self.gv_dniclock.setContextMenuPolicy(QtCore.Qt.NoContextMenu) + self.gv_dniclock.setAcceptDrops(False) + self.gv_dniclock.setFrameShadow(QtGui.QFrame.Plain) + self.gv_dniclock.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.gv_dniclock.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.gv_dniclock.setInteractive(False) + self.gv_dniclock.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) + self.gv_dniclock.setRenderHints(QtGui.QPainter.Antialiasing|QtGui.QPainter.SmoothPixmapTransform|QtGui.QPainter.TextAntialiasing) + self.gv_dniclock.setObjectName("gv_dniclock") + + self.gb_caverntime = QtGui.QGroupBox(self.tab_time) + self.gb_caverntime.setGeometry(QtCore.QRect(10,160,451,81)) + self.gb_caverntime.setObjectName("gb_caverntime") + + self.gridLayout = QtGui.QWidget(self.gb_caverntime) + self.gridLayout.setGeometry(QtCore.QRect(10,20,292,56)) + self.gridLayout.setObjectName("gridLayout") + + self.gridlayout1 = QtGui.QGridLayout(self.gridLayout) + self.gridlayout1.setMargin(0) + self.gridlayout1.setSpacing(6) + self.gridlayout1.setObjectName("gridlayout1") + + self.label_5 = QtGui.QLabel(self.gridLayout) + + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(5)) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.label_5.sizePolicy().hasHeightForWidth()) + self.label_5.setSizePolicy(sizePolicy) + self.label_5.setObjectName("label_5") + self.gridlayout1.addWidget(self.label_5,0,0,1,1) + + self.lb_cavern_utc = QtGui.QLabel(self.gridLayout) + self.lb_cavern_utc.setObjectName("lb_cavern_utc") + self.gridlayout1.addWidget(self.lb_cavern_utc,0,2,1,1) + + self.dt_cavern = QtGui.QDateTimeEdit(self.gridLayout) + self.dt_cavern.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape(0))) + self.dt_cavern.setFocusPolicy(QtCore.Qt.NoFocus) + self.dt_cavern.setContextMenuPolicy(QtCore.Qt.NoContextMenu) + self.dt_cavern.setReadOnly(True) + self.dt_cavern.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) + self.dt_cavern.setObjectName("dt_cavern") + self.gridlayout1.addWidget(self.dt_cavern,0,1,1,1) + + self.dt_pacific = QtGui.QDateTimeEdit(self.gridLayout) + self.dt_pacific.setFocusPolicy(QtCore.Qt.NoFocus) + self.dt_pacific.setContextMenuPolicy(QtCore.Qt.NoContextMenu) + self.dt_pacific.setReadOnly(True) + self.dt_pacific.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) + self.dt_pacific.setObjectName("dt_pacific") + self.gridlayout1.addWidget(self.dt_pacific,1,1,1,1) + + self.label_8 = QtGui.QLabel(self.gridLayout) + + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(5)) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.label_8.sizePolicy().hasHeightForWidth()) + self.label_8.setSizePolicy(sizePolicy) + self.label_8.setObjectName("label_8") + self.gridlayout1.addWidget(self.label_8,1,0,1,1) + + self.lb_pacific_utc = QtGui.QLabel(self.gridLayout) + self.lb_pacific_utc.setObjectName("lb_pacific_utc") + self.gridlayout1.addWidget(self.lb_pacific_utc,1,2,1,1) + self.groupBox_3 = QtGui.QGroupBox(self.tab_time) - self.groupBox_3.setGeometry(QtCore.QRect(10,0,451,151)) + self.groupBox_3.setGeometry(QtCore.QRect(10,0,451,161)) self.groupBox_3.setObjectName("groupBox_3") self.gridLayout_5 = QtGui.QWidget(self.groupBox_3) - self.gridLayout_5.setGeometry(QtCore.QRect(10,10,444,141)) + self.gridLayout_5.setGeometry(QtCore.QRect(10,20,451,138)) self.gridLayout_5.setObjectName("gridLayout_5") - self.gridlayout1 = QtGui.QGridLayout(self.gridLayout_5) - self.gridlayout1.setMargin(0) - self.gridlayout1.setSpacing(6) - self.gridlayout1.setObjectName("gridlayout1") + self.gridlayout2 = QtGui.QGridLayout(self.gridLayout_5) + self.gridlayout2.setMargin(0) + self.gridlayout2.setSpacing(2) + self.gridlayout2.setObjectName("gridlayout2") self.rb_earthtime = QtGui.QRadioButton(self.gridLayout_5) - self.rb_earthtime.setChecked(True) self.rb_earthtime.setObjectName("rb_earthtime") - self.gridlayout1.addWidget(self.rb_earthtime,1,0,1,1) + self.gridlayout2.addWidget(self.rb_earthtime,1,0,1,1) self.hboxlayout9 = QtGui.QHBoxLayout() self.hboxlayout9.setMargin(0) @@ -726,11 +794,11 @@ spacerItem4 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout9.addItem(spacerItem4) - self.gridlayout1.addLayout(self.hboxlayout9,4,1,1,1) + self.gridlayout2.addLayout(self.hboxlayout9,4,1,1,1) self.rb_curtime = QtGui.QRadioButton(self.gridLayout_5) self.rb_curtime.setObjectName("rb_curtime") - self.gridlayout1.addWidget(self.rb_curtime,0,0,1,1) + self.gridlayout2.addWidget(self.rb_curtime,0,0,1,1) self.hboxlayout10 = QtGui.QHBoxLayout() self.hboxlayout10.setMargin(0) @@ -780,14 +848,14 @@ spacerItem5 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout10.addItem(spacerItem5) - self.gridlayout1.addLayout(self.hboxlayout10,3,1,1,1) + self.gridlayout2.addLayout(self.hboxlayout10,3,1,1,1) - self.rb_dniholiday = QtGui.QRadioButton(self.gridLayout_5) - self.rb_dniholiday.setObjectName("rb_dniholiday") - self.gridlayout1.addWidget(self.rb_dniholiday,4,0,1,1) + self.rb_dniholidays = QtGui.QRadioButton(self.gridLayout_5) + self.rb_dniholidays.setObjectName("rb_dniholidays") + self.gridlayout2.addWidget(self.rb_dniholidays,4,0,1,1) spacerItem6 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) - self.gridlayout1.addItem(spacerItem6,0,1,1,1) + self.gridlayout2.addItem(spacerItem6,0,1,1,1) self.hboxlayout11 = QtGui.QHBoxLayout() self.hboxlayout11.setMargin(0) @@ -795,6 +863,7 @@ self.hboxlayout11.setObjectName("hboxlayout11") self.sb_fahrah = QtGui.QSpinBox(self.gridLayout_5) + self.sb_fahrah.setMaximumSize(QtCore.QSize(46,16777215)) self.sb_fahrah.setMaximum(15) self.sb_fahrah.setMinimum(1) self.sb_fahrah.setProperty("value",QtCore.QVariant(15)) @@ -802,6 +871,7 @@ self.hboxlayout11.addWidget(self.sb_fahrah) self.sb_fahrah_hahr = QtGui.QSpinBox(self.gridLayout_5) + self.sb_fahrah_hahr.setMaximumSize(QtCore.QSize(46,16777215)) self.sb_fahrah_hahr.setMaximum(249) self.sb_fahrah_hahr.setMinimum(0) self.sb_fahrah_hahr.setProperty("value",QtCore.QVariant(87)) @@ -819,29 +889,28 @@ self.sb_hahr.setObjectName("sb_hahr") self.hboxlayout11.addWidget(self.sb_hahr) - self.label_4 = QtGui.QLabel(self.gridLayout_5) - self.label_4.setObjectName("label_4") - self.hboxlayout11.addWidget(self.label_4) - self.cb_vailee = QtGui.QComboBox(self.gridLayout_5) - self.cb_vailee.setMinimumSize(QtCore.QSize(0,0)) + + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(1),QtGui.QSizePolicy.Policy(0)) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.cb_vailee.sizePolicy().hasHeightForWidth()) + self.cb_vailee.setSizePolicy(sizePolicy) + self.cb_vailee.setMinimumSize(QtCore.QSize(105,0)) self.cb_vailee.setObjectName("cb_vailee") self.hboxlayout11.addWidget(self.cb_vailee) - self.label_6 = QtGui.QLabel(self.gridLayout_5) - self.label_6.setObjectName("label_6") - self.hboxlayout11.addWidget(self.label_6) - self.sb_yahr = QtGui.QSpinBox(self.gridLayout_5) + self.sb_yahr.setMaximumSize(QtCore.QSize(46,16777215)) self.sb_yahr.setMaximum(29) self.sb_yahr.setMinimum(1) - self.sb_yahr.setProperty("value",QtCore.QVariant(1)) + self.sb_yahr.setProperty("value",QtCore.QVariant(29)) self.sb_yahr.setObjectName("sb_yahr") self.hboxlayout11.addWidget(self.sb_yahr) spacerItem7 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout11.addItem(spacerItem7) - self.gridlayout1.addLayout(self.hboxlayout11,2,1,1,1) + self.gridlayout2.addLayout(self.hboxlayout11,2,1,1,1) self.hboxlayout12 = QtGui.QHBoxLayout() self.hboxlayout12.setMargin(0) @@ -867,86 +936,11 @@ spacerItem8 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout12.addItem(spacerItem8) - self.gridlayout1.addLayout(self.hboxlayout12,1,1,1,1) + self.gridlayout2.addLayout(self.hboxlayout12,1,1,1,1) self.rb_dnitime = QtGui.QRadioButton(self.gridLayout_5) self.rb_dnitime.setObjectName("rb_dnitime") - self.gridlayout1.addWidget(self.rb_dnitime,2,0,1,1) - - self.gb_caverntime = QtGui.QGroupBox(self.tab_time) - self.gb_caverntime.setGeometry(QtCore.QRect(10,150,451,71)) - self.gb_caverntime.setObjectName("gb_caverntime") - - self.gridLayout = QtGui.QWidget(self.gb_caverntime) - self.gridLayout.setGeometry(QtCore.QRect(10,10,292,56)) - self.gridLayout.setObjectName("gridLayout") - - self.gridlayout2 = QtGui.QGridLayout(self.gridLayout) - self.gridlayout2.setMargin(0) - self.gridlayout2.setSpacing(6) - self.gridlayout2.setObjectName("gridlayout2") - - self.label_5 = QtGui.QLabel(self.gridLayout) - - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(5)) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.label_5.sizePolicy().hasHeightForWidth()) - self.label_5.setSizePolicy(sizePolicy) - self.label_5.setObjectName("label_5") - self.gridlayout2.addWidget(self.label_5,0,0,1,1) - - self.lb_cavern_utc = QtGui.QLabel(self.gridLayout) - self.lb_cavern_utc.setObjectName("lb_cavern_utc") - self.gridlayout2.addWidget(self.lb_cavern_utc,0,2,1,1) - - self.dt_cavern = QtGui.QDateTimeEdit(self.gridLayout) - self.dt_cavern.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape(0))) - self.dt_cavern.setFocusPolicy(QtCore.Qt.NoFocus) - self.dt_cavern.setContextMenuPolicy(QtCore.Qt.NoContextMenu) - self.dt_cavern.setReadOnly(True) - self.dt_cavern.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) - self.dt_cavern.setObjectName("dt_cavern") - self.gridlayout2.addWidget(self.dt_cavern,0,1,1,1) - - self.dt_pacific = QtGui.QDateTimeEdit(self.gridLayout) - self.dt_pacific.setFocusPolicy(QtCore.Qt.NoFocus) - self.dt_pacific.setContextMenuPolicy(QtCore.Qt.NoContextMenu) - self.dt_pacific.setReadOnly(True) - self.dt_pacific.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) - self.dt_pacific.setObjectName("dt_pacific") - self.gridlayout2.addWidget(self.dt_pacific,1,1,1,1) - - self.label_8 = QtGui.QLabel(self.gridLayout) - - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(5)) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.label_8.sizePolicy().hasHeightForWidth()) - self.label_8.setSizePolicy(sizePolicy) - self.label_8.setObjectName("label_8") - self.gridlayout2.addWidget(self.label_8,1,0,1,1) - - self.lb_pacific_utc = QtGui.QLabel(self.gridLayout) - self.lb_pacific_utc.setObjectName("lb_pacific_utc") - self.gridlayout2.addWidget(self.lb_pacific_utc,1,2,1,1) - - self.gb_dnitime = QtGui.QGroupBox(self.tab_time) - self.gb_dnitime.setGeometry(QtCore.QRect(10,220,451,181)) - self.gb_dnitime.setObjectName("gb_dnitime") - - self.gv_dniclock = QtGui.QGraphicsView(self.gb_dnitime) - self.gv_dniclock.setGeometry(QtCore.QRect(10,20,431,151)) - self.gv_dniclock.setFocusPolicy(QtCore.Qt.NoFocus) - self.gv_dniclock.setContextMenuPolicy(QtCore.Qt.NoContextMenu) - self.gv_dniclock.setAcceptDrops(False) - self.gv_dniclock.setFrameShadow(QtGui.QFrame.Plain) - self.gv_dniclock.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) - self.gv_dniclock.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) - self.gv_dniclock.setInteractive(False) - self.gv_dniclock.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) - self.gv_dniclock.setRenderHints(QtGui.QPainter.Antialiasing|QtGui.QPainter.SmoothPixmapTransform|QtGui.QPainter.TextAntialiasing) - self.gv_dniclock.setObjectName("gv_dniclock") + self.gridlayout2.addWidget(self.rb_dnitime,2,0,1,1) self.tabwidget.addTab(self.tab_time,"") self.tab_browse = QtGui.QWidget() @@ -1103,6 +1097,12 @@ self.tb_license.setObjectName("tb_license") self.tabwidget_about.addTab(self.tab_sub_license,"") self.tabwidget.addTab(self.tab_about,"") + + self.main_buttonbox = QtGui.QDialogButtonBox(self.centralwidget) + self.main_buttonbox.setGeometry(QtCore.QRect(10,520,451,32)) + self.main_buttonbox.setOrientation(QtCore.Qt.Horizontal) + self.main_buttonbox.setStandardButtons(QtGui.QDialogButtonBox.Close|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Reset|QtGui.QDialogButtonBox.Save) + self.main_buttonbox.setObjectName("main_buttonbox") MainWindow.setCentralWidget(self.centralwidget) self.statusbar = QtGui.QStatusBar(MainWindow) @@ -1176,32 +1176,31 @@ self.gb_servers.setTitle(QtGui.QApplication.translate("MainWindow", "Ping servers", None, QtGui.QApplication.UnicodeUTF8)) self.button_ping.setText(QtGui.QApplication.translate("MainWindow", "Ping", None, QtGui.QApplication.UnicodeUTF8)) self.tabwidget.setTabText(self.tabwidget.indexOf(self.tab_ping), QtGui.QApplication.translate("MainWindow", "Servers", None, QtGui.QApplication.UnicodeUTF8)) + self.gb_dnitime.setTitle(QtGui.QApplication.translate("MainWindow", "D\'ni time", None, QtGui.QApplication.UnicodeUTF8)) + self.gb_caverntime.setTitle(QtGui.QApplication.translate("MainWindow", "Time zones", None, QtGui.QApplication.UnicodeUTF8)) + self.label_5.setText(QtGui.QApplication.translate("MainWindow", "Cavern time:", None, QtGui.QApplication.UnicodeUTF8)) + self.lb_cavern_utc.setText(QtGui.QApplication.translate("MainWindow", "UTC -0", None, QtGui.QApplication.UnicodeUTF8)) + self.label_8.setText(QtGui.QApplication.translate("MainWindow", "Cyan time:", None, QtGui.QApplication.UnicodeUTF8)) + self.lb_pacific_utc.setText(QtGui.QApplication.translate("MainWindow", "UTC -0", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_3.setTitle(QtGui.QApplication.translate("MainWindow", "Choose Time", None, QtGui.QApplication.UnicodeUTF8)) self.rb_earthtime.setText(QtGui.QApplication.translate("MainWindow", "Earth Time", None, QtGui.QApplication.UnicodeUTF8)) - self.rb_curtime.setText(QtGui.QApplication.translate("MainWindow", "Current Time", None, QtGui.QApplication.UnicodeUTF8)) + self.rb_curtime.setText(QtGui.QApplication.translate("MainWindow", "Clock", None, QtGui.QApplication.UnicodeUTF8)) self.label_9.setText(QtGui.QApplication.translate("MainWindow", ":", None, QtGui.QApplication.UnicodeUTF8)) self.label_10.setText(QtGui.QApplication.translate("MainWindow", ":", None, QtGui.QApplication.UnicodeUTF8)) self.label_11.setText(QtGui.QApplication.translate("MainWindow", ":", None, QtGui.QApplication.UnicodeUTF8)) - self.rb_dniholiday.setText(QtGui.QApplication.translate("MainWindow", "D\'ni Holiday", None, QtGui.QApplication.UnicodeUTF8)) + self.rb_dniholidays.setText(QtGui.QApplication.translate("MainWindow", "Holidays", None, QtGui.QApplication.UnicodeUTF8)) self.label_12.setText(QtGui.QApplication.translate("MainWindow", "/", None, QtGui.QApplication.UnicodeUTF8)) - self.label_4.setText(QtGui.QApplication.translate("MainWindow", ".", None, QtGui.QApplication.UnicodeUTF8)) - self.label_6.setText(QtGui.QApplication.translate("MainWindow", ".", None, QtGui.QApplication.UnicodeUTF8)) + self.cb_vailee.addItem(QtGui.QApplication.translate("MainWindow", "8 Leevosahn", None, QtGui.QApplication.UnicodeUTF8)) self.cb_earthtime_tz.addItem(QtGui.QApplication.translate("MainWindow", "local time", None, QtGui.QApplication.UnicodeUTF8)) self.cb_earthtime_tz.addItem(QtGui.QApplication.translate("MainWindow", "cavern 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.gb_caverntime.setTitle(QtGui.QApplication.translate("MainWindow", "Time zones", None, QtGui.QApplication.UnicodeUTF8)) - self.label_5.setText(QtGui.QApplication.translate("MainWindow", "Cavern time:", None, QtGui.QApplication.UnicodeUTF8)) - self.lb_cavern_utc.setText(QtGui.QApplication.translate("MainWindow", "UTC -0", None, QtGui.QApplication.UnicodeUTF8)) - self.label_8.setText(QtGui.QApplication.translate("MainWindow", "Cyan time:", None, QtGui.QApplication.UnicodeUTF8)) - self.lb_pacific_utc.setText(QtGui.QApplication.translate("MainWindow", "UTC -0", 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_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)) @@ -1217,13 +1216,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-02-23 15:17:20 UTC (rev 185) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-02-23 15:19:19 UTC (rev 186) @@ -97,22 +97,6 @@ </item> </layout> </widget> - <widget class="QDialogButtonBox" name="main_buttonbox" > - <property name="geometry" > - <rect> - <x>10</x> - <y>520</y> - <width>451</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> @@ -1502,13 +1486,173 @@ <attribute name="title" > <string>Time</string> </attribute> + <widget class="QGroupBox" name="gb_dnitime" > + <property name="geometry" > + <rect> + <x>10</x> + <y>240</y> + <width>451</width> + <height>161</height> + </rect> + </property> + <property name="title" > + <string>D'ni time</string> + </property> + <widget class="QGraphicsView" name="gv_dniclock" > + <property name="geometry" > + <rect> + <x>10</x> + <y>20</y> + <width>431</width> + <height>131</height> + </rect> + </property> + <property name="focusPolicy" > + <enum>Qt::NoFocus</enum> + </property> + <property name="contextMenuPolicy" > + <enum>Qt::NoContextMenu</enum> + </property> + <property name="acceptDrops" > + <bool>false</bool> + </property> + <property name="frameShadow" > + <enum>QFrame::Plain</enum> + </property> + <property name="verticalScrollBarPolicy" > + <enum>Qt::ScrollBarAlwaysOff</enum> + </property> + <property name="horizontalScrollBarPolicy" > + <enum>Qt::ScrollBarAlwaysOff</enum> + </property> + <property name="interactive" > + <bool>false</bool> + </property> + <property name="alignment" > + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> + <property name="renderHints" > + <set>QPainter::Antialiasing|QPainter::SmoothPixmapTransform|QPainter::TextAntialiasing</set> + </property> + </widget> + </widget> + <widget class="QGroupBox" name="gb_caverntime" > + <property name="geometry" > + <rect> + <x>10</x> + <y>160</y> + <width>451</width> + <height>81</height> + </rect> + </property> + <property name="title" > + <string>Time zones</string> + </property> + <widget class="QWidget" native="1" name="gridLayout" > + <property name="geometry" > + <rect> + <x>10</x> + <y>20</y> + <width>292</width> + <height>56</height> + </rect> + </property> + <layout class="QGridLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item row="0" column="0" > + <widget class="QLabel" name="label_5" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Cavern time:</string> + </property> + </widget> + </item> + <item row="0" column="2" > + <widget class="QLabel" name="lb_cavern_utc" > + <property name="text" > + <string>UTC -0</string> + </property> + </widget> + </item> + <item row="0" column="1" > + <widget class="QDateTimeEdit" name="dt_cavern" > + <property name="cursor" > + <cursor>0</cursor> + </property> + <property name="focusPolicy" > + <enum>Qt::NoFocus</enum> + </property> + <property name="contextMenuPolicy" > + <enum>Qt::NoContextMenu</enum> + </property> + <property name="readOnly" > + <bool>true</bool> + </property> + <property name="buttonSymbols" > + <enum>QAbstractSpinBox::UpDownArrows</enum> + </property> + </widget> + </item> + <item row="1" column="1" > + <widget class="QDateTimeEdit" name="dt_pacific" > + <property name="focusPolicy" > + <enum>Qt::NoFocus</enum> + </property> + <property name="contextMenuPolicy" > + <enum>Qt::NoContextMenu</enum> + </property> + <property name="readOnly" > + <bool>true</bool> + </property> + <property name="buttonSymbols" > + <enum>QAbstractSpinBox::UpDownArrows</enum> + </property> + </widget> + </item> + <item row="1" column="0" > + <widget class="QLabel" name="label_8" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Cyan time:</string> + </property> + </widget> + </item> + <item row="1" column="2" > + <widget class="QLabel" name="lb_pacific_utc" > + <property name="text" > + <string>UTC -0</string> + </property> + </widget> + </item> + </layout> + </widget> + </widget> <widget class="QGroupBox" name="groupBox_3" > <property name="geometry" > <rect> <x>10</x> <y>0</y> <width>451</width> - <height>151</height> + <height>161</height> </rect> </property> <property name="title" > @@ -1518,9 +1662,9 @@ <property name="geometry" > <rect> <x>10</x> - <y>10</y> - <width>444</width> - <height>141</height> + <y>20</y> + <width>451</width> + <height>138</height> </rect> </property> <layout class="QGridLayout" > @@ -1528,16 +1672,13 @@ <number>0</number> </property> <property name="spacing" > - <number>6</number> + <number>2</number> </property> <item row="1" column="0" > <widget class="QRadioButton" name="rb_earthtime" > <property name="text" > <string>Earth Time</string> </property> - <property name="checked" > - <bool>true</bool> - </property> </widget> </item> <item row="4" column="1" > @@ -1569,7 +1710,7 @@ <item row="0" column="0" > <widget class="QRadioButton" name="rb_curtime" > <property name="text" > - <string>Current Time</string> + <string>Clock</string> </property> </widget> </item> @@ -1678,7 +1819,7 @@ <item row="4" column="0" > <widget class="QRadioButton" name="rb_dniholidays" > <property name="text" > - <string>D'ni Holiday</string> + <string>Holidays</string> </property> </widget> </item> @@ -1705,6 +1846,12 @@ </property> <item> <widget class="QSpinBox" name="sb_fahrah" > + <property name="maximumSize" > + <size> + <width>46</width> + <height>16777215</height> + </size> + </property> <property name="maximum" > <number>15</number> </property> @@ -1718,6 +1865,12 @@ </item> <item> <widget class="QSpinBox" name="sb_fahrah_hahr" > + <property name="maximumSize" > + <size> + <width>46</width> + <height>16777215</height> + </size> + </property> <property name="maximum" > <number>249</number> </property> @@ -1751,16 +1904,35 @@ </item> <item> <widget class="QComboBox" name="cb_vailee" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="minimumSize" > <size> - <width>0</width> + <width>105</width> <height>0</height> </size> </property> + <item> + <property name="text" > + <string>8 Leevosahn</string> + </property> + </item> </widget> </item> <item> <widget class="QSpinBox" name="sb_yahr" > + <property name="maximumSize" > + <size> + <width>46</width> + <height>16777215</height> + </size> + </property> <property name="maximum" > <number>29</number> </property> @@ -1768,7 +1940,7 @@ <number>1</number> </property> <property name="value" > - <number>1</number> + <number>29</number> </property> </widget> </item> @@ -1860,166 +2032,6 @@ </layout> </widget> </widget> - <widget class="QGroupBox" name="gb_caverntime" > - <property name="geometry" > - <rect> - <x>10</x> - <y>150</y> - <width>451</width> - <height>71</height> - </rect> - </property> - <property name="title" > - <string>Time zones</string> - </property> - <widget class="QWidget" native="1" name="gridLayout" > - <property name="geometry" > - <rect> - <x>10</x> - <y>10</y> - <width>292</width> - <height>56</height> - </rect> - </property> - <layout class="QGridLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item row="0" column="0" > - <widget class="QLabel" name="label_5" > - <property name="sizePolicy" > - <sizepolicy> - <hsizetype>0</hsizetype> - <vsizetype>5</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>Cavern time:</string> - </property> - </widget> - </item> - <item row="0" column="2" > - <widget class="QLabel" name="lb_cavern_utc" > - <property name="text" > - <string>UTC -0</string> - </property> - </widget> - </item> - <item row="0" column="1" > - <widget class="QDateTimeEdit" name="dt_cavern" > - <property name="cursor" > - <cursor>0</cursor> - </property> - <property name="focusPolicy" > - <enum>Qt::NoFocus</enum> - </property> - <property name="contextMenuPolicy" > - <enum>Qt::NoContextMenu</enum> - </property> - <property name="readOnly" > - <bool>true</bool> - </property> - <property name="buttonSymbols" > - <enum>QAbstractSpinBox::UpDownArrows</enum> - </property> - </widget> - </item> - <item row="1" column="1" > - <widget class="QDateTimeEdit" name="dt_pacific" > - <property name="focusPolicy" > - <enum>Qt::NoFocus</enum> - </property> - <property name="contextMenuPolicy" > - <enum>Qt::NoContextMenu</enum> - </property> - <property name="readOnly" > - <bool>true</bool> - </property> - <property name="buttonSymbols" > - <enum>QAbstractSpinBox::UpDownArrows</enum> - </property> - </widget> - </item> - <item row="1" column="0" > - <widget class="QLabel" name="label_8" > - <property name="sizePolicy" > - <sizepolicy> - <hsizetype>0</hsizetype> - <vsizetype>5</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>Cyan time:</string> - </property> - </widget> - </item> - <item row="1" column="2" > - <widget class="QLabel" name="lb_pacific_utc" > - <property name="text" > - <string>UTC -0</string> - </property> - </widget> - </item> - </layout> - </widget> - </widget> - <widget class="QGroupBox" name="gb_dnitime" > - <property name="geometry" > - <rect> - <x>10</x> - <y>220</y> - <width>451</width> - <height>181</height> - </rect> - </property> - <property name="title" > - <string>D'ni time</string> - </property> - <widget class="QGraphicsView" name="gv_dniclock" > - <property name="geometry" > - <rect> - <x>10</x> - <y>20</y> - <width>431</width> - <height>151</height> - </rect> - </property> - <property name="focusPolicy" > - <enum>Qt::NoFocus</enum> - </property> - <property name="contextMenuPolicy" > - <enum>Qt::NoContextMenu</enum> - </property> - <property name="acceptDrops" > - <bool>false</bool> - </property> - <property name="frameShadow" > - <enum>QFrame::Plain</enum> - </property> - <property name="verticalScrollBarPolicy" > - <enum>Qt::ScrollBarAlwaysOff</enum> - </property> - <property name="horizontalScrollBarPolicy" > - <enum>Qt::ScrollBarAlwaysOff</enum> - </property> - <property name="interactive" > - <bool>false</bool> - </property> - <property name="alignment" > - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> - </property> - <property name="renderHints" > - <set>QPainter::Antialiasing|QPainter::SmoothPixmapTransform|QPainter::TextAntialiasing</set> - </property> - </widget> - </widget> </widget> <widget class="QWidget" name="tab_browse" > <attribute name="title" > @@ -2068,8 +2080,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> @@ -2330,8 +2342,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> @@ -2357,8 +2369,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> @@ -2371,6 +2383,22 @@ </widget> </widget> </widget> + <widget class="QDialogButtonBox" name="main_buttonbox" > + <property name="geometry" > + <rect> + <x>10</x> + <y>520</y> + <width>451</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> <widget class="QStatusBar" name="statusbar" /> </widget> Modified: pymoul/trunk/src/moul/qt/utils.py =================================================================== --- pymoul/trunk/src/moul/qt/utils.py 2007-02-23 15:17:20 UTC (rev 185) +++ pymoul/trunk/src/moul/qt/utils.py 2007-02-23 15:19:19 UTC (rev 186) @@ -38,14 +38,17 @@ from PyQt4.QtCore import SIGNAL from PyQt4 import QtGui from PyQt4 import QtCore +from datetime import datetime from types import UnboundMethodType from types import FunctionType from moul.osdependent import __FROZEN__ -from logging import getLogger +from moul.time.utils import normalizeTZ +from moul.time.utils import UTC -LOG = getLogger('moul.qt.utils') +LOG = logging.getLogger('moul.qt.utils') + _marker=object() SLOT_RE = re.compile('^on_(.+)_([^_]+)$') @@ -155,8 +158,8 @@ @type parent: a QObject based instance """ QtCore.QObject.__init__(self, parent) + connectSlotsByName(container=parent, callobj=self) self.initialize() - connectSlotsByName(container=parent, callobj=self) @property def context(self): @@ -504,3 +507,21 @@ if text is None: text = context.trUtf8("Sorry, this feature is not implemented yet!") return infoMB(context, title, text) + +def qdt2dt(qdt, tzinfo=UTC): + """Convert QDateTime to datetime.datetime + """ + uqtd = qdt.toUTC() + qd, qt = uqtd.date(), uqtd.time() + utc_dt = datetime(qd.year(), qd.month(), qd.day(), + qt.hour(), qt.minute(), qt.second(), + tzinfo=UTC) + return normalizeTZ(tzinfo, utc_dt) + +def dt2qdt(dt): + """Convert datetime.datetime to QDateTime + """ + udt = normalizeTZ(UTC, dt) + qd = QtCore.QDate(udt.year, udt.month, udt.day) + qt = QtCore.QTime(udt.hour, udt.minute, udt.second) + return QtCore.QDateTime(qd, qt, QtCore.Qt.UTC) Modified: pymoul/trunk/src/moul/time/utils.py =================================================================== --- pymoul/trunk/src/moul/time/utils.py 2007-02-23 15:17:20 UTC (rev 185) +++ pymoul/trunk/src/moul/time/utils.py 2007-02-23 15:19:19 UTC (rev 186) @@ -28,10 +28,14 @@ pkg_resources.require("pytz>=2006p") from datetime import datetime +from logging import getLogger from pytz import utc as UTC from pytz import timezone from pytz import common_timezones + +LOG = getLogger('timeutils') + # timestamp 0 - start of unix time UNIX_0 = datetime(1970, 1, 1, 0, 0, 0, 0, tzinfo=UTC) @@ -76,16 +80,11 @@ """ return UTC.localize(datetime.utcnow()) -def ts2utc(ts): - """Get utc from time stamp +def normalizeTZ(tz=UTC, dt=None): + """Normalize a datetime object using another tz """ - return UTC.localize(datetime.fromtimestamp(ts)) - -def normalizeTZ(tz, utc_dt=None): - """Normalize a datetime object with UTC tz using another tz - """ - if utc_dt is None: - utc_dt = utcnow() + if dt is None: + dt = utcnow() if isinstance(tz, basestring): tz = timezone(tz) - return tz.normalize(utc_dt.astimezone(tz)) + return tz.normalize(dt.astimezone(tz)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-02-23 15:17:31
|
Revision: 185 http://pymoul.svn.sourceforge.net/pymoul/?rev=185&view=rev Author: tiran Date: 2007-02-23 07:17:20 -0800 (Fri, 23 Feb 2007) Log Message: ----------- Language update Modified Paths: -------------- 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 Modified: pymoul/trunk/src/moul/qt/i18n/pymoul_de.ts =================================================================== --- pymoul/trunk/src/moul/qt/i18n/pymoul_de.ts 2007-02-22 16:35:10 UTC (rev 184) +++ pymoul/trunk/src/moul/qt/i18n/pymoul_de.ts 2007-02-23 15:17:20 UTC (rev 185) @@ -339,13 +339,6 @@ <translation>Tonpriorität</translation> </message> <message> - <source><html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</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></source> - <translation type="unfinished"></translation> - </message> - <message> <source>Not implemented</source> <translation>Nicht implementiert</translation> </message> @@ -358,13 +351,6 @@ <translation>Wollen sie die Änderungen speichern?</translation> </message> <message> - <source><html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</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></source> - <translation type="unfinished"></translation> - </message> - <message> <source>No KI images to repair</source> <translation>Keine KI Bilder zu reparieren</translation> </message> @@ -435,6 +421,68 @@ <source>D'ni Numbers</source> <translation type="unfinished"></translation> </message> + <message> + <source>Choose Time</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Earth Time</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>:</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>/</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>local time</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>cavern time</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>UTC</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>D'ni Time</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Time</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Clock</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Holidays</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>8 Leevosahn</source> + <translation type="unfinished"></translation> + </message> + <message> + <source><html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</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></source> + <translation type="unfinished"></translation> + </message> + <message> + <source><html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</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></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-02-22 16:35:10 UTC (rev 184) +++ pymoul/trunk/src/moul/qt/i18n/pymoul_es.ts 2007-02-23 15:17:20 UTC (rev 185) @@ -331,13 +331,6 @@ <translation type="unfinished"></translation> </message> <message> - <source><html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</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></source> - <translation type="unfinished"></translation> - </message> - <message> <source>Not implemented</source> <translation type="unfinished"></translation> </message> @@ -350,13 +343,6 @@ <translation type="unfinished"></translation> </message> <message> - <source><html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</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></source> - <translation type="unfinished"></translation> - </message> - <message> <source>No KI images to repair</source> <translation type="unfinished"></translation> </message> @@ -425,6 +411,68 @@ <source>D'ni Numbers</source> <translation type="unfinished"></translation> </message> + <message> + <source>Choose Time</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Earth Time</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>:</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>/</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>local time</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>cavern time</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>UTC</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>D'ni Time</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Time</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Clock</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Holidays</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>8 Leevosahn</source> + <translation type="unfinished"></translation> + </message> + <message> + <source><html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</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></source> + <translation type="unfinished"></translation> + </message> + <message> + <source><html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</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></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-02-22 16:35:10 UTC (rev 184) +++ pymoul/trunk/src/moul/qt/i18n/pymoul_fr.ts 2007-02-23 15:17:20 UTC (rev 185) @@ -331,13 +331,6 @@ <translation type="unfinished"></translation> </message> <message> - <source><html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</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></source> - <translation type="unfinished"></translation> - </message> - <message> <source>Not implemented</source> <translation type="unfinished"></translation> </message> @@ -350,13 +343,6 @@ <translation type="unfinished"></translation> </message> <message> - <source><html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</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></source> - <translation type="unfinished"></translation> - </message> - <message> <source>No KI images to repair</source> <translation type="unfinished"></translation> </message> @@ -425,6 +411,68 @@ <source>D'ni Numbers</source> <translation type="unfinished"></translation> </message> + <message> + <source>Choose Time</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Earth Time</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>:</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>/</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>local time</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>cavern time</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>UTC</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>D'ni Time</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Time</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Clock</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Holidays</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>8 Leevosahn</source> + <translation type="unfinished"></translation> + </message> + <message> + <source><html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</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></source> + <translation type="unfinished"></translation> + </message> + <message> + <source><html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</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></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-02-22 16:35:10 UTC (rev 184) +++ pymoul/trunk/src/moul/qt/i18n/pymoul_it.ts 2007-02-23 15:17:20 UTC (rev 185) @@ -331,13 +331,6 @@ <translation type="unfinished"></translation> </message> <message> - <source><html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</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></source> - <translation type="unfinished"></translation> - </message> - <message> <source>Not implemented</source> <translation type="unfinished"></translation> </message> @@ -350,13 +343,6 @@ <translation type="unfinished"></translation> </message> <message> - <source><html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</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></source> - <translation type="unfinished"></translation> - </message> - <message> <source>No KI images to repair</source> <translation type="unfinished"></translation> </message> @@ -425,6 +411,68 @@ <source>D'ni Numbers</source> <translation type="unfinished"></translation> </message> + <message> + <source>Choose Time</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Earth Time</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>:</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>/</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>local time</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>cavern time</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>UTC</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>D'ni Time</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Time</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Clock</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Holidays</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>8 Leevosahn</source> + <translation type="unfinished"></translation> + </message> + <message> + <source><html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</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></source> + <translation type="unfinished"></translation> + </message> + <message> + <source><html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</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></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-02-22 16:35:10 UTC (rev 184) +++ pymoul/trunk/src/moul/qt/i18n/pymoul_nl.ts 2007-02-23 15:17:20 UTC (rev 185) @@ -331,13 +331,6 @@ <translation type="unfinished"></translation> </message> <message> - <source><html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</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></source> - <translation type="unfinished"></translation> - </message> - <message> <source>Not implemented</source> <translation type="unfinished"></translation> </message> @@ -350,13 +343,6 @@ <translation type="unfinished"></translation> </message> <message> - <source><html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</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></source> - <translation type="unfinished"></translation> - </message> - <message> <source>No KI images to repair</source> <translation type="unfinished"></translation> </message> @@ -425,6 +411,68 @@ <source>D'ni Numbers</source> <translation type="unfinished"></translation> </message> + <message> + <source>Choose Time</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Earth Time</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>:</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>/</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>local time</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>cavern time</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>UTC</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>D'ni Time</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Time</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Clock</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Holidays</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>8 Leevosahn</source> + <translation type="unfinished"></translation> + </message> + <message> + <source><html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</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></source> + <translation type="unfinished"></translation> + </message> + <message> + <source><html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</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></source> + <translation type="unfinished"></translation> + </message> </context> <context> <name>SimpleProgressbar</name> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-02-22 16:35:12
|
Revision: 184 http://pymoul.svn.sourceforge.net/pymoul/?rev=184&view=rev Author: tiran Date: 2007-02-22 08:35:10 -0800 (Thu, 22 Feb 2007) Log Message: ----------- ui update Modified Paths: -------------- pymoul/trunk/src/moul/qt/ui/mainwindow.py pymoul/trunk/src/moul/qt/ui/mainwindow.ui Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-02-22 15:48:55 UTC (rev 183) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-02-22 16:35:10 UTC (rev 184) @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'src\moul\qt\ui\mainwindow.ui' # -# Created: Thu Feb 22 16:46:01 2007 +# Created: Thu Feb 22 16:50:00 2007 # by: PyQt4 UI code generator 4.1.1 # # WARNING! All changes made in this file will be lost! Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.ui =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-02-22 15:48:55 UTC (rev 183) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-02-22 16:35:10 UTC (rev 184) @@ -1676,7 +1676,7 @@ </layout> </item> <item row="4" column="0" > - <widget class="QRadioButton" name="rb_dniholiday" > + <widget class="QRadioButton" name="rb_dniholidays" > <property name="text" > <string>D'ni Holiday</string> </property> @@ -1750,13 +1750,6 @@ </widget> </item> <item> - <widget class="QLabel" name="label_4" > - <property name="text" > - <string>.</string> - </property> - </widget> - </item> - <item> <widget class="QComboBox" name="cb_vailee" > <property name="minimumSize" > <size> @@ -1767,13 +1760,6 @@ </widget> </item> <item> - <widget class="QLabel" name="label_6" > - <property name="text" > - <string>.</string> - </property> - </widget> - </item> - <item> <widget class="QSpinBox" name="sb_yahr" > <property name="maximum" > <number>29</number> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-02-22 15:48:55
|
Revision: 183 http://pymoul.svn.sourceforge.net/pymoul/?rev=183&view=rev Author: tiran Date: 2007-02-22 07:48:55 -0800 (Thu, 22 Feb 2007) Log Message: ----------- Changed UI a bit fixed a log error Modified Paths: -------------- pymoul/trunk/build.bat pymoul/trunk/installer.bat pymoul/trunk/run.bat pymoul/trunk/src/moul/log.py pymoul/trunk/src/moul/qt/ui/mainwindow.py pymoul/trunk/src/moul/qt/ui/mainwindow.ui Modified: pymoul/trunk/build.bat =================================================================== --- pymoul/trunk/build.bat 2007-02-22 14:42:24 UTC (rev 182) +++ pymoul/trunk/build.bat 2007-02-22 15:48:55 UTC (rev 183) @@ -1,5 +1,6 @@ @echo off cls set PYTHONPATH=src +python utilities\compileui.py src\moul\qt python setup.py py2exe pause Modified: pymoul/trunk/installer.bat =================================================================== --- pymoul/trunk/installer.bat 2007-02-22 14:42:24 UTC (rev 182) +++ pymoul/trunk/installer.bat 2007-02-22 15:48:55 UTC (rev 183) @@ -2,5 +2,6 @@ cls set PYTHONPATH=src set INNOSETUP=yes +python utilities\compileui.py src\moul\qt python setup.py py2exe pause Modified: pymoul/trunk/run.bat =================================================================== --- pymoul/trunk/run.bat 2007-02-22 14:42:24 UTC (rev 182) +++ pymoul/trunk/run.bat 2007-02-22 15:48:55 UTC (rev 183) @@ -1,5 +1,5 @@ @echo off cls set PYTHONPATH=src +python utilities\compileui.py src\moul\qt python src\moul\qt\moulqt.py -pause Modified: pymoul/trunk/src/moul/log.py =================================================================== --- pymoul/trunk/src/moul/log.py 2007-02-22 14:42:24 UTC (rev 182) +++ pymoul/trunk/src/moul/log.py 2007-02-22 15:48:55 UTC (rev 183) @@ -74,7 +74,7 @@ # MemoryHandler doesn't flush w/o a target self.mhdlr = handlers.MemoryHandler(capacity=4*1024) self.mhdlr.setFormatter(self.format) - self.root.addHandler(mhdlr) + self.root.addHandler(self.mhdlr) def _removeMemoryHdlr(self): """Remove memory handler Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-02-22 14:42:24 UTC (rev 182) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-02-22 15:48:55 UTC (rev 183) @@ -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: Tue Feb 20 15:52:22 2007 +# Created: Thu Feb 22 16:46:01 2007 # by: PyQt4 UI code generator 4.1.1 # # WARNING! All changes made in this file will be lost! @@ -44,6 +44,12 @@ spacerItem1 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout.addItem(spacerItem1) + self.main_buttonbox = QtGui.QDialogButtonBox(self.centralwidget) + self.main_buttonbox.setGeometry(QtCore.QRect(10,520,451,32)) + self.main_buttonbox.setOrientation(QtCore.Qt.Horizontal) + self.main_buttonbox.setStandardButtons(QtGui.QDialogButtonBox.Close|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Reset|QtGui.QDialogButtonBox.Save) + self.main_buttonbox.setObjectName("main_buttonbox") + self.tabwidget = QtGui.QTabWidget(self.centralwidget) self.tabwidget.setGeometry(QtCore.QRect(0,80,471,434)) self.tabwidget.setTabPosition(QtGui.QTabWidget.North) @@ -140,64 +146,6 @@ spacerItem3 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout1.addItem(spacerItem3) - - self.gb_caverntime = QtGui.QGroupBox(self.tab_tasks) - self.gb_caverntime.setGeometry(QtCore.QRect(10,180,451,91)) - self.gb_caverntime.setObjectName("gb_caverntime") - - self.gridLayout = QtGui.QWidget(self.gb_caverntime) - self.gridLayout.setGeometry(QtCore.QRect(20,20,292,56)) - self.gridLayout.setObjectName("gridLayout") - - self.gridlayout1 = QtGui.QGridLayout(self.gridLayout) - self.gridlayout1.setMargin(0) - self.gridlayout1.setSpacing(6) - self.gridlayout1.setObjectName("gridlayout1") - - self.label_5 = QtGui.QLabel(self.gridLayout) - - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(5)) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.label_5.sizePolicy().hasHeightForWidth()) - self.label_5.setSizePolicy(sizePolicy) - self.label_5.setObjectName("label_5") - self.gridlayout1.addWidget(self.label_5,0,0,1,1) - - self.lb_cavern_utc = QtGui.QLabel(self.gridLayout) - self.lb_cavern_utc.setObjectName("lb_cavern_utc") - self.gridlayout1.addWidget(self.lb_cavern_utc,0,2,1,1) - - self.dt_cavern = QtGui.QDateTimeEdit(self.gridLayout) - self.dt_cavern.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape(0))) - self.dt_cavern.setFocusPolicy(QtCore.Qt.NoFocus) - self.dt_cavern.setContextMenuPolicy(QtCore.Qt.NoContextMenu) - self.dt_cavern.setReadOnly(True) - self.dt_cavern.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) - self.dt_cavern.setObjectName("dt_cavern") - self.gridlayout1.addWidget(self.dt_cavern,0,1,1,1) - - self.dt_pacific = QtGui.QDateTimeEdit(self.gridLayout) - self.dt_pacific.setFocusPolicy(QtCore.Qt.NoFocus) - self.dt_pacific.setContextMenuPolicy(QtCore.Qt.NoContextMenu) - self.dt_pacific.setReadOnly(True) - self.dt_pacific.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) - self.dt_pacific.setObjectName("dt_pacific") - self.gridlayout1.addWidget(self.dt_pacific,1,1,1,1) - - self.label_8 = QtGui.QLabel(self.gridLayout) - - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(5)) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.label_8.sizePolicy().hasHeightForWidth()) - self.label_8.setSizePolicy(sizePolicy) - self.label_8.setObjectName("label_8") - self.gridlayout1.addWidget(self.label_8,1,0,1,1) - - self.lb_pacific_utc = QtGui.QLabel(self.gridLayout) - self.lb_pacific_utc.setObjectName("lb_pacific_utc") - self.gridlayout1.addWidget(self.lb_pacific_utc,1,2,1,1) self.tabwidget.addTab(self.tab_tasks,"") self.tab_settings = QtGui.QWidget() @@ -749,80 +697,161 @@ self.tab_time = QtGui.QWidget() self.tab_time.setObjectName("tab_time") - self.gb_dnitime = QtGui.QGroupBox(self.tab_time) - self.gb_dnitime.setGeometry(QtCore.QRect(10,220,451,181)) - self.gb_dnitime.setObjectName("gb_dnitime") - - self.gv_dniclock = QtGui.QGraphicsView(self.gb_dnitime) - self.gv_dniclock.setGeometry(QtCore.QRect(10,20,431,151)) - self.gv_dniclock.setFocusPolicy(QtCore.Qt.NoFocus) - self.gv_dniclock.setContextMenuPolicy(QtCore.Qt.NoContextMenu) - self.gv_dniclock.setAcceptDrops(False) - self.gv_dniclock.setFrameShadow(QtGui.QFrame.Plain) - self.gv_dniclock.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) - self.gv_dniclock.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) - self.gv_dniclock.setInteractive(False) - self.gv_dniclock.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) - self.gv_dniclock.setRenderHints(QtGui.QPainter.Antialiasing|QtGui.QPainter.SmoothPixmapTransform|QtGui.QPainter.TextAntialiasing) - self.gv_dniclock.setObjectName("gv_dniclock") - self.groupBox_3 = QtGui.QGroupBox(self.tab_time) - self.groupBox_3.setGeometry(QtCore.QRect(10,0,451,221)) + self.groupBox_3.setGeometry(QtCore.QRect(10,0,451,151)) self.groupBox_3.setObjectName("groupBox_3") self.gridLayout_5 = QtGui.QWidget(self.groupBox_3) - self.gridLayout_5.setGeometry(QtCore.QRect(10,20,431,184)) + self.gridLayout_5.setGeometry(QtCore.QRect(10,10,444,141)) self.gridLayout_5.setObjectName("gridLayout_5") - self.gridlayout2 = QtGui.QGridLayout(self.gridLayout_5) - self.gridlayout2.setMargin(0) - self.gridlayout2.setSpacing(6) - self.gridlayout2.setObjectName("gridlayout2") + self.gridlayout1 = QtGui.QGridLayout(self.gridLayout_5) + self.gridlayout1.setMargin(0) + self.gridlayout1.setSpacing(6) + self.gridlayout1.setObjectName("gridlayout1") - spacerItem4 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) - self.gridlayout2.addItem(spacerItem4,0,1,1,1) + self.rb_earthtime = QtGui.QRadioButton(self.gridLayout_5) + self.rb_earthtime.setChecked(True) + self.rb_earthtime.setObjectName("rb_earthtime") + self.gridlayout1.addWidget(self.rb_earthtime,1,0,1,1) self.hboxlayout9 = QtGui.QHBoxLayout() self.hboxlayout9.setMargin(0) self.hboxlayout9.setSpacing(6) self.hboxlayout9.setObjectName("hboxlayout9") + self.cb_dniholidays = QtGui.QComboBox(self.gridLayout_5) + self.cb_dniholidays.setObjectName("cb_dniholidays") + self.hboxlayout9.addWidget(self.cb_dniholidays) + + spacerItem4 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) + self.hboxlayout9.addItem(spacerItem4) + self.gridlayout1.addLayout(self.hboxlayout9,4,1,1,1) + + self.rb_curtime = QtGui.QRadioButton(self.gridLayout_5) + self.rb_curtime.setObjectName("rb_curtime") + self.gridlayout1.addWidget(self.rb_curtime,0,0,1,1) + + self.hboxlayout10 = QtGui.QHBoxLayout() + self.hboxlayout10.setMargin(0) + self.hboxlayout10.setSpacing(6) + self.hboxlayout10.setObjectName("hboxlayout10") + + self.sb_gahrtahvo = QtGui.QSpinBox(self.gridLayout_5) + self.sb_gahrtahvo.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) + self.sb_gahrtahvo.setMaximum(4) + self.sb_gahrtahvo.setProperty("value",QtCore.QVariant(0)) + self.sb_gahrtahvo.setObjectName("sb_gahrtahvo") + self.hboxlayout10.addWidget(self.sb_gahrtahvo) + + self.label_9 = QtGui.QLabel(self.gridLayout_5) + self.label_9.setObjectName("label_9") + self.hboxlayout10.addWidget(self.label_9) + + self.sb_tahvo = QtGui.QSpinBox(self.gridLayout_5) + self.sb_tahvo.setMinimumSize(QtCore.QSize(0,0)) + self.sb_tahvo.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) + self.sb_tahvo.setMaximum(24) + self.sb_tahvo.setProperty("value",QtCore.QVariant(0)) + self.sb_tahvo.setObjectName("sb_tahvo") + self.hboxlayout10.addWidget(self.sb_tahvo) + + self.label_10 = QtGui.QLabel(self.gridLayout_5) + self.label_10.setObjectName("label_10") + self.hboxlayout10.addWidget(self.label_10) + + self.sb_gorahn = QtGui.QSpinBox(self.gridLayout_5) + self.sb_gorahn.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) + self.sb_gorahn.setMaximum(24) + self.sb_gorahn.setProperty("value",QtCore.QVariant(0)) + self.sb_gorahn.setObjectName("sb_gorahn") + self.hboxlayout10.addWidget(self.sb_gorahn) + + self.label_11 = QtGui.QLabel(self.gridLayout_5) + self.label_11.setObjectName("label_11") + self.hboxlayout10.addWidget(self.label_11) + + self.sb_prorahn = QtGui.QSpinBox(self.gridLayout_5) + self.sb_prorahn.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) + self.sb_prorahn.setMaximum(24) + self.sb_prorahn.setProperty("value",QtCore.QVariant(0)) + self.sb_prorahn.setObjectName("sb_prorahn") + self.hboxlayout10.addWidget(self.sb_prorahn) + + spacerItem5 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) + self.hboxlayout10.addItem(spacerItem5) + self.gridlayout1.addLayout(self.hboxlayout10,3,1,1,1) + + self.rb_dniholiday = QtGui.QRadioButton(self.gridLayout_5) + self.rb_dniholiday.setObjectName("rb_dniholiday") + self.gridlayout1.addWidget(self.rb_dniholiday,4,0,1,1) + + spacerItem6 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) + self.gridlayout1.addItem(spacerItem6,0,1,1,1) + + self.hboxlayout11 = QtGui.QHBoxLayout() + self.hboxlayout11.setMargin(0) + self.hboxlayout11.setSpacing(6) + self.hboxlayout11.setObjectName("hboxlayout11") + + self.sb_fahrah = QtGui.QSpinBox(self.gridLayout_5) + self.sb_fahrah.setMaximum(15) + self.sb_fahrah.setMinimum(1) + self.sb_fahrah.setProperty("value",QtCore.QVariant(15)) + self.sb_fahrah.setObjectName("sb_fahrah") + self.hboxlayout11.addWidget(self.sb_fahrah) + + self.sb_fahrah_hahr = QtGui.QSpinBox(self.gridLayout_5) + self.sb_fahrah_hahr.setMaximum(249) + self.sb_fahrah_hahr.setMinimum(0) + self.sb_fahrah_hahr.setProperty("value",QtCore.QVariant(87)) + self.sb_fahrah_hahr.setObjectName("sb_fahrah_hahr") + self.hboxlayout11.addWidget(self.sb_fahrah_hahr) + + self.label_12 = QtGui.QLabel(self.gridLayout_5) + self.label_12.setObjectName("label_12") + self.hboxlayout11.addWidget(self.label_12) + self.sb_hahr = QtGui.QSpinBox(self.gridLayout_5) self.sb_hahr.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) self.sb_hahr.setMaximum(9999) self.sb_hahr.setProperty("value",QtCore.QVariant(9662)) self.sb_hahr.setObjectName("sb_hahr") - self.hboxlayout9.addWidget(self.sb_hahr) + self.hboxlayout11.addWidget(self.sb_hahr) + self.label_4 = QtGui.QLabel(self.gridLayout_5) + self.label_4.setObjectName("label_4") + self.hboxlayout11.addWidget(self.label_4) + self.cb_vailee = QtGui.QComboBox(self.gridLayout_5) self.cb_vailee.setMinimumSize(QtCore.QSize(0,0)) self.cb_vailee.setObjectName("cb_vailee") - self.hboxlayout9.addWidget(self.cb_vailee) + self.hboxlayout11.addWidget(self.cb_vailee) + self.label_6 = QtGui.QLabel(self.gridLayout_5) + self.label_6.setObjectName("label_6") + self.hboxlayout11.addWidget(self.label_6) + self.sb_yahr = QtGui.QSpinBox(self.gridLayout_5) self.sb_yahr.setMaximum(29) self.sb_yahr.setMinimum(1) self.sb_yahr.setProperty("value",QtCore.QVariant(1)) self.sb_yahr.setObjectName("sb_yahr") - self.hboxlayout9.addWidget(self.sb_yahr) + self.hboxlayout11.addWidget(self.sb_yahr) - spacerItem5 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) - self.hboxlayout9.addItem(spacerItem5) - self.gridlayout2.addLayout(self.hboxlayout9,2,1,1,1) + spacerItem7 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) + self.hboxlayout11.addItem(spacerItem7) + self.gridlayout1.addLayout(self.hboxlayout11,2,1,1,1) - 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.hboxlayout12 = QtGui.QHBoxLayout() + self.hboxlayout12.setMargin(0) + self.hboxlayout12.setSpacing(6) + self.hboxlayout12.setObjectName("hboxlayout12") - self.hboxlayout10 = QtGui.QHBoxLayout() - self.hboxlayout10.setMargin(0) - self.hboxlayout10.setSpacing(6) - self.hboxlayout10.setObjectName("hboxlayout10") - self.dte_earthtime = QtGui.QDateTimeEdit(self.gridLayout_5) self.dte_earthtime.setCalendarPopup(True) self.dte_earthtime.setObjectName("dte_earthtime") - self.hboxlayout10.addWidget(self.dte_earthtime) + self.hboxlayout12.addWidget(self.dte_earthtime) self.cb_earthtime_tz = QtGui.QComboBox(self.gridLayout_5) self.cb_earthtime_tz.setEnabled(False) @@ -834,89 +863,90 @@ self.cb_earthtime_tz.setSizePolicy(sizePolicy) self.cb_earthtime_tz.setEditable(False) self.cb_earthtime_tz.setObjectName("cb_earthtime_tz") - self.hboxlayout10.addWidget(self.cb_earthtime_tz) + self.hboxlayout12.addWidget(self.cb_earthtime_tz) - spacerItem6 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) - self.hboxlayout10.addItem(spacerItem6) - self.gridlayout2.addLayout(self.hboxlayout10,1,1,1,1) + spacerItem8 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) + self.hboxlayout12.addItem(spacerItem8) + self.gridlayout1.addLayout(self.hboxlayout12,1,1,1,1) - self.hboxlayout11 = QtGui.QHBoxLayout() - self.hboxlayout11.setMargin(0) - self.hboxlayout11.setSpacing(6) - self.hboxlayout11.setObjectName("hboxlayout11") + self.rb_dnitime = QtGui.QRadioButton(self.gridLayout_5) + self.rb_dnitime.setObjectName("rb_dnitime") + self.gridlayout1.addWidget(self.rb_dnitime,2,0,1,1) - self.cb_dniholidays = QtGui.QComboBox(self.gridLayout_5) - self.cb_dniholidays.setObjectName("cb_dniholidays") - self.hboxlayout11.addWidget(self.cb_dniholidays) + self.gb_caverntime = QtGui.QGroupBox(self.tab_time) + self.gb_caverntime.setGeometry(QtCore.QRect(10,150,451,71)) + self.gb_caverntime.setObjectName("gb_caverntime") - spacerItem7 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) - self.hboxlayout11.addItem(spacerItem7) - self.gridlayout2.addLayout(self.hboxlayout11,4,1,1,1) + self.gridLayout = QtGui.QWidget(self.gb_caverntime) + self.gridLayout.setGeometry(QtCore.QRect(10,10,292,56)) + self.gridLayout.setObjectName("gridLayout") - self.hboxlayout12 = QtGui.QHBoxLayout() - self.hboxlayout12.setMargin(0) - self.hboxlayout12.setSpacing(6) - self.hboxlayout12.setObjectName("hboxlayout12") + self.gridlayout2 = QtGui.QGridLayout(self.gridLayout) + self.gridlayout2.setMargin(0) + self.gridlayout2.setSpacing(6) + self.gridlayout2.setObjectName("gridlayout2") - self.sb_gahrtahvo = QtGui.QSpinBox(self.gridLayout_5) - self.sb_gahrtahvo.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) - self.sb_gahrtahvo.setMaximum(4) - self.sb_gahrtahvo.setProperty("value",QtCore.QVariant(0)) - self.sb_gahrtahvo.setObjectName("sb_gahrtahvo") - self.hboxlayout12.addWidget(self.sb_gahrtahvo) + self.label_5 = QtGui.QLabel(self.gridLayout) - self.sb_tahvo = QtGui.QSpinBox(self.gridLayout_5) - self.sb_tahvo.setMinimumSize(QtCore.QSize(0,0)) - self.sb_tahvo.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) - self.sb_tahvo.setMaximum(24) - self.sb_tahvo.setProperty("value",QtCore.QVariant(0)) - self.sb_tahvo.setObjectName("sb_tahvo") - self.hboxlayout12.addWidget(self.sb_tahvo) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(5)) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.label_5.sizePolicy().hasHeightForWidth()) + self.label_5.setSizePolicy(sizePolicy) + self.label_5.setObjectName("label_5") + self.gridlayout2.addWidget(self.label_5,0,0,1,1) - self.sb_gorahn = QtGui.QSpinBox(self.gridLayout_5) - self.sb_gorahn.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) - self.sb_gorahn.setMaximum(24) - self.sb_gorahn.setProperty("value",QtCore.QVariant(0)) - self.sb_gorahn.setObjectName("sb_gorahn") - self.hboxlayout12.addWidget(self.sb_gorahn) + self.lb_cavern_utc = QtGui.QLabel(self.gridLayout) + self.lb_cavern_utc.setObjectName("lb_cavern_utc") + self.gridlayout2.addWidget(self.lb_cavern_utc,0,2,1,1) - self.sb_prorahn = QtGui.QSpinBox(self.gridLayout_5) - self.sb_prorahn.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) - self.sb_prorahn.setMaximum(24) - self.sb_prorahn.setProperty("value",QtCore.QVariant(0)) - self.sb_prorahn.setObjectName("sb_prorahn") - self.hboxlayout12.addWidget(self.sb_prorahn) + self.dt_cavern = QtGui.QDateTimeEdit(self.gridLayout) + self.dt_cavern.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape(0))) + self.dt_cavern.setFocusPolicy(QtCore.Qt.NoFocus) + self.dt_cavern.setContextMenuPolicy(QtCore.Qt.NoContextMenu) + self.dt_cavern.setReadOnly(True) + self.dt_cavern.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) + self.dt_cavern.setObjectName("dt_cavern") + self.gridlayout2.addWidget(self.dt_cavern,0,1,1,1) - spacerItem8 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) - self.hboxlayout12.addItem(spacerItem8) - self.gridlayout2.addLayout(self.hboxlayout12,3,1,1,1) + self.dt_pacific = QtGui.QDateTimeEdit(self.gridLayout) + self.dt_pacific.setFocusPolicy(QtCore.Qt.NoFocus) + self.dt_pacific.setContextMenuPolicy(QtCore.Qt.NoContextMenu) + self.dt_pacific.setReadOnly(True) + self.dt_pacific.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) + self.dt_pacific.setObjectName("dt_pacific") + self.gridlayout2.addWidget(self.dt_pacific,1,1,1,1) - self.rb_earthtime = QtGui.QRadioButton(self.gridLayout_5) - self.rb_earthtime.setChecked(True) - self.rb_earthtime.setObjectName("rb_earthtime") - self.gridlayout2.addWidget(self.rb_earthtime,1,0,1,1) + self.label_8 = QtGui.QLabel(self.gridLayout) - self.rb_curtime = QtGui.QRadioButton(self.gridLayout_5) - self.rb_curtime.setObjectName("rb_curtime") - self.gridlayout2.addWidget(self.rb_curtime,0,0,1,1) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(5)) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.label_8.sizePolicy().hasHeightForWidth()) + self.label_8.setSizePolicy(sizePolicy) + self.label_8.setObjectName("label_8") + self.gridlayout2.addWidget(self.label_8,1,0,1,1) - self.rb_dniholiday = QtGui.QRadioButton(self.gridLayout_5) - self.rb_dniholiday.setObjectName("rb_dniholiday") - self.gridlayout2.addWidget(self.rb_dniholiday,4,0,1,1) + self.lb_pacific_utc = QtGui.QLabel(self.gridLayout) + self.lb_pacific_utc.setObjectName("lb_pacific_utc") + self.gridlayout2.addWidget(self.lb_pacific_utc,1,2,1,1) - self.hboxlayout13 = QtGui.QHBoxLayout() - self.hboxlayout13.setMargin(0) - self.hboxlayout13.setSpacing(6) - self.hboxlayout13.setObjectName("hboxlayout13") + self.gb_dnitime = QtGui.QGroupBox(self.tab_time) + self.gb_dnitime.setGeometry(QtCore.QRect(10,220,451,181)) + self.gb_dnitime.setObjectName("gb_dnitime") - spacerItem9 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) - self.hboxlayout13.addItem(spacerItem9) - - self.pb_time_update = QtGui.QPushButton(self.gridLayout_5) - self.pb_time_update.setMaximumSize(QtCore.QSize(16777215,22)) - self.pb_time_update.setObjectName("pb_time_update") - self.hboxlayout13.addWidget(self.pb_time_update) - self.gridlayout2.addLayout(self.hboxlayout13,5,1,1,1) + self.gv_dniclock = QtGui.QGraphicsView(self.gb_dnitime) + self.gv_dniclock.setGeometry(QtCore.QRect(10,20,431,151)) + self.gv_dniclock.setFocusPolicy(QtCore.Qt.NoFocus) + self.gv_dniclock.setContextMenuPolicy(QtCore.Qt.NoContextMenu) + self.gv_dniclock.setAcceptDrops(False) + self.gv_dniclock.setFrameShadow(QtGui.QFrame.Plain) + self.gv_dniclock.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.gv_dniclock.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.gv_dniclock.setInteractive(False) + self.gv_dniclock.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) + self.gv_dniclock.setRenderHints(QtGui.QPainter.Antialiasing|QtGui.QPainter.SmoothPixmapTransform|QtGui.QPainter.TextAntialiasing) + self.gv_dniclock.setObjectName("gv_dniclock") self.tabwidget.addTab(self.tab_time,"") self.tab_browse = QtGui.QWidget() @@ -1073,12 +1103,6 @@ self.tb_license.setObjectName("tb_license") self.tabwidget_about.addTab(self.tab_sub_license,"") self.tabwidget.addTab(self.tab_about,"") - - self.main_buttonbox = QtGui.QDialogButtonBox(self.centralwidget) - self.main_buttonbox.setGeometry(QtCore.QRect(10,520,451,32)) - self.main_buttonbox.setOrientation(QtCore.Qt.Horizontal) - self.main_buttonbox.setStandardButtons(QtGui.QDialogButtonBox.Close|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Reset|QtGui.QDialogButtonBox.Save) - self.main_buttonbox.setObjectName("main_buttonbox") MainWindow.setCentralWidget(self.centralwidget) self.statusbar = QtGui.QStatusBar(MainWindow) @@ -1109,11 +1133,6 @@ self.groupBox_2.setTitle(QtGui.QApplication.translate("MainWindow", "KI Image repair", None, QtGui.QApplication.UnicodeUTF8)) self.pb_kiimage_repair.setText(QtGui.QApplication.translate("MainWindow", "Repair", None, QtGui.QApplication.UnicodeUTF8)) self.pb_kiimage_repair1.setText(QtGui.QApplication.translate("MainWindow", "Fix KI and avatar images", None, QtGui.QApplication.UnicodeUTF8)) - self.gb_caverntime.setTitle(QtGui.QApplication.translate("MainWindow", "Time zones", None, QtGui.QApplication.UnicodeUTF8)) - self.label_5.setText(QtGui.QApplication.translate("MainWindow", "Cavern time:", None, QtGui.QApplication.UnicodeUTF8)) - self.lb_cavern_utc.setText(QtGui.QApplication.translate("MainWindow", "UTC -0", None, QtGui.QApplication.UnicodeUTF8)) - self.label_8.setText(QtGui.QApplication.translate("MainWindow", "Cyan time:", None, QtGui.QApplication.UnicodeUTF8)) - self.lb_pacific_utc.setText(QtGui.QApplication.translate("MainWindow", "UTC -0", 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)) @@ -1157,22 +1176,32 @@ self.gb_servers.setTitle(QtGui.QApplication.translate("MainWindow", "Ping servers", None, QtGui.QApplication.UnicodeUTF8)) self.button_ping.setText(QtGui.QApplication.translate("MainWindow", "Ping", None, QtGui.QApplication.UnicodeUTF8)) self.tabwidget.setTabText(self.tabwidget.indexOf(self.tab_ping), QtGui.QApplication.translate("MainWindow", "Servers", None, QtGui.QApplication.UnicodeUTF8)) - self.gb_dnitime.setTitle(QtGui.QApplication.translate("MainWindow", "D\'ni time", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_3.setTitle(QtGui.QApplication.translate("MainWindow", "Choose Time", None, QtGui.QApplication.UnicodeUTF8)) - self.rb_dnitime.setText(QtGui.QApplication.translate("MainWindow", "D\'ni Time", None, QtGui.QApplication.UnicodeUTF8)) + self.rb_earthtime.setText(QtGui.QApplication.translate("MainWindow", "Earth Time", None, QtGui.QApplication.UnicodeUTF8)) + self.rb_curtime.setText(QtGui.QApplication.translate("MainWindow", "Current Time", None, QtGui.QApplication.UnicodeUTF8)) + self.label_9.setText(QtGui.QApplication.translate("MainWindow", ":", None, QtGui.QApplication.UnicodeUTF8)) + self.label_10.setText(QtGui.QApplication.translate("MainWindow", ":", None, QtGui.QApplication.UnicodeUTF8)) + self.label_11.setText(QtGui.QApplication.translate("MainWindow", ":", None, QtGui.QApplication.UnicodeUTF8)) + self.rb_dniholiday.setText(QtGui.QApplication.translate("MainWindow", "D\'ni Holiday", None, QtGui.QApplication.UnicodeUTF8)) + self.label_12.setText(QtGui.QApplication.translate("MainWindow", "/", None, QtGui.QApplication.UnicodeUTF8)) + self.label_4.setText(QtGui.QApplication.translate("MainWindow", ".", None, QtGui.QApplication.UnicodeUTF8)) + self.label_6.setText(QtGui.QApplication.translate("MainWindow", ".", None, QtGui.QApplication.UnicodeUTF8)) self.cb_earthtime_tz.addItem(QtGui.QApplication.translate("MainWindow", "local time", None, QtGui.QApplication.UnicodeUTF8)) self.cb_earthtime_tz.addItem(QtGui.QApplication.translate("MainWindow", "cavern time", None, QtGui.QApplication.UnicodeUTF8)) self.cb_earthtime_tz.addItem(QtGui.QApplication.translate("MainWindow", "UTC", None, QtGui.QApplication.UnicodeUTF8)) - self.rb_earthtime.setText(QtGui.QApplication.translate("MainWindow", "Earth Time", None, QtGui.QApplication.UnicodeUTF8)) - self.rb_curtime.setText(QtGui.QApplication.translate("MainWindow", "Current Time", None, QtGui.QApplication.UnicodeUTF8)) - self.rb_dniholiday.setText(QtGui.QApplication.translate("MainWindow", "D\'ni Holiday", None, QtGui.QApplication.UnicodeUTF8)) - self.pb_time_update.setText(QtGui.QApplication.translate("MainWindow", "Update", None, QtGui.QApplication.UnicodeUTF8)) + self.rb_dnitime.setText(QtGui.QApplication.translate("MainWindow", "D\'ni Time", None, QtGui.QApplication.UnicodeUTF8)) + self.gb_caverntime.setTitle(QtGui.QApplication.translate("MainWindow", "Time zones", None, QtGui.QApplication.UnicodeUTF8)) + self.label_5.setText(QtGui.QApplication.translate("MainWindow", "Cavern time:", None, QtGui.QApplication.UnicodeUTF8)) + self.lb_cavern_utc.setText(QtGui.QApplication.translate("MainWindow", "UTC -0", None, QtGui.QApplication.UnicodeUTF8)) + self.label_8.setText(QtGui.QApplication.translate("MainWindow", "Cyan time:", None, QtGui.QApplication.UnicodeUTF8)) + self.lb_pacific_utc.setText(QtGui.QApplication.translate("MainWindow", "UTC -0", 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_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:\'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)) + "</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)) 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)) @@ -1188,13 +1217,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:\'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)) + "</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)) 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:\'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)) + "</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)) 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-02-22 14:42:24 UTC (rev 182) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-02-22 15:48:55 UTC (rev 183) @@ -97,6 +97,22 @@ </item> </layout> </widget> + <widget class="QDialogButtonBox" name="main_buttonbox" > + <property name="geometry" > + <rect> + <x>10</x> + <y>520</y> + <width>451</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> @@ -343,116 +359,6 @@ </layout> </widget> </widget> - <widget class="QGroupBox" name="gb_caverntime" > - <property name="geometry" > - <rect> - <x>10</x> - <y>180</y> - <width>451</width> - <height>91</height> - </rect> - </property> - <property name="title" > - <string>Time zones</string> - </property> - <widget class="QWidget" native="1" name="gridLayout" > - <property name="geometry" > - <rect> - <x>20</x> - <y>20</y> - <width>292</width> - <height>56</height> - </rect> - </property> - <layout class="QGridLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item row="0" column="0" > - <widget class="QLabel" name="label_5" > - <property name="sizePolicy" > - <sizepolicy> - <hsizetype>0</hsizetype> - <vsizetype>5</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>Cavern time:</string> - </property> - </widget> - </item> - <item row="0" column="2" > - <widget class="QLabel" name="lb_cavern_utc" > - <property name="text" > - <string>UTC -0</string> - </property> - </widget> - </item> - <item row="0" column="1" > - <widget class="QDateTimeEdit" name="dt_cavern" > - <property name="cursor" > - <cursor>0</cursor> - </property> - <property name="focusPolicy" > - <enum>Qt::NoFocus</enum> - </property> - <property name="contextMenuPolicy" > - <enum>Qt::NoContextMenu</enum> - </property> - <property name="readOnly" > - <bool>true</bool> - </property> - <property name="buttonSymbols" > - <enum>QAbstractSpinBox::UpDownArrows</enum> - </property> - </widget> - </item> - <item row="1" column="1" > - <widget class="QDateTimeEdit" name="dt_pacific" > - <property name="focusPolicy" > - <enum>Qt::NoFocus</enum> - </property> - <property name="contextMenuPolicy" > - <enum>Qt::NoContextMenu</enum> - </property> - <property name="readOnly" > - <bool>true</bool> - </property> - <property name="buttonSymbols" > - <enum>QAbstractSpinBox::UpDownArrows</enum> - </property> - </widget> - </item> - <item row="1" column="0" > - <widget class="QLabel" name="label_8" > - <property name="sizePolicy" > - <sizepolicy> - <hsizetype>0</hsizetype> - <vsizetype>5</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>Cyan time:</string> - </property> - </widget> - </item> - <item row="1" column="2" > - <widget class="QLabel" name="lb_pacific_utc" > - <property name="text" > - <string>UTC -0</string> - </property> - </widget> - </item> - </layout> - </widget> - </widget> </widget> <widget class="QWidget" name="tab_settings" > <attribute name="title" > @@ -1596,63 +1502,13 @@ <attribute name="title" > <string>Time</string> </attribute> - <widget class="QGroupBox" name="gb_dnitime" > - <property name="geometry" > - <rect> - <x>10</x> - <y>220</y> - <width>451</width> - <height>181</height> - </rect> - </property> - <property name="title" > - <string>D'ni time</string> - </property> - <widget class="QGraphicsView" name="gv_dniclock" > - <property name="geometry" > - <rect> - <x>10</x> - <y>20</y> - <width>431</width> - <height>151</height> - </rect> - </property> - <property name="focusPolicy" > - <enum>Qt::NoFocus</enum> - </property> - <property name="contextMenuPolicy" > - <enum>Qt::NoContextMenu</enum> - </property> - <property name="acceptDrops" > - <bool>false</bool> - </property> - <property name="frameShadow" > - <enum>QFrame::Plain</enum> - </property> - <property name="verticalScrollBarPolicy" > - <enum>Qt::ScrollBarAlwaysOff</enum> - </property> - <property name="horizontalScrollBarPolicy" > - <enum>Qt::ScrollBarAlwaysOff</enum> - </property> - <property name="interactive" > - <bool>false</bool> - </property> - <property name="alignment" > - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> - </property> - <property name="renderHints" > - <set>QPainter::Antialiasing|QPainter::SmoothPixmapTransform|QPainter::TextAntialiasing</set> - </property> - </widget> - </widget> <widget class="QGroupBox" name="groupBox_3" > <property name="geometry" > <rect> <x>10</x> <y>0</y> <width>451</width> - <height>221</height> + <height>151</height> </rect> </property> <property name="title" > @@ -1662,9 +1518,9 @@ <property name="geometry" > <rect> <x>10</x> - <y>20</y> - <width>431</width> - <height>184</height> + <y>10</y> + <width>444</width> + <height>141</height> </rect> </property> <layout class="QGridLayout" > @@ -1674,6 +1530,158 @@ <property name="spacing" > <number>6</number> </property> + <item row="1" column="0" > + <widget class="QRadioButton" name="rb_earthtime" > + <property name="text" > + <string>Earth Time</string> + </property> + <property name="checked" > + <bool>true</bool> + </property> + </widget> + </item> + <item row="4" column="1" > + <layout class="QHBoxLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QComboBox" name="cb_dniholidays" /> + </item> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item row="0" column="0" > + <widget class="QRadioButton" name="rb_curtime" > + <property name="text" > + <string>Current Time</string> + </property> + </widget> + </item> + <item row="3" column="1" > + <layout class="QHBoxLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QSpinBox" name="sb_gahrtahvo" > + <property name="buttonSymbols" > + <enum>QAbstractSpinBox::UpDownArrows</enum> + </property> + <property name="maximum" > + <number>4</number> + </property> + <property name="value" > + <number>0</number> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_9" > + <property name="text" > + <string>:</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="sb_tahvo" > + <property name="minimumSize" > + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="buttonSymbols" > + <enum>QAbstractSpinBox::UpDownArrows</enum> + </property> + <property name="maximum" > + <number>24</number> + </property> + <property name="value" > + <number>0</number> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_10" > + <property name="text" > + <string>:</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="sb_gorahn" > + <property name="buttonSymbols" > + <enum>QAbstractSpinBox::UpDownArrows</enum> + </property> + <property name="maximum" > + <number>24</number> + </property> + <property name="value" > + <number>0</number> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_11" > + <property name="text" > + <string>:</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="sb_prorahn" > + <property name="buttonSymbols" > + <enum>QAbstractSpinBox::UpDownArrows</enum> + </property> + <property name="maximum" > + <number>24</number> + </property> + <property name="value" > + <number>0</number> + </property> + </widget> + </item> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item row="4" column="0" > + <widget class="QRadioButton" name="rb_dniholiday" > + <property name="text" > + <string>D'ni Holiday</string> + </property> + </widget> + </item> <item row="0" column="1" > <spacer> <property name="orientation" > @@ -1696,6 +1704,39 @@ <number>6</number> </property> <item> + <widget class="QSpinBox" name="sb_fahrah" > + <property name="maximum" > + <number>15</number> + </property> + <property name="minimum" > + <number>1</number> + </property> + <property name="value" > + <number>15</number> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="sb_fahrah_hahr" > + <property name="maximum" > + <number>249</number> + </property> + <property name="minimum" > + <number>0</number> + </property> + <property name="value" > + <number>87</number> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_12" > + <property name="text" > + <string>/</string> + </property> + </widget> + </item> + <item> <widget class="QSpinBox" name="sb_hahr" > <property name="buttonSymbols" > <enum>QAbstractSpinBox::UpDownArrows</enum> @@ -1709,6 +1750,13 @@ </widget> </item> <item> + <widget class="QLabel" name="label_4" > + <property name="text" > + <string>.</string> + </property> + </widget> + </item> + <item> <widget class="QComboBox" name="cb_vailee" > <property name="minimumSize" > <size> @@ -1719,6 +1767,13 @@ </widget> </item> <item> + <widget class="QLabel" name="label_6" > + <property name="text" > + <string>.</string> + </property> + </widget> + </item> + <item> <widget class="QSpinBox" name="sb_yahr" > <property name="maximum" > <number>29</number> @@ -1746,13 +1801,6 @@ </item> </layout> </item> - <item row="2" column="0" > - <widget class="QRadioButton" name="rb_dnitime" > - <property name="text" > - <string>D'ni Time</string> - </property> - </widget> - </item> <item row="1" column="1" > <layout class="QHBoxLayout" > <property name="margin" > @@ -1816,176 +1864,176 @@ </item> </layout> </item> - <item row="4" column="1" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> + <item row="2" column="0" > + <widget class="QRadioButton" name="rb_dnitime" > + <property name="text" > + <string>D'ni Time</string> </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QComboBox" name="cb_dniholidays" /> - </item> - <item> - <spacer> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> + </widget> </item> - <item row="3" column="1" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> + </layout> + </widget> + </widget> + <widget class="QGroupBox" name="gb_caverntime" > + <property name="geometry" > + <rect> + <x>10</x> + <y>150</y> + <width>451</width> + <height>71</height> + </rect> + </property> + <property name="title" > + <string>Time zones</string> + </property> + <widget class="QWidget" native="1" name="gridLayout" > + <property name="geometry" > + <rect> + <x>10</x> + <y>10</y> + <width>292</width> + <height>56</height> + </rect> + </property> + <layout class="QGridLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item row="0" column="0" > + <widget class="QLabel" name="label_5" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - <property name="spacing" > - <number>6</number> + <property name="text" > + <string>Cavern time:</string> </property> - <item> - <widget class="QSpinBox" name="sb_gahrtahvo" > - <property name="buttonSymbols" > - <enum>QAbstractSpinBox::UpDownArrows</enum> - </property> - <property name="maximum" > - <number>4</number> - </property> - <property name="value" > - <number>0</number> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="sb_tahvo" > - <property name="minimumSize" > - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="buttonSymbols" > - <enum>QAbstractSpinBox::UpDownArrows</enum> - </property> - <property name="maximum" > - <number>24</number> - </property> - <property name="value" > - <number>0</number> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="sb_gorahn" > - <property name="buttonSymbols" > - <enum>QAbstractSpinBox::UpDownArrows</enum> - </property> - <property name="maximum" > - <number>24</number> - </property> - <property name="value" > - <number>0</number> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="sb_prorahn" > - <property name="buttonSymbols" > - <enum>QAbstractSpinBox::UpDownArrows</enum> - </property> - <property name="maximum" > - <number>24</number> - </property> - <property name="value" > - <number>0</number> - </property> - </widget> - </item> - <item> - <spacer> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> + </widget> </item> - <item row="1" column="0" > - <widget class="QRadioButton" name="rb_earthtime" > + <item row="0" column="2" > + <widget class="QLabel" name="lb_cavern_utc" > <property name="text" > - <string>Earth Time</string> + <string>UTC -0</string> </property> - <property name="checked" > + </widget> + </item> + <item row="0" column="1" > + <widget class="QDateTimeEdit" name="dt_cavern" > + <property name="cursor" > + <cursor>0</cursor> + </property> + <property name="focusPolicy" > + <enum>Qt::NoFocus</enum> + </property> + <property name="contextMenuPolicy" > + <enum>Qt::NoContextMenu</enum> + </property> + <property name="readOnly" > <bool>true</bool> </property> + <property name="buttonSymbols" > + <enum>QAbstractSpinBox::UpDownArrows</enum> + </property> </widget> </item> - <item row="0" column="0" > - <widget class="QRadioButton" name="rb_curtime" > - <property name="text" > - <string>Current Time</string> + <item row="1" column="1" > + <widget class="QDateTimeEdit" name="dt_pacific" > + <property name="focusPolicy" > + <enum>Qt::NoFocus</enum> </property> + <property name="contextMenuPolicy" > + <enum>Qt::NoContextMenu</enum> + </property> + <property name="readOnly" > + <bool>true</bool> + </property> + <property name="buttonSymbols" > + <enum>QAbstractSpinBox::UpDownArrows</enum> + </property> </widget> </item> - <item row="4" column="0" > - <widget class="QRadioButton" name="rb_dniholiday" > + <item row="1" column="0" > + <widget class="QLabel" name="label_8" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="text" > - <string>D'ni Holiday</string> + <string>Cyan time:</string> </property> </widget> </item> - <item row="5" column="1" > - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> + <item row="1" column="2" > + <widget class="QLabel" name="lb_pacific_utc" > + <property name="text" > + <string>UTC -0</string> </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <spacer> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="pb_time_update" > - <property name="maximumSize" > - <size> - <width>16777215</width> - <height>22</height> - </size> - </property> - <property name="text" > - <string>Update</string> - </property> - </widget> - </item> - </layout> + </widget> </item> </layout> </widget> </widget> + <widget class="QGroupBox" name="gb_dnitime" > + <property name="geometry" > + <rect> + <x>10</x> + <y>220</y> + <width>451</width> + <height>181</height> + </rect> + </property> + <property name="title" > + <string>D'ni time</string> + </property> + <widget class="QGraphicsView" name="gv_dniclock" > + <property name="geometry" > + <rect> + <x>10</x> + <y>20</y> + <width>431</width> + <height>151</height> + </rect> + </property> + <property name="focusPolicy" > + <enum>Qt::NoFocus</enum> + </property> + <property name="contextMenuPolicy" > + <enum>Qt::NoContextMenu</enum> + </property> + <property name="acceptDrops" > + <bool>false</bool> + </property> + <property name="frameShadow" > + <enum>QFrame::Plain</enum> + </property> + <property name="verticalScrollBarPolicy" > + <enum>Qt::ScrollBarAlwaysOff</enum> + </property> + <property name="horizontalScrollBarPolicy" > + <enum>Qt::ScrollBarAlwaysOff</enum> + </property> + <property name="interactive" > + <bool>false</bool> + </property> + <property name="alignment" > + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> + <property name="renderHints" > + <set>QPainter::Antialiasing|QPainter::SmoothPixmapTransform|QPainter::TextAntialiasing</set> + </property> + </widget> + </widget> </widget> <widget class="QWidget" name="tab_browse" > <attribute name="title" > @@ -2034,8 +2082,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:'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> +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400;... [truncated message content] |
From: <ti...@us...> - 2007-02-22 14:42:23
|
Revision: 182 http://pymoul.svn.sourceforge.net/pymoul/?rev=182&view=rev Author: tiran Date: 2007-02-22 06:42:24 -0800 (Thu, 22 Feb 2007) Log Message: ----------- Clean up logging Modified Paths: -------------- pymoul/trunk/src/moul/crypt/whatdoyousee.py pymoul/trunk/src/moul/file/chatlog.py pymoul/trunk/src/moul/file/directory.py pymoul/trunk/src/moul/file/kiimage.py pymoul/trunk/src/moul/file/localization.py pymoul/trunk/src/moul/file/plasmalog.py pymoul/trunk/src/moul/file/wdysini.py pymoul/trunk/src/moul/log.py pymoul/trunk/src/moul/osdependent/darwin/__init__.py pymoul/trunk/src/moul/osdependent/linux/__init__.py pymoul/trunk/src/moul/osdependent/win32/__init__.py pymoul/trunk/src/moul/qt/dninumbers.py pymoul/trunk/src/moul/qt/errorhandler.py pymoul/trunk/src/moul/qt/i18n/__init__.py pymoul/trunk/src/moul/qt/localization.py pymoul/trunk/src/moul/qt/mainwindow.py pymoul/trunk/src/moul/qt/moulqt.py pymoul/trunk/src/moul/qt/utils.py pymoul/trunk/src/moul/qt/wdysini.py pymoul/trunk/src/moul/time/utils.py Modified: pymoul/trunk/src/moul/crypt/whatdoyousee.py =================================================================== --- pymoul/trunk/src/moul/crypt/whatdoyousee.py 2007-02-22 14:14:24 UTC (rev 181) +++ pymoul/trunk/src/moul/crypt/whatdoyousee.py 2007-02-22 14:42:24 UTC (rev 182) @@ -33,7 +33,7 @@ from moul.crypt.xtea import xtea_decrypt from moul.crypt.xtea import xtea_encrypt from moul.crypt.binary import BinaryFile -from moul.log import getLogger +from logging import getLogger HEADER = "whatdoyousee" Modified: pymoul/trunk/src/moul/file/chatlog.py =================================================================== --- pymoul/trunk/src/moul/file/chatlog.py 2007-02-22 14:14:24 UTC (rev 181) +++ pymoul/trunk/src/moul/file/chatlog.py 2007-02-22 14:42:24 UTC (rev 182) @@ -39,7 +39,7 @@ from time import localtime from moul.file.utils import fileModTime -from moul.log import getLogger +from logging import getLogger RE_FLAGS = re.LOCALE Modified: pymoul/trunk/src/moul/file/directory.py =================================================================== --- pymoul/trunk/src/moul/file/directory.py 2007-02-22 14:14:24 UTC (rev 181) +++ pymoul/trunk/src/moul/file/directory.py 2007-02-22 14:42:24 UTC (rev 182) @@ -30,7 +30,7 @@ from moul.file.plasmalog import PlasmalogZipper from moul.file.wdysini import AudioIni from moul.file.wdysini import GraphicsIni -from moul.log import getLogger +from logging import getLogger LOG = getLogger('moul.file.directory') Modified: pymoul/trunk/src/moul/file/kiimage.py =================================================================== --- pymoul/trunk/src/moul/file/kiimage.py 2007-02-22 14:14:24 UTC (rev 181) +++ pymoul/trunk/src/moul/file/kiimage.py 2007-02-22 14:42:24 UTC (rev 182) @@ -29,7 +29,7 @@ from moul.file.utils import fileModTime from moul.file.utils import fileSize -from moul.log import getLogger +from logging import getLogger KINUMBER_RE = re.compile("(\d+)\.jpg$", re.IGNORECASE) JPEG_HEADER = "\377\330\377" Modified: pymoul/trunk/src/moul/file/localization.py =================================================================== --- pymoul/trunk/src/moul/file/localization.py 2007-02-22 14:14:24 UTC (rev 181) +++ pymoul/trunk/src/moul/file/localization.py 2007-02-22 14:42:24 UTC (rev 182) @@ -26,7 +26,7 @@ from xml.sax.handler import feature_namespaces from xml.sax.saxutils import unescape -from moul.log import getLogger +from logging import getLogger __author__ = "Christian Heimes" __version__ = "$Id$" Modified: pymoul/trunk/src/moul/file/plasmalog.py =================================================================== --- pymoul/trunk/src/moul/file/plasmalog.py 2007-02-22 14:14:24 UTC (rev 181) +++ pymoul/trunk/src/moul/file/plasmalog.py 2007-02-22 14:42:24 UTC (rev 182) @@ -29,7 +29,7 @@ from moul.crypt.elf import decryptElf from moul.file.utils import fileModTime -from moul.log import getLogger +from logging import getLogger PLASMA_LOG = "plasmalog.txt" Modified: pymoul/trunk/src/moul/file/wdysini.py =================================================================== --- pymoul/trunk/src/moul/file/wdysini.py 2007-02-22 14:14:24 UTC (rev 181) +++ pymoul/trunk/src/moul/file/wdysini.py 2007-02-22 14:42:24 UTC (rev 182) @@ -26,7 +26,7 @@ from moul.crypt.whatdoyousee import decryptWDYS from moul.crypt.whatdoyousee import encryptWDYS -from moul.log import getLogger +from logging import getLogger LOG = getLogger('moul.file.wdysini') Modified: pymoul/trunk/src/moul/log.py =================================================================== --- pymoul/trunk/src/moul/log.py 2007-02-22 14:14:24 UTC (rev 181) +++ pymoul/trunk/src/moul/log.py 2007-02-22 14:42:24 UTC (rev 182) @@ -35,98 +35,109 @@ from moul.metadata import __version__ as moul_version +LOG = logging.getLogger('pyMoul') -getLogger = logging.getLogger - -__FROZEN__ = bool(getattr(sys, 'frozen', False)) - -format = Formatter('%(asctime)s %(name)-8s %(levelname)-7s %(message)s', - #'%a, %d %b %Y %H:%M:%S' - '%H:%M:%S') -root = getLogger() -root.setLevel(logging.DEBUG) -LOG = getLogger('pyMoul') - class LoggingStdout(object): """Replacement for stdout/stderr IO """ __slot__ = ('_logfunc',) - + def __init__(self, logfunc): self._logfunc = logfunc - + def write(self, value): while value.endswith('\n'): value = value[:-1] if value: self._logfunc(value) -mhdlr = None -fhdlr = None -def _installMemoryHdlr(): - """setup a memory handler to store records before we have the - infrastructure to log events to a file +class LoggerSetup(object): + """Setup logger """ - global mhdlr - mhdlr = handlers.MemoryHandler(capacity=4*1024) # MemoryHandler doesn't flush w/o a target - mhdlr.setFormatter(format) - root.addHandler(mhdlr) + format = Formatter('%(asctime)s %(name)-8s %(levelname)-7s %(message)s', + #'%a, %d %b %Y %H:%M:%S' + '%H:%M:%S') -def _removeMemoryHdlr(): - """Remove memory handler - """ - global mhdlr - global fhdlr - if mhdlr: - mhdlr.setTarget(fhdlr) - mhdlr.flush() - root.removeHandler(mhdlr) - del mhdlr + frozen = bool(getattr(sys, 'frozen', False)) + level = logging.DEBUG -def _installFileHdlr(): - """Install a file handler - """ - global fhdlr - from moul.config import getPyMoulDataDir - logFile = os.path.join(getPyMoulDataDir(check=True), 'pymoul.log') - LOG.info("Adding file logger: %s" % logFile) - fhdlr = handlers.RotatingFileHandler(logFile, backupCount=9) - fhdlr.setFormatter(format) - root.addHandler(fhdlr) - fhdlr.doRollover() + def __init__(self): + self.root = logging.getLogger() + self.root.setLevel(self.level) + self.mhdlr = None + self.fhdlr = None -def _systemInfo(): - from moul.osdependent import __INFO__ - LOG.info("time: " + time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime())) - LOG.info("pyMoul version: %s" % moul_version) - LOG.info("Python: %s" % repr(sys.version_info)) - LOG.info("Python: %s" % sys.version.replace('\n', ' ')) - LOG.info("Platform: %s, OS name: %s" % (sys.platform, os.name)) - LOG.info("system %r, node %r, release %r, version %r, machine %r, processor %r" - % platform.uname()) - LOG.info("platform name: %s" % platform.platform(True)) - LOG.info("sys.frozen status: %s" % __FROZEN__) - LOG.info("OS detected: win32: %r, cygwin: %r, Linux: %r, Mac: %r, BSD: %r, " - "posix/Un*x: %r, NT: %r" % __INFO__) + def _installMemoryHdlr(self): + """setup a memory handler to store records before we have the + infrastructure to log events to a file + """ + # MemoryHandler doesn't flush w/o a target + self.mhdlr = handlers.MemoryHandler(capacity=4*1024) + self.mhdlr.setFormatter(self.format) + self.root.addHandler(mhdlr) -# no setup the logging stuff! + def _removeMemoryHdlr(self): + """Remove memory handler -if not __FROZEN__: - # Add streaming handler to sys.stderr. - # Only log to stderr when the program is not frozen! - shdlr = logging.StreamHandler(sys.stderr) - shdlr.setFormatter(format) - root.addHandler(shdlr) - #_systemInfo() -else: - _installMemoryHdlr() - _systemInfo() + Flush content to file handler + """ + if self.mhdlr: + self.mhdlr.setTarget(self.fhdlr) + self.mhdlr.flush() + self.root.removeHandler(self.mhdlr) + self.mhdlr = None -def createLogfile(): - """Create log file and redirect stdout/stderr to logfile - """ - _installFileHdlr() - _removeMemoryHdlr() - # Redirect stdout and stderr to logger when running as frozen app - #sys.stdout = LoggingStdout(getLogger('stdout').info) - #sys.stderr = LoggingStdout(getLogger('stderr').error) + def _installFileHdlr(self): + """Install a file handler + """ + from moul.config import getPyMoulDataDir + logFile = os.path.join(getPyMoulDataDir(check=True), 'pymoul.log') + LOG.info("Adding file logger: %s" % logFile) + self.fhdlr = handlers.RotatingFileHandler(logFile, backupCount=9) + self.fhdlr.setFormatter(self.format) + self.root.addHandler(self.fhdlr) + self.fhdlr.doRollover() + + def _installStreamStderr(self): + """Install stream handler to stderr + """ + shdlr = logging.StreamHandler(sys.stderr) + shdlr.setFormatter(self.format) + self.root.addHandler(shdlr) + + def _redirectStdout(self): + """Redirect stdout and stderr to logger + """ + sys.stdout = LoggingStdout(getLogger('stdout').info) + sys.stderr = LoggingStdout(getLogger('stderr').error) + + def _systemInfo(self): + from moul.osdependent import __INFO__ + LOG.info("time: " + time.strftime("%a, %d %b %Y %H:%M:%S +0000", + time.gmtime())) + LOG.info("pyMoul version: %s" % moul_version) + LOG.info("Python: %s" % repr(sys.version_info)) + LOG.info("Python: %s" % sys.version.replace('\n', ' ')) + LOG.info("Platform: %s, OS name: %s" % (sys.platform, os.name)) + LOG.info("system %r, node %r, release %r, version %r, machine %r, " + "processor %r" % platform.uname()) + LOG.info("platform name: %s" % platform.platform(True)) + LOG.info("sys.frozen status: %s" % self.frozen) + LOG.info("OS detected: win32: %r, cygwin: %r, Linux: %r, Mac: %r, " + "BSD: %r, posix/Un*x: %r, NT: %r" % __INFO__) + + def __call__(self): + if not self.frozen: + self._installStreamStderr() + else: + self._installMemoryHdlr() + self._systemInfo() + + def createLogfile(self): + self._installFileHdlr() + self._removeMemoryHdlr() + +loggerSetup = LoggerSetup() +createLogfile = loggerSetup.createLogfile + +loggerSetup() Modified: pymoul/trunk/src/moul/osdependent/darwin/__init__.py =================================================================== --- pymoul/trunk/src/moul/osdependent/darwin/__init__.py 2007-02-22 14:14:24 UTC (rev 181) +++ pymoul/trunk/src/moul/osdependent/darwin/__init__.py 2007-02-22 14:42:24 UTC (rev 182) @@ -24,7 +24,7 @@ import os from subprocess import Popen -from moul.log import getLogger +from logging import getLogger LOG = getLogger('moul.darwin') Modified: pymoul/trunk/src/moul/osdependent/linux/__init__.py =================================================================== --- pymoul/trunk/src/moul/osdependent/linux/__init__.py 2007-02-22 14:14:24 UTC (rev 181) +++ pymoul/trunk/src/moul/osdependent/linux/__init__.py 2007-02-22 14:42:24 UTC (rev 182) @@ -25,7 +25,7 @@ from subprocess import Popen from moul.osdependent.processinfo import getPidNames -from moul.log import getLogger +from logging import getLogger LOG = getLogger('moul.linux') Modified: pymoul/trunk/src/moul/osdependent/win32/__init__.py =================================================================== --- pymoul/trunk/src/moul/osdependent/win32/__init__.py 2007-02-22 14:14:24 UTC (rev 181) +++ pymoul/trunk/src/moul/osdependent/win32/__init__.py 2007-02-22 14:42:24 UTC (rev 182) @@ -24,7 +24,7 @@ import os from subprocess import Popen -from moul.log import getLogger +from logging import getLogger from moul.osdependent.processinfo import getPidNames from moul.osdependent.win32 import winpath Modified: pymoul/trunk/src/moul/qt/dninumbers.py =================================================================== --- pymoul/trunk/src/moul/qt/dninumbers.py 2007-02-22 14:14:24 UTC (rev 181) +++ pymoul/trunk/src/moul/qt/dninumbers.py 2007-02-22 14:42:24 UTC (rev 182) @@ -40,7 +40,7 @@ from moul.time.dni import DNI_HOLIDAYS from moul.time.utils import ts2utc from moul.time.utils import utcnow -from moul.log import getLogger +from logging import getLogger from moul.qt.utils import QNamespaceContainer from moul.qt.utils import QSignalLoggerMetaclass from moul.qt.utils import skipLogging Modified: pymoul/trunk/src/moul/qt/errorhandler.py =================================================================== --- pymoul/trunk/src/moul/qt/errorhandler.py 2007-02-22 14:14:24 UTC (rev 181) +++ pymoul/trunk/src/moul/qt/errorhandler.py 2007-02-22 14:42:24 UTC (rev 182) @@ -31,7 +31,7 @@ from PyQt4.QtGui import QApplication from traceback import format_exception -from moul.log import getLogger +from logging import getLogger from moul.qt.utils import criticalMB Modified: pymoul/trunk/src/moul/qt/i18n/__init__.py =================================================================== --- pymoul/trunk/src/moul/qt/i18n/__init__.py 2007-02-22 14:14:24 UTC (rev 181) +++ pymoul/trunk/src/moul/qt/i18n/__init__.py 2007-02-22 14:42:24 UTC (rev 182) @@ -29,7 +29,7 @@ from PyQt4 import QtCore from moul.osdependent import __FROZEN__ -from moul.log import getLogger +from logging import getLogger LOG = getLogger('moul.qt.i18n') Modified: pymoul/trunk/src/moul/qt/localization.py =================================================================== --- pymoul/trunk/src/moul/qt/localization.py 2007-02-22 14:14:24 UTC (rev 181) +++ pymoul/trunk/src/moul/qt/localization.py 2007-02-22 14:42:24 UTC (rev 182) @@ -31,7 +31,7 @@ from PyQt4.QtCore import pyqtSignature from moul.file.localization import translationRegistry as tr -from moul.log import getLogger +from logging import getLogger from moul.qt.simpleprogressbar import SimpleProgressbar from moul.qt.utils import QYieldingThreadlet Modified: pymoul/trunk/src/moul/qt/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/mainwindow.py 2007-02-22 14:14:24 UTC (rev 181) +++ pymoul/trunk/src/moul/qt/mainwindow.py 2007-02-22 14:42:24 UTC (rev 182) @@ -36,7 +36,7 @@ from moul.config import lookupDir from moul.file.directory import UruGameDataDirectory from moul.file.directory import UruPersonalDataDirectory -from moul.log import getLogger +from logging import getLogger from moul.osdependent import isMoulRunning from moul.server.ping import ServerList from moul.server.ping import isSocketError Modified: pymoul/trunk/src/moul/qt/moulqt.py =================================================================== --- pymoul/trunk/src/moul/qt/moulqt.py 2007-02-22 14:14:24 UTC (rev 181) +++ pymoul/trunk/src/moul/qt/moulqt.py 2007-02-22 14:42:24 UTC (rev 182) @@ -23,12 +23,13 @@ __version__ = "$Id$" __revision__ = "$Revision$" +from moul.log import createLogfile + import sys from PyQt4 import QtGui +from logging import getLogger from moul.config import getPyMoulDataDir -from moul.log import createLogfile -from moul.log import getLogger from moul.osdependent import isMoulRunning from moul.osdependent.singleapp import SimpleSingleApp Modified: pymoul/trunk/src/moul/qt/utils.py =================================================================== --- pymoul/trunk/src/moul/qt/utils.py 2007-02-22 14:14:24 UTC (rev 181) +++ pymoul/trunk/src/moul/qt/utils.py 2007-02-22 14:42:24 UTC (rev 182) @@ -42,7 +42,7 @@ from types import FunctionType from moul.osdependent import __FROZEN__ -from moul.log import getLogger +from logging import getLogger LOG = getLogger('moul.qt.utils') Modified: pymoul/trunk/src/moul/qt/wdysini.py =================================================================== --- pymoul/trunk/src/moul/qt/wdysini.py 2007-02-22 14:14:24 UTC (rev 181) +++ pymoul/trunk/src/moul/qt/wdysini.py 2007-02-22 14:42:24 UTC (rev 182) @@ -36,7 +36,7 @@ from moul.file.directory import UruGameDataDirectory from moul.file.directory import UruPersonalDataDirectory from moul.file.wdysini import videoModes -from moul.log import getLogger +from logging import getLogger from moul.qt.utils import QNamespaceContainer from moul.qt.utils import QSignalLoggerMetaclass from moul.qt.utils import questionMB Modified: pymoul/trunk/src/moul/time/utils.py =================================================================== --- pymoul/trunk/src/moul/time/utils.py 2007-02-22 14:14:24 UTC (rev 181) +++ pymoul/trunk/src/moul/time/utils.py 2007-02-22 14:42:24 UTC (rev 182) @@ -65,9 +65,9 @@ >>> from datetime import timedelta >>> td2sec(timedelta(0, 3600)) - 3600 + 3600.0 >>> td2sec(timedelta(0, -3600)) - -3600 + -3600.0 """ return 86400 * td.days + td.seconds + td.microseconds/1000000.0 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-02-22 14:14:31
|
Revision: 181 http://pymoul.svn.sourceforge.net/pymoul/?rev=181&view=rev Author: tiran Date: 2007-02-22 06:14:24 -0800 (Thu, 22 Feb 2007) Log Message: ----------- Time fixes (round microseconds) Moved Threadlets to utils Modified Paths: -------------- pymoul/trunk/src/moul/qt/dninumbers.py pymoul/trunk/src/moul/qt/localization.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/utils.py pymoul/trunk/src/moul/time/dni.py pymoul/trunk/src/moul/time/utils.py Removed Paths: ------------- pymoul/trunk/src/moul/qt/threadlet.py Modified: pymoul/trunk/src/moul/qt/dninumbers.py =================================================================== --- pymoul/trunk/src/moul/qt/dninumbers.py 2007-02-19 20:12:39 UTC (rev 180) +++ pymoul/trunk/src/moul/qt/dninumbers.py 2007-02-22 14:14:24 UTC (rev 181) @@ -22,9 +22,10 @@ __version__ = "$Id$" __revision__ = "$Revision$" +import math import operator -import math import sys +import time from PyQt4 import QtCore from PyQt4 import QtGui from PyQt4.QtCore import Qt @@ -35,10 +36,15 @@ from moul.time.dni import DniTime from moul.time.dni import FACTOR_SP from moul.time.dni import decimal2dni +from moul.time.dni import VAILEETEE +from moul.time.dni import DNI_HOLIDAYS +from moul.time.utils import ts2utc +from moul.time.utils import utcnow from moul.log import getLogger from moul.qt.utils import QNamespaceContainer from moul.qt.utils import QSignalLoggerMetaclass from moul.qt.utils import skipLogging +from moul.qt.utils import QTimerThreadlet NUMBER_HEIGHT = 25 @@ -62,8 +68,9 @@ self.clockscene = QDniClockScene(view.parent()) view.setScene(self.clockscene) view.show() - self.dnitime_timer = QtCore.QTimer(self.context) - self.dnitime_timer.setInterval(FACTOR_SP*1000+60) # XXX: smooth + self.dnitime_timer = QTimerThreadlet(None) + self.dnitime_timer.setInterval(FACTOR_SP*1000.0/1.0) # XXX: smooth + #fself.dnitime_timer.setCallable(self.clockscene.timeEvent) # time zone # TODO: change timer from every second to once a minute? @@ -75,6 +82,13 @@ off = ct['pacific']['utcoffset'] self.lb_pacific_utc.setText("UTC %s%i" % (off[0], abs(off[1]))) + # chooser + self.dte_earthtime.setDateTime(QtCore.QDateTime(utcnow())) + for i, name in enumerate(VAILEETEE): + self.cb_vailee.addItem("%2i %s" % (i+1, name)) + for name, date in DNI_HOLIDAYS: + self.cb_dniholidays.addItem(self.trUtf8(name)) + self.connect(self.timezone_timer, SIGNAL('timeout()'), self.on_timezone_timer_timeout) self.connect(self.dnitime_timer, SIGNAL('timeout()'), @@ -82,7 +96,7 @@ self.connect(self.context, SIGNAL("timerEnable(bool)"), self.on_timer_timerEnable) # TODO: needs optimization? run only when timer tab is active - self.emit(SIGNAL("timerEnable(bool)"), True) + #self.emit(SIGNAL("timerEnable(bool)"), True) @pyqtSignature("bool") def on_timer_timerEnable(self, value=True): @@ -106,6 +120,42 @@ self.dt_cavern.setDateTime(ct['cavern']) self.dt_pacific.setDateTime(ct['pacific']) + @pyqtSignature("bool") + def on_rb_curtime_clicked(self, value): + if value: + self.emit(SIGNAL("timerEnable(bool)"), True) + + @pyqtSignature("bool") + def on_rb_earthtime_clicked(self, value): + if value: + self.emit(SIGNAL("timerEnable(bool)"), False) + + @pyqtSignature("bool") + def on_rb_dnitime_clicked(self, value): + if value: + self.emit(SIGNAL("timerEnable(bool)"), False) + + @pyqtSignature("bool") + def on_rb_dniholiday_clicked(self, value): + if value: + self.emit(SIGNAL("timerEnable(bool)"), False) + + @pyqtSignature("") + def on_pb_time_update_clicked(self): + if self.rb_curtime.isChecked(): + pass + elif self.rb_earthtime.isChecked(): + qdt = self.dte_earthtime.dateTime() + utc_dt = ts2utc(qdt.toTime_t()) + self.clockscene.setClockFromUTC(utc_dt) + elif self.rb_dnitime.isChecked(): + pass + elif self.rb_dniholiday.isChecked(): + pass + else: + LOG.warning("Unknown state of time chooser") + + def setup_dninumbers(self): # may change! widget = self.context.gridLayout_3 @@ -434,7 +484,7 @@ # initialize view self.timeEvent(initialize=True) - def setClockByDnidate(self, dnitime, initialize=False): + def setClockFromDnidate(self, dnitime, initialize=False): if dnitime.prorahn == self.prorahn.get() and not initialize: return @@ -455,6 +505,10 @@ self.gorahn.setNumber(dnitime.gorahn) self.prorahn.setNumber(dnitime.prorahn) + def setClockFromUTC(self, utc_dt): + self.dnitime.fromUTC(utc_dt) + self.setClockFromDnidate(self.dnitime, initialize=True) + @pyqtSignature("") @skipLogging def timeEvent(self, initialize=False): @@ -462,7 +516,7 @@ SIGNAL: QTimer timeout """ self.dnitime.fromUTC() # set to now - self.setClockByDnidate(self.dnitime, initialize) + self.setClockFromDnidate(self.dnitime, initialize) class QDniClockCircle(QtGui.QGraphicsItem): """Circular part of the D'ni clock Modified: pymoul/trunk/src/moul/qt/localization.py =================================================================== --- pymoul/trunk/src/moul/qt/localization.py 2007-02-19 20:12:39 UTC (rev 180) +++ pymoul/trunk/src/moul/qt/localization.py 2007-02-22 14:14:24 UTC (rev 181) @@ -34,7 +34,7 @@ from moul.log import getLogger from moul.qt.simpleprogressbar import SimpleProgressbar -from moul.qt.threadlet import YieldingThreadlet +from moul.qt.utils import QYieldingThreadlet from moul.qt.utils import QNamespaceContainer from moul.qt.utils import QSignalLoggerMetaclass @@ -88,7 +88,7 @@ self.progressbar.setProgressbar(0, len(loc), 0) self.progressbar.show() - self.threadlet = YieldingThreadlet(self.context) + self.threadlet = QYieldingThreadlet(self.context) self.connect(self.threadlet, SIGNAL('finished()'), self.on_localization_loaded) self.connect(self.threadlet, SIGNAL("yield(const QString&)"), Modified: pymoul/trunk/src/moul/qt/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/mainwindow.py 2007-02-19 20:12:39 UTC (rev 180) +++ pymoul/trunk/src/moul/qt/mainwindow.py 2007-02-22 14:14:24 UTC (rev 181) @@ -46,8 +46,8 @@ from moul.qt.localization import LocalizationContainer from moul.qt.wdysini import IniFileContainer from moul.qt.simpleprogressbar import SimpleProgressbar -from moul.qt.threadlet import YieldingThreadlet -from moul.qt.threadlet import Threadlet +from moul.qt.utils import QYieldingThreadlet +from moul.qt.utils import QThreadlet from moul.qt.ui.mainwindow import Ui_MainWindow from moul.qt import utils as qtutils @@ -211,7 +211,7 @@ # ************************************************************************ # tasks def _chatlog_init(self): - self._chatlog_threadlet = Threadlet(self) + self._chatlog_threadlet = QThreadlet(self) self.connect(self, SIGNAL("chatlogsUpdated()"), self._chatlog_threadlet.start) self.connect(self._chatlog_threadlet, SIGNAL("finished()"), @@ -266,7 +266,7 @@ self._kiimage_progressbar = SimpleProgressbar(self) self._kiimage_progressbar.setWindowTitle( self.trUtf8("Repairing KI images")) - self._kiimage_threadlet = YieldingThreadlet(self) + self._kiimage_threadlet = QYieldingThreadlet(self) self._kiimage_progressbar.setProgressbar(0, len(kimover), 0) self.connect(self._kiimage_threadlet, SIGNAL("yield(const QString&)"), Deleted: pymoul/trunk/src/moul/qt/threadlet.py =================================================================== --- pymoul/trunk/src/moul/qt/threadlet.py 2007-02-19 20:12:39 UTC (rev 180) +++ pymoul/trunk/src/moul/qt/threadlet.py 2007-02-22 14:14:24 UTC (rev 181) @@ -1,128 +0,0 @@ -#!/usr/bin/env python2.5 -# pyMoul - Python interface to Myst Online URU Live -# Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de> - -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., 59 -# Temple Place, Suite 330, Boston, MA 02111-1307 USA -# - -"""Threadlet - execute a function in a seperate thread -""" -__author__ = "Christian Heimes" -__version__ = "$Id$" -__revision__ = "$Revision$" - -import sys -from PyQt4 import QtCore -from PyQt4.QtCore import SIGNAL - -from moul.log import getLogger - - -LOG = getLogger('moul.tasklet') - -class Threadlet(QtCore.QThread): - """Threadlet - execute a function in a seperate thread - - Use this class to run a CPU or I/O bound function in a seperate thread. - - - >>> def pow(x, y): return x**y - >>> def printer(r): print r - >>> parent.example = Threadlet() - >>> parent.connect(parent.example, SIGNAL('done(result)'), printer) - >>> parent.example.detach(pow, 2, 6) - - Signals emitted: - - started() - - done(result) - - finished() - - You should disconnect all signals after the threadlet has finished - >>> parent.disconnect(parent.example, SIGNAL('done(result)')) - >>> del parent.example - - @qtsignal started(): Signal is emitted when the thread starts executing. - @qtsignal finished(): Signal is emitted when the thread has finished. - @qtsignal terminated(): Signal is emitted when the thread is terminated. - - @warning: The function and all applied arguments must be thread safe! - """ - def __init__(self, parent=None): - """Constructor - - @param parent: Qt parent object - @type parent: QObject instance or None - """ - QtCore.QThread.__init__(self, parent) - self.mutex = QtCore.QMutex() - self.clear() - - def clear(self): - """ - Clear variables - - Mutex must be locked before clear() is called from a method! - """ - self._func = None - self._args = None - self._kwargs = None - - def __del__(self): - self.clear() - - def detach(self, obj, *args, **kwargs): - """ - Detach a function call - - @param obj: a callable (or iterable for YieldingThreadlet) - @param *args: additional arguments for the function - @param **kwargs: additional keyword arguments for the function - """ - self.mutex.lock() - self._obj = obj - self._args = args or () - self._kwargs = kwargs or {} - self.mutex.unlock() - if not self.isRunning(): - self.start() - - def run(self): - """ - Payload - runs the callable and emits done(result) - - The function and its args/kwargs are cleared after the function has - run to avoid cyclic references. - - @qtsignal done(result): Signal is emitted when the function has returned. - """ - self.mutex.lock() - result = self._obj(*self._args, **self._kwargs) - self.emit(SIGNAL("done(result)"), result) - self.mutex.unlock() - -class YieldingThreadlet(Threadlet): - """ - Similar to Threadlet by iters over the object and yields each value - """ - def run(self): - """ - Paylad - iters over the object and yields each value - - @qtsignal yield(const QString&): yield - """ - self.mutex.lock() - for result in iter(self._obj): - self.emit(SIGNAL("yield(const QString&)"), result) - self.mutex.unlock() Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-02-19 20:12:39 UTC (rev 180) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-02-22 14:14:24 UTC (rev 181) @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file './src/moul/qt/ui/mainwindow.ui' # -# Created: Mon Feb 19 21:09:28 2007 +# Created: Tue Feb 20 15:52:22 2007 # by: PyQt4 UI code generator 4.1.1 # # WARNING! All changes made in this file will be lost! @@ -44,12 +44,6 @@ spacerItem1 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout.addItem(spacerItem1) - self.main_buttonbox = QtGui.QDialogButtonBox(self.centralwidget) - self.main_buttonbox.setGeometry(QtCore.QRect(10,520,451,32)) - self.main_buttonbox.setOrientation(QtCore.Qt.Horizontal) - self.main_buttonbox.setStandardButtons(QtGui.QDialogButtonBox.Close|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Reset|QtGui.QDialogButtonBox.Save) - self.main_buttonbox.setObjectName("main_buttonbox") - self.tabwidget = QtGui.QTabWidget(self.centralwidget) self.tabwidget.setGeometry(QtCore.QRect(0,80,471,434)) self.tabwidget.setTabPosition(QtGui.QTabWidget.North) @@ -755,12 +749,29 @@ self.tab_time = QtGui.QWidget() self.tab_time.setObjectName("tab_time") + self.gb_dnitime = QtGui.QGroupBox(self.tab_time) + self.gb_dnitime.setGeometry(QtCore.QRect(10,220,451,181)) + self.gb_dnitime.setObjectName("gb_dnitime") + + self.gv_dniclock = QtGui.QGraphicsView(self.gb_dnitime) + self.gv_dniclock.setGeometry(QtCore.QRect(10,20,431,151)) + self.gv_dniclock.setFocusPolicy(QtCore.Qt.NoFocus) + self.gv_dniclock.setContextMenuPolicy(QtCore.Qt.NoContextMenu) + self.gv_dniclock.setAcceptDrops(False) + self.gv_dniclock.setFrameShadow(QtGui.QFrame.Plain) + self.gv_dniclock.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.gv_dniclock.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.gv_dniclock.setInteractive(False) + self.gv_dniclock.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) + self.gv_dniclock.setRenderHints(QtGui.QPainter.Antialiasing|QtGui.QPainter.SmoothPixmapTransform|QtGui.QPainter.TextAntialiasing) + self.gv_dniclock.setObjectName("gv_dniclock") + self.groupBox_3 = QtGui.QGroupBox(self.tab_time) - self.groupBox_3.setGeometry(QtCore.QRect(10,0,451,181)) + self.groupBox_3.setGeometry(QtCore.QRect(10,0,451,221)) self.groupBox_3.setObjectName("groupBox_3") self.gridLayout_5 = QtGui.QWidget(self.groupBox_3) - self.gridLayout_5.setGeometry(QtCore.QRect(10,20,431,154)) + self.gridLayout_5.setGeometry(QtCore.QRect(10,20,431,184)) self.gridLayout_5.setObjectName("gridLayout_5") self.gridlayout2 = QtGui.QGridLayout(self.gridLayout_5) @@ -768,138 +779,144 @@ self.gridlayout2.setSpacing(6) self.gridlayout2.setObjectName("gridlayout2") + spacerItem4 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) + self.gridlayout2.addItem(spacerItem4,0,1,1,1) + self.hboxlayout9 = QtGui.QHBoxLayout() self.hboxlayout9.setMargin(0) self.hboxlayout9.setSpacing(6) self.hboxlayout9.setObjectName("hboxlayout9") - self.sb_ = QtGui.QSpinBox(self.gridLayout_5) - self.sb_.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) - self.sb_.setMaximum(4) - self.sb_.setProperty("value",QtCore.QVariant(0)) - self.sb_.setObjectName("sb_") - self.hboxlayout9.addWidget(self.sb_) + self.sb_hahr = QtGui.QSpinBox(self.gridLayout_5) + self.sb_hahr.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) + self.sb_hahr.setMaximum(9999) + self.sb_hahr.setProperty("value",QtCore.QVariant(9662)) + self.sb_hahr.setObjectName("sb_hahr") + self.hboxlayout9.addWidget(self.sb_hahr) - self.sb_1 = QtGui.QSpinBox(self.gridLayout_5) - self.sb_1.setMinimumSize(QtCore.QSize(0,0)) - self.sb_1.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) - self.sb_1.setMaximum(24) - self.sb_1.setProperty("value",QtCore.QVariant(0)) - self.sb_1.setObjectName("sb_1") - self.hboxlayout9.addWidget(self.sb_1) + self.cb_vailee = QtGui.QComboBox(self.gridLayout_5) + self.cb_vailee.setMinimumSize(QtCore.QSize(0,0)) + self.cb_vailee.setObjectName("cb_vailee") + self.hboxlayout9.addWidget(self.cb_vailee) - self.sb_2 = QtGui.QSpinBox(self.gridLayout_5) - self.sb_2.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) - self.sb_2.setMaximum(24) - self.sb_2.setProperty("value",QtCore.QVariant(0)) - self.sb_2.setObjectName("sb_2") - self.hboxlayout9.addWidget(self.sb_2) + self.sb_yahr = QtGui.QSpinBox(self.gridLayout_5) + self.sb_yahr.setMaximum(29) + self.sb_yahr.setMinimum(1) + self.sb_yahr.setProperty("value",QtCore.QVariant(1)) + self.sb_yahr.setObjectName("sb_yahr") + self.hboxlayout9.addWidget(self.sb_yahr) - self.sb_3 = QtGui.QSpinBox(self.gridLayout_5) - self.sb_3.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) - self.sb_3.setMaximum(24) - self.sb_3.setProperty("value",QtCore.QVariant(0)) - self.sb_3.setObjectName("sb_3") - self.hboxlayout9.addWidget(self.sb_3) + spacerItem5 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) + self.hboxlayout9.addItem(spacerItem5) + self.gridlayout2.addLayout(self.hboxlayout9,2,1,1,1) - spacerItem4 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) - self.hboxlayout9.addItem(spacerItem4) - self.gridlayout2.addLayout(self.hboxlayout9,3,1,1,1) + 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.hboxlayout10 = QtGui.QHBoxLayout() self.hboxlayout10.setMargin(0) self.hboxlayout10.setSpacing(6) self.hboxlayout10.setObjectName("hboxlayout10") - self.dateTimeEdit = QtGui.QDateTimeEdit(self.gridLayout_5) - self.dateTimeEdit.setCalendarPopup(True) - self.dateTimeEdit.setObjectName("dateTimeEdit") - self.hboxlayout10.addWidget(self.dateTimeEdit) + self.dte_earthtime = QtGui.QDateTimeEdit(self.gridLayout_5) + self.dte_earthtime.setCalendarPopup(True) + self.dte_earthtime.setObjectName("dte_earthtime") + self.hboxlayout10.addWidget(self.dte_earthtime) - self.comboBox_2 = QtGui.QComboBox(self.gridLayout_5) - self.comboBox_2.setObjectName("comboBox_2") - self.hboxlayout10.addWidget(self.comboBox_2) + self.cb_earthtime_tz = QtGui.QComboBox(self.gridLayout_5) + self.cb_earthtime_tz.setEnabled(False) - spacerItem5 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) - self.hboxlayout10.addItem(spacerItem5) - self.gridlayout2.addLayout(self.hboxlayout10,1,1,1,1) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(3),QtGui.QSizePolicy.Policy(0)) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.cb_earthtime_tz.sizePolicy().hasHeightForWidth()) + self.cb_earthtime_tz.setSizePolicy(sizePolicy) + self.cb_earthtime_tz.setEditable(False) + self.cb_earthtime_tz.setObjectName("cb_earthtime_tz") + self.hboxlayout10.addWidget(self.cb_earthtime_tz) spacerItem6 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) - self.gridlayout2.addItem(spacerItem6,0,1,1,1) + self.hboxlayout10.addItem(spacerItem6) + self.gridlayout2.addLayout(self.hboxlayout10,1,1,1,1) - self.radioButton_4 = QtGui.QRadioButton(self.gridLayout_5) - self.radioButton_4.setObjectName("radioButton_4") - self.gridlayout2.addWidget(self.radioButton_4,4,0,1,1) - self.hboxlayout11 = QtGui.QHBoxLayout() self.hboxlayout11.setMargin(0) self.hboxlayout11.setSpacing(6) self.hboxlayout11.setObjectName("hboxlayout11") - self.sb_4 = QtGui.QSpinBox(self.gridLayout_5) - self.sb_4.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) - self.sb_4.setMaximum(9999) - self.sb_4.setProperty("value",QtCore.QVariant(9662)) - self.sb_4.setObjectName("sb_4") - self.hboxlayout11.addWidget(self.sb_4) + self.cb_dniholidays = QtGui.QComboBox(self.gridLayout_5) + self.cb_dniholidays.setObjectName("cb_dniholidays") + self.hboxlayout11.addWidget(self.cb_dniholidays) - self.comboBox_3 = QtGui.QComboBox(self.gridLayout_5) - self.comboBox_3.setMinimumSize(QtCore.QSize(0,0)) - self.comboBox_3.setObjectName("comboBox_3") - self.hboxlayout11.addWidget(self.comboBox_3) - - self.spinBox_2 = QtGui.QSpinBox(self.gridLayout_5) - self.spinBox_2.setMaximum(29) - self.spinBox_2.setMinimum(1) - self.spinBox_2.setProperty("value",QtCore.QVariant(1)) - self.spinBox_2.setObjectName("spinBox_2") - self.hboxlayout11.addWidget(self.spinBox_2) - spacerItem7 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout11.addItem(spacerItem7) - self.gridlayout2.addLayout(self.hboxlayout11,2,1,1,1) + self.gridlayout2.addLayout(self.hboxlayout11,4,1,1,1) - self.radioButton = QtGui.QRadioButton(self.gridLayout_5) - self.radioButton.setObjectName("radioButton") - self.gridlayout2.addWidget(self.radioButton,0,0,1,1) - - self.radioButton_3 = QtGui.QRadioButton(self.gridLayout_5) - self.radioButton_3.setObjectName("radioButton_3") - self.gridlayout2.addWidget(self.radioButton_3,2,0,1,1) - - self.radioButton_2 = QtGui.QRadioButton(self.gridLayout_5) - self.radioButton_2.setObjectName("radioButton_2") - self.gridlayout2.addWidget(self.radioButton_2,1,0,1,1) - self.hboxlayout12 = QtGui.QHBoxLayout() self.hboxlayout12.setMargin(0) self.hboxlayout12.setSpacing(6) self.hboxlayout12.setObjectName("hboxlayout12") - self.comboBox = QtGui.QComboBox(self.gridLayout_5) - self.comboBox.setObjectName("comboBox") - self.hboxlayout12.addWidget(self.comboBox) + self.sb_gahrtahvo = QtGui.QSpinBox(self.gridLayout_5) + self.sb_gahrtahvo.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) + self.sb_gahrtahvo.setMaximum(4) + self.sb_gahrtahvo.setProperty("value",QtCore.QVariant(0)) + self.sb_gahrtahvo.setObjectName("sb_gahrtahvo") + self.hboxlayout12.addWidget(self.sb_gahrtahvo) + self.sb_tahvo = QtGui.QSpinBox(self.gridLayout_5) + self.sb_tahvo.setMinimumSize(QtCore.QSize(0,0)) + self.sb_tahvo.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) + self.sb_tahvo.setMaximum(24) + self.sb_tahvo.setProperty("value",QtCore.QVariant(0)) + self.sb_tahvo.setObjectName("sb_tahvo") + self.hboxlayout12.addWidget(self.sb_tahvo) + + self.sb_gorahn = QtGui.QSpinBox(self.gridLayout_5) + self.sb_gorahn.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) + self.sb_gorahn.setMaximum(24) + self.sb_gorahn.setProperty("value",QtCore.QVariant(0)) + self.sb_gorahn.setObjectName("sb_gorahn") + self.hboxlayout12.addWidget(self.sb_gorahn) + + self.sb_prorahn = QtGui.QSpinBox(self.gridLayout_5) + self.sb_prorahn.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) + self.sb_prorahn.setMaximum(24) + self.sb_prorahn.setProperty("value",QtCore.QVariant(0)) + self.sb_prorahn.setObjectName("sb_prorahn") + self.hboxlayout12.addWidget(self.sb_prorahn) + spacerItem8 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout12.addItem(spacerItem8) - self.gridlayout2.addLayout(self.hboxlayout12,4,1,1,1) + self.gridlayout2.addLayout(self.hboxlayout12,3,1,1,1) - self.gb_dnitime = QtGui.QGroupBox(self.tab_time) - self.gb_dnitime.setGeometry(QtCore.QRect(10,220,451,181)) - self.gb_dnitime.setObjectName("gb_dnitime") + self.rb_earthtime = QtGui.QRadioButton(self.gridLayout_5) + self.rb_earthtime.setChecked(True) + self.rb_earthtime.setObjectName("rb_earthtime") + self.gridlayout2.addWidget(self.rb_earthtime,1,0,1,1) - self.gv_dniclock = QtGui.QGraphicsView(self.gb_dnitime) - self.gv_dniclock.setGeometry(QtCore.QRect(10,20,431,151)) - self.gv_dniclock.setFocusPolicy(QtCore.Qt.NoFocus) - self.gv_dniclock.setContextMenuPolicy(QtCore.Qt.NoContextMenu) - self.gv_dniclock.setAcceptDrops(False) - self.gv_dniclock.setFrameShadow(QtGui.QFrame.Plain) - self.gv_dniclock.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) - self.gv_dniclock.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) - self.gv_dniclock.setInteractive(False) - self.gv_dniclock.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) - self.gv_dniclock.setRenderHints(QtGui.QPainter.Antialiasing|QtGui.QPainter.SmoothPixmapTransform|QtGui.QPainter.TextAntialiasing) - self.gv_dniclock.setObjectName("gv_dniclock") + self.rb_curtime = QtGui.QRadioButton(self.gridLayout_5) + self.rb_curtime.setObjectName("rb_curtime") + self.gridlayout2.addWidget(self.rb_curtime,0,0,1,1) + + self.rb_dniholiday = QtGui.QRadioButton(self.gridLayout_5) + self.rb_dniholiday.setObjectName("rb_dniholiday") + self.gridlayout2.addWidget(self.rb_dniholiday,4,0,1,1) + + self.hboxlayout13 = QtGui.QHBoxLayout() + self.hboxlayout13.setMargin(0) + self.hboxlayout13.setSpacing(6) + self.hboxlayout13.setObjectName("hboxlayout13") + + spacerItem9 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) + self.hboxlayout13.addItem(spacerItem9) + + self.pb_time_update = QtGui.QPushButton(self.gridLayout_5) + self.pb_time_update.setMaximumSize(QtCore.QSize(16777215,22)) + self.pb_time_update.setObjectName("pb_time_update") + self.hboxlayout13.addWidget(self.pb_time_update) + self.gridlayout2.addLayout(self.hboxlayout13,5,1,1,1) self.tabwidget.addTab(self.tab_time,"") self.tab_browse = QtGui.QWidget() @@ -1056,6 +1073,12 @@ self.tb_license.setObjectName("tb_license") self.tabwidget_about.addTab(self.tab_sub_license,"") self.tabwidget.addTab(self.tab_about,"") + + self.main_buttonbox = QtGui.QDialogButtonBox(self.centralwidget) + self.main_buttonbox.setGeometry(QtCore.QRect(10,520,451,32)) + self.main_buttonbox.setOrientation(QtCore.Qt.Horizontal) + self.main_buttonbox.setStandardButtons(QtGui.QDialogButtonBox.Close|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Reset|QtGui.QDialogButtonBox.Save) + self.main_buttonbox.setObjectName("main_buttonbox") MainWindow.setCentralWidget(self.centralwidget) self.statusbar = QtGui.QStatusBar(MainWindow) @@ -1134,13 +1157,16 @@ self.gb_servers.setTitle(QtGui.QApplication.translate("MainWindow", "Ping servers", None, QtGui.QApplication.UnicodeUTF8)) self.button_ping.setText(QtGui.QApplication.translate("MainWindow", "Ping", None, QtGui.QApplication.UnicodeUTF8)) self.tabwidget.setTabText(self.tabwidget.indexOf(self.tab_ping), QtGui.QApplication.translate("MainWindow", "Servers", None, QtGui.QApplication.UnicodeUTF8)) + self.gb_dnitime.setTitle(QtGui.QApplication.translate("MainWindow", "D\'ni time", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_3.setTitle(QtGui.QApplication.translate("MainWindow", "Choose Time", None, QtGui.QApplication.UnicodeUTF8)) - self.radioButton_4.setText(QtGui.QApplication.translate("MainWindow", "D\'ni Holiday", None, QtGui.QApplication.UnicodeUTF8)) - self.comboBox_3.addItem(QtGui.QApplication.translate("MainWindow", "8 Leevosahn", None, QtGui.QApplication.UnicodeUTF8)) - self.radioButton.setText(QtGui.QApplication.translate("MainWindow", "Current Time", None, QtGui.QApplication.UnicodeUTF8)) - self.radioButton_3.setText(QtGui.QApplication.translate("MainWindow", "D\'ni Time", None, QtGui.QApplication.UnicodeUTF8)) - self.radioButton_2.setText(QtGui.QApplication.translate("MainWindow", "Earth Time", None, QtGui.QApplication.UnicodeUTF8)) - self.gb_dnitime.setTitle(QtGui.QApplication.translate("MainWindow", "D\'ni time", None, QtGui.QApplication.UnicodeUTF8)) + self.rb_dnitime.setText(QtGui.QApplication.translate("MainWindow", "D\'ni Time", None, QtGui.QApplication.UnicodeUTF8)) + self.cb_earthtime_tz.addItem(QtGui.QApplication.translate("MainWindow", "local time", None, QtGui.QApplication.UnicodeUTF8)) + self.cb_earthtime_tz.addItem(QtGui.QApplication.translate("MainWindow", "cavern time", None, QtGui.QApplication.UnicodeUTF8)) + self.cb_earthtime_tz.addItem(QtGui.QApplication.translate("MainWindow", "UTC", None, QtGui.QApplication.UnicodeUTF8)) + self.rb_earthtime.setText(QtGui.QApplication.translate("MainWindow", "Earth Time", None, QtGui.QApplication.UnicodeUTF8)) + self.rb_curtime.setText(QtGui.QApplication.translate("MainWindow", "Current Time", None, QtGui.QApplication.UnicodeUTF8)) + self.rb_dniholiday.setText(QtGui.QApplication.translate("MainWindow", "D\'ni Holiday", None, QtGui.QApplication.UnicodeUTF8)) + self.pb_time_update.setText(QtGui.QApplication.translate("MainWindow", "Update", 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" Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.ui =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-02-19 20:12:39 UTC (rev 180) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-02-22 14:14:24 UTC (rev 181) @@ -97,22 +97,6 @@ </item> </layout> </widget> - <widget class="QDialogButtonBox" name="main_buttonbox" > - <property name="geometry" > - <rect> - <x>10</x> - <y>520</y> - <width>451</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> @@ -1612,13 +1596,63 @@ <attribute name="title" > <string>Time</string> </attribute> + <widget class="QGroupBox" name="gb_dnitime" > + <property name="geometry" > + <rect> + <x>10</x> + <y>220</y> + <width>451</width> + <height>181</height> + </rect> + </property> + <property name="title" > + <string>D'ni time</string> + </property> + <widget class="QGraphicsView" name="gv_dniclock" > + <property name="geometry" > + <rect> + <x>10</x> + <y>20</y> + <width>431</width> + <height>151</height> + </rect> + </property> + <property name="focusPolicy" > + <enum>Qt::NoFocus</enum> + </property> + <property name="contextMenuPolicy" > + <enum>Qt::NoContextMenu</enum> + </property> + <property name="acceptDrops" > + <bool>false</bool> + </property> + <property name="frameShadow" > + <enum>QFrame::Plain</enum> + </property> + <property name="verticalScrollBarPolicy" > + <enum>Qt::ScrollBarAlwaysOff</enum> + </property> + <property name="horizontalScrollBarPolicy" > + <enum>Qt::ScrollBarAlwaysOff</enum> + </property> + <property name="interactive" > + <bool>false</bool> + </property> + <property name="alignment" > + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> + <property name="renderHints" > + <set>QPainter::Antialiasing|QPainter::SmoothPixmapTransform|QPainter::TextAntialiasing</set> + </property> + </widget> + </widget> <widget class="QGroupBox" name="groupBox_3" > <property name="geometry" > <rect> <x>10</x> <y>0</y> <width>451</width> - <height>181</height> + <height>221</height> </rect> </property> <property name="title" > @@ -1630,7 +1664,7 @@ <x>10</x> <y>20</y> <width>431</width> - <height>154</height> + <height>184</height> </rect> </property> <layout class="QGridLayout" > @@ -1640,7 +1674,20 @@ <property name="spacing" > <number>6</number> </property> - <item row="3" column="1" > + <item row="0" column="1" > + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="2" column="1" > <layout class="QHBoxLayout" > <property name="margin" > <number>0</number> @@ -1649,60 +1696,38 @@ <number>6</number> </property> <item> - <widget class="QSpinBox" name="sb_" > + <widget class="QSpinBox" name="sb_hahr" > <property name="buttonSymbols" > <enum>QAbstractSpinBox::UpDownArrows</enum> </property> <property name="maximum" > - <number>4</number> + <number>9999</number> </property> <property name="value" > - <number>0</number> + <number>9662</number> </property> </widget> </item> <item> - <widget class="QSpinBox" name="sb_1" > + <widget class="QComboBox" name="cb_vailee" > <property name="minimumSize" > <size> <width>0</width> <height>0</height> </size> </property> - <property name="buttonSymbols" > - <enum>QAbstractSpinBox::UpDownArrows</enum> - </property> - <property name="maximum" > - <number>24</number> - </property> - <property name="value" > - <number>0</number> - </property> </widget> </item> <item> - <widget class="QSpinBox" name="sb_2" > - <property name="buttonSymbols" > - <enum>QAbstractSpinBox::UpDownArrows</enum> - </property> + <widget class="QSpinBox" name="sb_yahr" > <property name="maximum" > - <number>24</number> + <number>29</number> </property> - <property name="value" > - <number>0</number> + <property name="minimum" > + <number>1</number> </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="sb_3" > - <property name="buttonSymbols" > - <enum>QAbstractSpinBox::UpDownArrows</enum> - </property> - <property name="maximum" > - <number>24</number> - </property> <property name="value" > - <number>0</number> + <number>1</number> </property> </widget> </item> @@ -1721,6 +1746,13 @@ </item> </layout> </item> + <item row="2" column="0" > + <widget class="QRadioButton" name="rb_dnitime" > + <property name="text" > + <string>D'ni Time</string> + </property> + </widget> + </item> <item row="1" column="1" > <layout class="QHBoxLayout" > <property name="margin" > @@ -1730,14 +1762,44 @@ <number>6</number> </property> <item> - <widget class="QDateTimeEdit" name="dateTimeEdit" > + <widget class="QDateTimeEdit" name="dte_earthtime" > <property name="calendarPopup" > <bool>true</bool> </property> </widget> </item> <item> - <widget class="QComboBox" name="comboBox_2" /> + <widget class="QComboBox" name="cb_earthtime_tz" > + <property name="enabled" > + <bool>false</bool> + </property> + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="editable" > + <bool>false</bool> + </property> + <item> + <property name="text" > + <string>local time</string> + </property> + </item> + <item> + <property name="text" > + <string>cavern time</string> + </property> + </item> + <item> + <property name="text" > + <string>UTC</string> + </property> + </item> + </widget> </item> <item> <spacer> @@ -1754,27 +1816,33 @@ </item> </layout> </item> - <item row="0" column="1" > - <spacer> - <property name="orientation" > - <enum>Qt::Horizontal</enum> + <item row="4" column="1" > + <layout class="QHBoxLayout" > + <property name="margin" > + <number>0</number> </property> - <property name="sizeHint" > - <size> - <width>40</width> - <height>20</height> - </size> + <property name="spacing" > + <number>6</number> </property> - </spacer> + <item> + <widget class="QComboBox" name="cb_dniholidays" /> + </item> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> </item> - <item row="4" column="0" > - <widget class="QRadioButton" name="radioButton_4" > - <property name="text" > - <string>D'ni Holiday</string> - </property> - </widget> - </item> - <item row="2" column="1" > + <item row="3" column="1" > <layout class="QHBoxLayout" > <property name="margin" > <number>0</number> @@ -1783,43 +1851,60 @@ <number>6</number> </property> <item> - <widget class="QSpinBox" name="sb_4" > + <widget class="QSpinBox" name="sb_gahrtahvo" > <property name="buttonSymbols" > <enum>QAbstractSpinBox::UpDownArrows</enum> </property> <property name="maximum" > - <number>9999</number> + <number>4</number> </property> <property name="value" > - <number>9662</number> + <number>0</number> </property> </widget> </item> <item> - <widget class="QComboBox" name="comboBox_3" > + <widget class="QSpinBox" name="sb_tahvo" > <property name="minimumSize" > <size> <width>0</width> <height>0</height> </size> </property> - <item> - <property name="text" > - <string>8 Leevosahn</string> - </property> - </item> + <property name="buttonSymbols" > + <enum>QAbstractSpinBox::UpDownArrows</enum> + </property> + <property name="maximum" > + <number>24</number> + </property> + <property name="value" > + <number>0</number> + </property> </widget> </item> <item> - <widget class="QSpinBox" name="spinBox_2" > + <widget class="QSpinBox" name="sb_gorahn" > + <property name="buttonSymbols" > + <enum>QAbstractSpinBox::UpDownArrows</enum> + </property> <property name="maximum" > - <number>29</number> + <number>24</number> </property> - <property name="minimum" > - <number>1</number> + <property name="value" > + <number>0</number> </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="sb_prorahn" > + <property name="buttonSymbols" > + <enum>QAbstractSpinBox::UpDownArrows</enum> + </property> + <property name="maximum" > + <number>24</number> + </property> <property name="value" > - <number>1</number> + <number>0</number> </property> </widget> </item> @@ -1838,28 +1923,31 @@ </item> </layout> </item> - <item row="0" column="0" > - <widget class="QRadioButton" name="radioButton" > + <item row="1" column="0" > + <widget class="QRadioButton" name="rb_earthtime" > <property name="text" > - <string>Current Time</string> + <string>Earth Time</string> </property> + <property name="checked" > + <bool>true</bool> + </property> </widget> </item> - <item row="2" column="0" > - <widget class="QRadioButton" name="radioButton_3" > + <item row="0" column="0" > + <widget class="QRadioButton" name="rb_curtime" > <property name="text" > - <string>D'ni Time</string> + <string>Current Time</string> </property> </widget> </item> - <item row="1" column="0" > - <widget class="QRadioButton" name="radioButton_2" > + <item row="4" column="0" > + <widget class="QRadioButton" name="rb_dniholiday" > <property name="text" > - <string>Earth Time</string> + <string>D'ni Holiday</string> </property> </widget> </item> - <item row="4" column="1" > + <item row="5" column="1" > <layout class="QHBoxLayout" > <property name="margin" > <number>0</number> @@ -1868,9 +1956,6 @@ <number>6</number> </property> <item> - <widget class="QComboBox" name="comboBox" /> - </item> - <item> <spacer> <property name="orientation" > <enum>Qt::Horizontal</enum> @@ -1883,61 +1968,24 @@ </property> </spacer> </item> + <item> + <widget class="QPushButton" name="pb_time_update" > + <property name="maximumSize" > + <size> + <width>16777215</width> + <height>22</height> + </size> + </property> + <property name="text" > + <string>Update</string> + </property> + </widget> + </item> </layout> </item> </layout> </widget> </widget> - <widget class="QGroupBox" name="gb_dnitime" > - <property name="geometry" > - <rect> - <x>10</x> - <y>220</y> - <width>451</width> - <height>181</height> - </rect> - </property> - <property name="title" > - <string>D'ni time</string> - </property> - <widget class="QGraphicsView" name="gv_dniclock" > - <property name="geometry" > - <rect> - <x>10</x> - <y>20</y> - <width>431</width> - <height>151</height> - </rect> - </property> - <property name="focusPolicy" > - <enum>Qt::NoFocus</enum> - </property> - <property name="contextMenuPolicy" > - <enum>Qt::NoContextMenu</enum> - </property> - <property name="acceptDrops" > - <bool>false</bool> - </property> - <property name="frameShadow" > - <enum>QFrame::Plain</enum> - </property> - <property name="verticalScrollBarPolicy" > - <enum>Qt::ScrollBarAlwaysOff</enum> - </property> - <property name="horizontalScrollBarPolicy" > - <enum>Qt::ScrollBarAlwaysOff</enum> - </property> - <property name="interactive" > - <bool>false</bool> - </property> - <property name="alignment" > - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> - </property> - <property name="renderHints" > - <set>QPainter::Antialiasing|QPainter::SmoothPixmapTransform|QPainter::TextAntialiasing</set> - </property> - </widget> - </widget> </widget> <widget class="QWidget" name="tab_browse" > <attribute name="title" > @@ -2289,6 +2337,22 @@ </widget> </widget> </widget> + <widget class="QDialogButtonBox" name="main_buttonbox" > + <property name="geometry" > + <rect> + <x>10</x> + <y>520</y> + <width>451</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> <widget class="QStatusBar" name="statusbar" /> </widget> Modified: pymoul/trunk/src/moul/qt/utils.py =================================================================== --- pymoul/trunk/src/moul/qt/utils.py 2007-02-19 20:12:39 UTC (rev 180) +++ pymoul/trunk/src/moul/qt/utils.py 2007-02-22 14:14:24 UTC (rev 181) @@ -19,6 +19,12 @@ """Misc utilities +* QSignalLoggerMetaclass - logs signals to a logging logger +* QNamespaceContainer - transparent container for code and data +* connectSlotsByName - alternative implementation for connecting slots +* Threadlet and YieldingThreadlet - execute code in its own thread +* QTimerThread - QTimer in its own thread + It also contains several functions to create message boxes. """ __author__ = "Christian Heimes" @@ -257,6 +263,185 @@ #logging.debug('Connecting: %s to %s: %s' % (widget, signature, method)) QtCore.QObject.connect(widget, SIGNAL(signature), method) +class QThreadlet(QtCore.QThread): + """Threadlet - execute a function in a seperate thread + + Use this class to run a CPU or I/O bound function in a seperate thread. + + + >>> def pow(x, y): return x**y + >>> def printer(r): print r + >>> parent.example = Threadlet() + >>> parent.connect(parent.example, SIGNAL('done(result)'), printer) + >>> parent.example.detach(pow, 2, 6) + + Signals emitted: + - started() + - done(result) + - finished() + + You should disconnect all signals after the threadlet has finished + >>> parent.disconnect(parent.example, SIGNAL('done(result)')) + >>> del parent.example + + @qtsignal started(): Signal is emitted when the thread starts executing. + @qtsignal finished(): Signal is emitted when the thread has finished. + @qtsignal terminated(): Signal is emitted when the thread is terminated. + + @warning: The function and all applied arguments must be thread safe! + """ + def __init__(self, parent=None): + """Constructor + + @param parent: Qt parent object + @type parent: QObject instance or None + """ + QtCore.QThread.__init__(self, parent) + self.mutex = QtCore.QMutex() + self.clear() + + def clear(self): + """ + Clear variables + + Mutex must be locked before clear() is called from a method! + """ + self._func = None + self._args = None + self._kwargs = None + + def __del__(self): + self.wait() + self.clear() + + def detach(self, obj, *args, **kwargs): + """ + Detach a function call + + @param obj: a callable (or iterable for YieldingThreadlet) + @param *args: additional arguments for the function + @param **kwargs: additional keyword arguments for the function + """ + self.mutex.lock() + self._obj = obj + self._args = args or () + self._kwargs = kwargs or {} + self.mutex.unlock() + if not self.isRunning(): + self.start() + + def run(self): + """ + Payload - runs the callable and emits done(result) + + The function and its args/kwargs are cleared after the function has + run to avoid cyclic references. + + @qtsignal done(result): Signal is emitted when the function has returned. + """ + self.mutex.lock() + result = self._obj(*self._args, **self._kwargs) + self.emit(SIGNAL("done(result)"), result) + self.mutex.unlock() + +class QYieldingThreadlet(QThreadlet): + """ + Similar to Threadlet by iters over the object and yields each value + """ + def run(self): + """ + Paylad - iters over the object and yields each value + + @qtsignal yield(const QString&): yield + """ + self.mutex.lock() + for result in iter(self._obj): + self.emit(SIGNAL("yield(const QString&)"), result) + self.mutex.unlock() + self.clear() + +class QTimerThreadlet(QtCore.QThread): + """Timed Threadlet - a QTimer like threadlet + """ + def __init__(self, parent=None): + """Constructor + + @param parent: Qt parent object + @type parent: QObject instance or None + """ + QtCore.QThread.__init__(self, parent) + self.mutex = QtCore.QMutex() + self._quit = True + self._interval = None + self.clear() + + def clear(self): + """ + Clear variables + + Mutex must be locked before clear() is called from a method! + """ + self.stop() + self._func = None + self._args = None + self._kwargs = None + + def __del__(self): + self.stop() + self.wait() + self.clear() + + def setInterval(self, msec): + """Set interval in mili seconds + """ + self.mutex.lock() + self._interval = int(round(msec)) + self.mutex.unlock() + + def isActive(self): + """Alias for isRunning + """ + return self.isRunning() + + #def setCallable(self, obj, *args, **kwargs): + #""" + #Set callable to run each timeout + + #@param obj: a callable (or iterable for YieldingThreadlet) + #@param *args: additional arguments for the function + #@param **kwargs: additional keyword arguments for the function + #""" + #if not self._interval: + #raise ValueError("Interval not set") + #self.mutex.lock() + #self._obj = obj + #self._args = args or () + #self._kwargs = kwargs or {} + #self.mutex.unlock() + + def start(self): + """Start the timer + """ + self._quit = False + return QtCore.QThread.start(self) + + def stop(self): + """Stop the timer + """ + self._quit = True + + def run(self): + """Payload + """ + self.mutex.lock() + try: + interval = self._interval + while not self._quit: + self.emit(SIGNAL("timeout()")) + self.msleep(interval) + finally: + self.mutex.unlock() + def _mkMessageBox(context, title, text, icon='Information'): """ Create a message box Modified: pymoul/trunk/src/moul/time/dni.py =================================================================== --- pymoul/trunk/src/moul/time/dni.py 2007-02-19 20:12:39 UTC (rev 180) +++ pymoul/trunk/src/moul/time/dni.py 2007-02-22 14:14:24 UTC (rev 181) @@ -23,15 +23,6 @@ official sources say that: 00:00:00:00, Leefo 1, 9654 DE = 10:35:18 UTC, April 21, 1998 CE -D'ni New Year - Leefo 1, April 21 -First Feast of the Maker - Lenovoo 10, March 27 (Pre-earth celebration) -The Common Library Opened - Leefo 12, May 5 -Second Feast of the Maker - Leebro 20, June 21 (Pre-earth celebration) -The Day of Dancing - Leetar 21, September 3 -First Arrival of the Great King - Leevot 12, September 28 -Third Feast of the Maker - Leevofo 18, November 11 (Pre-earth celebration) -Coronation of King Kerath - Leevofo 27, November 23 - >>> from datetime import timedelta >>> LEEFO_1_TABLE = [ @@ -117,6 +108,17 @@ 'Leenovoo', # 10: March 16th to April 21st ) +DNI_HOLIDAYS = ( + ("D'ni New Year", (1, 1)), + ("First Feast of the Maker (PEC)", (10, 10)), + ("The Common Library Opened", (1, 12)), + ("Second Feast of the Maker (PEC)", (2, 20)), + ("The Day of Dancing", (4, 21)), + ("First Arrival of the Great King", (5, 12)), + ("Third Feast of the Maker (PEC)", (6, 18)), + ("Coronation of King Kerath", (6, 27)), +) + # 00:00:00:00, Leefo 1, 9654 DE = 10:35:18 1998/4/21 BASE_GREGORIAN = datetime(1998, 4, 21, 10, 35, 18, 0, tzinfo=UTC) BASE_HAHR = 9654 Modified: pymoul/trunk/src/moul/time/utils.py =================================================================== --- pymoul/trunk/src/moul/time/utils.py 2007-02-19 20:12:39 UTC (rev 180) +++ pymoul/trunk/src/moul/time/utils.py 2007-02-22 14:14:24 UTC (rev 181) @@ -69,13 +69,18 @@ >>> td2sec(timedelta(0, -3600)) -3600 """ - return td.seconds + 86400 * td.days + return 86400 * td.days + td.seconds + td.microseconds/1000000.0 def utcnow(): """Get current time in UTC """ return UTC.localize(datetime.utcnow()) +def ts2utc(ts): + """Get utc from time stamp + """ + return UTC.localize(datetime.fromtimestamp(ts)) + def normalizeTZ(tz, utc_dt=None): """Normalize a datetime object with UTC tz using another tz """ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-02-19 20:12:40
|
Revision: 180 http://pymoul.svn.sourceforge.net/pymoul/?rev=180&view=rev Author: tiran Date: 2007-02-19 12:12:39 -0800 (Mon, 19 Feb 2007) Log Message: ----------- New time tab with time converter Modified Paths: -------------- pymoul/trunk/src/moul/qt/dninumbers.py pymoul/trunk/src/moul/qt/ui/mainwindow.py pymoul/trunk/src/moul/qt/ui/mainwindow.ui Modified: pymoul/trunk/src/moul/qt/dninumbers.py =================================================================== --- pymoul/trunk/src/moul/qt/dninumbers.py 2007-02-19 18:27:50 UTC (rev 179) +++ pymoul/trunk/src/moul/qt/dninumbers.py 2007-02-19 20:12:39 UTC (rev 180) @@ -429,7 +429,7 @@ self.clocktext.setPos(0, yoff+2*height+2*space) # circular day clock self.circle = QDniClockCircle(None, self) - self.circle.setPos(300, 3) + self.circle.setPos(250, 3) # initialize view self.timeEvent(initialize=True) @@ -467,13 +467,14 @@ class QDniClockCircle(QtGui.QGraphicsItem): """Circular part of the D'ni clock """ - r = 45.0 # radios of circle + r = 70.0 # radios of circle rdot = 3.0 # radius of dots - rinner = 5.0 # radius of inner circle + rinner = 6.0 # radius of inner circle outrect = QtCore.QRectF(0.0, 0.0, 2.0*r, 2.0*r) center = (r, r) angel = 2.0*math.pi/25.0 offset = 0.5 * math.pi + 5.0 * angel + pm_height = 18 def __init__(self, parent=None, scene=None): QtGui.QGraphicsItem.__init__(self, parent, scene) @@ -528,16 +529,15 @@ painter.restore() # number - h = 15 - pm = self._dni.get(self._pahrtovo, height=h) + pm = self._dni.get(self._pahrtovo, height=self.pm_height) w = pm.width() - posx, posy = self.center[0]-w/2.0, self.center[1]+10.0 - painter.save() - painter.setBrush(QtGui.QBrush(QtGui.QColor(Qt.white))) - painter.setPen(QtGui.QPen(Qt.NoPen)) - painter.drawRect(posx-1, posy-1, w+2, h+2) + posx, posy = self.center[0]-w/2.0, self.center[1]-25.0-self.pm_height + #painter.save() + #painter.setBrush(QtGui.QBrush(QtGui.QColor(Qt.white))) + #painter.setPen(QtGui.QPen(Qt.NoPen)) + #painter.drawRect(posx-1, posy-1, w+2, self.pm_height+2) painter.drawPixmap(posx, posy, pm) - painter.restore() + #painter.restore() # pointer painter.save() Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-02-19 18:27:50 UTC (rev 179) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-02-19 20:12:39 UTC (rev 180) @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file './src/moul/qt/ui/mainwindow.ui' # -# Created: Mon Feb 19 15:44:53 2007 +# Created: Mon Feb 19 21:09:28 2007 # by: PyQt4 UI code generator 4.1.1 # # WARNING! All changes made in this file will be lost! @@ -44,6 +44,12 @@ spacerItem1 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.hboxlayout.addItem(spacerItem1) + self.main_buttonbox = QtGui.QDialogButtonBox(self.centralwidget) + self.main_buttonbox.setGeometry(QtCore.QRect(10,520,451,32)) + self.main_buttonbox.setOrientation(QtCore.Qt.Horizontal) + self.main_buttonbox.setStandardButtons(QtGui.QDialogButtonBox.Close|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Reset|QtGui.QDialogButtonBox.Save) + self.main_buttonbox.setObjectName("main_buttonbox") + self.tabwidget = QtGui.QTabWidget(self.centralwidget) self.tabwidget.setGeometry(QtCore.QRect(0,80,471,434)) self.tabwidget.setTabPosition(QtGui.QTabWidget.North) @@ -146,7 +152,7 @@ self.gb_caverntime.setObjectName("gb_caverntime") self.gridLayout = QtGui.QWidget(self.gb_caverntime) - self.gridLayout.setGeometry(QtCore.QRect(10,20,431,61)) + self.gridLayout.setGeometry(QtCore.QRect(20,20,292,56)) self.gridLayout.setObjectName("gridLayout") self.gridlayout1 = QtGui.QGridLayout(self.gridLayout) @@ -154,24 +160,20 @@ self.gridlayout1.setSpacing(6) self.gridlayout1.setObjectName("gridlayout1") - self.lb_cavern_utc = QtGui.QLabel(self.gridLayout) - self.lb_cavern_utc.setObjectName("lb_cavern_utc") - self.gridlayout1.addWidget(self.lb_cavern_utc,0,2,1,1) + self.label_5 = QtGui.QLabel(self.gridLayout) - self.lb_pacific_utc = QtGui.QLabel(self.gridLayout) - self.lb_pacific_utc.setObjectName("lb_pacific_utc") - self.gridlayout1.addWidget(self.lb_pacific_utc,1,2,1,1) - - self.label_4 = QtGui.QLabel(self.gridLayout) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(5)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.label_4.sizePolicy().hasHeightForWidth()) - self.label_4.setSizePolicy(sizePolicy) - self.label_4.setObjectName("label_4") - self.gridlayout1.addWidget(self.label_4,0,0,1,1) + sizePolicy.setHeightForWidth(self.label_5.sizePolicy().hasHeightForWidth()) + self.label_5.setSizePolicy(sizePolicy) + self.label_5.setObjectName("label_5") + self.gridlayout1.addWidget(self.label_5,0,0,1,1) + self.lb_cavern_utc = QtGui.QLabel(self.gridLayout) + self.lb_cavern_utc.setObjectName("lb_cavern_utc") + self.gridlayout1.addWidget(self.lb_cavern_utc,0,2,1,1) + self.dt_cavern = QtGui.QDateTimeEdit(self.gridLayout) self.dt_cavern.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape(0))) self.dt_cavern.setFocusPolicy(QtCore.Qt.NoFocus) @@ -181,16 +183,6 @@ self.dt_cavern.setObjectName("dt_cavern") self.gridlayout1.addWidget(self.dt_cavern,0,1,1,1) - self.label_5 = QtGui.QLabel(self.gridLayout) - - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(5)) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.label_5.sizePolicy().hasHeightForWidth()) - self.label_5.setSizePolicy(sizePolicy) - self.label_5.setObjectName("label_5") - self.gridlayout1.addWidget(self.label_5,1,0,1,1) - self.dt_pacific = QtGui.QDateTimeEdit(self.gridLayout) self.dt_pacific.setFocusPolicy(QtCore.Qt.NoFocus) self.dt_pacific.setContextMenuPolicy(QtCore.Qt.NoContextMenu) @@ -199,25 +191,19 @@ self.dt_pacific.setObjectName("dt_pacific") self.gridlayout1.addWidget(self.dt_pacific,1,1,1,1) - spacerItem4 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) - self.gridlayout1.addItem(spacerItem4,0,3,1,1) + self.label_8 = QtGui.QLabel(self.gridLayout) - self.gb_dnitime = QtGui.QGroupBox(self.tab_tasks) - self.gb_dnitime.setGeometry(QtCore.QRect(10,270,451,131)) - self.gb_dnitime.setObjectName("gb_dnitime") + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(5)) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.label_8.sizePolicy().hasHeightForWidth()) + self.label_8.setSizePolicy(sizePolicy) + self.label_8.setObjectName("label_8") + self.gridlayout1.addWidget(self.label_8,1,0,1,1) - self.gv_dniclock = QtGui.QGraphicsView(self.gb_dnitime) - self.gv_dniclock.setGeometry(QtCore.QRect(10,20,431,101)) - self.gv_dniclock.setFocusPolicy(QtCore.Qt.NoFocus) - self.gv_dniclock.setContextMenuPolicy(QtCore.Qt.NoContextMenu) - self.gv_dniclock.setAcceptDrops(False) - self.gv_dniclock.setFrameShadow(QtGui.QFrame.Plain) - self.gv_dniclock.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) - self.gv_dniclock.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) - self.gv_dniclock.setInteractive(False) - self.gv_dniclock.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) - self.gv_dniclock.setRenderHints(QtGui.QPainter.Antialiasing|QtGui.QPainter.SmoothPixmapTransform|QtGui.QPainter.TextAntialiasing) - self.gv_dniclock.setObjectName("gv_dniclock") + self.lb_pacific_utc = QtGui.QLabel(self.gridLayout) + self.lb_pacific_utc.setObjectName("lb_pacific_utc") + self.gridlayout1.addWidget(self.lb_pacific_utc,1,2,1,1) self.tabwidget.addTab(self.tab_tasks,"") self.tab_settings = QtGui.QWidget() @@ -766,6 +752,156 @@ self.tb_ping_view.setObjectName("tb_ping_view") self.tabwidget.addTab(self.tab_ping,"") + self.tab_time = QtGui.QWidget() + self.tab_time.setObjectName("tab_time") + + self.groupBox_3 = QtGui.QGroupBox(self.tab_time) + self.groupBox_3.setGeometry(QtCore.QRect(10,0,451,181)) + self.groupBox_3.setObjectName("groupBox_3") + + self.gridLayout_5 = QtGui.QWidget(self.groupBox_3) + self.gridLayout_5.setGeometry(QtCore.QRect(10,20,431,154)) + self.gridLayout_5.setObjectName("gridLayout_5") + + self.gridlayout2 = QtGui.QGridLayout(self.gridLayout_5) + self.gridlayout2.setMargin(0) + self.gridlayout2.setSpacing(6) + self.gridlayout2.setObjectName("gridlayout2") + + self.hboxlayout9 = QtGui.QHBoxLayout() + self.hboxlayout9.setMargin(0) + self.hboxlayout9.setSpacing(6) + self.hboxlayout9.setObjectName("hboxlayout9") + + self.sb_ = QtGui.QSpinBox(self.gridLayout_5) + self.sb_.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) + self.sb_.setMaximum(4) + self.sb_.setProperty("value",QtCore.QVariant(0)) + self.sb_.setObjectName("sb_") + self.hboxlayout9.addWidget(self.sb_) + + self.sb_1 = QtGui.QSpinBox(self.gridLayout_5) + self.sb_1.setMinimumSize(QtCore.QSize(0,0)) + self.sb_1.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) + self.sb_1.setMaximum(24) + self.sb_1.setProperty("value",QtCore.QVariant(0)) + self.sb_1.setObjectName("sb_1") + self.hboxlayout9.addWidget(self.sb_1) + + self.sb_2 = QtGui.QSpinBox(self.gridLayout_5) + self.sb_2.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) + self.sb_2.setMaximum(24) + self.sb_2.setProperty("value",QtCore.QVariant(0)) + self.sb_2.setObjectName("sb_2") + self.hboxlayout9.addWidget(self.sb_2) + + self.sb_3 = QtGui.QSpinBox(self.gridLayout_5) + self.sb_3.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) + self.sb_3.setMaximum(24) + self.sb_3.setProperty("value",QtCore.QVariant(0)) + self.sb_3.setObjectName("sb_3") + self.hboxlayout9.addWidget(self.sb_3) + + spacerItem4 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) + self.hboxlayout9.addItem(spacerItem4) + self.gridlayout2.addLayout(self.hboxlayout9,3,1,1,1) + + self.hboxlayout10 = QtGui.QHBoxLayout() + self.hboxlayout10.setMargin(0) + self.hboxlayout10.setSpacing(6) + self.hboxlayout10.setObjectName("hboxlayout10") + + self.dateTimeEdit = QtGui.QDateTimeEdit(self.gridLayout_5) + self.dateTimeEdit.setCalendarPopup(True) + self.dateTimeEdit.setObjectName("dateTimeEdit") + self.hboxlayout10.addWidget(self.dateTimeEdit) + + self.comboBox_2 = QtGui.QComboBox(self.gridLayout_5) + self.comboBox_2.setObjectName("comboBox_2") + self.hboxlayout10.addWidget(self.comboBox_2) + + spacerItem5 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) + self.hboxlayout10.addItem(spacerItem5) + self.gridlayout2.addLayout(self.hboxlayout10,1,1,1,1) + + spacerItem6 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) + self.gridlayout2.addItem(spacerItem6,0,1,1,1) + + self.radioButton_4 = QtGui.QRadioButton(self.gridLayout_5) + self.radioButton_4.setObjectName("radioButton_4") + self.gridlayout2.addWidget(self.radioButton_4,4,0,1,1) + + self.hboxlayout11 = QtGui.QHBoxLayout() + self.hboxlayout11.setMargin(0) + self.hboxlayout11.setSpacing(6) + self.hboxlayout11.setObjectName("hboxlayout11") + + self.sb_4 = QtGui.QSpinBox(self.gridLayout_5) + self.sb_4.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) + self.sb_4.setMaximum(9999) + self.sb_4.setProperty("value",QtCore.QVariant(9662)) + self.sb_4.setObjectName("sb_4") + self.hboxlayout11.addWidget(self.sb_4) + + self.comboBox_3 = QtGui.QComboBox(self.gridLayout_5) + self.comboBox_3.setMinimumSize(QtCore.QSize(0,0)) + self.comboBox_3.setObjectName("comboBox_3") + self.hboxlayout11.addWidget(self.comboBox_3) + + self.spinBox_2 = QtGui.QSpinBox(self.gridLayout_5) + self.spinBox_2.setMaximum(29) + self.spinBox_2.setMinimum(1) + self.spinBox_2.setProperty("value",QtCore.QVariant(1)) + self.spinBox_2.setObjectName("spinBox_2") + self.hboxlayout11.addWidget(self.spinBox_2) + + spacerItem7 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) + self.hboxlayout11.addItem(spacerItem7) + self.gridlayout2.addLayout(self.hboxlayout11,2,1,1,1) + + self.radioButton = QtGui.QRadioButton(self.gridLayout_5) + self.radioButton.setObjectName("radioButton") + self.gridlayout2.addWidget(self.radioButton,0,0,1,1) + + self.radioButton_3 = QtGui.QRadioButton(self.gridLayout_5) + self.radioButton_3.setObjectName("radioButton_3") + self.gridlayout2.addWidget(self.radioButton_3,2,0,1,1) + + self.radioButton_2 = QtGui.QRadioButton(self.gridLayout_5) + self.radioButton_2.setObjectName("radioButton_2") + self.gridlayout2.addWidget(self.radioButton_2,1,0,1,1) + + self.hboxlayout12 = QtGui.QHBoxLayout() + self.hboxlayout12.setMargin(0) + self.hboxlayout12.setSpacing(6) + self.hboxlayout12.setObjectName("hboxlayout12") + + self.comboBox = QtGui.QComboBox(self.gridLayout_5) + self.comboBox.setObjectName("comboBox") + self.hboxlayout12.addWidget(self.comboBox) + + spacerItem8 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) + self.hboxlayout12.addItem(spacerItem8) + self.gridlayout2.addLayout(self.hboxlayout12,4,1,1,1) + + self.gb_dnitime = QtGui.QGroupBox(self.tab_time) + self.gb_dnitime.setGeometry(QtCore.QRect(10,220,451,181)) + self.gb_dnitime.setObjectName("gb_dnitime") + + self.gv_dniclock = QtGui.QGraphicsView(self.gb_dnitime) + self.gv_dniclock.setGeometry(QtCore.QRect(10,20,431,151)) + self.gv_dniclock.setFocusPolicy(QtCore.Qt.NoFocus) + self.gv_dniclock.setContextMenuPolicy(QtCore.Qt.NoContextMenu) + self.gv_dniclock.setAcceptDrops(False) + self.gv_dniclock.setFrameShadow(QtGui.QFrame.Plain) + self.gv_dniclock.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.gv_dniclock.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.gv_dniclock.setInteractive(False) + self.gv_dniclock.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) + self.gv_dniclock.setRenderHints(QtGui.QPainter.Antialiasing|QtGui.QPainter.SmoothPixmapTransform|QtGui.QPainter.TextAntialiasing) + self.gv_dniclock.setObjectName("gv_dniclock") + self.tabwidget.addTab(self.tab_time,"") + self.tab_browse = QtGui.QWidget() self.tab_browse.setObjectName("tab_browse") @@ -781,6 +917,12 @@ self.groupBox_5.setGeometry(QtCore.QRect(10,0,451,371)) self.groupBox_5.setObjectName("groupBox_5") + self.tb_chatlog_view = QtGui.QTextBrowser(self.groupBox_5) + self.tb_chatlog_view.setGeometry(QtCore.QRect(10,50,431,311)) + self.tb_chatlog_view.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse) + self.tb_chatlog_view.setOpenExternalLinks(True) + self.tb_chatlog_view.setObjectName("tb_chatlog_view") + self.cb_chatlog = QtGui.QComboBox(self.groupBox_5) self.cb_chatlog.setGeometry(QtCore.QRect(70,20,323,22)) @@ -790,12 +932,6 @@ sizePolicy.setHeightForWidth(self.cb_chatlog.sizePolicy().hasHeightForWidth()) self.cb_chatlog.setSizePolicy(sizePolicy) self.cb_chatlog.setObjectName("cb_chatlog") - - self.tb_chatlog_view = QtGui.QTextBrowser(self.groupBox_5) - self.tb_chatlog_view.setGeometry(QtCore.QRect(10,50,431,311)) - self.tb_chatlog_view.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse) - self.tb_chatlog_view.setOpenExternalLinks(True) - self.tb_chatlog_view.setObjectName("tb_chatlog_view") self.tabWidget.addTab(self.tab_sub_chatlogs,"") self.tab_sub_journals = QtGui.QWidget() @@ -809,14 +945,14 @@ self.gridLayout_2.setGeometry(QtCore.QRect(10,20,431,113)) self.gridLayout_2.setObjectName("gridLayout_2") - self.gridlayout2 = QtGui.QGridLayout(self.gridLayout_2) - self.gridlayout2.setMargin(0) - self.gridlayout2.setSpacing(6) - self.gridlayout2.setObjectName("gridlayout2") + self.gridlayout3 = QtGui.QGridLayout(self.gridLayout_2) + self.gridlayout3.setMargin(0) + self.gridlayout3.setSpacing(6) + self.gridlayout3.setObjectName("gridlayout3") self.cb_doc_element = QtGui.QComboBox(self.gridLayout_2) self.cb_doc_element.setObjectName("cb_doc_element") - self.gridlayout2.addWidget(self.cb_doc_element,3,1,1,1) + self.gridlayout3.addWidget(self.cb_doc_element,3,1,1,1) self.cb_doc_language = QtGui.QComboBox(self.gridLayout_2) @@ -826,38 +962,38 @@ sizePolicy.setHeightForWidth(self.cb_doc_language.sizePolicy().hasHeightForWidth()) self.cb_doc_language.setSizePolicy(sizePolicy) self.cb_doc_language.setObjectName("cb_doc_language") - self.gridlayout2.addWidget(self.cb_doc_language,0,1,1,1) + self.gridlayout3.addWidget(self.cb_doc_language,0,1,1,1) self.label = QtGui.QLabel(self.gridLayout_2) self.label.setMinimumSize(QtCore.QSize(80,0)) self.label.setObjectName("label") - self.gridlayout2.addWidget(self.label,0,0,1,1) + self.gridlayout3.addWidget(self.label,0,0,1,1) self.cb_doc_set = QtGui.QComboBox(self.gridLayout_2) self.cb_doc_set.setObjectName("cb_doc_set") - self.gridlayout2.addWidget(self.cb_doc_set,2,1,1,1) + self.gridlayout3.addWidget(self.cb_doc_set,2,1,1,1) self.label_7 = QtGui.QLabel(self.gridLayout_2) self.label_7.setObjectName("label_7") - self.gridlayout2.addWidget(self.label_7,3,0,1,1) + self.gridlayout3.addWidget(self.label_7,3,0,1,1) self.label_2 = QtGui.QLabel(self.gridLayout_2) self.label_2.setObjectName("label_2") - self.gridlayout2.addWidget(self.label_2,1,0,1,1) + self.gridlayout3.addWidget(self.label_2,1,0,1,1) self.label_3 = QtGui.QLabel(self.gridLayout_2) self.label_3.setObjectName("label_3") - self.gridlayout2.addWidget(self.label_3,2,0,1,1) + self.gridlayout3.addWidget(self.label_3,2,0,1,1) self.cb_doc_age = QtGui.QComboBox(self.gridLayout_2) self.cb_doc_age.setObjectName("cb_doc_age") - self.gridlayout2.addWidget(self.cb_doc_age,1,1,1,1) + self.gridlayout3.addWidget(self.cb_doc_age,1,1,1,1) self.pb_doc_loadjournals = QtGui.QPushButton(self.gridLayout_2) self.pb_doc_loadjournals.setMinimumSize(QtCore.QSize(0,22)) self.pb_doc_loadjournals.setMaximumSize(QtCore.QSize(16777215,22)) self.pb_doc_loadjournals.setObjectName("pb_doc_loadjournals") - self.gridlayout2.addWidget(self.pb_doc_loadjournals,0,2,1,1) + self.gridlayout3.addWidget(self.pb_doc_loadjournals,0,2,1,1) self.lb_doc_status = QtGui.QLabel(self.gridLayout_2) self.lb_doc_status.setMinimumSize(QtCore.QSize(120,80)) @@ -865,7 +1001,7 @@ self.lb_doc_status.setAlignment(QtCore.Qt.AlignHCenter|QtCore.Qt.AlignTop) self.lb_doc_status.setWordWrap(True) self.lb_doc_status.setObjectName("lb_doc_status") - self.gridlayout2.addWidget(self.lb_doc_status,1,2,3,1) + self.gridlayout3.addWidget(self.lb_doc_status,1,2,3,1) self.tb_journal_view = QtGui.QTextBrowser(self.gb_documents) self.tb_journal_view.setGeometry(QtCore.QRect(10,140,431,221)) @@ -885,10 +1021,10 @@ self.gridLayout_3.setGeometry(QtCore.QRect(10,20,411,341)) self.gridLayout_3.setObjectName("gridLayout_3") - self.gridlayout3 = QtGui.QGridLayout(self.gridLayout_3) - self.gridlayout3.setMargin(0) - self.gridlayout3.setSpacing(6) - self.gridlayout3.setObjectName("gridlayout3") + self.gridlayout4 = QtGui.QGridLayout(self.gridLayout_3) + self.gridlayout4.setMargin(0) + self.gridlayout4.setSpacing(6) + self.gridlayout4.setObjectName("gridlayout4") self.tabWidget.addTab(self.tab,"") self.tabwidget.addTab(self.tab_browse,"") @@ -920,12 +1056,6 @@ self.tb_license.setObjectName("tb_license") self.tabwidget_about.addTab(self.tab_sub_license,"") self.tabwidget.addTab(self.tab_about,"") - - self.main_buttonbox = QtGui.QDialogButtonBox(self.centralwidget) - self.main_buttonbox.setGeometry(QtCore.QRect(10,520,451,32)) - self.main_buttonbox.setOrientation(QtCore.Qt.Horizontal) - self.main_buttonbox.setStandardButtons(QtGui.QDialogButtonBox.Close|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Reset|QtGui.QDialogButtonBox.Save) - self.main_buttonbox.setObjectName("main_buttonbox") MainWindow.setCentralWidget(self.centralwidget) self.statusbar = QtGui.QStatusBar(MainWindow) @@ -937,7 +1067,7 @@ self.lb_doc_status.setBuddy(self.pb_doc_loadjournals) self.retranslateUi(MainWindow) - self.tabwidget.setCurrentIndex(0) + self.tabwidget.setCurrentIndex(3) self.tab_sub_settings.setCurrentIndex(0) self.tabWidget.setCurrentIndex(0) self.tabwidget_about.setCurrentIndex(0) @@ -957,11 +1087,10 @@ self.pb_kiimage_repair.setText(QtGui.QApplication.translate("MainWindow", "Repair", None, QtGui.QApplication.UnicodeUTF8)) self.pb_kiimage_repair1.setText(QtGui.QApplication.translate("MainWindow", "Fix KI and avatar images", None, QtGui.QApplication.UnicodeUTF8)) self.gb_caverntime.setTitle(QtGui.QApplication.translate("MainWindow", "Time zones", None, QtGui.QApplication.UnicodeUTF8)) + self.label_5.setText(QtGui.QApplication.translate("MainWindow", "Cavern time:", None, QtGui.QApplication.UnicodeUTF8)) self.lb_cavern_utc.setText(QtGui.QApplication.translate("MainWindow", "UTC -0", None, QtGui.QApplication.UnicodeUTF8)) + self.label_8.setText(QtGui.QApplication.translate("MainWindow", "Cyan time:", None, QtGui.QApplication.UnicodeUTF8)) 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)) @@ -1005,12 +1134,20 @@ self.gb_servers.setTitle(QtGui.QApplication.translate("MainWindow", "Ping servers", None, QtGui.QApplication.UnicodeUTF8)) self.button_ping.setText(QtGui.QApplication.translate("MainWindow", "Ping", None, QtGui.QApplication.UnicodeUTF8)) self.tabwidget.setTabText(self.tabwidget.indexOf(self.tab_ping), QtGui.QApplication.translate("MainWindow", "Servers", None, QtGui.QApplication.UnicodeUTF8)) + self.groupBox_3.setTitle(QtGui.QApplication.translate("MainWindow", "Choose Time", None, QtGui.QApplication.UnicodeUTF8)) + self.radioButton_4.setText(QtGui.QApplication.translate("MainWindow", "D\'ni Holiday", None, QtGui.QApplication.UnicodeUTF8)) + self.comboBox_3.addItem(QtGui.QApplication.translate("MainWindow", "8 Leevosahn", None, QtGui.QApplication.UnicodeUTF8)) + self.radioButton.setText(QtGui.QApplication.translate("MainWindow", "Current Time", None, QtGui.QApplication.UnicodeUTF8)) + self.radioButton_3.setText(QtGui.QApplication.translate("MainWindow", "D\'ni Time", None, QtGui.QApplication.UnicodeUTF8)) + self.radioButton_2.setText(QtGui.QApplication.translate("MainWindow", "Earth 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_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.cb_chatlog.addItem(QtGui.QApplication.translate("MainWindow", "Not implemented", 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:\'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)) self.label.setText(QtGui.QApplication.translate("MainWindow", "Language", None, QtGui.QApplication.UnicodeUTF8)) Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.ui =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-02-19 18:27:50 UTC (rev 179) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-02-19 20:12:39 UTC (rev 180) @@ -97,6 +97,22 @@ </item> </layout> </widget> + <widget class="QDialogButtonBox" name="main_buttonbox" > + <property name="geometry" > + <rect> + <x>10</x> + <y>520</y> + <width>451</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> @@ -110,7 +126,7 @@ <enum>QTabWidget::North</enum> </property> <property name="currentIndex" > - <number>0</number> + <number>3</number> </property> <widget class="QWidget" name="tab_tasks" > <attribute name="title" > @@ -358,10 +374,10 @@ <widget class="QWidget" native="1" name="gridLayout" > <property name="geometry" > <rect> - <x>10</x> + <x>20</x> <y>20</y> - <width>431</width> - <height>61</height> + <width>292</width> + <height>56</height> </rect> </property> <layout class="QGridLayout" > @@ -371,22 +387,8 @@ <property name="spacing" > <number>6</number> </property> - <item row="0" column="2" > - <widget class="QLabel" name="lb_cavern_utc" > - <property name="text" > - <string>UTC -0</string> - </property> - </widget> - </item> - <item row="1" column="2" > - <widget class="QLabel" name="lb_pacific_utc" > - <property name="text" > - <string>UTC -0</string> - </property> - </widget> - </item> <item row="0" column="0" > - <widget class="QLabel" name="label_4" > + <widget class="QLabel" name="label_5" > <property name="sizePolicy" > <sizepolicy> <hsizetype>0</hsizetype> @@ -400,6 +402,13 @@ </property> </widget> </item> + <item row="0" column="2" > + <widget class="QLabel" name="lb_cavern_utc" > + <property name="text" > + <string>UTC -0</string> + </property> + </widget> + </item> <item row="0" column="1" > <widget class="QDateTimeEdit" name="dt_cavern" > <property name="cursor" > @@ -419,21 +428,6 @@ </property> </widget> </item> - <item row="1" column="0" > - <widget class="QLabel" name="label_5" > - <property name="sizePolicy" > - <sizepolicy> - <hsizetype>0</hsizetype> - <vsizetype>5</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>Cyan time:</string> - </property> - </widget> - </item> <item row="1" column="1" > <widget class="QDateTimeEdit" name="dt_pacific" > <property name="focusPolicy" > @@ -450,72 +444,31 @@ </property> </widget> </item> - <item row="0" column="3" > - <spacer> - <property name="orientation" > - <enum>Qt::Horizontal</enum> + <item row="1" column="0" > + <widget class="QLabel" name="label_8" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - <property name="sizeHint" > - <size> - <width>40</width> - <height>20</height> - </size> + <property name="text" > + <string>Cyan time:</string> </property> - </spacer> + </widget> </item> + <item row="1" column="2" > + <widget class="QLabel" name="lb_pacific_utc" > + <property name="text" > + <string>UTC -0</string> + </property> + </widget> + </item> </layout> </widget> </widget> - <widget class="QGroupBox" name="gb_dnitime" > - <property name="geometry" > - <rect> - <x>10</x> - <y>270</y> - <width>451</width> - <height>131</height> - </rect> - </property> - <property name="title" > - <string>D'ni time</string> - </property> - <widget class="QGraphicsView" name="gv_dniclock" > - <property name="geometry" > - <rect> - <x>10</x> - <y>20</y> - <width>431</width> - <height>101</height> - </rect> - </property> - <property name="focusPolicy" > - <enum>Qt::NoFocus</enum> - </property> - <property name="contextMenuPolicy" > - <enum>Qt::NoContextMenu</enum> - </property> - <property name="acceptDrops" > - <bool>false</bool> - </property> - <property name="frameShadow" > - <enum>QFrame::Plain</enum> - </property> - <property name="verticalScrollBarPolicy" > - <enum>Qt::ScrollBarAlwaysOff</enum> - </property> - <property name="horizontalScrollBarPolicy" > - <enum>Qt::ScrollBarAlwaysOff</enum> - </property> - <property name="interactive" > - <bool>false</bool> - </property> - <property name="alignment" > - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> - </property> - <property name="renderHints" > - <set>QPainter::Antialiasing|QPainter::SmoothPixmapTransform|QPainter::TextAntialiasing</set> - </property> - </widget> - </widget> </widget> <widget class="QWidget" name="tab_settings" > <attribute name="title" > @@ -1655,6 +1608,337 @@ </widget> </widget> </widget> + <widget class="QWidget" name="tab_time" > + <attribute name="title" > + <string>Time</string> + </attribute> + <widget class="QGroupBox" name="groupBox_3" > + <property name="geometry" > + <rect> + <x>10</x> + <y>0</y> + <width>451</width> + <height>181</height> + </rect> + </property> + <property name="title" > + <string>Choose Time</string> + </property> + <widget class="QWidget" name="gridLayout_5" > + <property name="geometry" > + <rect> + <x>10</x> + <y>20</y> + <width>431</width> + <height>154</height> + </rect> + </property> + <layout class="QGridLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item row="3" column="1" > + <layout class="QHBoxLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QSpinBox" name="sb_" > + <property name="buttonSymbols" > + <enum>QAbstractSpinBox::UpDownArrows</enum> + </property> + <property name="maximum" > + <number>4</number> + </property> + <property name="value" > + <number>0</number> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="sb_1" > + <property name="minimumSize" > + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="buttonSymbols" > + <enum>QAbstractSpinBox::UpDownArrows</enum> + </property> + <property name="maximum" > + <number>24</number> + </property> + <property name="value" > + <number>0</number> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="sb_2" > + <property name="buttonSymbols" > + <enum>QAbstractSpinBox::UpDownArrows</enum> + </property> + <property name="maximum" > + <number>24</number> + </property> + <property name="value" > + <number>0</number> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="sb_3" > + <property name="buttonSymbols" > + <enum>QAbstractSpinBox::UpDownArrows</enum> + </property> + <property name="maximum" > + <number>24</number> + </property> + <property name="value" > + <number>0</number> + </property> + </widget> + </item> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item row="1" column="1" > + <layout class="QHBoxLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QDateTimeEdit" name="dateTimeEdit" > + <property name="calendarPopup" > + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="comboBox_2" /> + </item> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item row="0" column="1" > + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="4" column="0" > + <widget class="QRadioButton" name="radioButton_4" > + <property name="text" > + <string>D'ni Holiday</string> + </property> + </widget> + </item> + <item row="2" column="1" > + <layout class="QHBoxLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QSpinBox" name="sb_4" > + <property name="buttonSymbols" > + <enum>QAbstractSpinBox::UpDownArrows</enum> + </property> + <property name="maximum" > + <number>9999</number> + </property> + <property name="value" > + <number>9662</number> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="comboBox_3" > + <property name="minimumSize" > + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <item> + <property name="text" > + <string>8 Leevosahn</string> + </property> + </item> + </widget> + </item> + <item> + <widget class="QSpinBox" name="spinBox_2" > + <property name="maximum" > + <number>29</number> + </property> + <property name="minimum" > + <number>1</number> + </property> + <property name="value" > + <number>1</number> + </property> + </widget> + </item> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item row="0" column="0" > + <widget class="QRadioButton" name="radioButton" > + <property name="text" > + <string>Current Time</string> + </property> + </widget> + </item> + <item row="2" column="0" > + <widget class="QRadioButton" name="radioButton_3" > + <property name="text" > + <string>D'ni Time</string> + </property> + </widget> + </item> + <item row="1" column="0" > + <widget class="QRadioButton" name="radioButton_2" > + <property name="text" > + <string>Earth Time</string> + </property> + </widget> + </item> + <item row="4" column="1" > + <layout class="QHBoxLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QComboBox" name="comboBox" /> + </item> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </widget> + </widget> + <widget class="QGroupBox" name="gb_dnitime" > + <property name="geometry" > + <rect> + <x>10</x> + <y>220</y> + <width>451</width> + <height>181</height> + </rect> + </property> + <property name="title" > + <string>D'ni time</string> + </property> + <widget class="QGraphicsView" name="gv_dniclock" > + <property name="geometry" > + <rect> + <x>10</x> + <y>20</y> + <width>431</width> + <height>151</height> + </rect> + </property> + <property name="focusPolicy" > + <enum>Qt::NoFocus</enum> + </property> + <property name="contextMenuPolicy" > + <enum>Qt::NoContextMenu</enum> + </property> + <property name="acceptDrops" > + <bool>false</bool> + </property> + <property name="frameShadow" > + <enum>QFrame::Plain</enum> + </property> + <property name="verticalScrollBarPolicy" > + <enum>Qt::ScrollBarAlwaysOff</enum> + </property> + <property name="horizontalScrollBarPolicy" > + <enum>Qt::ScrollBarAlwaysOff</enum> + </property> + <property name="interactive" > + <bool>false</bool> + </property> + <property name="alignment" > + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> + <property name="renderHints" > + <set>QPainter::Antialiasing|QPainter::SmoothPixmapTransform|QPainter::TextAntialiasing</set> + </property> + </widget> + </widget> + </widget> <widget class="QWidget" name="tab_browse" > <attribute name="title" > <string>Browse</string> @@ -1690,6 +1974,28 @@ <property name="title" > <string>Read chatlogs</string> </property> + <widget class="QTextBrowser" name="tb_chatlog_view" > + <property name="geometry" > + <rect> + <x>10</x> + <y>50</y> + <width>431</width> + <height>311</height> + </rect> + </property> + <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:'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> + </property> + <property name="openExternalLinks" > + <bool>true</bool> + </property> + </widget> <widget class="QComboBox" name="cb_chatlog" > <property name="geometry" > <rect> @@ -1713,28 +2019,6 @@ </property> </item> </widget> - <widget class="QTextBrowser" name="tb_chatlog_view" > - <property name="geometry" > - <rect> - <x>10</x> - <y>50</y> - <width>431</width> - <height>311</height> - </rect> - </property> - <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:'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> - </property> - <property name="openExternalLinks" > - <bool>true</bool> - </property> - </widget> </widget> </widget> <widget class="QWidget" name="tab_sub_journals" > @@ -2005,22 +2289,6 @@ </widget> </widget> </widget> - <widget class="QDialogButtonBox" name="main_buttonbox" > - <property name="geometry" > - <rect> - <x>10</x> - <y>520</y> - <width>451</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> <widget class="QStatusBar" name="statusbar" /> </widget> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-02-19 18:27:50
|
Revision: 179 http://pymoul.svn.sourceforge.net/pymoul/?rev=179&view=rev Author: tiran Date: 2007-02-19 10:27:50 -0800 (Mon, 19 Feb 2007) Log Message: ----------- More time stuff Modified Paths: -------------- pymoul/trunk/src/moul/qt/dninumbers.py pymoul/trunk/src/moul/qt/mainwindow.py pymoul/trunk/src/moul/time/dni.py Modified: pymoul/trunk/src/moul/qt/dninumbers.py =================================================================== --- pymoul/trunk/src/moul/qt/dninumbers.py 2007-02-19 16:37:51 UTC (rev 178) +++ pymoul/trunk/src/moul/qt/dninumbers.py 2007-02-19 18:27:50 UTC (rev 179) @@ -66,16 +66,22 @@ self.dnitime_timer.setInterval(FACTOR_SP*1000+60) # XXX: smooth # time zone - # TODO: change timer from every second to every minute + # TODO: change timer from every second to once a minute? self.timezone_timer = QtCore.QTimer(self.context) self.timezone_timer.setInterval(1000) # 1 sec - # TODO: needs optimization? run only when timer tab is active + ct = self.caverntime.info() + off = ct['cavern']['utcoffset'] + self.lb_cavern_utc.setText("UTC %s%i" % (off[0], abs(off[1]))) + off = ct['pacific']['utcoffset'] + self.lb_pacific_utc.setText("UTC %s%i" % (off[0], abs(off[1]))) + self.connect(self.timezone_timer, SIGNAL('timeout()'), self.on_timezone_timer_timeout) self.connect(self.dnitime_timer, SIGNAL('timeout()'), self.clockscene.timeEvent) self.connect(self.context, SIGNAL("timerEnable(bool)"), self.on_timer_timerEnable) + # TODO: needs optimization? run only when timer tab is active self.emit(SIGNAL("timerEnable(bool)"), True) @pyqtSignature("bool") @@ -90,23 +96,6 @@ else: timer.stop() - def timezone_update(self): - """ - Update datetime widgets - """ - ct = self.caverntime.info() - - self.dt_cavern.setDateTime(ct['cavern']['datetime']) - self.dt_pacific.setDateTime(ct['pacific']['datetime']) - - off = ct['cavern']['utcoffset'] - txt = "UTC %s%i" % (off[0], abs(off[1])) - self.lb_cavern_utc.setText(QtCore.QString(txt)) - - off = ct['pacific']['utcoffset'] - txt = "UTC %s%i" % (off[0], abs(off[1])) - self.lb_pacific_utc.setText(QtCore.QString(txt)) - @pyqtSignature("") @skipLogging def on_timezone_timer_timeout(self): @@ -451,7 +440,7 @@ self.clocktext.setPlainText(str(self.dnitime)) - self.circle.setPahrtovo(dnitime.pahrtovo + dnitime.tahvo / 5.0) + self.circle.setPahrtovo(dnitime.getPahrtovoFraction()) hahr = decimal2dni(dnitime.hahr, digits=3) self.hahrl.setNumber(hahr[0]) Modified: pymoul/trunk/src/moul/qt/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/mainwindow.py 2007-02-19 16:37:51 UTC (rev 178) +++ pymoul/trunk/src/moul/qt/mainwindow.py 2007-02-19 18:27:50 UTC (rev 179) @@ -130,10 +130,9 @@ @param event: close event @type event: QCloseEvent instance """ - accept = self.handleDirtyOnClose() - if accept: - self._systray_close() - self._moulrunning_thread.terminate() + if self.handleDirtyOnClose(): + #self._systray_close() + #self._moulrunning_thread.terminate() event.accept() else: event.ignore() Modified: pymoul/trunk/src/moul/time/dni.py =================================================================== --- pymoul/trunk/src/moul/time/dni.py 2007-02-19 16:37:51 UTC (rev 178) +++ pymoul/trunk/src/moul/time/dni.py 2007-02-19 18:27:50 UTC (rev 179) @@ -298,6 +298,11 @@ return (self._prorahn // PRORAHN_PER_PAHRTOVO) % 25 pahrtovo = property(_getPahrtovo) + def getPahrtovoFraction(self): + """Get Pahrtovo with decimal fraction + """ + return ((self._prorahn // PRORAHN_PER_TAHVO) % 125) / 5.0 + def _getTahvo(self): return (self._prorahn // PRORAHN_PER_TAHVO) % 25 @valueCheck(int, 0, 25) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-02-19 16:37:54
|
Revision: 178 http://pymoul.svn.sourceforge.net/pymoul/?rev=178&view=rev Author: tiran Date: 2007-02-19 08:37:51 -0800 (Mon, 19 Feb 2007) Log Message: ----------- Language update Modified Paths: -------------- pymoul/trunk/src/moul/qt/i18n/pymoul_de.qm 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 Modified: pymoul/trunk/src/moul/qt/i18n/pymoul_de.qm =================================================================== (Binary files differ) Modified: pymoul/trunk/src/moul/qt/i18n/pymoul_de.ts =================================================================== --- pymoul/trunk/src/moul/qt/i18n/pymoul_de.ts 2007-02-19 16:36:31 UTC (rev 177) +++ pymoul/trunk/src/moul/qt/i18n/pymoul_de.ts 2007-02-19 16:37:51 UTC (rev 178) @@ -1,5 +1,12 @@ <!DOCTYPE TS><TS> <context> + <name>DniTimeNumberContainer</name> + <message> + <source>cyclic 0</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> <name>IniFileContainer</name> <message> <source>Error opening graphics.ini</source> @@ -237,7 +244,7 @@ </message> <message> <source>Remove zipped logs</source> - <translation>Entferne gepackte Logs</translation> + <translation type="obsolete">Entferne gepackte Logs</translation> </message> <message> <source>Remove</source> @@ -249,7 +256,7 @@ </message> <message> <source>Zip debug logs</source> - <translation>Packe Debuglogs</translation> + <translation type="obsolete">Packe Debuglogs</translation> </message> <message> <source>Delete debug logs</source> @@ -416,6 +423,18 @@ <source>D'ni time</source> <translation type="unfinished"></translation> </message> + <message> + <source>Zip and delete debug logs</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Remove all zipped logs</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>D'ni Numbers</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-02-19 16:36:31 UTC (rev 177) +++ pymoul/trunk/src/moul/qt/i18n/pymoul_es.ts 2007-02-19 16:37:51 UTC (rev 178) @@ -1,5 +1,12 @@ <!DOCTYPE TS><TS> <context> + <name>DniTimeNumberContainer</name> + <message> + <source>cyclic 0</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> <name>IniFileContainer</name> <message> <source>Error opening graphics.ini</source> @@ -236,10 +243,6 @@ <translation type="unfinished"></translation> </message> <message> - <source>Remove zipped logs</source> - <translation type="unfinished"></translation> - </message> - <message> <source>Remove</source> <translation type="unfinished"></translation> </message> @@ -248,10 +251,6 @@ <translation type="unfinished"></translation> </message> <message> - <source>Zip debug logs</source> - <translation type="unfinished"></translation> - </message> - <message> <source>Delete debug logs</source> <translation type="unfinished"></translation> </message> @@ -414,6 +413,18 @@ <source>D'ni time</source> <translation type="unfinished"></translation> </message> + <message> + <source>Zip and delete debug logs</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Remove all zipped logs</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>D'ni Numbers</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-02-19 16:36:31 UTC (rev 177) +++ pymoul/trunk/src/moul/qt/i18n/pymoul_fr.ts 2007-02-19 16:37:51 UTC (rev 178) @@ -1,5 +1,12 @@ <!DOCTYPE TS><TS> <context> + <name>DniTimeNumberContainer</name> + <message> + <source>cyclic 0</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> <name>IniFileContainer</name> <message> <source>Error opening graphics.ini</source> @@ -236,10 +243,6 @@ <translation type="unfinished"></translation> </message> <message> - <source>Remove zipped logs</source> - <translation type="unfinished"></translation> - </message> - <message> <source>Remove</source> <translation type="unfinished"></translation> </message> @@ -248,10 +251,6 @@ <translation type="unfinished"></translation> </message> <message> - <source>Zip debug logs</source> - <translation type="unfinished"></translation> - </message> - <message> <source>Delete debug logs</source> <translation type="unfinished"></translation> </message> @@ -414,6 +413,18 @@ <source>D'ni time</source> <translation type="unfinished"></translation> </message> + <message> + <source>Zip and delete debug logs</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Remove all zipped logs</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>D'ni Numbers</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-02-19 16:36:31 UTC (rev 177) +++ pymoul/trunk/src/moul/qt/i18n/pymoul_it.ts 2007-02-19 16:37:51 UTC (rev 178) @@ -1,5 +1,12 @@ <!DOCTYPE TS><TS> <context> + <name>DniTimeNumberContainer</name> + <message> + <source>cyclic 0</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> <name>IniFileContainer</name> <message> <source>Error opening graphics.ini</source> @@ -236,10 +243,6 @@ <translation type="unfinished"></translation> </message> <message> - <source>Remove zipped logs</source> - <translation type="unfinished"></translation> - </message> - <message> <source>Remove</source> <translation type="unfinished"></translation> </message> @@ -248,10 +251,6 @@ <translation type="unfinished"></translation> </message> <message> - <source>Zip debug logs</source> - <translation type="unfinished"></translation> - </message> - <message> <source>Delete debug logs</source> <translation type="unfinished"></translation> </message> @@ -414,6 +413,18 @@ <source>D'ni time</source> <translation type="unfinished"></translation> </message> + <message> + <source>Zip and delete debug logs</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Remove all zipped logs</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>D'ni Numbers</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-02-19 16:36:31 UTC (rev 177) +++ pymoul/trunk/src/moul/qt/i18n/pymoul_nl.ts 2007-02-19 16:37:51 UTC (rev 178) @@ -1,5 +1,12 @@ <!DOCTYPE TS><TS> <context> + <name>DniTimeNumberContainer</name> + <message> + <source>cyclic 0</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> <name>IniFileContainer</name> <message> <source>Error opening graphics.ini</source> @@ -236,10 +243,6 @@ <translation type="unfinished"></translation> </message> <message> - <source>Remove zipped logs</source> - <translation type="unfinished"></translation> - </message> - <message> <source>Remove</source> <translation type="unfinished"></translation> </message> @@ -248,10 +251,6 @@ <translation type="unfinished"></translation> </message> <message> - <source>Zip debug logs</source> - <translation type="unfinished"></translation> - </message> - <message> <source>Delete debug logs</source> <translation type="unfinished"></translation> </message> @@ -414,6 +413,18 @@ <source>D'ni time</source> <translation type="unfinished"></translation> </message> + <message> + <source>Zip and delete debug logs</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Remove all zipped logs</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>D'ni Numbers</source> + <translation type="unfinished"></translation> + </message> </context> <context> <name>SimpleProgressbar</name> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-02-19 16:36:33
|
Revision: 177 http://pymoul.svn.sourceforge.net/pymoul/?rev=177&view=rev Author: tiran Date: 2007-02-19 08:36:31 -0800 (Mon, 19 Feb 2007) Log Message: ----------- Enhanced D'ni clock Modified Paths: -------------- pymoul/trunk/src/moul/qt/dninumbers.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/time/utils.py Modified: pymoul/trunk/src/moul/qt/dninumbers.py =================================================================== --- pymoul/trunk/src/moul/qt/dninumbers.py 2007-02-17 21:49:15 UTC (rev 176) +++ pymoul/trunk/src/moul/qt/dninumbers.py 2007-02-19 16:36:31 UTC (rev 177) @@ -23,6 +23,7 @@ __revision__ = "$Revision$" import operator +import math import sys from PyQt4 import QtCore from PyQt4 import QtGui @@ -53,28 +54,42 @@ def initialize(self): # D'ni numbers self.dninumbers = QDniNumbers() - self.dnitime = DniTime() - self.setup_dniclock() + self.caverntime = CavernTime() self.setup_dninumbers() + # D'ni date and time + view = self.gv_dniclock + self.clockscene = QDniClockScene(view.parent()) + view.setScene(self.clockscene) + view.show() self.dnitime_timer = QtCore.QTimer(self.context) - self.dnitime_timer.setInterval(FACTOR_SP*1000) - self.connect(self.dnitime_timer, SIGNAL('timeout()'), - self.on_dnitimer_timeout) - self.dnitime_timer.start() - self.on_dnitimer_timeout(True) + self.dnitime_timer.setInterval(FACTOR_SP*1000+60) # XXX: smooth # time zone - self.caverntime = CavernTime() - self.timezone_update() # TODO: change timer from every second to every minute self.timezone_timer = QtCore.QTimer(self.context) self.timezone_timer.setInterval(1000) # 1 sec # TODO: needs optimization? run only when timer tab is active self.connect(self.timezone_timer, SIGNAL('timeout()'), self.on_timezone_timer_timeout) - self.timezone_timer.start() + self.connect(self.dnitime_timer, SIGNAL('timeout()'), + self.clockscene.timeEvent) + self.connect(self.context, SIGNAL("timerEnable(bool)"), + self.on_timer_timerEnable) + self.emit(SIGNAL("timerEnable(bool)"), True) + @pyqtSignature("bool") + def on_timer_timerEnable(self, value=True): + value = bool(value) + for timer in (self.dnitime_timer, self.timezone_timer): + if value == timer.isActive(): + pass + elif value: + timer.emit(SIGNAL("timeout()")) # emit to update + timer.start() + else: + timer.stop() + def timezone_update(self): """ Update datetime widgets @@ -102,74 +117,6 @@ self.dt_cavern.setDateTime(ct['cavern']) self.dt_pacific.setDateTime(ct['pacific']) - @pyqtSignature("") - @skipLogging - def on_dnitimer_timeout(self, initialize=False): - """ - SIGNAL: QTimer timeout - """ - self.dnitime.fromUTC() # set to now - self.context.le_dnitime.setText(str(self.dnitime)+", bell: %s" % - self.dnitime.pahrtovo) - self.setClockByDnidate(self.dnitime, initialize) - - def setup_dniclock(self): - height = 15 - space = 5 - width = self.dninumbers.get(0, height=height).width() - widthl = self.dninumbers.getLeft(0, height=height).width() - widthm = self.dninumbers.getMiddle(0, height=height).width() - widthr = self.dninumbers.getRight(0, height=height).width() - widthhahr = widthl + widthm + widthr - widthyahr = widthhahr + 2 * space + width - - view = self.gv_dniclock - dniclock = self.dniclock = QtGui.QGraphicsScene(view.parent()) - view.setScene(self.dniclock) - view.show() - - self.hahrl = QDniNumberRing(dniclock, 0, 24, height, 'left') - self.hahrl.setPos(0, height+space) - self.hahrm = QDniNumberRing(dniclock, 0, 24, height, 'middle') - self.hahrm.setPos(widthl, height+space) - self.hahrr = QDniNumberRing(dniclock, 0, 24, height, 'right') - self.hahrr.setPos(widthl+widthm, height+space) - - self.vailee = QDniNumberRing(dniclock, 1, 10, height) - self.vailee.setPos(widthhahr+space, height+space) - self.yahrl = QDniNumberRing(dniclock, 0, 10, height, 'left') - self.yahrl.setPos(widthyahr, height+space) - self.yahrr = QDniNumberRing(dniclock, 0, 24, height, 'right') - self.yahrr.setPos(widthyahr+widthl, height+space) - for i, name in enumerate(('gahrtahvo', 'tahvo', 'gorahn', 'prorahn')): - ring = QDniNumberRing(dniclock, 0, 24, height, cyclic=True) - setattr(self, name, ring) - ring.setPos((width+space)*i+width/2, 0) - #ring.setNumber(i) - - #for i, ring in enumerate((self.hahrl, self.hahrm, self.hahrr, self.vailee, - #self.yahrl, self.yahrr)): - #ring.setNumber(i) - - def setClockByDnidate(self, dnitime, initialize=False): - if dnitime.prorahn == self.prorahn.get() and not initialize: - return - hahr = decimal2dni(dnitime.hahr, digits=3) - self.hahrl.setNumber(hahr[0]) - self.hahrm.setNumber(hahr[1]) - self.hahrr.setNumber(hahr[2]) - - self.vailee.setNumber(dnitime.vailee) - - yahr = decimal2dni(dnitime.yahr, digits=2) - self.yahrl.setNumber(yahr[0]) - self.yahrr.setNumber(yahr[1]) - - self.gahrtahvo.setNumber(dnitime.gahrtahvo) - self.tahvo.setNumber(dnitime.tahvo) - self.gorahn.setNumber(dnitime.gorahn) - self.prorahn.setNumber(dnitime.prorahn) - def setup_dninumbers(self): # may change! widget = self.context.gridLayout_3 @@ -222,8 +169,6 @@ dnipix.setPosition(grid, 5, 0, QtCore.Qt.AlignRight) grid.addWidget(dnipix, 5, 0, 1, 2) -QtGui.QPixmapCache.setCacheLimit(QtGui.QPixmapCache.cacheLimit() + 1024) - class QDniNumbers(object): """Qt D'ni Number helper class @@ -232,6 +177,9 @@ efficency drawbacks """ __slots__ = () + + QtGui.QPixmapCache.setCacheLimit(QtGui.QPixmapCache.cacheLimit() + 1024) + # w, h = 67, 55 _rectleft = QtCore.QRect(0, 0, 60, 55) # with right border _rectright = QtCore.QRect(12, 0, 55, 55) # w/o left border @@ -257,7 +205,8 @@ else: return pm - def get(self, nr, height=None): + @classmethod + def get(cls, nr, height=None): """Get pixmap by number and scale it @param nr: number (0-25, 'cyclic') @@ -267,7 +216,7 @@ @return: (scaled) pixmap @rtype: QPixmap instance """ - pm = self._findCache(nr, height, 'full') + pm = cls._findCache(nr, height, 'full') if pm: return pm @@ -277,20 +226,21 @@ nr = int(nr) fname = "%02i.png" % nr - if nr not in self._valid: + if nr not in cls._valid: raise ValueError(nr) # lookup non scaled - pm = self._findCache(nr, None, 'full') + pm = cls._findCache(nr, None, 'full') if not pm: pm = QtGui.QPixmap(":/dninumbers/resources/dninumbers/%s" % fname) - self._insertCache(nr, None, 'full', pm) + cls._insertCache(nr, None, 'full', pm) - spm = self._scale(pm, height) - self._insertCache(nr, height, 'full', spm) + spm = cls._scale(pm, height) + cls._insertCache(nr, height, 'full', spm) return spm - def getLeft(self, nr, height=None): + @classmethod + def getLeft(cls, nr, height=None): """Get pixmap for left digit of combined number @param nr: number (0-25, 'cyclic') @@ -300,15 +250,16 @@ @return: (scaled) pixmap @rtype: QPixmap instance """ - pm = self._findCache(nr, height, 'left') + pm = cls._findCache(nr, height, 'left') if pm: return pm - pm = self.get(nr).copy(self._rectleft) - spm = self._scale(pm, height) - self._insertCache(nr, height, 'left', spm) + pm = cls.get(nr).copy(cls._rectleft) + spm = cls._scale(pm, height) + cls._insertCache(nr, height, 'left', spm) return spm - def getRight(self, nr, height=None): + @classmethod + def getRight(cls, nr, height=None): """Get pixmap for right digit of combined number @param nr: number (0-25, 'cyclic') @@ -318,15 +269,16 @@ @return: (scaled) pixmap @rtype: QPixmap instance """ - pm = self._findCache(nr, height, 'right') + pm = cls._findCache(nr, height, 'right') if pm: return pm - pm = self.get(nr).copy(self._rectright) - spm = self._scale(pm, height) - self._insertCache(nr, height, 'right', spm) + pm = cls.get(nr).copy(cls._rectright) + spm = cls._scale(pm, height) + cls._insertCache(nr, height, 'right', spm) return spm - def getMiddle(self, nr, height=None): + @classmethod + def getMiddle(cls, nr, height=None): """Get pixmap for middle digit of combined number @param nr: number (0-25, 'cyclic') @@ -336,31 +288,285 @@ @return: (scaled) pixmap @rtype: QPixmap instance """ - pm = self._findCache(nr, height, 'middle') + pm = cls._findCache(nr, height, 'middle') if pm: return pm - pm = self.get(nr).copy(self._rectmiddle) - spm = self._scale(pm, height) - self._insertCache(nr, height, 'middle', spm) + pm = cls.get(nr).copy(cls._rectmiddle) + spm = cls._scale(pm, height) + cls._insertCache(nr, height, 'middle', spm) return spm - def getFactory(self, model='full'): + @classmethod + def getFactory(cls, model='full'): """Get factory method for model """ if model == 'full': - return self.get + return cls.get elif model == 'left': - return self.getLeft + return cls.getLeft elif model == 'right': - return self.getRight + return cls.getRight elif model == 'middle': - return self.getMiddle + return cls.getMiddle else: raise ValueError(model) +class QDniNumberRing(object): + """Qt D'ni number graphics item ring + + The class emulates a ring structure similar to a clock. Internally it + stores a list of QGraphicsPixmapItem assossiacted with a scene. All items + are hidden by default and at position (0,0) + + >>> example = QDniNumberRing(scene, start=1, stop=25) + >>> example.setPosition(24) + 24 + >>> example.next() + 25 + >>> example.next() + 1 + """ + __slots__ = ('_elements', '_first', '_last', '_pos') + + def __init__(self, scene, start=0, stop=24, height=None, + model='full', cyclic=False): + factory = QDniNumbers().getFactory(model) + self._elements = [] + self._first = start + self._last = stop + self._pos = start + for i in range(start, stop+1): + if cyclic and i == 0: + i = 'cyclic' + pmitem = QtGui.QGraphicsPixmapItem(factory(i, height=height)) + pmitem.hide() + scene.addItem(pmitem) + self._elements.append(pmitem) + + def __getitem__(self, pos): + return self._elements[pos - self._first] + + def get(self): + return self._pos + + def next(self): + """Get next item + + Hides the current item and returns the next item after it is made visible + """ + pos = self._pos + self[pos].hide() + pos += 1 + if pos > self._last: + pos = self._first + self._pos = pos + element = self[pos] + element.show() + return pos + + def setNumber(self, nr): + """Set current number to nr + + Also hides all elements before returning the current element + """ + for element in self._elements: + element.hide() + element = self[nr] + element.show() + self._pos = nr + return nr + + def setPos(self, xpos, y=None): + """Set position of element + """ + for element in self._elements: + if y is not None: + element.setPos(xpos, y) + else: + element.setPos(xpos) + + def moveBy(self, dx, dy): + """Move every elemenet + """ + for element in self._elements: + element.moveBy(dx, dy) + +class QDniClockScene(QtGui.QGraphicsScene): + """Graphics scene for D'ni clock + """ + def __init__(self, parent=None): + QtGui.QGraphicsScene.__init__(self, parent) + self.dninumbers = QDniNumbers() + self.dnitime = DniTime() + + height = 15 + space = 5 + xoff = 50 + yoff = 20 + + # set widths from pixmaps + width = self.dninumbers.get(0, height=height).width() + widthl = self.dninumbers.getLeft(0, height=height).width() + widthm = self.dninumbers.getMiddle(0, height=height).width() + widthr = self.dninumbers.getRight(0, height=height).width() + widthhahr = widthl + widthm + widthr + widthyahr = widthhahr + 2 * space + width + + # setup clock D'ni numbers + self.hahrl = QDniNumberRing(self, 0, 24, height, 'left') + self.hahrl.setPos(0, height+space) + self.hahrm = QDniNumberRing(self, 0, 24, height, 'middle') + self.hahrm.setPos(widthl, height+space) + self.hahrr = QDniNumberRing(self, 0, 24, height, 'right') + self.hahrr.setPos(widthl+widthm, height+space) + self.vailee = QDniNumberRing(self, 1, 10, height) + self.vailee.setPos(widthhahr+space, height+space) + self.yahrl = QDniNumberRing(self, 0, 10, height, 'left') + self.yahrl.setPos(widthyahr, height+space) + self.yahrr = QDniNumberRing(self, 0, 24, height, 'right') + self.yahrr.setPos(widthyahr+widthl, height+space) + for i, name in enumerate(('gahrtahvo', 'tahvo', 'gorahn', 'prorahn')): + ring = QDniNumberRing(self, 0, 24, height, cyclic=True) + setattr(self, name, ring) + ring.setPos((width+space)*i+width/2, 0) + + for value in self.__dict__.values(): + if isinstance(value, QDniNumberRing): + value.moveBy(xoff, yoff) + + # clock text + # XXX: parent? + self.clocktext = QtGui.QGraphicsTextItem(None, self) + self.clocktext.setPos(0, yoff+2*height+2*space) + # circular day clock + self.circle = QDniClockCircle(None, self) + self.circle.setPos(300, 3) + + # initialize view + self.timeEvent(initialize=True) + + def setClockByDnidate(self, dnitime, initialize=False): + if dnitime.prorahn == self.prorahn.get() and not initialize: + return + + self.clocktext.setPlainText(str(self.dnitime)) + + self.circle.setPahrtovo(dnitime.pahrtovo + dnitime.tahvo / 5.0) + + hahr = decimal2dni(dnitime.hahr, digits=3) + self.hahrl.setNumber(hahr[0]) + self.hahrm.setNumber(hahr[1]) + self.hahrr.setNumber(hahr[2]) + self.vailee.setNumber(dnitime.vailee) + yahr = decimal2dni(dnitime.yahr, digits=2) + self.yahrl.setNumber(yahr[0]) + self.yahrr.setNumber(yahr[1]) + self.gahrtahvo.setNumber(dnitime.gahrtahvo) + self.tahvo.setNumber(dnitime.tahvo) + self.gorahn.setNumber(dnitime.gorahn) + self.prorahn.setNumber(dnitime.prorahn) + + @pyqtSignature("") + @skipLogging + def timeEvent(self, initialize=False): + """ + SIGNAL: QTimer timeout + """ + self.dnitime.fromUTC() # set to now + self.setClockByDnidate(self.dnitime, initialize) + +class QDniClockCircle(QtGui.QGraphicsItem): + """Circular part of the D'ni clock + """ + r = 45.0 # radios of circle + rdot = 3.0 # radius of dots + rinner = 5.0 # radius of inner circle + outrect = QtCore.QRectF(0.0, 0.0, 2.0*r, 2.0*r) + center = (r, r) + angel = 2.0*math.pi/25.0 + offset = 0.5 * math.pi + 5.0 * angel + + def __init__(self, parent=None, scene=None): + QtGui.QGraphicsItem.__init__(self, parent, scene) + self._pahrtovo = 0.0 + self._dni =QDniNumbers() + + def boundingRect(self): + return self.outrect + + def setPahrtovo(self, value): + if value != self._pahrtovo: + self._pahrtovo = value + self.update() + + def paint(self, painter, option, widget): + # pie pieces for darkness + painter.save() + painter.setBrush(QtGui.QColor(Qt.lightGray)) + painter.setPen(QtGui.QPen(Qt.NoPen)) + for i in (-1, 0): + rot = 270.0 + i*360.0/5.0 # 6 o'clock +/- angel + painter.drawPie(self.outrect, rot*16.0, 360.0/5.0*16.0) + painter.restore() + + # outer circle + painter.drawEllipse(self.outrect) + # inner dot + painter.save() + painter.setBrush(QtGui.QColor(Qt.black)) + painter.drawEllipse(self.center[0]-self.rinner/2.0, + self.center[1]-self.rinner/2.0, + self.rinner, self.rinner) + painter.restore() + + painter.save() + painter.setBrush(QtGui.QBrush(QtGui.QColor(Qt.white))) + # stripes and dots + for i in range(0, 25): + rot = i * self.angel + self.offset + if i % 5 == 0: + # lines + end = QtCore.QPointF(self.center[0] + self.r * math.cos(rot), + self.center[1] + self.r * math.sin(rot)) + painter.drawLine(QtCore.QPointF(*self.center), end) + else: + # outer ring of dots + rect = QtCore.QRectF( + self.center[0] - self.rdot/2 + (self.r - self.rdot-1.0) * math.cos(rot), + self.center[1] - self.rdot/2 + (self.r - self.rdot-1.0) * math.sin(rot), + self.rdot, self.rdot) + painter.drawEllipse(rect) + painter.restore() + + # number + h = 15 + pm = self._dni.get(self._pahrtovo, height=h) + w = pm.width() + posx, posy = self.center[0]-w/2.0, self.center[1]+10.0 + painter.save() + painter.setBrush(QtGui.QBrush(QtGui.QColor(Qt.white))) + painter.setPen(QtGui.QPen(Qt.NoPen)) + painter.drawRect(posx-1, posy-1, w+2, h+2) + painter.drawPixmap(posx, posy, pm) + painter.restore() + + # pointer + painter.save() + pen = QtGui.QPen(Qt.black) + pen.setWidth(2) + pen.setCapStyle(Qt.RoundCap) + painter.setPen(pen) + rot = self.angel * self._pahrtovo + self.offset + end = QtCore.QPointF(self.center[0] + (self.r-self.rdot) * math.cos(rot), + self.center[1] + (self.r-self.rdot) * math.sin(rot)) + painter.drawLine(QtCore.QPointF(*self.center), end) + painter.restore() + class QDniNumberWidget(QtGui.QWidget): """Q D'ni number widget - + + XXX: hacky, replace it + Displays combined number """ def __init__(self, parent): @@ -455,77 +661,3 @@ movex = movex // 2 self.move(geometry.x()+movex, geometry.y()) self._layout = None - -class QDniNumberRing(object): - """Qt D'ni number graphics item ring - - The class emulates a ring structure similar to a clock. Internally it - stores a list of QGraphicsPixmapItem assossiacted with a scene. All items - are hidden by default and at position (0,0) - - >>> example = QDniNumberRing(scene, start=1, stop=25) - >>> example.setPosition(24) - 24 - >>> example.next() - 25 - >>> example.next() - 1 - """ - __slots__ = ('_elements', '_first', '_last', '_pos') - - def __init__(self, scene, start=0, stop=24, height=None, - model='full', cyclic=False): - factory = QDniNumbers().getFactory(model) - self._elements = [] - self._first = start - self._last = stop - self._pos = start - for i in range(start, stop+1): - if cyclic and i == 0: - i = 'cyclic' - pmitem = QtGui.QGraphicsPixmapItem(factory(i, height=height)) - pmitem.hide() - scene.addItem(pmitem) - self._elements.append(pmitem) - - def __getitem__(self, pos): - return self._elements[pos - self._first] - - def get(self): - return self._pos - - def next(self): - """Get next item - - Hides the current item and returns the next item after it is made visible - """ - pos = self._pos - self[pos].hide() - pos += 1 - if pos > self._last: - pos = self._first - self._pos = pos - element = self[pos] - element.show() - return pos - - def setNumber(self, nr): - """Set current number to nr - - Also hides all elements before returning the current element - """ - for element in self._elements: - element.hide() - element = self[nr] - element.show() - self._pos = nr - return nr - - def setPos(self, xpos, y=None): - """Set position of element - """ - for element in self._elements: - if y is not None: - element.setPos(xpos, y) - else: - element.setPos(xpos) Modified: pymoul/trunk/src/moul/qt/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/mainwindow.py 2007-02-17 21:49:15 UTC (rev 176) +++ pymoul/trunk/src/moul/qt/mainwindow.py 2007-02-19 16:36:31 UTC (rev 177) @@ -85,20 +85,20 @@ self.urupersonaldir.initializeFactories() # init handlers + self.qcDniTimeNumber = DniTimeNumberContainer(self) + self.qcLocalization = LocalizationContainer(self) + self.qcIniFile = IniFileContainer(self) self._ping_init() - self._systray_init() + #self._systray_init() self._about_init() self._chatlog_init() - self.qcLocalization = LocalizationContainer(self) - self.qcIniFile = IniFileContainer(self) - self.qcDniTimeNumber = DniTimeNumberContainer(self) # run checker - self._moulrunning = None - self._moulrunning_thread = MoulRunningThread() - self.connect(self._moulrunning_thread, SIGNAL('moulIsRunning(bool)'), - self.on_moulIsRunning) - self._moulrunning_thread.startChecker(5.0) # check now and every 5 seconds + #self._moulrunning = None + #self._moulrunning_thread = MoulRunningThread() + #self.connect(self._moulrunning_thread, SIGNAL('moulIsRunning(bool)'), + # self.on_moulIsRunning) + #self._moulrunning_thread.startChecker(5.0) # check now and every 5 seconds def on_moulIsRunning(self, boolean): """ Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-02-17 21:49:15 UTC (rev 176) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-02-19 16:36:31 UTC (rev 177) @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file './src/moul/qt/ui/mainwindow.ui' # -# Created: Sat Feb 17 22:12:04 2007 +# Created: Mon Feb 19 15:44:53 2007 # by: PyQt4 UI code generator 4.1.1 # # WARNING! All changes made in this file will be lost! @@ -207,16 +207,17 @@ self.gb_dnitime.setObjectName("gb_dnitime") self.gv_dniclock = QtGui.QGraphicsView(self.gb_dnitime) - self.gv_dniclock.setGeometry(QtCore.QRect(10,20,150,55)) + self.gv_dniclock.setGeometry(QtCore.QRect(10,20,431,101)) + self.gv_dniclock.setFocusPolicy(QtCore.Qt.NoFocus) + self.gv_dniclock.setContextMenuPolicy(QtCore.Qt.NoContextMenu) self.gv_dniclock.setAcceptDrops(False) self.gv_dniclock.setFrameShadow(QtGui.QFrame.Plain) + self.gv_dniclock.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.gv_dniclock.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.gv_dniclock.setInteractive(False) + self.gv_dniclock.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) + self.gv_dniclock.setRenderHints(QtGui.QPainter.Antialiasing|QtGui.QPainter.SmoothPixmapTransform|QtGui.QPainter.TextAntialiasing) self.gv_dniclock.setObjectName("gv_dniclock") - - self.le_dnitime = QtGui.QLineEdit(self.gb_dnitime) - self.le_dnitime.setGeometry(QtCore.QRect(10,90,271,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() Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.ui =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-02-17 21:49:15 UTC (rev 176) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-02-19 16:36:31 UTC (rev 177) @@ -483,32 +483,37 @@ <rect> <x>10</x> <y>20</y> - <width>150</width> - <height>55</height> + <width>431</width> + <height>101</height> </rect> </property> + <property name="focusPolicy" > + <enum>Qt::NoFocus</enum> + </property> + <property name="contextMenuPolicy" > + <enum>Qt::NoContextMenu</enum> + </property> <property name="acceptDrops" > <bool>false</bool> </property> <property name="frameShadow" > <enum>QFrame::Plain</enum> </property> - </widget> - <widget class="QLineEdit" name="le_dnitime" > - <property name="geometry" > - <rect> - <x>10</x> - <y>90</y> - <width>271</width> - <height>25</height> - </rect> + <property name="verticalScrollBarPolicy" > + <enum>Qt::ScrollBarAlwaysOff</enum> </property> - <property name="echoMode" > - <enum>QLineEdit::Normal</enum> + <property name="horizontalScrollBarPolicy" > + <enum>Qt::ScrollBarAlwaysOff</enum> </property> - <property name="readOnly" > - <bool>true</bool> + <property name="interactive" > + <bool>false</bool> </property> + <property name="alignment" > + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> + <property name="renderHints" > + <set>QPainter::Antialiasing|QPainter::SmoothPixmapTransform|QPainter::TextAntialiasing</set> + </property> </widget> </widget> </widget> Modified: pymoul/trunk/src/moul/time/utils.py =================================================================== --- pymoul/trunk/src/moul/time/utils.py 2007-02-17 21:49:15 UTC (rev 176) +++ pymoul/trunk/src/moul/time/utils.py 2007-02-19 16:36:31 UTC (rev 177) @@ -30,6 +30,7 @@ from datetime import datetime from pytz import utc as UTC from pytz import timezone +from pytz import common_timezones # timestamp 0 - start of unix time UNIX_0 = datetime(1970, 1, 1, 0, 0, 0, 0, tzinfo=UTC) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-02-17 21:49:31
|
Revision: 176 http://pymoul.svn.sourceforge.net/pymoul/?rev=176&view=rev Author: tiran Date: 2007-02-17 13:49:15 -0800 (Sat, 17 Feb 2007) Log Message: ----------- Some optimizations and fine tunings on the D'ni clock Modified Paths: -------------- pymoul/trunk/src/moul/qt/dninumbers.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/dninumbers.py =================================================================== --- pymoul/trunk/src/moul/qt/dninumbers.py 2007-02-17 18:10:20 UTC (rev 175) +++ pymoul/trunk/src/moul/qt/dninumbers.py 2007-02-17 21:49:15 UTC (rev 176) @@ -33,6 +33,7 @@ from moul.time.cavern import CavernTime from moul.time.dni import DniTime from moul.time.dni import FACTOR_SP +from moul.time.dni import decimal2dni from moul.log import getLogger from moul.qt.utils import QNamespaceContainer from moul.qt.utils import QSignalLoggerMetaclass @@ -52,17 +53,16 @@ def initialize(self): # D'ni numbers self.dninumbers = QDniNumbers() + self.dnitime = DniTime() self.setup_dniclock() self.setup_dninumbers() - # D'ni date and time - self.dnitime = DniTime() - self.on_dnitimer_timeout() self.dnitime_timer = QtCore.QTimer(self.context) self.dnitime_timer.setInterval(FACTOR_SP*1000) self.connect(self.dnitime_timer, SIGNAL('timeout()'), self.on_dnitimer_timeout) self.dnitime_timer.start() + self.on_dnitimer_timeout(True) # time zone self.caverntime = CavernTime() @@ -104,13 +104,14 @@ @pyqtSignature("") @skipLogging - def on_dnitimer_timeout(self): + def on_dnitimer_timeout(self, initialize=False): """ SIGNAL: QTimer timeout """ - dni = self.dnitime.fromUTC() # set to now + self.dnitime.fromUTC() # set to now self.context.le_dnitime.setText(str(self.dnitime)+", bell: %s" % self.dnitime.pahrtovo) + self.setClockByDnidate(self.dnitime, initialize) def setup_dniclock(self): height = 15 @@ -140,18 +141,35 @@ self.yahrl.setPos(widthyahr, height+space) self.yahrr = QDniNumberRing(dniclock, 0, 24, height, 'right') self.yahrr.setPos(widthyahr+widthl, height+space) - - for i, ring in enumerate((self.hahrl, self.hahrm, self.hahrr, self.vailee, - self.yahrl, self.yahrr)): - ring.setNumber(i) - for i, name in enumerate(('gahrtahvo', 'tahvo', 'gorahn', 'prorahn')): ring = QDniNumberRing(dniclock, 0, 24, height, cyclic=True) setattr(self, name, ring) ring.setPos((width+space)*i+width/2, 0) - ring.setNumber(i) + #ring.setNumber(i) + #for i, ring in enumerate((self.hahrl, self.hahrm, self.hahrr, self.vailee, + #self.yahrl, self.yahrr)): + #ring.setNumber(i) + def setClockByDnidate(self, dnitime, initialize=False): + if dnitime.prorahn == self.prorahn.get() and not initialize: + return + hahr = decimal2dni(dnitime.hahr, digits=3) + self.hahrl.setNumber(hahr[0]) + self.hahrm.setNumber(hahr[1]) + self.hahrr.setNumber(hahr[2]) + + self.vailee.setNumber(dnitime.vailee) + + yahr = decimal2dni(dnitime.yahr, digits=2) + self.yahrl.setNumber(yahr[0]) + self.yahrr.setNumber(yahr[1]) + + self.gahrtahvo.setNumber(dnitime.gahrtahvo) + self.tahvo.setNumber(dnitime.tahvo) + self.gorahn.setNumber(dnitime.gorahn) + self.prorahn.setNumber(dnitime.prorahn) + def setup_dninumbers(self): # may change! widget = self.context.gridLayout_3 @@ -360,18 +378,7 @@ def setByDecimal(self, number, digits=1): """Set numbers by decial value with minimum digits """ - numbers = [] - pos = 0 - while True: - div = 25**pos - cur = (number / div) % 25 - number -= cur * div - pos+=1 - numbers.insert(0, cur) - if not number: - break - while len(numbers) < digits: - numbers.insert(0, 0) + numbers = decimal2dni(number, digits) return self.setNumbers(*numbers) def setNumbers(self, *args): @@ -458,11 +465,11 @@ >>> example = QDniNumberRing(scene, start=1, stop=25) >>> example.setPosition(24) - <Pixmap Graphics Item 24> + 24 >>> example.next() - <Pixmap Graphics Item 25> + 25 >>> example.next() - <Pixmap Graphics Item 25> + 1 """ __slots__ = ('_elements', '_first', '_last', '_pos') @@ -484,6 +491,9 @@ def __getitem__(self, pos): return self._elements[pos - self._first] + def get(self): + return self._pos + def next(self): """Get next item @@ -497,7 +507,7 @@ self._pos = pos element = self[pos] element.show() - return element + return pos def setNumber(self, nr): """Set current number to nr @@ -509,7 +519,7 @@ element = self[nr] element.show() self._pos = nr - return element + return nr def setPos(self, xpos, y=None): """Set position of element Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-02-17 18:10:20 UTC (rev 175) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-02-17 21:49:15 UTC (rev 176) @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file './src/moul/qt/ui/mainwindow.ui' # -# Created: Sat Feb 17 18:51:48 2007 +# Created: Sat Feb 17 22:12:04 2007 # by: PyQt4 UI code generator 4.1.1 # # WARNING! All changes made in this file will be lost! @@ -142,11 +142,11 @@ self.hboxlayout1.addItem(spacerItem3) self.gb_caverntime = QtGui.QGroupBox(self.tab_tasks) - self.gb_caverntime.setGeometry(QtCore.QRect(10,180,451,101)) + self.gb_caverntime.setGeometry(QtCore.QRect(10,180,451,91)) self.gb_caverntime.setObjectName("gb_caverntime") self.gridLayout = QtGui.QWidget(self.gb_caverntime) - self.gridLayout.setGeometry(QtCore.QRect(10,20,431,74)) + self.gridLayout.setGeometry(QtCore.QRect(10,20,431,61)) self.gridLayout.setObjectName("gridLayout") self.gridlayout1 = QtGui.QGridLayout(self.gridLayout) @@ -203,20 +203,20 @@ self.gridlayout1.addItem(spacerItem4,0,3,1,1) self.gb_dnitime = QtGui.QGroupBox(self.tab_tasks) - self.gb_dnitime.setGeometry(QtCore.QRect(10,280,451,121)) + self.gb_dnitime.setGeometry(QtCore.QRect(10,270,451,131)) self.gb_dnitime.setObjectName("gb_dnitime") + self.gv_dniclock = QtGui.QGraphicsView(self.gb_dnitime) + self.gv_dniclock.setGeometry(QtCore.QRect(10,20,150,55)) + self.gv_dniclock.setAcceptDrops(False) + self.gv_dniclock.setFrameShadow(QtGui.QFrame.Plain) + self.gv_dniclock.setObjectName("gv_dniclock") + self.le_dnitime = QtGui.QLineEdit(self.gb_dnitime) - self.le_dnitime.setGeometry(QtCore.QRect(200,20,241,25)) + self.le_dnitime.setGeometry(QtCore.QRect(10,90,271,25)) self.le_dnitime.setEchoMode(QtGui.QLineEdit.Normal) self.le_dnitime.setReadOnly(True) self.le_dnitime.setObjectName("le_dnitime") - - self.gv_dniclock = QtGui.QGraphicsView(self.gb_dnitime) - self.gv_dniclock.setGeometry(QtCore.QRect(10,20,181,94)) - self.gv_dniclock.setAcceptDrops(False) - self.gv_dniclock.setFrameShadow(QtGui.QFrame.Plain) - self.gv_dniclock.setObjectName("gv_dniclock") self.tabwidget.addTab(self.tab_tasks,"") self.tab_settings = QtGui.QWidget() Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.ui =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-02-17 18:10:20 UTC (rev 175) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-02-17 21:49:15 UTC (rev 176) @@ -349,7 +349,7 @@ <x>10</x> <y>180</y> <width>451</width> - <height>101</height> + <height>91</height> </rect> </property> <property name="title" > @@ -361,7 +361,7 @@ <x>10</x> <y>20</y> <width>431</width> - <height>74</height> + <height>61</height> </rect> </property> <layout class="QGridLayout" > @@ -470,44 +470,44 @@ <property name="geometry" > <rect> <x>10</x> - <y>280</y> + <y>270</y> <width>451</width> - <height>121</height> + <height>131</height> </rect> </property> <property name="title" > <string>D'ni time</string> </property> - <widget class="QLineEdit" name="le_dnitime" > + <widget class="QGraphicsView" name="gv_dniclock" > <property name="geometry" > <rect> - <x>200</x> + <x>10</x> <y>20</y> - <width>241</width> - <height>25</height> + <width>150</width> + <height>55</height> </rect> </property> - <property name="echoMode" > - <enum>QLineEdit::Normal</enum> + <property name="acceptDrops" > + <bool>false</bool> </property> - <property name="readOnly" > - <bool>true</bool> + <property name="frameShadow" > + <enum>QFrame::Plain</enum> </property> </widget> - <widget class="QGraphicsView" name="gv_dniclock" > + <widget class="QLineEdit" name="le_dnitime" > <property name="geometry" > <rect> <x>10</x> - <y>20</y> - <width>181</width> - <height>94</height> + <y>90</y> + <width>271</width> + <height>25</height> </rect> </property> - <property name="acceptDrops" > - <bool>false</bool> + <property name="echoMode" > + <enum>QLineEdit::Normal</enum> </property> - <property name="frameShadow" > - <enum>QFrame::Plain</enum> + <property name="readOnly" > + <bool>true</bool> </property> </widget> </widget> Modified: pymoul/trunk/src/moul/time/dni.py =================================================================== --- pymoul/trunk/src/moul/time/dni.py 2007-02-17 18:10:20 UTC (rev 175) +++ pymoul/trunk/src/moul/time/dni.py 2007-02-17 21:49:15 UTC (rev 176) @@ -151,6 +151,23 @@ return checker return wrapper +def decimal2dni(number, digits=1): + """Convert decimal number to dni number + """ + numbers = [] + pos = 0 + while True: + div = 25**pos + cur = (number / div) % 25 + number -= cur * div + pos+=1 + numbers.insert(0, cur) + if not number: + break + while len(numbers) < digits: + numbers.insert(0, 0) + return numbers + class DniTime(object): """D'ni time representation This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-02-17 18:10:25
|
Revision: 175 http://pymoul.svn.sourceforge.net/pymoul/?rev=175&view=rev Author: tiran Date: 2007-02-17 10:10:20 -0800 (Sat, 17 Feb 2007) Log Message: ----------- Added basics for D'ni clock Modified Paths: -------------- pymoul/trunk/src/moul/qt/dninumbers.py pymoul/trunk/src/moul/qt/mainwindow.py pymoul/trunk/src/moul/qt/ui/mainwindow.py pymoul/trunk/src/moul/qt/ui/mainwindow.ui Modified: pymoul/trunk/src/moul/qt/dninumbers.py =================================================================== --- pymoul/trunk/src/moul/qt/dninumbers.py 2007-02-16 13:09:45 UTC (rev 174) +++ pymoul/trunk/src/moul/qt/dninumbers.py 2007-02-17 18:10:20 UTC (rev 175) @@ -22,6 +22,7 @@ __version__ = "$Id$" __revision__ = "$Revision$" +import operator import sys from PyQt4 import QtCore from PyQt4 import QtGui @@ -29,37 +30,214 @@ from PyQt4.QtCore import SIGNAL from PyQt4.QtCore import pyqtSignature +from moul.time.cavern import CavernTime +from moul.time.dni import DniTime +from moul.time.dni import FACTOR_SP +from moul.log import getLogger from moul.qt.utils import QNamespaceContainer from moul.qt.utils import QSignalLoggerMetaclass -from moul.qt.utils import questionMB -from moul.qt.utils import criticalMB +from moul.qt.utils import skipLogging +NUMBER_HEIGHT = 25 +LOG = getLogger('moul.qt.dni') + +class DniTimeNumberContainer(QNamespaceContainer): + """Container for Dni Date and Dni + number stuff + """ + __metaclass__ = QSignalLoggerMetaclass + __logger__ = LOG.debug + + def initialize(self): + # D'ni numbers + self.dninumbers = QDniNumbers() + self.setup_dniclock() + self.setup_dninumbers() + + # D'ni date and time + self.dnitime = DniTime() + self.on_dnitimer_timeout() + self.dnitime_timer = QtCore.QTimer(self.context) + self.dnitime_timer.setInterval(FACTOR_SP*1000) + self.connect(self.dnitime_timer, SIGNAL('timeout()'), + self.on_dnitimer_timeout) + self.dnitime_timer.start() + + # time zone + self.caverntime = CavernTime() + self.timezone_update() + # TODO: change timer from every second to every minute + self.timezone_timer = QtCore.QTimer(self.context) + self.timezone_timer.setInterval(1000) # 1 sec + # TODO: needs optimization? run only when timer tab is active + self.connect(self.timezone_timer, SIGNAL('timeout()'), + self.on_timezone_timer_timeout) + self.timezone_timer.start() + + def timezone_update(self): + """ + Update datetime widgets + """ + ct = self.caverntime.info() + + self.dt_cavern.setDateTime(ct['cavern']['datetime']) + self.dt_pacific.setDateTime(ct['pacific']['datetime']) + + off = ct['cavern']['utcoffset'] + txt = "UTC %s%i" % (off[0], abs(off[1])) + self.lb_cavern_utc.setText(QtCore.QString(txt)) + + off = ct['pacific']['utcoffset'] + txt = "UTC %s%i" % (off[0], abs(off[1])) + self.lb_pacific_utc.setText(QtCore.QString(txt)) + + @pyqtSignature("") + @skipLogging + def on_timezone_timer_timeout(self): + """ + SIGNAL: QTimer timeout + """ + ct = self.caverntime() + self.dt_cavern.setDateTime(ct['cavern']) + self.dt_pacific.setDateTime(ct['pacific']) + + @pyqtSignature("") + @skipLogging + def on_dnitimer_timeout(self): + """ + SIGNAL: QTimer timeout + """ + dni = self.dnitime.fromUTC() # set to now + self.context.le_dnitime.setText(str(self.dnitime)+", bell: %s" % + self.dnitime.pahrtovo) + + def setup_dniclock(self): + height = 15 + space = 5 + width = self.dninumbers.get(0, height=height).width() + widthl = self.dninumbers.getLeft(0, height=height).width() + widthm = self.dninumbers.getMiddle(0, height=height).width() + widthr = self.dninumbers.getRight(0, height=height).width() + widthhahr = widthl + widthm + widthr + widthyahr = widthhahr + 2 * space + width + + view = self.gv_dniclock + dniclock = self.dniclock = QtGui.QGraphicsScene(view.parent()) + view.setScene(self.dniclock) + view.show() + + self.hahrl = QDniNumberRing(dniclock, 0, 24, height, 'left') + self.hahrl.setPos(0, height+space) + self.hahrm = QDniNumberRing(dniclock, 0, 24, height, 'middle') + self.hahrm.setPos(widthl, height+space) + self.hahrr = QDniNumberRing(dniclock, 0, 24, height, 'right') + self.hahrr.setPos(widthl+widthm, height+space) + + self.vailee = QDniNumberRing(dniclock, 1, 10, height) + self.vailee.setPos(widthhahr+space, height+space) + self.yahrl = QDniNumberRing(dniclock, 0, 10, height, 'left') + self.yahrl.setPos(widthyahr, height+space) + self.yahrr = QDniNumberRing(dniclock, 0, 24, height, 'right') + self.yahrr.setPos(widthyahr+widthl, height+space) + + for i, ring in enumerate((self.hahrl, self.hahrm, self.hahrr, self.vailee, + self.yahrl, self.yahrr)): + ring.setNumber(i) + + for i, name in enumerate(('gahrtahvo', 'tahvo', 'gorahn', 'prorahn')): + ring = QDniNumberRing(dniclock, 0, 24, height, cyclic=True) + setattr(self, name, ring) + ring.setPos((width+space)*i+width/2, 0) + ring.setNumber(i) + + + def setup_dninumbers(self): + # may change! + widget = self.context.gridLayout_3 + grid = self.context.gridlayout3 + + alignl = QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter + alignc = QtCore.Qt.AlignCenter | QtCore.Qt.AlignVCenter + for i in range(0, 5): + for j in range(0, 5): + nr = QtGui.QLabel(widget) + nr.setObjectName("lb_dninumber_nr_%02i_%02i" % (i, j)) + nr.setAlignment(alignc) + nr.setText(str(i + j*5)) + grid.addWidget(nr, j, i*2) + dni_pic = self.dninumbers.get(i + j*5, height=NUMBER_HEIGHT) + dni = QtGui.QLabel(widget) + dni.setObjectName("lb_dninumber_%02i_%02i" % (i, j)) + dni.setPixmap(dni_pic) + dni.setAlignment(alignl) + grid.addWidget(dni, j, i*2+1) + + nr = QtGui.QLabel(widget) + nr.setObjectName("lb_dninumber_nr_25") + nr.setAlignment(alignc) + nr.setText("25") + grid.addWidget(nr, 5, 2) + dni_pic = self.dninumbers.get(25, height=NUMBER_HEIGHT) + dni = QtGui.QLabel(widget) + dni.setObjectName("lb_dninumber_25") + dni.setAlignment(alignl) + dni.setPixmap(dni_pic) + grid.addWidget(dni, 5, 3) + + nr = QtGui.QLabel(widget) + nr.setObjectName("lb_dninumber_nr_00c") + nr.setAlignment(alignc) + nr.setText(self.trUtf8("cyclic 0")) + grid.addWidget(nr, 5, 5, 1, 2) + dni_pic = self.dninumbers.get("cyclic", height=NUMBER_HEIGHT) + dni = QtGui.QLabel(widget) + dni.setObjectName("lb_dninumber_00c") + dni.setAlignment(alignl) + dni.setPixmap(dni_pic) + grid.addWidget(dni, 5, 7) + + dnipix = QDniNumberWidget(widget) + dnipix.setHeight(NUMBER_HEIGHT) + dnipix.setByDecimal(25, digits=2) + dnipix.setObjectName("dnw_dninumber_250") + dnipix.setPosition(grid, 5, 0, QtCore.Qt.AlignRight) + grid.addWidget(dnipix, 5, 0, 1, 2) + +QtGui.QPixmapCache.setCacheLimit(QtGui.QPixmapCache.cacheLimit() + 1024) + class QDniNumbers(object): """Qt D'ni Number helper class - - Lookup and scale pixmaps for D'ni numbers + + Lookup and scale pixmaps for D'ni numbers. Pixmaps are cached in a + QPixmapCache. You can create as many instances as you require w/o much + efficency drawbacks """ - def __init__(self): - self.pixmaps = {} - for i in range(0, 26): - self.pixmaps[i] = QtGui.QPixmap( - ":/dninumbers/resources/dninumbers/%02i.png" % i) - self.pixmaps['cyclic'] = QtGui.QPixmap( - ":/dninumbers/resources/dninumbers/00c.png") - # w, h = 67, 55 - self._rectleft = QtCore.QRect(0, 0, 60, 55) # with right border - self._rectright = QtCore.QRect(12, 0, 55, 55) # w/o left border - self._rectmiddle = QtCore.QRect(12, 0, 49, 55) # right line + __slots__ = () + # w, h = 67, 55 + _rectleft = QtCore.QRect(0, 0, 60, 55) # with right border + _rectright = QtCore.QRect(12, 0, 55, 55) # w/o left border + _rectmiddle = QtCore.QRect(12, 0, 49, 55) # right line + _valid = tuple(range(0, 26)) + ('cyclic',) @staticmethod - def _scale(pixmap, height=None): + def _insertCache(nr, height, pos, pm): + key = 'dninumber%s_%s_%s' % (nr, height if height else '', pos) + QtGui.QPixmapCache.insert(key, pm) + + @staticmethod + def _findCache(nr, height, pos): + key = 'dninumber%s_%s_%s' % (nr, height if height else '', pos) + return QtGui.QPixmapCache.find(key) + + @staticmethod + def _scale(pm, height=None): """Scale a pixmap to height """ if height is not None: - return pixmap.scaledToHeight(height, QtCore.Qt.SmoothTransformation) + return pm.scaledToHeight(height, QtCore.Qt.SmoothTransformation) else: - return pixmap + return pm def get(self, nr, height=None): """Get pixmap by number and scale it @@ -71,13 +249,29 @@ @return: (scaled) pixmap @rtype: QPixmap instance """ - try: + pm = self._findCache(nr, height, 'full') + if pm: + return pm + + if nr == "cyclic": + fname = "00c.png" + else: nr = int(nr) - except ValueError: - pass - pixmap = self.pixmaps[nr] - return self._scale(pixmap, height) + fname = "%02i.png" % nr + if nr not in self._valid: + raise ValueError(nr) + + # lookup non scaled + pm = self._findCache(nr, None, 'full') + if not pm: + pm = QtGui.QPixmap(":/dninumbers/resources/dninumbers/%s" % fname) + self._insertCache(nr, None, 'full', pm) + + spm = self._scale(pm, height) + self._insertCache(nr, height, 'full', spm) + return spm + def getLeft(self, nr, height=None): """Get pixmap for left digit of combined number @@ -88,8 +282,13 @@ @return: (scaled) pixmap @rtype: QPixmap instance """ - pixmap = self.get(nr).copy(self._rectleft) - return self._scale(pixmap, height) + pm = self._findCache(nr, height, 'left') + if pm: + return pm + pm = self.get(nr).copy(self._rectleft) + spm = self._scale(pm, height) + self._insertCache(nr, height, 'left', spm) + return spm def getRight(self, nr, height=None): """Get pixmap for right digit of combined number @@ -101,10 +300,15 @@ @return: (scaled) pixmap @rtype: QPixmap instance """ - pixmap = self.get(nr).copy(self._rectright) - return self._scale(pixmap, height) + pm = self._findCache(nr, height, 'right') + if pm: + return pm + pm = self.get(nr).copy(self._rectright) + spm = self._scale(pm, height) + self._insertCache(nr, height, 'right', spm) + return spm - def getMiddle(self, nr, heigh=None): + def getMiddle(self, nr, height=None): """Get pixmap for middle digit of combined number @param nr: number (0-25, 'cyclic') @@ -114,9 +318,28 @@ @return: (scaled) pixmap @rtype: QPixmap instance """ - pixmap = self.get(nr).copy(self._rectmiddle) - return self._scale(pixmap, height) + pm = self._findCache(nr, height, 'middle') + if pm: + return pm + pm = self.get(nr).copy(self._rectmiddle) + spm = self._scale(pm, height) + self._insertCache(nr, height, 'middle', spm) + return spm + def getFactory(self, model='full'): + """Get factory method for model + """ + if model == 'full': + return self.get + elif model == 'left': + return self.getLeft + elif model == 'right': + return self.getRight + elif model == 'middle': + return self.getMiddle + else: + raise ValueError(model) + class QDniNumberWidget(QtGui.QWidget): """Q D'ni number widget @@ -124,42 +347,61 @@ """ def __init__(self, parent): QtGui.QWidget.__init__(self, parent) - self.dni = None + self.dni = QDniNumbers() self.height = None self.numbers = () self._layout = None - def setDniNumbers(self, dninumbers): - """Set D'ni number instance - """ - if not isinstance(dninumbers, QDniNumbers): - raise TypeError(type(dninumbers)) - self.dni = dninumbers - def setHeight(self, height=None): """Set height to scale """ self.height=height + def setByDecimal(self, number, digits=1): + """Set numbers by decial value with minimum digits + """ + numbers = [] + pos = 0 + while True: + div = 25**pos + cur = (number / div) % 25 + number -= cur * div + pos+=1 + numbers.insert(0, cur) + if not number: + break + while len(numbers) < digits: + numbers.insert(0, 0) + return self.setNumbers(*numbers) + def setNumbers(self, *args): """Set numbers to display """ valid = tuple(range(0, 26)) + ('cyclic',) for number in args: - if not isinstance(number, int): + if not isinstance(number, (int, basestring)): raise TypeError(number) if number not in valid: raise ValueError(number) self.numbers = args - self._pmleft = self.dni.getLeft(self.numbers[0], height=self.height) - self._pmright = self.dni.getRight(self.numbers[-1], height=self.height) - self._pmmiddle = [self.dni.getMiddle(nr, height=self.height) - for nr in self.numbers[1:-1]] - if self._pmmiddle: - raise NotImplementedError + self.pmlist = [] + if len(args) == 1: + self.pmlist.append(self.dni.get(self.numbers[0], + height=self.height)) else: - middlewidth = 0 - self.width = self._pmleft.width() + self._pmright.width() + middlewidth + for i, number in enumerate(args): + if i == 0: + # first + self.pmlist.append(self.dni.getLeft(number, + height=self.height)) + elif i == len(self.numbers)-1: + # last + self.pmlist.append(self.dni.getRight(number, + height=self.height)) + else: + self.pmlist.append(self.dni.getMiddle(number, + height=self.height)) + self.width = reduce(operator.add, [pm.width() for pm in self.pmlist]) self.setMinimumSize(self.width, self.height) self.setMaximumSize(self.width, self.height) self.resize(self.width, self.height) @@ -190,8 +432,10 @@ #painter.setWindow(self.parent().rect()) # left - painter.drawPixmap(0, 0, self._pmleft) - painter.drawPixmap(self.width-self._pmright.width(), 0, self._pmright) + pos = 0 + for i, pm in enumerate(self.pmlist): + painter.drawPixmap(pos, 0, pm) + pos += pm.width() painter.end() # remove the hack! @@ -204,3 +448,74 @@ movex = movex // 2 self.move(geometry.x()+movex, geometry.y()) self._layout = None + +class QDniNumberRing(object): + """Qt D'ni number graphics item ring + + The class emulates a ring structure similar to a clock. Internally it + stores a list of QGraphicsPixmapItem assossiacted with a scene. All items + are hidden by default and at position (0,0) + + >>> example = QDniNumberRing(scene, start=1, stop=25) + >>> example.setPosition(24) + <Pixmap Graphics Item 24> + >>> example.next() + <Pixmap Graphics Item 25> + >>> example.next() + <Pixmap Graphics Item 25> + """ + __slots__ = ('_elements', '_first', '_last', '_pos') + + def __init__(self, scene, start=0, stop=24, height=None, + model='full', cyclic=False): + factory = QDniNumbers().getFactory(model) + self._elements = [] + self._first = start + self._last = stop + self._pos = start + for i in range(start, stop+1): + if cyclic and i == 0: + i = 'cyclic' + pmitem = QtGui.QGraphicsPixmapItem(factory(i, height=height)) + pmitem.hide() + scene.addItem(pmitem) + self._elements.append(pmitem) + + def __getitem__(self, pos): + return self._elements[pos - self._first] + + def next(self): + """Get next item + + Hides the current item and returns the next item after it is made visible + """ + pos = self._pos + self[pos].hide() + pos += 1 + if pos > self._last: + pos = self._first + self._pos = pos + element = self[pos] + element.show() + return element + + def setNumber(self, nr): + """Set current number to nr + + Also hides all elements before returning the current element + """ + for element in self._elements: + element.hide() + element = self[nr] + element.show() + self._pos = nr + return element + + def setPos(self, xpos, y=None): + """Set position of element + """ + for element in self._elements: + if y is not None: + element.setPos(xpos, y) + else: + element.setPos(xpos) Modified: pymoul/trunk/src/moul/qt/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/mainwindow.py 2007-02-16 13:09:45 UTC (rev 174) +++ pymoul/trunk/src/moul/qt/mainwindow.py 2007-02-17 18:10:20 UTC (rev 175) @@ -41,10 +41,8 @@ from moul.server.ping import ServerList 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.dninumbers import DniTimeNumberContainer from moul.qt.localization import LocalizationContainer from moul.qt.wdysini import IniFileContainer from moul.qt.simpleprogressbar import SimpleProgressbar @@ -52,8 +50,6 @@ from moul.qt.threadlet import Threadlet from moul.qt.ui.mainwindow import Ui_MainWindow from moul.qt import utils as qtutils -from moul.qt.dninumbers import QDniNumbers -from moul.qt.dninumbers import QDniNumberWidget LOG = getLogger('moul.qt') @@ -89,14 +85,13 @@ self.urupersonaldir.initializeFactories() # init handlers - self._dninumbers_init() - self._timezone_init() self._ping_init() self._systray_init() self._about_init() self._chatlog_init() self.qcLocalization = LocalizationContainer(self) self.qcIniFile = IniFileContainer(self) + self.qcDniTimeNumber = DniTimeNumberContainer(self) # run checker self._moulrunning = None @@ -388,68 +383,6 @@ sfdonate_url)) # ************************************************************************ - # time zones - def _timezone_init(self): - """ - Init time zone tab""" - # create info object and update display the first time - self._caverntime = CavernTime() - self._timezone_update() - - # create a timer to update the display every second - # TODO: change timer from every second to every minute - 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(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 - """ - ct = self._caverntime.info() - - self.dt_cavern.setDateTime(ct['cavern']['datetime']) - self.dt_pacific.setDateTime(ct['pacific']['datetime']) - - off = ct['cavern']['utcoffset'] - txt = "UTC %s%i" % (off[0], abs(off[1])) - self.lb_cavern_utc.setText(QtCore.QString(txt)) - - off = ct['pacific']['utcoffset'] - txt = "UTC %s%i" % (off[0], abs(off[1])) - self.lb_pacific_utc.setText(QtCore.QString(txt)) - - @pyqtSignature("") - @qtutils.skipLogging - def on_timezone_timer_timeout(self): - """ - SIGNAL: QTimer timeout - """ - ct = self._caverntime() - 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.pahrtovo) - - # ************************************************************************ # ping def _ping_init(self): """ @@ -506,59 +439,6 @@ else: LOG.error("Ping thread is already running") - def _dninumbers_init(self): - self._dninumbers = QDniNumbers() - height = 25 - widget = self.gridLayout_3 - grid = self.gridlayout3 - alignl = QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter - alignc = QtCore.Qt.AlignCenter | QtCore.Qt.AlignVCenter - for i in range(0, 5): - for j in range(0, 5): - nr = QtGui.QLabel(widget) - nr.setObjectName("lb_dninumber_nr_%02i_%02i" % (i, j)) - nr.setAlignment(alignc) - nr.setText(str(i + j*5)) - grid.addWidget(nr, j, i*2) - dni_pic = self._dninumbers.get(i + j*5, height=height) - dni = QtGui.QLabel(widget) - dni.setObjectName("lb_dninumber_%02i_%02i" % (i, j)) - dni.setPixmap(dni_pic) - dni.setAlignment(alignl) - grid.addWidget(dni, j, i*2+1) - - nr = QtGui.QLabel(widget) - nr.setObjectName("lb_dninumber_nr_25") - nr.setAlignment(alignc) - nr.setText("25") - grid.addWidget(nr, 5, 2) - dni_pic = self._dninumbers.get(25, height=height) - dni = QtGui.QLabel(widget) - dni.setObjectName("lb_dninumber_25") - dni.setAlignment(alignl) - dni.setPixmap(dni_pic) - grid.addWidget(dni, 5, 3) - - nr = QtGui.QLabel(widget) - nr.setObjectName("lb_dninumber_nr_00c") - nr.setAlignment(alignc) - nr.setText(self.trUtf8("cyclic 0")) - grid.addWidget(nr, 5, 5, 1, 2) - dni_pic = self._dninumbers.get("cyclic", height=height) - dni = QtGui.QLabel(widget) - dni.setObjectName("lb_dninumber_00c") - dni.setAlignment(alignl) - dni.setPixmap(dni_pic) - grid.addWidget(dni, 5, 7) - - dnipix = QDniNumberWidget(widget) - dnipix.setDniNumbers(self._dninumbers) - dnipix.setHeight(25) - dnipix.setNumbers(1, 0) - dnipix.setObjectName("dnw_dninumber_250") - dnipix.setPosition(grid, 5, 0, QtCore.Qt.AlignRight) - grid.addWidget(dnipix, 5, 0, 1, 2) - class PingServerThread(QtCore.QThread): def __init__(self, parent=None): QtCore.QThread.__init__(self, parent) Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-02-16 13:09:45 UTC (rev 174) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-02-17 18:10:20 UTC (rev 175) @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file './src/moul/qt/ui/mainwindow.ui' # -# Created: Thu Feb 15 13:28:03 2007 +# Created: Sat Feb 17 18:51:48 2007 # by: PyQt4 UI code generator 4.1.1 # # WARNING! All changes made in this file will be lost! @@ -117,11 +117,11 @@ 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,120,451,81)) + self.groupBox_2.setGeometry(QtCore.QRect(10,120,451,61)) self.groupBox_2.setObjectName("groupBox_2") self.layoutWidget1 = QtGui.QWidget(self.groupBox_2) - self.layoutWidget1.setGeometry(QtCore.QRect(10,30,431,30)) + self.layoutWidget1.setGeometry(QtCore.QRect(10,20,431,30)) self.layoutWidget1.setObjectName("layoutWidget1") self.hboxlayout1 = QtGui.QHBoxLayout(self.layoutWidget1) @@ -142,7 +142,7 @@ self.hboxlayout1.addItem(spacerItem3) self.gb_caverntime = QtGui.QGroupBox(self.tab_tasks) - self.gb_caverntime.setGeometry(QtCore.QRect(10,200,451,101)) + self.gb_caverntime.setGeometry(QtCore.QRect(10,180,451,101)) self.gb_caverntime.setObjectName("gb_caverntime") self.gridLayout = QtGui.QWidget(self.gb_caverntime) @@ -203,14 +203,20 @@ 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.setGeometry(QtCore.QRect(10,280,451,121)) 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.setGeometry(QtCore.QRect(200,20,241,25)) self.le_dnitime.setEchoMode(QtGui.QLineEdit.Normal) self.le_dnitime.setReadOnly(True) self.le_dnitime.setObjectName("le_dnitime") + + self.gv_dniclock = QtGui.QGraphicsView(self.gb_dnitime) + self.gv_dniclock.setGeometry(QtCore.QRect(10,20,181,94)) + self.gv_dniclock.setAcceptDrops(False) + self.gv_dniclock.setFrameShadow(QtGui.QFrame.Plain) + self.gv_dniclock.setObjectName("gv_dniclock") self.tabwidget.addTab(self.tab_tasks,"") self.tab_settings = QtGui.QWidget() Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.ui =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-02-16 13:09:45 UTC (rev 174) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-02-17 18:10:20 UTC (rev 175) @@ -282,7 +282,7 @@ <x>10</x> <y>120</y> <width>451</width> - <height>81</height> + <height>61</height> </rect> </property> <property name="title" > @@ -292,7 +292,7 @@ <property name="geometry" > <rect> <x>10</x> - <y>30</y> + <y>20</y> <width>431</width> <height>30</height> </rect> @@ -347,7 +347,7 @@ <property name="geometry" > <rect> <x>10</x> - <y>200</y> + <y>180</y> <width>451</width> <height>101</height> </rect> @@ -470,9 +470,9 @@ <property name="geometry" > <rect> <x>10</x> - <y>300</y> + <y>280</y> <width>451</width> - <height>101</height> + <height>121</height> </rect> </property> <property name="title" > @@ -481,9 +481,9 @@ <widget class="QLineEdit" name="le_dnitime" > <property name="geometry" > <rect> - <x>10</x> - <y>40</y> - <width>281</width> + <x>200</x> + <y>20</y> + <width>241</width> <height>25</height> </rect> </property> @@ -494,6 +494,22 @@ <bool>true</bool> </property> </widget> + <widget class="QGraphicsView" name="gv_dniclock" > + <property name="geometry" > + <rect> + <x>10</x> + <y>20</y> + <width>181</width> + <height>94</height> + </rect> + </property> + <property name="acceptDrops" > + <bool>false</bool> + </property> + <property name="frameShadow" > + <enum>QFrame::Plain</enum> + </property> + </widget> </widget> </widget> <widget class="QWidget" name="tab_settings" > This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |