[Pymoul-svn] SF.net SVN: pymoul: [181] pymoul/trunk/src/moul
Status: Alpha
Brought to you by:
tiran
|
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.
|