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