pymoul-svn Mailing List for pyMoul (Page 11)
Status: Alpha
Brought to you by:
tiran
You can subscribe to this list here.
2007 |
Jan
(89) |
Feb
(108) |
Mar
(62) |
Apr
(8) |
May
(9) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|
From: <ti...@us...> - 2007-01-18 17:00:18
|
Revision: 44 http://pymoul.svn.sourceforge.net/pymoul/?rev=44&view=rev Author: tiran Date: 2007-01-18 09:00:13 -0800 (Thu, 18 Jan 2007) Log Message: ----------- WDYS ini parser (working) parses and writes graphics and audio ini data Modified Paths: -------------- pymoul/trunk/src/moul/file/tests/test_wdysini.py pymoul/trunk/src/moul/file/wdysini.py Modified: pymoul/trunk/src/moul/file/tests/test_wdysini.py =================================================================== --- pymoul/trunk/src/moul/file/tests/test_wdysini.py 2007-01-17 22:28:07 UTC (rev 43) +++ pymoul/trunk/src/moul/file/tests/test_wdysini.py 2007-01-18 17:00:13 UTC (rev 44) @@ -21,13 +21,59 @@ __version__ = "$Id$" __revision__ = "$Revision$" +import os import unittest from doctest import DocTestSuite -import moul.file.wdysini +from moul.file.wdysini import AudioIni +from moul.file.wdysini import GraphicsIni +base = os.path.dirname(__file__) +gra_enc = os.path.join(base, 'graphics.ini') +gra_dec = os.path.join(base, 'graphics.txt') +aud_enc = os.path.join(base, 'audio.ini') +aud_dec = os.path.join(base, 'audio.txt') + +class GenericIniTest(unittest.TestCase): + enc = None + dec = None + parserClass = None + + def setUp(self): + self.enc_fd = open(self.enc, 'rb') + self.dec_fd = open(self.dec, 'r') + self.parser = self.parserClass() + + def tearDown(self): + self.enc_fd.close() + self.dec_fd.close() + + def test_parseString(self): + p = self.parser + data = self.dec_fd.read() + p.parseString(data) + self.failUnless(p._filedata) + self.failIf(p.isChanged()) + newdata = p.writeString() + olines = data.split('\n') + nlines = newdata.split('\n') + for i, oline in enumerate(olines): + self.failUnlessEqual(oline, nlines[i]) + +class AudioIniTest(GenericIniTest): + enc = aud_enc + dec = aud_dec + parserClass = AudioIni + +class GraphicsIniTest(GenericIniTest): + enc = gra_enc + dec = gra_dec + parserClass = GraphicsIni + def test_suite(): return unittest.TestSuite(( + unittest.makeSuite(AudioIniTest), + unittest.makeSuite(GraphicsIniTest), DocTestSuite('moul.file.wdysini') )) Modified: pymoul/trunk/src/moul/file/wdysini.py =================================================================== --- pymoul/trunk/src/moul/file/wdysini.py 2007-01-17 22:28:07 UTC (rev 43) +++ pymoul/trunk/src/moul/file/wdysini.py 2007-01-18 17:00:13 UTC (rev 44) @@ -24,6 +24,89 @@ from moul.crypt.whatdoyousee import decryptWDYS from moul.crypt.whatdoyousee import encryptWDYS +class BoolString(object): + """Boolean string + + >>> BoolString(True) + true + >>> BoolString(1) + true + >>> bool(BoolString(1)) + True + >>> int(BoolString(1)) + 1 + >>> BoolString('yes'), BoolString('true'), BoolString('1') + (true, true, true) + + >>> BoolString() + false + >>> BoolString(False) + false + >>> BoolString(0) + false + >>> bool(BoolString(0)) + False + >>> int(BoolString(0)) + 0 + >>> BoolString('no'), BoolString('false'), BoolString('0') + (false, false, false) + + >>> BoolString('OK') + Traceback (most recent call last): + ... + ValueError: OK + """ + + def __init__(self, value=False): + if isinstance(value, basestring): + if value.lower() in ('yes', 'true', '1'): + value = True + elif value.lower() in ('no', 'false', '0'): + value = False + else: + raise ValueError(value) + self._true = bool(value) + + def __nonzero__(self): + return self._true + + def __int__(self): + return int(self._true) + + def __str__(self): + if self._true: + return 'true' + else: + return 'false' + + def __repr__(self): + return str(self) + + def __cmp__(self, other): + return cmp(bool(self), bool(other)) + +class FloatString(float): + """Float with a slightly different representation + + >>> FloatString(1.0) + 1 + >>> str(FloatString(1.0)) + '1' + >>> FloatString(0.0) + 0.0 + >>> str(FloatString(0.0)) + '0.0' + """ + def __str__(self): + if self == 0.0: + return '0.0' + if self == 1.0: + return '1' + return "%0.12f" % self + + def __repr__(self): + return str(self) + VIDEO_MODES = ( # width, height, w ratio, h ratio (800, 600, 4, 3), @@ -41,20 +124,69 @@ class ConfFile(object): _options = {} + + def __init__(self): + self._filedata = {} + self._newdata = {} + self._order = [] + + def parseString(self, s): + """Parse string with file contents + + @param s newline seperated file (string) + """ + lines = s.split('\n') + for line in lines: + if not line.strip(): + continue + found = False + for key, convert in self._options.items(): + # not elegant but safe + if line.startswith(key): + found = True + newkey = key.replace(' ', '_') + self._order.append(newkey) + data = line[len(key)+1:].strip() + self._filedata[newkey] = convert(data) + break + if not found: + raise ValueError(line) + + self._newdata = self._filedata.copy() + + def isChanged(self): + """Check if the data was changed + """ + for key, value in self._filedata.items(): + if value != self._newdata[key]: + return True + return False + + def writeString(self): + """Create a string with new file contents + """ + out = [] + for newkey in self._order: + value = self._newdata[newkey] + key = newkey.replace('_', ' ') + assert key in self._options + out.append("%s %s" % (key, value)) + out.append('') # new line at EOF + return '\n'.join(out) class AudioIni(ConfFile): _options = { - 'Audio.Initialize' : bool, - 'Audio.UseEAX' : bool, + 'Audio.Initialize' : BoolString, + 'Audio.UseEAX' : BoolString, 'Audio.SetPriorityCutoff' : int, 'Audio.MuteAll' : int, - 'Audio.SetChannelVolume SoundFX' : float, - 'Audio.SetChannelVolume BgndMusic' : float, - 'Audio.SetChannelVolume Ambience' : float, - 'Audio.SetChannelVolume NPCVoice' : float, + 'Audio.SetChannelVolume SoundFX' : FloatString, + 'Audio.SetChannelVolume BgndMusic' : FloatString, + 'Audio.SetChannelVolume Ambience' : FloatString, + 'Audio.SetChannelVolume NPCVoice' : FloatString, 'Audio.EnableVoiceRecording' : int, 'Audio.SetDeviceName' : str, - 'Audio.SetChannelVolume GUI' : float, + 'Audio.SetChannelVolume GUI' : FloatString, } class GraphicsIni(ConfFile): @@ -62,15 +194,15 @@ 'Graphics.Width' : int, 'Graphics.Height' : int, 'Graphics.ColorDepth' : int, - 'Graphics.Windowed' : bool, + 'Graphics.Windowed' : BoolString, 'Graphics.AntiAliasAmount' : int, 'Graphics.AnisotropicLevel' : int, 'Graphics.TextureQuality' : int, 'Quality.Level' : int, 'Graphics.Shadow.Enable' : int, 'Graphics.EnablePlanarReflections' : int, - 'Graphics.EnableVSync' : bool, - 'Graphics.Shadow.VisibleDistance' : float, + 'Graphics.EnableVSync' : BoolString, + 'Graphics.Shadow.VisibleDistance' : FloatString, } # width, height, w ratio, h ratio @@ -84,7 +216,6 @@ def getVidModeHuman(self, idx): """Human readable vidoe mode by index """ - #import pdb; pdb.set_trace() return "%ix%i (%i:%i)" % self.getVidModeByIdx(idx) def getVidIdxByMode(self, w, h): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-17 22:28:08
|
Revision: 43 http://pymoul.svn.sourceforge.net/pymoul/?rev=43&view=rev Author: tiran Date: 2007-01-17 14:28:07 -0800 (Wed, 17 Jan 2007) Log Message: ----------- * Auto change log level based on sys.frozen * Added some comments to time.dni * Finally the threaded server ping is working as expected Modified Paths: -------------- pymoul/trunk/src/moul/log.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/ui/moulqt_rc.py pymoul/trunk/src/moul/time/dni.py Modified: pymoul/trunk/src/moul/log.py =================================================================== --- pymoul/trunk/src/moul/log.py 2007-01-17 13:37:52 UTC (rev 42) +++ pymoul/trunk/src/moul/log.py 2007-01-17 22:28:07 UTC (rev 43) @@ -22,8 +22,15 @@ __revision__ = "$Revision$" import logging +import sys -logging.basicConfig(level=logging.DEBUG, +# py2exe sets sys.frozen +if getattr(sys, 'frozen', False): + level = logging.ERROR +else: + level = logging.DEBUG + +logging.basicConfig(level=level, format='%(asctime)s %(levelname)-8s %(message)s', datefmt='%a, %d %b %Y %H:%M:%S' ) Modified: pymoul/trunk/src/moul/qt/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/mainwindow.py 2007-01-17 13:37:52 UTC (rev 42) +++ pymoul/trunk/src/moul/qt/mainwindow.py 2007-01-17 22:28:07 UTC (rev 43) @@ -17,6 +17,8 @@ # """Moul QT GUI main windows """ +from __future__ import with_statement + __author__ = "Christian Heimes" __version__ = "$Id$" __revision__ = "$Revision$" @@ -24,18 +26,19 @@ import sys from PyQt4 import QtGui -from PyQt4.QtCore import QString -from PyQt4.QtCore import QStringList +from PyQt4 import QtCore from PyQt4.QtCore import pyqtSignature from PyQt4.QtCore import SIGNAL -from PyQt4.QtCore import QTimer from moul.qt.ui.mainwindow import Ui_MainWindow from moul.time.cavern import CavernTime from moul.file.wdysini import GraphicsIni from moul.server.ping import ServerList from moul.server.ping import isSocketError +from moul.log import getLogger +LOG = getLogger('moul.qt') + class MainWindow(QtGui.QMainWindow, Ui_MainWindow): def __init__(self): QtGui.QMainWindow.__init__(self) @@ -52,18 +55,19 @@ """init graphics tab """ self._graphicsini = GraphicsIni() - length = len(self._graphicsini._videomodes) -1 + length = len(self._graphicsini._videomodes) - 1 self.slid_screenres.setMaximum(length) self.connect(self.slid_screenres, SIGNAL("valueChanged(int)"), self.on_slid_screenres_changed) self.connect(self.slid_screenres, SIGNAL("sliderMoved(int)"), self.on_slid_screenres_changed) + @pyqtSignature("int") def on_slid_screenres_changed(self, idx): """SIGNAL: valueChanged (int) """ txt = self._graphicsini.getVidModeHuman(idx) - self.lb_screenres.setText(QString(txt)) + self.lb_screenres.setText(QtCore.QString(txt)) # ************************************************************************ # time zones @@ -75,7 +79,7 @@ self._timezone_update() # create a timer to update the display every second - self._timezone_timer = timer = QTimer(self) + self._timezone_timer = timer = QtCore.QTimer(self) timer.setInterval(1000) # 1 sec # TODO: needs optimization? run only when timer tab is active self.connect(timer, SIGNAL('timeout()'), self.on_timezone_timer_timeout) @@ -90,12 +94,13 @@ off = ct['cavern']['utcoffset'] txt = "UTC %s%i" % (off[0], abs(off[1])) - self.lb_cavern_utc.setText(QString(txt)) + self.lb_cavern_utc.setText(QtCore.QString(txt)) off = ct['pacific']['utcoffset'] txt = "UTC %s%i" % (off[0], abs(off[1])) - self.lb_pacific_utc.setText(QString(txt)) - + self.lb_pacific_utc.setText(QtCore.QString(txt)) + + @pyqtSignature("") def on_timezone_timer_timeout(self): """SIGNAL: QTimer timeout """ @@ -108,35 +113,83 @@ def _ping_init(self): """init ping tab """ - self.connect(self.button_ping, SIGNAL("clicked()"), self.on_button_ping_clicked) + self._ping_thread = thread = PingServerThread() + self.connect(self.button_ping, SIGNAL("clicked"), + self.on_button_ping_clicked) - def _ping_servers(self): - # TODO: Use a seperate thread! + self.connect(thread, SIGNAL("started"), + self.on_pingthread_started) + self.connect(thread, SIGNAL("done()"), + self.on_pingthread_done) + self.connect(thread, SIGNAL("server(const QString&)"), + self.on_pingthread_server) + self.connect(thread, SIGNAL("dnserror(const QString&, int, const QString&)"), + self.on_pingthread_error) + self.connect(thread, SIGNAL("dns(const QString&, float)"), + self.on_pingthread_dns) + self.connect(thread, SIGNAL("pingerror(const QString&, int, const QString&)"), + self.on_pingthread_error) + self.connect(thread, SIGNAL("ping(const QString&, float)"), + self.on_pingthread_ping) + + def on_pingthread_started(self): + LOG.debug('ping thread STARTED') + self.button_ping.setEnabled(False) self.text_ping.clear() - insertText = self.text_ping.insertPlainText + + def on_pingthread_done(self): + LOG.debug('ping thread DONE') + self.button_ping.setEnabled(True) - serverlist = ServerList() - # dns - for server in serverlist: - insertText("%s ... " % server.name) - result = server.dns() - if isSocketError(result): - insertText("DNS: FAILED\n") + def on_pingthread_server(self, name): + self.text_ping.insertPlainText("%s ... " % name) + + def on_pingthread_dns(self, name, time): + self.text_ping.insertPlainText("dns: %0.3f " % time) + + def on_pingthread_ping(self, name, time): + self.text_ping.insertPlainText("ping: %0.3f\n" % time) + + def on_pingthread_error(self, name, errcode, errmsg): + LOG.debug('error: %s, %i, %s' % (name, errcode, errmsg)) + self.text_ping.insertPlainText("error: %s\n" % errmsg) + + @pyqtSignature("bool") + def on_button_ping_clicked(self): + LOG.debug('ping thread CLICKED') + thread = self._ping_thread + if not thread.isRunning(): + servers = ServerList() + self._ping_thread.pingServers(servers) + +class PingServerThread(QtCore.QThread): + def __init__(self, parent=None): + QtCore.QThread.__init__(self, parent) + self._servers = None + + def pingServers(self, servers): + self.servers = servers + if not self.isRunning(): + self.start() + + def run(self): + self.emit(SIGNAL("started")) + + for server in self.servers: + name = server.name + self.emit(SIGNAL("server(const QString&)"), name) + dns = server.dns() + if isSocketError(dns): + self.emit(SIGNAL("dnserror(const QString&, int, const QString&)"), + name, dns[0], dns[1]) continue + self.emit(SIGNAL("dns(const QString&, float)"), name, dns) - insertText("dns: %0.3f " % result) - result = server.portping() - if isSocketError(result): - insertText("ping: FAILED\n") + ping = server.portping() + if isSocketError(ping): + self.emit(SIGNAL("pingerror(const QString&, int, const QString&)"), + name, ping[0], ping[1]) continue - insertText("pin: %0.3f\n" % result) + self.emit(SIGNAL("ping(const QString&, float)"), name, ping) - @pyqtSignature("") - def on_button_ping_clicked(self): - """SIGNAL: clicked() - """ - self.button_ping.setEnabled(False) - try: - self._ping_servers() - finally: - self.button_ping.setEnabled(True) + self.emit(SIGNAL("done()")) Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-01-17 13:37:52 UTC (rev 42) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-01-17 22:28:07 UTC (rev 43) @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'src\moul\qt\ui\mainwindow.ui' # -# Created: Wed Jan 17 14:23:33 2007 +# Created: Wed Jan 17 23:18:34 2007 # by: PyQt4 UI code generator 4.1.1 # # WARNING! All changes made in this file will be lost! @@ -65,6 +65,12 @@ self.pushButton.setObjectName("pushButton") self.hboxlayout.addWidget(self.pushButton) + self.buttonbox_rresavcl = QtGui.QDialogButtonBox(self.centralwidget) + self.buttonbox_rresavcl.setGeometry(QtCore.QRect(10,480,441,32)) + self.buttonbox_rresavcl.setOrientation(QtCore.Qt.Horizontal) + self.buttonbox_rresavcl.setStandardButtons(QtGui.QDialogButtonBox.Close|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Reset|QtGui.QDialogButtonBox.Save) + self.buttonbox_rresavcl.setObjectName("buttonbox_rresavcl") + self.tabWidget = QtGui.QTabWidget(self.centralwidget) self.tabWidget.setGeometry(QtCore.QRect(5,100,450,375)) self.tabWidget.setTabPosition(QtGui.QTabWidget.North) @@ -283,6 +289,10 @@ 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,130,431,211)) + self.gb_dnitime.setObjectName("gb_dnitime") + self.gb_caverntime = QtGui.QGroupBox(self.tab_time) self.gb_caverntime.setGeometry(QtCore.QRect(10,10,431,111)) self.gb_caverntime.setObjectName("gb_caverntime") @@ -328,10 +338,6 @@ self.lb_pacific_utc = QtGui.QLabel(self.gridLayout) self.lb_pacific_utc.setObjectName("lb_pacific_utc") self.gridlayout.addWidget(self.lb_pacific_utc,1,2,1,1) - - self.gb_dnitime = QtGui.QGroupBox(self.tab_time) - self.gb_dnitime.setGeometry(QtCore.QRect(10,130,431,211)) - self.gb_dnitime.setObjectName("gb_dnitime") self.tabWidget.addTab(self.tab_time,"") self.tab = QtGui.QWidget() @@ -349,10 +355,6 @@ self.button_ping = QtGui.QPushButton(self.gb_servers) self.button_ping.setGeometry(QtCore.QRect(330,300,75,24)) self.button_ping.setObjectName("button_ping") - - self.label_3 = QtGui.QLabel(self.gb_servers) - self.label_3.setGeometry(QtCore.QRect(170,300,151,16)) - self.label_3.setObjectName("label_3") self.tabWidget.addTab(self.tab,"") self.tab_4 = QtGui.QWidget() @@ -363,12 +365,6 @@ self.label_6.setAlignment(QtCore.Qt.AlignCenter) self.label_6.setObjectName("label_6") self.tabWidget.addTab(self.tab_4,"") - - self.buttonbox_rresavcl = QtGui.QDialogButtonBox(self.centralwidget) - self.buttonbox_rresavcl.setGeometry(QtCore.QRect(10,480,441,32)) - self.buttonbox_rresavcl.setOrientation(QtCore.Qt.Horizontal) - self.buttonbox_rresavcl.setStandardButtons(QtGui.QDialogButtonBox.Close|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Reset|QtGui.QDialogButtonBox.Save) - self.buttonbox_rresavcl.setObjectName("buttonbox_rresavcl") MainWindow.setCentralWidget(self.centralwidget) self.statusbar = QtGui.QStatusBar(MainWindow) @@ -376,7 +372,7 @@ MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) - self.tabWidget.setCurrentIndex(3) + self.tabWidget.setCurrentIndex(0) QtCore.QObject.connect(self.buttonbox_rresavcl,QtCore.SIGNAL("rejected()"),MainWindow.close) QtCore.QMetaObject.connectSlotsByName(MainWindow) @@ -402,20 +398,19 @@ self.label_7.setText(QtGui.QApplication.translate("MainWindow", "Ultra", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_graphics), QtGui.QApplication.translate("MainWindow", "Graphis", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_audio), QtGui.QApplication.translate("MainWindow", "Audio", 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_4.setText(QtGui.QApplication.translate("MainWindow", "Cavern time:", None, QtGui.QApplication.UnicodeUTF8)) self.lb_cavern_utc.setText(QtGui.QApplication.translate("MainWindow", "UTC", None, QtGui.QApplication.UnicodeUTF8)) self.label_5.setText(QtGui.QApplication.translate("MainWindow", "Pacific time:", None, QtGui.QApplication.UnicodeUTF8)) self.lb_pacific_utc.setText(QtGui.QApplication.translate("MainWindow", "UTC", 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.gb_servers.setTitle(QtGui.QApplication.translate("MainWindow", "Ping servers", None, QtGui.QApplication.UnicodeUTF8)) self.text_ping.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;\"></p></body></html>", None, QtGui.QApplication.UnicodeUTF8)) + "<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-size:8pt;\"></p></body></html>", None, QtGui.QApplication.UnicodeUTF8)) self.button_ping.setText(QtGui.QApplication.translate("MainWindow", "Ping", None, QtGui.QApplication.UnicodeUTF8)) - self.label_3.setText(QtGui.QApplication.translate("MainWindow", "TODO: Use a seperate thread", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QtGui.QApplication.translate("MainWindow", "Servers", None, QtGui.QApplication.UnicodeUTF8)) self.label_6.setText(QtGui.QApplication.translate("MainWindow", "pyMoul tools", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_4), 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-01-17 13:37:52 UTC (rev 42) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-01-17 22:28:07 UTC (rev 43) @@ -100,6 +100,22 @@ </item> </layout> </widget> + <widget class="QDialogButtonBox" name="buttonbox_rresavcl" > + <property name="geometry" > + <rect> + <x>10</x> + <y>480</y> + <width>441</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> @@ -113,7 +129,7 @@ <enum>QTabWidget::North</enum> </property> <property name="currentIndex" > - <number>3</number> + <number>0</number> </property> <widget class="QWidget" name="tab_graphics" > <attribute name="title" > @@ -545,6 +561,19 @@ <attribute name="title" > <string>Time</string> </attribute> + <widget class="QGroupBox" name="gb_dnitime" > + <property name="geometry" > + <rect> + <x>10</x> + <y>130</y> + <width>431</width> + <height>211</height> + </rect> + </property> + <property name="title" > + <string>D'ni time</string> + </property> + </widget> <widget class="QGroupBox" name="gb_caverntime" > <property name="geometry" > <rect> @@ -639,19 +668,6 @@ </layout> </widget> </widget> - <widget class="QGroupBox" name="gb_dnitime" > - <property name="geometry" > - <rect> - <x>10</x> - <y>130</y> - <width>431</width> - <height>211</height> - </rect> - </property> - <property name="title" > - <string>D'ni time</string> - </property> - </widget> </widget> <widget class="QWidget" name="tab" > <attribute name="title" > @@ -685,7 +701,7 @@ <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;"></p></body></html></string> +<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-size:8pt;"></p></body></html></string> </property> </widget> <widget class="QPushButton" name="button_ping" > @@ -701,19 +717,6 @@ <string>Ping</string> </property> </widget> - <widget class="QLabel" name="label_3" > - <property name="geometry" > - <rect> - <x>170</x> - <y>300</y> - <width>151</width> - <height>16</height> - </rect> - </property> - <property name="text" > - <string>TODO: Use a seperate thread</string> - </property> - </widget> </widget> </widget> <widget class="QWidget" name="tab_4" > @@ -738,22 +741,6 @@ </widget> </widget> </widget> - <widget class="QDialogButtonBox" name="buttonbox_rresavcl" > - <property name="geometry" > - <rect> - <x>10</x> - <y>480</y> - <width>441</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/ui/moulqt_rc.py =================================================================== --- pymoul/trunk/src/moul/qt/ui/moulqt_rc.py 2007-01-17 13:37:52 UTC (rev 42) +++ pymoul/trunk/src/moul/qt/ui/moulqt_rc.py 2007-01-17 22:28:07 UTC (rev 43) @@ -2,7 +2,7 @@ # Resource object code # -# Created: Di 16. Jan 01:02:23 2007 +# Created: Mi 17. Jan 17:01:45 2007 # by: The Resource Compiler for PyQt (Qt v4.2.2) # # WARNING! All changes made in this file will be lost! Modified: pymoul/trunk/src/moul/time/dni.py =================================================================== --- pymoul/trunk/src/moul/time/dni.py 2007-01-17 13:37:52 UTC (rev 42) +++ pymoul/trunk/src/moul/time/dni.py 2007-01-17 22:28:07 UTC (rev 43) @@ -54,7 +54,47 @@ # Official SI year 365.25 days = 31.557.600 seconds YEAR_SI = 31557600 # Sidereal year: 365.256 363 051 days (365 d 6 h 9 min 9 s) -YEAR_SIDEREAL = (((((365 * 24) + 6 ) * 60 ) + 9 ) * 60 ) + 9 -YEAR = float(YEAR_SIDEREAL) +# YEAR_SIDEREAL = (((((365 * 24) + 6 ) * 60 ) + 9 ) * 60 ) + 9 +YEAR = float(YEAR_SI) FACTOR = YEAR / PRORAHN_PER_HAHR + +class DniTime(object): + """D'ni time handler + + The D'ni were using a complex calendar based on a pentovigesimal (25) + numbering system. + + The DniTime class assumes the following rules: + + * Hahrtee Farah 1 started on 21st of April 7656 B.C. + * Hahrtee Fahrah 15 started 1719 A.C. + * A new hahr starts on 21st of April. + * The reference time for the calculation is Mountain Standard Time (MST) + without (!) DST. The UTC offset is always UTC-7. + * To compensate leap years a new hahr starts on midnight (0:00am) in every + forth year (year % 4 == 0). + * To simplify the code special cases like year % 100 and year % 400 are + NOT taken into account. I'm assuming a year has 365,25 days (which is + wrong). A year according to the Gregorian Calendar has 365,2425 days. + + Overview + --------- + + fahrah millenium 625 years + hahr year 1 year + vailee month 10 per year + yahr day 29 per vailee, about 30h 14min + gahrtahvo section about 6h, 3min + tahvo quarter about 14,5min + gorahn minute 36 seconds + prorahn second about 1.3929 seconds + """ + _fahrah = None # millenium (625 years) + _hahr = None # year (1 year) + _vailee = None # month (10 per year) + _yahr = None # day (29 per vailee) + _gahrtahvo = None # section (about 6h, 3min) + _tahvo = None # quarter (about 14,5min) + _gorahn = None # minute (about 36 seconds) + _prorahn = None # second (1,4 seconds) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-17 13:37:56
|
Revision: 42 http://pymoul.svn.sourceforge.net/pymoul/?rev=42&view=rev Author: tiran Date: 2007-01-17 05:37:52 -0800 (Wed, 17 Jan 2007) Log Message: ----------- PING box works but I need to use a seperate thread or event loop. The main loops freezes when the ping method is invoked. Modified Paths: -------------- pymoul/trunk/src/moul/qt/mainwindow.py pymoul/trunk/src/moul/qt/ui/mainwindow.py pymoul/trunk/src/moul/qt/ui/mainwindow.ui pymoul/trunk/src/moul/server/ping.py pymoul/trunk/src/moul/server/tests/test_ping.py Modified: pymoul/trunk/src/moul/qt/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/mainwindow.py 2007-01-17 12:52:49 UTC (rev 41) +++ pymoul/trunk/src/moul/qt/mainwindow.py 2007-01-17 13:37:52 UTC (rev 42) @@ -33,6 +33,8 @@ from moul.qt.ui.mainwindow import Ui_MainWindow from moul.time.cavern import CavernTime from moul.file.wdysini import GraphicsIni +from moul.server.ping import ServerList +from moul.server.ping import isSocketError class MainWindow(QtGui.QMainWindow, Ui_MainWindow): def __init__(self): @@ -42,6 +44,7 @@ self._timezone_init() self._graphics_init() + self._ping_init() # ************************************************************************ # graphics @@ -99,3 +102,41 @@ ct = self._caverntime() self.dt_cavern.setDateTime(ct['cavern']) self.dt_pacific.setDateTime(ct['pacific']) + + # ************************************************************************ + # ping + def _ping_init(self): + """init ping tab + """ + self.connect(self.button_ping, SIGNAL("clicked()"), self.on_button_ping_clicked) + + def _ping_servers(self): + # TODO: Use a seperate thread! + self.text_ping.clear() + insertText = self.text_ping.insertPlainText + + serverlist = ServerList() + # dns + for server in serverlist: + insertText("%s ... " % server.name) + result = server.dns() + if isSocketError(result): + insertText("DNS: FAILED\n") + continue + + insertText("dns: %0.3f " % result) + result = server.portping() + if isSocketError(result): + insertText("ping: FAILED\n") + continue + insertText("pin: %0.3f\n" % result) + + @pyqtSignature("") + def on_button_ping_clicked(self): + """SIGNAL: clicked() + """ + self.button_ping.setEnabled(False) + try: + self._ping_servers() + finally: + self.button_ping.setEnabled(True) Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-01-17 12:52:49 UTC (rev 41) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-01-17 13:37:52 UTC (rev 42) @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'src\moul\qt\ui\mainwindow.ui' # -# Created: Wed Jan 17 13:36:40 2007 +# Created: Wed Jan 17 14:23:33 2007 # by: PyQt4 UI code generator 4.1.1 # # WARNING! All changes made in this file will be lost! @@ -341,14 +341,18 @@ self.gb_servers.setGeometry(QtCore.QRect(10,0,421,341)) self.gb_servers.setObjectName("gb_servers") - self.but_ping = QtGui.QPushButton(self.gb_servers) - self.but_ping.setGeometry(QtCore.QRect(330,310,75,24)) - self.but_ping.setObjectName("but_ping") - self.text_ping = QtGui.QTextEdit(self.gb_servers) self.text_ping.setGeometry(QtCore.QRect(10,20,401,271)) self.text_ping.setReadOnly(True) self.text_ping.setObjectName("text_ping") + + self.button_ping = QtGui.QPushButton(self.gb_servers) + self.button_ping.setGeometry(QtCore.QRect(330,300,75,24)) + self.button_ping.setObjectName("button_ping") + + self.label_3 = QtGui.QLabel(self.gb_servers) + self.label_3.setGeometry(QtCore.QRect(170,300,151,16)) + self.label_3.setObjectName("label_3") self.tabWidget.addTab(self.tab,"") self.tab_4 = QtGui.QWidget() @@ -372,7 +376,7 @@ MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) - self.tabWidget.setCurrentIndex(2) + self.tabWidget.setCurrentIndex(3) QtCore.QObject.connect(self.buttonbox_rresavcl,QtCore.SIGNAL("rejected()"),MainWindow.close) QtCore.QMetaObject.connectSlotsByName(MainWindow) @@ -406,11 +410,12 @@ 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.gb_servers.setTitle(QtGui.QApplication.translate("MainWindow", "Ping servers", None, QtGui.QApplication.UnicodeUTF8)) - self.but_ping.setText(QtGui.QApplication.translate("MainWindow", "Ping", None, QtGui.QApplication.UnicodeUTF8)) self.text_ping.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;\"></p></body></html>", None, QtGui.QApplication.UnicodeUTF8)) + self.button_ping.setText(QtGui.QApplication.translate("MainWindow", "Ping", None, QtGui.QApplication.UnicodeUTF8)) + self.label_3.setText(QtGui.QApplication.translate("MainWindow", "TODO: Use a seperate thread", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QtGui.QApplication.translate("MainWindow", "Servers", None, QtGui.QApplication.UnicodeUTF8)) self.label_6.setText(QtGui.QApplication.translate("MainWindow", "pyMoul tools", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_4), 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-01-17 12:52:49 UTC (rev 41) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-01-17 13:37:52 UTC (rev 42) @@ -113,7 +113,7 @@ <enum>QTabWidget::North</enum> </property> <property name="currentIndex" > - <number>2</number> + <number>3</number> </property> <widget class="QWidget" name="tab_graphics" > <attribute name="title" > @@ -669,19 +669,6 @@ <property name="title" > <string>Ping servers</string> </property> - <widget class="QPushButton" name="but_ping" > - <property name="geometry" > - <rect> - <x>330</x> - <y>310</y> - <width>75</width> - <height>24</height> - </rect> - </property> - <property name="text" > - <string>Ping</string> - </property> - </widget> <widget class="QTextEdit" name="text_ping" > <property name="geometry" > <rect> @@ -701,6 +688,32 @@ <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> </widget> + <widget class="QPushButton" name="button_ping" > + <property name="geometry" > + <rect> + <x>330</x> + <y>300</y> + <width>75</width> + <height>24</height> + </rect> + </property> + <property name="text" > + <string>Ping</string> + </property> + </widget> + <widget class="QLabel" name="label_3" > + <property name="geometry" > + <rect> + <x>170</x> + <y>300</y> + <width>151</width> + <height>16</height> + </rect> + </property> + <property name="text" > + <string>TODO: Use a seperate thread</string> + </property> + </widget> </widget> </widget> <widget class="QWidget" name="tab_4" > Modified: pymoul/trunk/src/moul/server/ping.py =================================================================== --- pymoul/trunk/src/moul/server/ping.py 2007-01-17 12:52:49 UTC (rev 41) +++ pymoul/trunk/src/moul/server/ping.py 2007-01-17 13:37:52 UTC (rev 42) @@ -24,7 +24,7 @@ from moul.server.serverlist import PORT from moul.server.serverlist import SERVER_LIST -def isError(stat): +def isSocketError(stat): return isinstance(stat, socket.error) class Server(object): @@ -94,7 +94,7 @@ class ServerList(object): """A list of servers to test """ - def __init__(self, names, port, timeout=3.0): + def __init__(self, names=SERVER_LIST, port=PORT, timeout=3.0): self._names = names self._port = int(port) self._timeout = float(timeout) Modified: pymoul/trunk/src/moul/server/tests/test_ping.py =================================================================== --- pymoul/trunk/src/moul/server/tests/test_ping.py 2007-01-17 12:52:49 UTC (rev 41) +++ pymoul/trunk/src/moul/server/tests/test_ping.py 2007-01-17 13:37:52 UTC (rev 42) @@ -26,7 +26,7 @@ from moul.server.ping import Server from moul.server.ping import ServerList -from moul.server.ping import isError +from moul.server.ping import isSocketError from moul.server.serverlist import SERVER_LIST from moul.server.serverlist import PORT @@ -42,7 +42,7 @@ def test_ping_bogus(self): server = Server('bogus.nonworking.example.foo', PORT) result = server.dns() - self.failUnless(isError(result)) + self.failUnless(isSocketError(result)) result = server.portping() self.failUnless(result is False) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-17 12:52:53
|
Revision: 41 http://pymoul.svn.sourceforge.net/pymoul/?rev=41&view=rev Author: tiran Date: 2007-01-17 04:52:49 -0800 (Wed, 17 Jan 2007) Log Message: ----------- * Disabled some code in time.cavern that is no longer required * Revamped ping tests and added some useful stuff to ServerList like iter() and len() Modified Paths: -------------- pymoul/trunk/Makefile pymoul/trunk/src/moul/qt/ui/mainwindow.py pymoul/trunk/src/moul/qt/ui/mainwindow.ui pymoul/trunk/src/moul/server/ping.py pymoul/trunk/src/moul/server/tests/test_ping.py pymoul/trunk/src/moul/time/cavern.py Modified: pymoul/trunk/Makefile =================================================================== --- pymoul/trunk/Makefile 2007-01-17 11:29:30 UTC (rev 40) +++ pymoul/trunk/Makefile 2007-01-17 12:52:49 UTC (rev 41) @@ -9,7 +9,7 @@ inplace: $(PYTHON) setup.py $(SETUPFLAGS) build_ext -i -build: +build: compileui $(PYTHON) setup.py $(SETUPFLAGS) build py2exe: @@ -18,13 +18,16 @@ bdist_egg: $(PYTHON) setup.py $(SETUPFLAGS) bdist_egg -run: +run: compileui $(PYTHON) src/moul/qt/moulqt.py -test_build: build +compileui: + $(PYTHON) compileui.py + +test_build: build compileui $(PYTHON) test.py $(TESTFLAGS) $(TESTOPTS) -test_inplace: +test_inplace: compileui $(PYTHON) test.py $(TESTFLAGS) $(TESTOPTS) ftest_build: build Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-01-17 11:29:30 UTC (rev 40) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-01-17 12:52:49 UTC (rev 41) @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'src\moul\qt\ui\mainwindow.ui' # -# Created: Wed Jan 17 01:43:35 2007 +# Created: Wed Jan 17 13:36:40 2007 # by: PyQt4 UI code generator 4.1.1 # # WARNING! All changes made in this file will be lost! @@ -27,6 +27,13 @@ self.centralwidget.setEnabled(True) self.centralwidget.setObjectName("centralwidget") + self.label = QtGui.QLabel(self.centralwidget) + self.label.setGeometry(QtCore.QRect(15,10,430,58)) + self.label.setFrameShape(QtGui.QFrame.StyledPanel) + self.label.setFrameShadow(QtGui.QFrame.Sunken) + self.label.setPixmap(QtGui.QPixmap(":/resources/moul_logo.png")) + self.label.setObjectName("label") + self.horizontalLayout = QtGui.QWidget(self.centralwidget) self.horizontalLayout.setGeometry(QtCore.QRect(60,70,341,31)) self.horizontalLayout.setObjectName("horizontalLayout") @@ -58,13 +65,6 @@ self.pushButton.setObjectName("pushButton") self.hboxlayout.addWidget(self.pushButton) - self.label = QtGui.QLabel(self.centralwidget) - self.label.setGeometry(QtCore.QRect(15,10,430,58)) - self.label.setFrameShape(QtGui.QFrame.StyledPanel) - self.label.setFrameShadow(QtGui.QFrame.Sunken) - self.label.setPixmap(QtGui.QPixmap(":/resources/moul_logo.png")) - self.label.setObjectName("label") - self.tabWidget = QtGui.QTabWidget(self.centralwidget) self.tabWidget.setGeometry(QtCore.QRect(5,100,450,375)) self.tabWidget.setTabPosition(QtGui.QTabWidget.North) @@ -283,10 +283,6 @@ 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,130,431,211)) - self.gb_dnitime.setObjectName("gb_dnitime") - self.gb_caverntime = QtGui.QGroupBox(self.tab_time) self.gb_caverntime.setGeometry(QtCore.QRect(10,10,431,111)) self.gb_caverntime.setObjectName("gb_caverntime") @@ -301,6 +297,9 @@ self.gridlayout.setObjectName("gridlayout") 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") @@ -319,6 +318,8 @@ self.gridlayout.addWidget(self.label_5,1,0,1,1) self.dt_pacific = QtGui.QDateTimeEdit(self.gridLayout) + self.dt_pacific.setFocusPolicy(QtCore.Qt.NoFocus) + self.dt_pacific.setContextMenuPolicy(QtCore.Qt.NoContextMenu) self.dt_pacific.setReadOnly(True) self.dt_pacific.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) self.dt_pacific.setObjectName("dt_pacific") @@ -327,8 +328,29 @@ self.lb_pacific_utc = QtGui.QLabel(self.gridLayout) self.lb_pacific_utc.setObjectName("lb_pacific_utc") self.gridlayout.addWidget(self.lb_pacific_utc,1,2,1,1) + + self.gb_dnitime = QtGui.QGroupBox(self.tab_time) + self.gb_dnitime.setGeometry(QtCore.QRect(10,130,431,211)) + self.gb_dnitime.setObjectName("gb_dnitime") self.tabWidget.addTab(self.tab_time,"") + self.tab = QtGui.QWidget() + self.tab.setObjectName("tab") + + self.gb_servers = QtGui.QGroupBox(self.tab) + self.gb_servers.setGeometry(QtCore.QRect(10,0,421,341)) + self.gb_servers.setObjectName("gb_servers") + + self.but_ping = QtGui.QPushButton(self.gb_servers) + self.but_ping.setGeometry(QtCore.QRect(330,310,75,24)) + self.but_ping.setObjectName("but_ping") + + self.text_ping = QtGui.QTextEdit(self.gb_servers) + self.text_ping.setGeometry(QtCore.QRect(10,20,401,271)) + self.text_ping.setReadOnly(True) + self.text_ping.setObjectName("text_ping") + self.tabWidget.addTab(self.tab,"") + self.tab_4 = QtGui.QWidget() self.tab_4.setObjectName("tab_4") @@ -350,7 +372,7 @@ MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) - self.tabWidget.setCurrentIndex(0) + self.tabWidget.setCurrentIndex(2) QtCore.QObject.connect(self.buttonbox_rresavcl,QtCore.SIGNAL("rejected()"),MainWindow.close) QtCore.QMetaObject.connectSlotsByName(MainWindow) @@ -376,13 +398,20 @@ self.label_7.setText(QtGui.QApplication.translate("MainWindow", "Ultra", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_graphics), QtGui.QApplication.translate("MainWindow", "Graphis", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_audio), QtGui.QApplication.translate("MainWindow", "Audio", 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_4.setText(QtGui.QApplication.translate("MainWindow", "Cavern time:", None, QtGui.QApplication.UnicodeUTF8)) self.lb_cavern_utc.setText(QtGui.QApplication.translate("MainWindow", "UTC", None, QtGui.QApplication.UnicodeUTF8)) self.label_5.setText(QtGui.QApplication.translate("MainWindow", "Pacific time:", None, QtGui.QApplication.UnicodeUTF8)) self.lb_pacific_utc.setText(QtGui.QApplication.translate("MainWindow", "UTC", 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.gb_servers.setTitle(QtGui.QApplication.translate("MainWindow", "Ping servers", None, QtGui.QApplication.UnicodeUTF8)) + self.but_ping.setText(QtGui.QApplication.translate("MainWindow", "Ping", None, QtGui.QApplication.UnicodeUTF8)) + self.text_ping.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;\"></p></body></html>", None, QtGui.QApplication.UnicodeUTF8)) + self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QtGui.QApplication.translate("MainWindow", "Servers", None, QtGui.QApplication.UnicodeUTF8)) self.label_6.setText(QtGui.QApplication.translate("MainWindow", "pyMoul tools", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_4), 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-01-17 11:29:30 UTC (rev 40) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-01-17 12:52:49 UTC (rev 41) @@ -31,6 +31,28 @@ <property name="enabled" > <bool>true</bool> </property> + <widget class="QLabel" name="label" > + <property name="geometry" > + <rect> + <x>15</x> + <y>10</y> + <width>430</width> + <height>58</height> + </rect> + </property> + <property name="frameShape" > + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow" > + <enum>QFrame::Sunken</enum> + </property> + <property name="text" > + <string/> + </property> + <property name="pixmap" > + <pixmap resource="moulqt.qrc" >:/resources/moul_logo.png</pixmap> + </property> + </widget> <widget class="QWidget" name="horizontalLayout" > <property name="geometry" > <rect> @@ -78,28 +100,6 @@ </item> </layout> </widget> - <widget class="QLabel" name="label" > - <property name="geometry" > - <rect> - <x>15</x> - <y>10</y> - <width>430</width> - <height>58</height> - </rect> - </property> - <property name="frameShape" > - <enum>QFrame::StyledPanel</enum> - </property> - <property name="frameShadow" > - <enum>QFrame::Sunken</enum> - </property> - <property name="text" > - <string/> - </property> - <property name="pixmap" > - <pixmap resource="moulqt.qrc" >:/resources/moul_logo.png</pixmap> - </property> - </widget> <widget class="QTabWidget" name="tabWidget" > <property name="geometry" > <rect> @@ -113,7 +113,7 @@ <enum>QTabWidget::North</enum> </property> <property name="currentIndex" > - <number>0</number> + <number>2</number> </property> <widget class="QWidget" name="tab_graphics" > <attribute name="title" > @@ -545,19 +545,6 @@ <attribute name="title" > <string>Time</string> </attribute> - <widget class="QGroupBox" name="gb_dnitime" > - <property name="geometry" > - <rect> - <x>10</x> - <y>130</y> - <width>431</width> - <height>211</height> - </rect> - </property> - <property name="title" > - <string>D'ni time</string> - </property> - </widget> <widget class="QGroupBox" name="gb_caverntime" > <property name="geometry" > <rect> @@ -588,6 +575,15 @@ </property> <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> @@ -619,6 +615,12 @@ </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> @@ -637,7 +639,70 @@ </layout> </widget> </widget> + <widget class="QGroupBox" name="gb_dnitime" > + <property name="geometry" > + <rect> + <x>10</x> + <y>130</y> + <width>431</width> + <height>211</height> + </rect> + </property> + <property name="title" > + <string>D'ni time</string> + </property> + </widget> </widget> + <widget class="QWidget" name="tab" > + <attribute name="title" > + <string>Servers</string> + </attribute> + <widget class="QGroupBox" name="gb_servers" > + <property name="geometry" > + <rect> + <x>10</x> + <y>0</y> + <width>421</width> + <height>341</height> + </rect> + </property> + <property name="title" > + <string>Ping servers</string> + </property> + <widget class="QPushButton" name="but_ping" > + <property name="geometry" > + <rect> + <x>330</x> + <y>310</y> + <width>75</width> + <height>24</height> + </rect> + </property> + <property name="text" > + <string>Ping</string> + </property> + </widget> + <widget class="QTextEdit" name="text_ping" > + <property name="geometry" > + <rect> + <x>10</x> + <y>20</y> + <width>401</width> + <height>271</height> + </rect> + </property> + <property name="readOnly" > + <bool>true</bool> + </property> + <property name="html" > + <string><html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'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;"></p></body></html></string> + </property> + </widget> + </widget> + </widget> <widget class="QWidget" name="tab_4" > <attribute name="title" > <string>About</string> Modified: pymoul/trunk/src/moul/server/ping.py =================================================================== --- pymoul/trunk/src/moul/server/ping.py 2007-01-17 11:29:30 UTC (rev 40) +++ pymoul/trunk/src/moul/server/ping.py 2007-01-17 12:52:49 UTC (rev 41) @@ -17,30 +17,6 @@ # """Server ping ->>> server = Server(SERVER_LIST[0], PORT) ->>> result = server.dns() ->>> isinstance(result, float) -True ->>> result = server.portping() ->>> isinstance(result, float) -True - ->>> server = Server('bogus.nonworking.example.foo', PORT) ->>> result = server.dns() ->>> isinstance(result, socket.gaierror) -True - ->>> server = Server(name=SERVER_LIST[0], port=12345, timeout=1.0) ->>> result = server.portping() ->>> isinstance(result, socket.timeout) -True - ->>> serverlist = ServerList(names=SERVER_LIST, port=PORT, timeout=1.0) ->>> for name, stat in serverlist.dns(): -... print name, stat ->>> for name, stat in serverlist.portping(): -... print name, stat - """ import socket from time import time @@ -88,7 +64,7 @@ if self._ip is None: self.dns() if self._ip is False: - return + return False sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.settimeout(self._timeout) @@ -133,3 +109,9 @@ def portping(self): for server in self._servers: yield server.name, server.portping() + + def __iter__(self): + return iter(self._servers) + + def __len__(self): + return len(self._servers) Modified: pymoul/trunk/src/moul/server/tests/test_ping.py =================================================================== --- pymoul/trunk/src/moul/server/tests/test_ping.py 2007-01-17 11:29:30 UTC (rev 40) +++ pymoul/trunk/src/moul/server/tests/test_ping.py 2007-01-17 12:52:49 UTC (rev 41) @@ -24,10 +24,40 @@ import unittest from doctest import DocTestSuite -import moul.server.ping +from moul.server.ping import Server +from moul.server.ping import ServerList +from moul.server.ping import isError +from moul.server.serverlist import SERVER_LIST +from moul.server.serverlist import PORT +class PingServerTest(unittest.TestCase): + + def test_ping_working(self): + server = Server(SERVER_LIST[0], PORT) + result = server.dns() + self.failUnless(isinstance(result, float)) + result = server.portping() + self.failUnless(isinstance(result, float)) + + def test_ping_bogus(self): + server = Server('bogus.nonworking.example.foo', PORT) + result = server.dns() + self.failUnless(isError(result)) + result = server.portping() + self.failUnless(result is False) + + def test_iterlist(self): + names = ['server1', 'server2'] + sl = ServerList(names, PORT) + self.failUnlessEqual(len(sl), 2) + servers = [] + for server in sl: + servers.append(server.name) + self.failUnlessEqual(servers, names) + def test_suite(): return unittest.TestSuite(( + unittest.makeSuite(PingServerTest), DocTestSuite('moul.server.ping'), )) Modified: pymoul/trunk/src/moul/time/cavern.py =================================================================== --- pymoul/trunk/src/moul/time/cavern.py 2007-01-17 11:29:30 UTC (rev 40) +++ pymoul/trunk/src/moul/time/cavern.py 2007-01-17 12:52:49 UTC (rev 41) @@ -21,7 +21,7 @@ __version__ = "$Id$" __revision__ = "$Revision$" -__all__ = ['TIMEZONE_NAMES', 'CavernTime'] +__all__ = ['CavernTime'] from datetime import datetime @@ -30,43 +30,46 @@ from pytz import timezone from pytz import utc as UTC -SUPPORTED_TZ = ('America', 'Canada', 'Etc', 'Europe', 'US') -ADDITIONAL_TZ = ('GMT', 'UTC') +## not used in the current version +#SUPPORTED_TZ = ('America', 'Canada', 'Etc', 'Europe', 'US') +#ADDITIONAL_TZ = ('GMT', 'UTC') +# +#def _listSupported(tz_list): +# supported = [] +# unsupported = [] +# for tz in tz_list: +# if tz.find('/') == -1: +# if tz in ADDITIONAL_TZ: +# supported.append(tz) +# else: +# unsupported.append(tz) +# continue +# split = tz.split('/') +# if len(split) > 2: +# continue +# prefix, postfix = tz.split('/')[:2] +# if prefix in SUPPORTED_TZ: +# supported.append(tz) +# else: +# unsupported.append(tz) +# supported.sort() +# unsupported.sort() +# return supported, unsupported +# +## not used in the current version +#TIMEZONE_NAMES, UNSUPPORTED = _listSupported(all_timezones) -def _listSupported(tz_list): - supported = [] - unsupported = [] - for tz in tz_list: - if tz.find('/') == -1: - if tz in ADDITIONAL_TZ: - supported.append(tz) - else: - unsupported.append(tz) - continue - split = tz.split('/') - if len(split) > 2: - continue - prefix, postfix = tz.split('/')[:2] - if prefix in SUPPORTED_TZ: - supported.append(tz) - else: - unsupported.append(tz) - supported.sort() - unsupported.sort() - return supported, unsupported - -TIMEZONE_NAMES, UNSUPPORTED = _listSupported(all_timezones) - # Cyan HQ is near Spokane / Washington # Cavern time is Mountain Time Zone (MDT) with daylight savings (MST) CAVERN_TZ_NAME = 'US/Mountain' # MST / MDT CAVERN_TZ = timezone(CAVERN_TZ_NAME) +# The support is using PST (PDT) PACIFIC_TZ_NAME = 'US/Pacific' # PST / PDT PACIFIC_TZ = timezone(PACIFIC_TZ_NAME) def diffTD(td1, td2): - """Difference of two objects -> int + """Difference of two time delta objects -> int >>> from datetime import timedelta >>> type(diffTD(timedelta(0, 3600), timedelta(0, -3600))) @@ -150,12 +153,12 @@ True >>> del pst - >>> 'UTC' in CavernTime.timezones - True - >>> 'UTC' in ct.timezones - True + #>>> 'UTC' in CavernTime.timezones + #True + #>>> 'UTC' in ct.timezones + #True """ - timezones = TIMEZONE_NAMES + # timezones = TIMEZONE_NAMES _cavern = CAVERN_TZ _pacific = PACIFIC_TZ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-17 11:29:32
|
Revision: 40 http://pymoul.svn.sourceforge.net/pymoul/?rev=40&view=rev Author: tiran Date: 2007-01-17 03:29:30 -0800 (Wed, 17 Jan 2007) Log Message: ----------- Added moul.server package. The package contains a list of game servers and two classes to DNS lookup and socket.connect() servers. Added Paths: ----------- pymoul/trunk/src/moul/server/ pymoul/trunk/src/moul/server/__init__.py pymoul/trunk/src/moul/server/ping.py pymoul/trunk/src/moul/server/serverlist.py pymoul/trunk/src/moul/server/tests/ pymoul/trunk/src/moul/server/tests/__init__.py pymoul/trunk/src/moul/server/tests/test_ping.py pymoul/trunk/src/moul/server/tests/test_serverlist.py Added: pymoul/trunk/src/moul/server/__init__.py =================================================================== --- pymoul/trunk/src/moul/server/__init__.py (rev 0) +++ pymoul/trunk/src/moul/server/__init__.py 2007-01-17 11:29:30 UTC (rev 40) @@ -0,0 +1,7 @@ +# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages +try: + __import__('pkg_resources').declare_namespace(__name__) +except ImportError: + from pkgutil import extend_path + __path__ = extend_path(__path__, __name__) + Property changes on: pymoul/trunk/src/moul/server/__init__.py ___________________________________________________________________ Name: svn:eol-style + native Added: pymoul/trunk/src/moul/server/ping.py =================================================================== --- pymoul/trunk/src/moul/server/ping.py (rev 0) +++ pymoul/trunk/src/moul/server/ping.py 2007-01-17 11:29:30 UTC (rev 40) @@ -0,0 +1,135 @@ +# 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 +# +"""Server ping + +>>> server = Server(SERVER_LIST[0], PORT) +>>> result = server.dns() +>>> isinstance(result, float) +True +>>> result = server.portping() +>>> isinstance(result, float) +True + +>>> server = Server('bogus.nonworking.example.foo', PORT) +>>> result = server.dns() +>>> isinstance(result, socket.gaierror) +True + +>>> server = Server(name=SERVER_LIST[0], port=12345, timeout=1.0) +>>> result = server.portping() +>>> isinstance(result, socket.timeout) +True + +>>> serverlist = ServerList(names=SERVER_LIST, port=PORT, timeout=1.0) +>>> for name, stat in serverlist.dns(): +... print name, stat +>>> for name, stat in serverlist.portping(): +... print name, stat + +""" +import socket +from time import time + +from moul.server.serverlist import PORT +from moul.server.serverlist import SERVER_LIST + +def isError(stat): + return isinstance(stat, socket.error) + +class Server(object): + """A server object + """ + + def __init__(self, name, port, timeout=3.0): + self._name = name + self._port = int(port) + self._timeout = float(timeout) + # None: not yet resolved, False: failure, str: IP address + self._ip = None + self._stats = { + 'dns' : None, + 'portping' : None, + } + + def dns(self): + """Resolve IP address + """ + start = time() + try: + ip = socket.gethostbyname(self._name) + except socket.error, msg: + self._ip = False + self._stats['dns'] = msg + return msg + + period = time() - start + self._ip = ip + self._stats['dns'] = period + return period + + def portping(self): + """Connects to the game server port and terminates immediatly + """ + if self._ip is None: + self.dns() + if self._ip is False: + return + + sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + sock.settimeout(self._timeout) + start = time() + try: + try: + sock.connect((self._ip, self._port)) + sock.send('\n') + data = sock.recv(1024) + except socket.error, msg: + self._stats['portping'] = msg + return msg + finally: + sock.close() + + period = time() - start + self._stats['portping'] = period + return period + + def __str__(self): + return self._name + + @property + def name(self): + return self._name + +class ServerList(object): + """A list of servers to test + """ + def __init__(self, names, port, timeout=3.0): + self._names = names + self._port = int(port) + self._timeout = float(timeout) + self._servers = [] + for name in names: + self._servers.append(Server(name, port=port, timeout=timeout)) + + def dns(self): + for server in self._servers: + yield server.name, server.dns() + + def portping(self): + for server in self._servers: + yield server.name, server.portping() Property changes on: pymoul/trunk/src/moul/server/ping.py ___________________________________________________________________ Name: svn:eol-style + native Added: pymoul/trunk/src/moul/server/serverlist.py =================================================================== --- pymoul/trunk/src/moul/server/serverlist.py (rev 0) +++ pymoul/trunk/src/moul/server/serverlist.py 2007-01-17 11:29:30 UTC (rev 40) @@ -0,0 +1,53 @@ +# 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 +# +"""Server list +""" +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + +PORT = 14617 + +SERVER_LIST = [ + 'beta-auth.urulive.com', + 'beta-file.urulive.com', + 'uruapp-cw01.ibs.aol.com', + 'uruapp-cw02.ibs.aol.com', + 'uruapp-cw03.ibs.aol.com', + 'uruapp-cw04.ibs.aol.com', + 'uruapp-cw05.ibs.aol.com', + 'uruapp-cw06.ibs.aol.com', + 'uruapp-cw07.ibs.aol.com', + 'uruapp-cw08.ibs.aol.com', + 'uruapp-cw09.ibs.aol.com', + 'uruapp-cw10.ibs.aol.com', + 'uruapp-cw11.ibs.aol.com', + 'uruapp-cw12.ibs.aol.com', + 'uruapp-cw13.ibs.aol.com', + 'uruapp-cw14.ibs.aol.com', + 'uruapp-cw15.ibs.aol.com', + 'uruapp-cw16.ibs.aol.com', + 'uruapp-cw17.ibs.aol.com', + ## The servers below are available via ICMP ping but have no running game + ## server (2006-01-17) + #'uruapp-cw18.ibs.aol.com', + #'uruapp-cw19.ibs.aol.com', + #'uruapp-cw20.ibs.aol.com', + #'uruapp-cw21.ibs.aol.com', + #'uruapp-cw22.ibs.aol.com', +] Property changes on: pymoul/trunk/src/moul/server/serverlist.py ___________________________________________________________________ Name: svn:eol-style + native Added: pymoul/trunk/src/moul/server/tests/__init__.py =================================================================== --- pymoul/trunk/src/moul/server/tests/__init__.py (rev 0) +++ pymoul/trunk/src/moul/server/tests/__init__.py 2007-01-17 11:29:30 UTC (rev 40) @@ -0,0 +1,2 @@ +# testing package + Property changes on: pymoul/trunk/src/moul/server/tests/__init__.py ___________________________________________________________________ Name: svn:eol-style + native Added: pymoul/trunk/src/moul/server/tests/test_ping.py =================================================================== --- pymoul/trunk/src/moul/server/tests/test_ping.py (rev 0) +++ pymoul/trunk/src/moul/server/tests/test_ping.py 2007-01-17 11:29:30 UTC (rev 40) @@ -0,0 +1,35 @@ +# 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 +# +"""moul.server.serverlist unit tests +""" +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + +import unittest +from doctest import DocTestSuite + +import moul.server.ping + +def test_suite(): + return unittest.TestSuite(( + DocTestSuite('moul.server.ping'), + )) + +if __name__ == '__main__': + unittest.main(defaultTest="test_suite") Property changes on: pymoul/trunk/src/moul/server/tests/test_ping.py ___________________________________________________________________ Name: svn:eol-style + native Added: pymoul/trunk/src/moul/server/tests/test_serverlist.py =================================================================== --- pymoul/trunk/src/moul/server/tests/test_serverlist.py (rev 0) +++ pymoul/trunk/src/moul/server/tests/test_serverlist.py 2007-01-17 11:29:30 UTC (rev 40) @@ -0,0 +1,35 @@ +# 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 +# +"""moul.server.serverlist unit tests +""" +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + +import unittest +from doctest import DocTestSuite + +import moul.server.serverlist + +def test_suite(): + return unittest.TestSuite(( + DocTestSuite('moul.server.serverlist'), + )) + +if __name__ == '__main__': + unittest.main(defaultTest="test_suite") Property changes on: pymoul/trunk/src/moul/server/tests/test_serverlist.py ___________________________________________________________________ Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-17 11:28:11
|
Revision: 39 http://pymoul.svn.sourceforge.net/pymoul/?rev=39&view=rev Author: tiran Date: 2007-01-17 03:28:12 -0800 (Wed, 17 Jan 2007) Log Message: ----------- Added unit test stubs. ATM most unit tests are NOOPs that simply import the module and try to apply a DocTestSuite. At least the tests are catching syntax errors :) Modified Paths: -------------- pymoul/trunk/src/moul/crypt/tests/test_elf.py pymoul/trunk/src/moul/crypt/tests/test_wdys.py pymoul/trunk/src/moul/qt/moulqt.py pymoul/trunk/src/moul/qt/ui/mainwindow.py pymoul/trunk/src/moul/tests/test_i18n.py pymoul/trunk/src/moul/time/tests/test_cavern.py Added Paths: ----------- pymoul/trunk/src/moul/file/tests/test_chatlog.py pymoul/trunk/src/moul/file/tests/test_kiimage.py pymoul/trunk/src/moul/file/tests/test_localization.py pymoul/trunk/src/moul/file/tests/test_plasmalog.py pymoul/trunk/src/moul/file/tests/test_wdysini.py pymoul/trunk/src/moul/time/tests/test_dni.py Modified: pymoul/trunk/src/moul/crypt/tests/test_elf.py =================================================================== --- pymoul/trunk/src/moul/crypt/tests/test_elf.py 2007-01-16 21:39:46 UTC (rev 38) +++ pymoul/trunk/src/moul/crypt/tests/test_elf.py 2007-01-17 11:28:12 UTC (rev 39) @@ -48,6 +48,7 @@ def test_suite(): return unittest.TestSuite(( unittest.makeSuite(ElfTest), + DocTestSuite('moul.crypt.elf'), )) if __name__ == '__main__': Modified: pymoul/trunk/src/moul/crypt/tests/test_wdys.py =================================================================== --- pymoul/trunk/src/moul/crypt/tests/test_wdys.py 2007-01-16 21:39:46 UTC (rev 38) +++ pymoul/trunk/src/moul/crypt/tests/test_wdys.py 2007-01-17 11:28:12 UTC (rev 39) @@ -62,6 +62,8 @@ def test_suite(): return unittest.TestSuite(( unittest.makeSuite(WDYSTest), + DocTestSuite('moul.crypt.whatdoyousee'), + DocTestSuite('moul.crypt.xtea'), )) if __name__ == '__main__': Added: pymoul/trunk/src/moul/file/tests/test_chatlog.py =================================================================== --- pymoul/trunk/src/moul/file/tests/test_chatlog.py (rev 0) +++ pymoul/trunk/src/moul/file/tests/test_chatlog.py 2007-01-17 11:28:12 UTC (rev 39) @@ -0,0 +1,35 @@ +# 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 +# +"""moul.file. unit tests +""" +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + +import unittest +from doctest import DocTestSuite + +import moul.file.chatlog + +def test_suite(): + return unittest.TestSuite(( + DocTestSuite('moul.file.chatlog') + )) + +if __name__ == '__main__': + unittest.main(defaultTest="test_suite") Property changes on: pymoul/trunk/src/moul/file/tests/test_chatlog.py ___________________________________________________________________ Name: svn:eol-style + native Added: pymoul/trunk/src/moul/file/tests/test_kiimage.py =================================================================== --- pymoul/trunk/src/moul/file/tests/test_kiimage.py (rev 0) +++ pymoul/trunk/src/moul/file/tests/test_kiimage.py 2007-01-17 11:28:12 UTC (rev 39) @@ -0,0 +1,35 @@ +# 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 +# +"""moul.file.kiimage unit tests +""" +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + +import unittest +from doctest import DocTestSuite + +import moul.file.kiimage + +def test_suite(): + return unittest.TestSuite(( + DocTestSuite('moul.file.kiimage') + )) + +if __name__ == '__main__': + unittest.main(defaultTest="test_suite") Property changes on: pymoul/trunk/src/moul/file/tests/test_kiimage.py ___________________________________________________________________ Name: svn:eol-style + native Added: pymoul/trunk/src/moul/file/tests/test_localization.py =================================================================== --- pymoul/trunk/src/moul/file/tests/test_localization.py (rev 0) +++ pymoul/trunk/src/moul/file/tests/test_localization.py 2007-01-17 11:28:12 UTC (rev 39) @@ -0,0 +1,35 @@ +# 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 +# +"""moul.file.localization unit tests +""" +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + +import unittest +from doctest import DocTestSuite + +import moul.file.localization + +def test_suite(): + return unittest.TestSuite(( + DocTestSuite('moul.file.localization') + )) + +if __name__ == '__main__': + unittest.main(defaultTest="test_suite") Property changes on: pymoul/trunk/src/moul/file/tests/test_localization.py ___________________________________________________________________ Name: svn:eol-style + native Added: pymoul/trunk/src/moul/file/tests/test_plasmalog.py =================================================================== --- pymoul/trunk/src/moul/file/tests/test_plasmalog.py (rev 0) +++ pymoul/trunk/src/moul/file/tests/test_plasmalog.py 2007-01-17 11:28:12 UTC (rev 39) @@ -0,0 +1,35 @@ +# 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 +# +"""moul.file.plasmalog unit tests +""" +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + +import unittest +from doctest import DocTestSuite + +import moul.file.plasmalog + +def test_suite(): + return unittest.TestSuite(( + DocTestSuite('moul.file.plasmalog') + )) + +if __name__ == '__main__': + unittest.main(defaultTest="test_suite") Property changes on: pymoul/trunk/src/moul/file/tests/test_plasmalog.py ___________________________________________________________________ Name: svn:eol-style + native Added: pymoul/trunk/src/moul/file/tests/test_wdysini.py =================================================================== --- pymoul/trunk/src/moul/file/tests/test_wdysini.py (rev 0) +++ pymoul/trunk/src/moul/file/tests/test_wdysini.py 2007-01-17 11:28:12 UTC (rev 39) @@ -0,0 +1,35 @@ +# 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 +# +"""moul.file.wdysini unit tests +""" +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + +import unittest +from doctest import DocTestSuite + +import moul.file.wdysini + +def test_suite(): + return unittest.TestSuite(( + DocTestSuite('moul.file.wdysini') + )) + +if __name__ == '__main__': + unittest.main(defaultTest="test_suite") Property changes on: pymoul/trunk/src/moul/file/tests/test_wdysini.py ___________________________________________________________________ Name: svn:eol-style + native Modified: pymoul/trunk/src/moul/qt/moulqt.py =================================================================== --- pymoul/trunk/src/moul/qt/moulqt.py 2007-01-16 21:39:46 UTC (rev 38) +++ pymoul/trunk/src/moul/qt/moulqt.py 2007-01-17 11:28:12 UTC (rev 39) @@ -27,10 +27,6 @@ from PyQt4 import QtGui from moul.qt.mainwindow import MainWindow -from moul.file import plasmalog -from moul.file import wdysini -from moul.file import kiimage -from moul.time import dni as dnitime def main(*args): app = QtGui.QApplication(*args) Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-01-16 21:39:46 UTC (rev 38) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-01-17 11:28:12 UTC (rev 39) @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'src\moul\qt\ui\mainwindow.ui' # -# Created: Tue Jan 16 22:34:20 2007 +# Created: Wed Jan 17 01:43:35 2007 # by: PyQt4 UI code generator 4.1.1 # # WARNING! All changes made in this file will be lost! Modified: pymoul/trunk/src/moul/tests/test_i18n.py =================================================================== --- pymoul/trunk/src/moul/tests/test_i18n.py 2007-01-16 21:39:46 UTC (rev 38) +++ pymoul/trunk/src/moul/tests/test_i18n.py 2007-01-17 11:28:12 UTC (rev 39) @@ -24,6 +24,8 @@ import unittest from doctest import DocTestSuite +import moul.i18n + def test_suite(): return unittest.TestSuite(( DocTestSuite('moul.i18n'), Modified: pymoul/trunk/src/moul/time/tests/test_cavern.py =================================================================== --- pymoul/trunk/src/moul/time/tests/test_cavern.py 2007-01-16 21:39:46 UTC (rev 38) +++ pymoul/trunk/src/moul/time/tests/test_cavern.py 2007-01-17 11:28:12 UTC (rev 39) @@ -25,6 +25,8 @@ import unittest from doctest import DocTestSuite +import moul.time.cavern + def test_suite(): return unittest.TestSuite(( DocTestSuite('moul.time.cavern'), Added: pymoul/trunk/src/moul/time/tests/test_dni.py =================================================================== --- pymoul/trunk/src/moul/time/tests/test_dni.py (rev 0) +++ pymoul/trunk/src/moul/time/tests/test_dni.py 2007-01-17 11:28:12 UTC (rev 39) @@ -0,0 +1,36 @@ +# 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 +# +"""moul.time.dni unit tests +""" +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + +import os +import unittest +from doctest import DocTestSuite + +import moul.time.dni + +def test_suite(): + return unittest.TestSuite(( + DocTestSuite('moul.time.dni'), + )) + +if __name__ == '__main__': + unittest.main(defaultTest="test_suite") Property changes on: pymoul/trunk/src/moul/time/tests/test_dni.py ___________________________________________________________________ Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-16 21:39:46
|
Revision: 38 http://pymoul.svn.sourceforge.net/pymoul/?rev=38&view=rev Author: tiran Date: 2007-01-16 13:39:46 -0800 (Tue, 16 Jan 2007) Log Message: ----------- More cool work on the UI: time and screen resolution slider Modified Paths: -------------- pymoul/trunk/setup_win32.py pymoul/trunk/src/moul/file/wdysini.py pymoul/trunk/src/moul/qt/mainwindow.py pymoul/trunk/src/moul/qt/ui/mainwindow.py pymoul/trunk/src/moul/qt/ui/mainwindow.ui pymoul/trunk/src/moul/time/cavern.py Modified: pymoul/trunk/setup_win32.py =================================================================== --- pymoul/trunk/setup_win32.py 2007-01-16 20:43:19 UTC (rev 37) +++ pymoul/trunk/setup_win32.py 2007-01-16 21:39:46 UTC (rev 38) @@ -38,7 +38,8 @@ packages = ['pytz.zoneinfo'] for tz in ('GMT', 'UTC'): packages.append('pytz.zoneinfo.%s' % tz) - for tz in ('America', 'Canada', 'Etc', 'Europe', 'US'): + # ('America', 'Canada', 'Etc', 'Europe', 'US'): + for tz in ('US',): packages.append('pytz.zoneinfo.%s.*' % tz) return packages # import pytz @@ -78,11 +79,11 @@ kw['setup_requires'].append(req) for req in (): kw['install_requires'].append(req) - kw['console'] = [ - { "script" : "src/moul/cli/moullauncher.py", - "icon_resources": [(1, "src/moul/uru.ico")] - } - ] +# kw['console'] = [ +# { "script" : "src/moul/cli/moullauncher.py", +# "icon_resources": [(1, "src/moul/uru.ico")] +# } +# ] kw.setdefault('options', {}) pexe = kw['options'].setdefault('py2exe', {}) pexe['compressed'] = 100 # compress zip file Modified: pymoul/trunk/src/moul/file/wdysini.py =================================================================== --- pymoul/trunk/src/moul/file/wdysini.py 2007-01-16 20:43:19 UTC (rev 37) +++ pymoul/trunk/src/moul/file/wdysini.py 2007-01-16 21:39:46 UTC (rev 38) @@ -72,4 +72,23 @@ 'Graphics.EnableVSync' : bool, 'Graphics.Shadow.VisibleDistance' : float, } + + # width, height, w ratio, h ratio + _videomodes = VIDEO_MODES + + def getVidModeByIdx(self, idx): + """Get video mode by index + """ + return self._videomodes[idx] + + def getVidModeHuman(self, idx): + """Human readable vidoe mode by index + """ + #import pdb; pdb.set_trace() + return "%ix%i (%i:%i)" % self.getVidModeByIdx(idx) + def getVidIdxByMode(self, w, h): + for idx, mode in enumerate(self._videomodes): + if mode[0] == w and mode[1] == h: + return idx + raise KeyError("Video mode for %ix%i not found" % (w, h)) Modified: pymoul/trunk/src/moul/qt/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/mainwindow.py 2007-01-16 20:43:19 UTC (rev 37) +++ pymoul/trunk/src/moul/qt/mainwindow.py 2007-01-16 21:39:46 UTC (rev 38) @@ -32,7 +32,7 @@ from moul.qt.ui.mainwindow import Ui_MainWindow from moul.time.cavern import CavernTime -from moul.time.cavern import TIMEZONE_NAMES +from moul.file.wdysini import GraphicsIni class MainWindow(QtGui.QMainWindow, Ui_MainWindow): def __init__(self): @@ -41,6 +41,29 @@ self.setupUi(self) self._timezone_init() + self._graphics_init() + + # ************************************************************************ + # graphics + def _graphics_init(self): + """init graphics tab + """ + self._graphicsini = GraphicsIni() + length = len(self._graphicsini._videomodes) -1 + self.slid_screenres.setMaximum(length) + self.connect(self.slid_screenres, SIGNAL("valueChanged(int)"), + self.on_slid_screenres_changed) + self.connect(self.slid_screenres, SIGNAL("sliderMoved(int)"), + self.on_slid_screenres_changed) + + def on_slid_screenres_changed(self, idx): + """SIGNAL: valueChanged (int) + """ + txt = self._graphicsini.getVidModeHuman(idx) + self.lb_screenres.setText(QString(txt)) + + # ************************************************************************ + # time zones def _timezone_init(self): """Init time zone tab""" @@ -52,13 +75,12 @@ self._timezone_timer = timer = QTimer(self) timer.setInterval(1000) # 1 sec # TODO: needs optimization? run only when timer tab is active - self.connect(timer, SIGNAL('timeout()'), self._timezone_update) + self.connect(timer, SIGNAL('timeout()'), self.on_timezone_timer_timeout) timer.start() - def _timezone_update(self, ct=None): + def _timezone_update(self): """Update datetime widgets""" - if ct is None: - ct = self._caverntime() + ct = self._caverntime.info() self.dt_cavern.setDateTime(ct['cavern']['datetime']) self.dt_pacific.setDateTime(ct['pacific']['datetime']) @@ -70,3 +92,10 @@ off = ct['pacific']['utcoffset'] txt = "UTC %s%i" % (off[0], abs(off[1])) self.lb_pacific_utc.setText(QString(txt)) + + def on_timezone_timer_timeout(self): + """SIGNAL: QTimer timeout + """ + ct = self._caverntime() + self.dt_cavern.setDateTime(ct['cavern']) + self.dt_pacific.setDateTime(ct['pacific']) Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-01-16 20:43:19 UTC (rev 37) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-01-16 21:39:46 UTC (rev 38) @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'src\moul\qt\ui\mainwindow.ui' # -# Created: Tue Jan 16 21:38:16 2007 +# Created: Tue Jan 16 22:34:20 2007 # by: PyQt4 UI code generator 4.1.1 # # WARNING! All changes made in this file will be lost! @@ -65,12 +65,6 @@ self.label.setPixmap(QtGui.QPixmap(":/resources/moul_logo.png")) self.label.setObjectName("label") - self.buttonbox_rresavcl = QtGui.QDialogButtonBox(self.centralwidget) - self.buttonbox_rresavcl.setGeometry(QtCore.QRect(10,480,441,32)) - self.buttonbox_rresavcl.setOrientation(QtCore.Qt.Horizontal) - self.buttonbox_rresavcl.setStandardButtons(QtGui.QDialogButtonBox.Close|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Reset|QtGui.QDialogButtonBox.Save) - self.buttonbox_rresavcl.setObjectName("buttonbox_rresavcl") - self.tabWidget = QtGui.QTabWidget(self.centralwidget) self.tabWidget.setGeometry(QtCore.QRect(5,100,450,375)) self.tabWidget.setTabPosition(QtGui.QTabWidget.North) @@ -92,21 +86,20 @@ self.vboxlayout.setSpacing(6) self.vboxlayout.setObjectName("vboxlayout") - self.horizontalSlider = QtGui.QSlider(self.verticalLayout_2) - self.horizontalSlider.setMaximum(11) - self.horizontalSlider.setPageStep(1) - self.horizontalSlider.setSliderPosition(0) - self.horizontalSlider.setTracking(False) - self.horizontalSlider.setOrientation(QtCore.Qt.Horizontal) - self.horizontalSlider.setTickPosition(QtGui.QSlider.TicksBelow) - self.horizontalSlider.setTickInterval(1) - self.horizontalSlider.setObjectName("horizontalSlider") - self.vboxlayout.addWidget(self.horizontalSlider) + self.slid_screenres = QtGui.QSlider(self.verticalLayout_2) + self.slid_screenres.setMaximum(10) + self.slid_screenres.setPageStep(1) + self.slid_screenres.setSliderPosition(0) + self.slid_screenres.setOrientation(QtCore.Qt.Horizontal) + self.slid_screenres.setTickPosition(QtGui.QSlider.TicksBelow) + self.slid_screenres.setTickInterval(1) + self.slid_screenres.setObjectName("slid_screenres") + self.vboxlayout.addWidget(self.slid_screenres) - self.label_resolution = QtGui.QLabel(self.verticalLayout_2) - self.label_resolution.setAlignment(QtCore.Qt.AlignCenter) - self.label_resolution.setObjectName("label_resolution") - self.vboxlayout.addWidget(self.label_resolution) + self.lb_screenres = QtGui.QLabel(self.verticalLayout_2) + self.lb_screenres.setAlignment(QtCore.Qt.AlignCenter) + self.lb_screenres.setObjectName("lb_screenres") + self.vboxlayout.addWidget(self.lb_screenres) self.groupBox_2 = QtGui.QGroupBox(self.tab_graphics) self.groupBox_2.setGeometry(QtCore.QRect(10,90,430,250)) @@ -290,6 +283,10 @@ 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,130,431,211)) + self.gb_dnitime.setObjectName("gb_dnitime") + self.gb_caverntime = QtGui.QGroupBox(self.tab_time) self.gb_caverntime.setGeometry(QtCore.QRect(10,10,431,111)) self.gb_caverntime.setObjectName("gb_caverntime") @@ -330,10 +327,6 @@ self.lb_pacific_utc = QtGui.QLabel(self.gridLayout) self.lb_pacific_utc.setObjectName("lb_pacific_utc") self.gridlayout.addWidget(self.lb_pacific_utc,1,2,1,1) - - self.gb_dnitime = QtGui.QGroupBox(self.tab_time) - self.gb_dnitime.setGeometry(QtCore.QRect(10,130,431,211)) - self.gb_dnitime.setObjectName("gb_dnitime") self.tabWidget.addTab(self.tab_time,"") self.tab_4 = QtGui.QWidget() @@ -344,6 +337,12 @@ self.label_6.setAlignment(QtCore.Qt.AlignCenter) self.label_6.setObjectName("label_6") self.tabWidget.addTab(self.tab_4,"") + + self.buttonbox_rresavcl = QtGui.QDialogButtonBox(self.centralwidget) + self.buttonbox_rresavcl.setGeometry(QtCore.QRect(10,480,441,32)) + self.buttonbox_rresavcl.setOrientation(QtCore.Qt.Horizontal) + self.buttonbox_rresavcl.setStandardButtons(QtGui.QDialogButtonBox.Close|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Reset|QtGui.QDialogButtonBox.Save) + self.buttonbox_rresavcl.setObjectName("buttonbox_rresavcl") MainWindow.setCentralWidget(self.centralwidget) self.statusbar = QtGui.QStatusBar(MainWindow) @@ -356,10 +355,10 @@ QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): - MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8)) + MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "Tool for Myst Online", None, QtGui.QApplication.UnicodeUTF8)) self.pushButton.setText(QtGui.QApplication.translate("MainWindow", "Configure", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox.setTitle(QtGui.QApplication.translate("MainWindow", "Screen Resolution", None, QtGui.QApplication.UnicodeUTF8)) - self.label_resolution.setText(QtGui.QApplication.translate("MainWindow", "800x600 (4:3)", None, QtGui.QApplication.UnicodeUTF8)) + self.lb_screenres.setText(QtGui.QApplication.translate("MainWindow", "800x600 (4:3)", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_2.setTitle(QtGui.QApplication.translate("MainWindow", "Quality", None, QtGui.QApplication.UnicodeUTF8)) self.label_20.setText(QtGui.QApplication.translate("MainWindow", "Texture:", None, QtGui.QApplication.UnicodeUTF8)) self.label_21.setText(QtGui.QApplication.translate("MainWindow", "Low", None, QtGui.QApplication.UnicodeUTF8)) @@ -377,12 +376,12 @@ self.label_7.setText(QtGui.QApplication.translate("MainWindow", "Ultra", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_graphics), QtGui.QApplication.translate("MainWindow", "Graphis", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_audio), QtGui.QApplication.translate("MainWindow", "Audio", 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_4.setText(QtGui.QApplication.translate("MainWindow", "Cavern time:", None, QtGui.QApplication.UnicodeUTF8)) self.lb_cavern_utc.setText(QtGui.QApplication.translate("MainWindow", "UTC", None, QtGui.QApplication.UnicodeUTF8)) self.label_5.setText(QtGui.QApplication.translate("MainWindow", "Pacific time:", None, QtGui.QApplication.UnicodeUTF8)) self.lb_pacific_utc.setText(QtGui.QApplication.translate("MainWindow", "UTC", 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.label_6.setText(QtGui.QApplication.translate("MainWindow", "pyMoul tools", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_4), 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-01-16 20:43:19 UTC (rev 37) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-01-16 21:39:46 UTC (rev 38) @@ -22,7 +22,7 @@ </sizepolicy> </property> <property name="windowTitle" > - <string>MainWindow</string> + <string>Tool for Myst Online</string> </property> <property name="windowIcon" > <iconset resource="moulqt.qrc" >:/resources/uru_icon_32x32.png</iconset> @@ -100,22 +100,6 @@ <pixmap resource="moulqt.qrc" >:/resources/moul_logo.png</pixmap> </property> </widget> - <widget class="QDialogButtonBox" name="buttonbox_rresavcl" > - <property name="geometry" > - <rect> - <x>10</x> - <y>480</y> - <width>441</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> @@ -164,9 +148,9 @@ <number>6</number> </property> <item> - <widget class="QSlider" name="horizontalSlider" > + <widget class="QSlider" name="slid_screenres" > <property name="maximum" > - <number>11</number> + <number>10</number> </property> <property name="pageStep" > <number>1</number> @@ -174,9 +158,6 @@ <property name="sliderPosition" > <number>0</number> </property> - <property name="tracking" > - <bool>false</bool> - </property> <property name="orientation" > <enum>Qt::Horizontal</enum> </property> @@ -189,7 +170,7 @@ </widget> </item> <item> - <widget class="QLabel" name="label_resolution" > + <widget class="QLabel" name="lb_screenres" > <property name="text" > <string>800x600 (4:3)</string> </property> @@ -564,6 +545,19 @@ <attribute name="title" > <string>Time</string> </attribute> + <widget class="QGroupBox" name="gb_dnitime" > + <property name="geometry" > + <rect> + <x>10</x> + <y>130</y> + <width>431</width> + <height>211</height> + </rect> + </property> + <property name="title" > + <string>D'ni time</string> + </property> + </widget> <widget class="QGroupBox" name="gb_caverntime" > <property name="geometry" > <rect> @@ -643,19 +637,6 @@ </layout> </widget> </widget> - <widget class="QGroupBox" name="gb_dnitime" > - <property name="geometry" > - <rect> - <x>10</x> - <y>130</y> - <width>431</width> - <height>211</height> - </rect> - </property> - <property name="title" > - <string>D'ni time</string> - </property> - </widget> </widget> <widget class="QWidget" name="tab_4" > <attribute name="title" > @@ -679,6 +660,22 @@ </widget> </widget> </widget> + <widget class="QDialogButtonBox" name="buttonbox_rresavcl" > + <property name="geometry" > + <rect> + <x>10</x> + <y>480</y> + <width>441</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> @@ -697,8 +694,8 @@ <y>494</y> </hint> <hint type="destinationlabel" > - <x>46</x> - <y>661</y> + <x>42</x> + <y>529</y> </hint> </hints> </connection> Modified: pymoul/trunk/src/moul/time/cavern.py =================================================================== --- pymoul/trunk/src/moul/time/cavern.py 2007-01-16 20:43:19 UTC (rev 37) +++ pymoul/trunk/src/moul/time/cavern.py 2007-01-16 21:39:46 UTC (rev 38) @@ -119,6 +119,9 @@ >>> ct = CavernTime() >>> result = ct() + >>> 'cavern' in result, 'pacific' in result + (True, True) + >>> result = ct.info() >>> 'utc' in result True @@ -169,11 +172,18 @@ if utc_dt is None: utc_dt = self._utcnow() return tz.normalize(utc_dt.astimezone(tz)) - + def __call__(self): now = self._utcnow() result = {} for id, tz in (('cavern', self._cavern), ('pacific', self._pacific)): + result[id] = self._normalize(tz, now) + return result + + def info(self): + now = self._utcnow() + result = {} + for id, tz in (('cavern', self._cavern), ('pacific', self._pacific)): info = result.setdefault(id, {}) utcoffset = td2int(tz.utcoffset(now)) signum = utcoffset < 0 and '-' or '+' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-16 20:52:04
|
Revision: 37 http://pymoul.svn.sourceforge.net/pymoul/?rev=37&view=rev Author: tiran Date: 2007-01-16 12:43:19 -0800 (Tue, 16 Jan 2007) Log Message: ----------- * Added PST time zone because the support used PST instead of MST/cavern time * Updated UI to use a timer for the time zone display. Qt is cool :) Modified Paths: -------------- pymoul/trunk/src/moul/qt/mainwindow.py pymoul/trunk/src/moul/qt/moulqt.py pymoul/trunk/src/moul/qt/ui/mainwindow.py pymoul/trunk/src/moul/qt/ui/mainwindow.ui pymoul/trunk/src/moul/time/cavern.py Modified: pymoul/trunk/src/moul/qt/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/mainwindow.py 2007-01-16 13:11:23 UTC (rev 36) +++ pymoul/trunk/src/moul/qt/mainwindow.py 2007-01-16 20:43:19 UTC (rev 37) @@ -24,12 +24,11 @@ import sys from PyQt4 import QtGui -from PyQt4.QtCore import QDir from PyQt4.QtCore import QString from PyQt4.QtCore import QStringList from PyQt4.QtCore import pyqtSignature from PyQt4.QtCore import SIGNAL -from PyQt4.QtCore import QFileInfo +from PyQt4.QtCore import QTimer from moul.qt.ui.mainwindow import Ui_MainWindow from moul.time.cavern import CavernTime @@ -45,19 +44,16 @@ def _timezone_init(self): """Init time zone tab""" - tz = 'Europe/Berlin' - self._caverntime = CavernTime(tz) - - chooser = self.cb_timezone_chooser - curidx = TIMEZONE_NAMES.index(tz) - chooser.addItems(QStringList(TIMEZONE_NAMES)) - chooser.setCurrentIndex(curidx) - - self.connect(self.cb_timezone_chooser, - SIGNAL("currentIndexChanged (const QString&)"), - self.on_cb_timezone_chooser_changed) - + # create info object and update display the first time + self._caverntime = CavernTime() self._timezone_update() + + # create a timer to update the display every second + self._timezone_timer = timer = QTimer(self) + timer.setInterval(1000) # 1 sec + # TODO: needs optimization? run only when timer tab is active + self.connect(timer, SIGNAL('timeout()'), self._timezone_update) + timer.start() def _timezone_update(self, ct=None): """Update datetime widgets""" @@ -65,22 +61,12 @@ ct = self._caverntime() self.dt_cavern.setDateTime(ct['cavern']['datetime']) - self.dt_local.setDateTime(ct['local']['datetime']) + self.dt_pacific.setDateTime(ct['pacific']['datetime']) - # TODO: handle fractions off = ct['cavern']['utcoffset'] txt = "UTC %s%i" % (off[0], abs(off[1])) self.lb_cavern_utc.setText(QString(txt)) - off = ct['local']['utcoffset'] + off = ct['pacific']['utcoffset'] txt = "UTC %s%i" % (off[0], abs(off[1])) - self.lb_local_utc.setText(QString(txt)) - - def on_cb_timezone_chooser_changed(self, name): - """Change time zone event - - SIGNAL: currentIndexChanged (const QString&) - """ - name = str(name) - self._caverntime.setLocalTZ(name) - self._timezone_update() + self.lb_pacific_utc.setText(QString(txt)) Modified: pymoul/trunk/src/moul/qt/moulqt.py =================================================================== --- pymoul/trunk/src/moul/qt/moulqt.py 2007-01-16 13:11:23 UTC (rev 36) +++ pymoul/trunk/src/moul/qt/moulqt.py 2007-01-16 20:43:19 UTC (rev 37) @@ -30,7 +30,6 @@ from moul.file import plasmalog from moul.file import wdysini from moul.file import kiimage -from moul.time import cavern as caverntime from moul.time import dni as dnitime def main(*args): Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-01-16 13:11:23 UTC (rev 36) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-01-16 20:43:19 UTC (rev 37) @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'src\moul\qt\ui\mainwindow.ui' # -# Created: Tue Jan 16 13:40:50 2007 +# Created: Tue Jan 16 21:38:16 2007 # by: PyQt4 UI code generator 4.1.1 # # WARNING! All changes made in this file will be lost! @@ -65,6 +65,12 @@ self.label.setPixmap(QtGui.QPixmap(":/resources/moul_logo.png")) self.label.setObjectName("label") + self.buttonbox_rresavcl = QtGui.QDialogButtonBox(self.centralwidget) + self.buttonbox_rresavcl.setGeometry(QtCore.QRect(10,480,441,32)) + self.buttonbox_rresavcl.setOrientation(QtCore.Qt.Horizontal) + self.buttonbox_rresavcl.setStandardButtons(QtGui.QDialogButtonBox.Close|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Reset|QtGui.QDialogButtonBox.Save) + self.buttonbox_rresavcl.setObjectName("buttonbox_rresavcl") + self.tabWidget = QtGui.QTabWidget(self.centralwidget) self.tabWidget.setGeometry(QtCore.QRect(5,100,450,375)) self.tabWidget.setTabPosition(QtGui.QTabWidget.North) @@ -284,65 +290,49 @@ self.tab_time = QtGui.QWidget() self.tab_time.setObjectName("tab_time") - self.gb_timezone = QtGui.QGroupBox(self.tab_time) - self.gb_timezone.setGeometry(QtCore.QRect(10,10,421,81)) - self.gb_timezone.setObjectName("gb_timezone") - - self.cb_timezone_chooser = QtGui.QComboBox(self.gb_timezone) - self.cb_timezone_chooser.setGeometry(QtCore.QRect(10,30,271,21)) - self.cb_timezone_chooser.setObjectName("cb_timezone_chooser") - self.gb_caverntime = QtGui.QGroupBox(self.tab_time) - self.gb_caverntime.setGeometry(QtCore.QRect(10,100,421,121)) + self.gb_caverntime.setGeometry(QtCore.QRect(10,10,431,111)) self.gb_caverntime.setObjectName("gb_caverntime") - self.horizontalLayout_2 = QtGui.QWidget(self.gb_caverntime) - self.horizontalLayout_2.setGeometry(QtCore.QRect(20,20,261,31)) - self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.gridLayout = QtGui.QWidget(self.gb_caverntime) + self.gridLayout.setGeometry(QtCore.QRect(10,20,281,80)) + self.gridLayout.setObjectName("gridLayout") - self.hboxlayout5 = QtGui.QHBoxLayout(self.horizontalLayout_2) - self.hboxlayout5.setMargin(0) - self.hboxlayout5.setSpacing(6) - self.hboxlayout5.setObjectName("hboxlayout5") + self.gridlayout = QtGui.QGridLayout(self.gridLayout) + self.gridlayout.setMargin(0) + self.gridlayout.setSpacing(6) + self.gridlayout.setObjectName("gridlayout") - self.label_4 = QtGui.QLabel(self.horizontalLayout_2) - self.label_4.setObjectName("label_4") - self.hboxlayout5.addWidget(self.label_4) - - self.dt_cavern = QtGui.QDateTimeEdit(self.horizontalLayout_2) + self.dt_cavern = QtGui.QDateTimeEdit(self.gridLayout) self.dt_cavern.setReadOnly(True) self.dt_cavern.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) self.dt_cavern.setObjectName("dt_cavern") - self.hboxlayout5.addWidget(self.dt_cavern) + self.gridlayout.addWidget(self.dt_cavern,0,1,1,1) - self.lb_cavern_utc = QtGui.QLabel(self.horizontalLayout_2) + self.label_4 = QtGui.QLabel(self.gridLayout) + self.label_4.setObjectName("label_4") + self.gridlayout.addWidget(self.label_4,0,0,1,1) + + self.lb_cavern_utc = QtGui.QLabel(self.gridLayout) self.lb_cavern_utc.setObjectName("lb_cavern_utc") - self.hboxlayout5.addWidget(self.lb_cavern_utc) + self.gridlayout.addWidget(self.lb_cavern_utc,0,2,1,1) - self.horizontalLayout_3 = QtGui.QWidget(self.gb_caverntime) - self.horizontalLayout_3.setGeometry(QtCore.QRect(20,70,261,31)) - self.horizontalLayout_3.setObjectName("horizontalLayout_3") - - self.hboxlayout6 = QtGui.QHBoxLayout(self.horizontalLayout_3) - self.hboxlayout6.setMargin(0) - self.hboxlayout6.setSpacing(6) - self.hboxlayout6.setObjectName("hboxlayout6") - - self.label_5 = QtGui.QLabel(self.horizontalLayout_3) + self.label_5 = QtGui.QLabel(self.gridLayout) self.label_5.setObjectName("label_5") - self.hboxlayout6.addWidget(self.label_5) + self.gridlayout.addWidget(self.label_5,1,0,1,1) - self.dt_local = QtGui.QDateTimeEdit(self.horizontalLayout_3) - self.dt_local.setReadOnly(True) - self.dt_local.setObjectName("dt_local") - self.hboxlayout6.addWidget(self.dt_local) + self.dt_pacific = QtGui.QDateTimeEdit(self.gridLayout) + self.dt_pacific.setReadOnly(True) + self.dt_pacific.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) + self.dt_pacific.setObjectName("dt_pacific") + self.gridlayout.addWidget(self.dt_pacific,1,1,1,1) - self.lb_local_utc = QtGui.QLabel(self.horizontalLayout_3) - self.lb_local_utc.setObjectName("lb_local_utc") - self.hboxlayout6.addWidget(self.lb_local_utc) + self.lb_pacific_utc = QtGui.QLabel(self.gridLayout) + self.lb_pacific_utc.setObjectName("lb_pacific_utc") + self.gridlayout.addWidget(self.lb_pacific_utc,1,2,1,1) self.gb_dnitime = QtGui.QGroupBox(self.tab_time) - self.gb_dnitime.setGeometry(QtCore.QRect(10,230,421,111)) + self.gb_dnitime.setGeometry(QtCore.QRect(10,130,431,211)) self.gb_dnitime.setObjectName("gb_dnitime") self.tabWidget.addTab(self.tab_time,"") @@ -354,12 +344,6 @@ self.label_6.setAlignment(QtCore.Qt.AlignCenter) self.label_6.setObjectName("label_6") self.tabWidget.addTab(self.tab_4,"") - - self.buttonbox_rresavcl = QtGui.QDialogButtonBox(self.centralwidget) - self.buttonbox_rresavcl.setGeometry(QtCore.QRect(10,480,441,32)) - self.buttonbox_rresavcl.setOrientation(QtCore.Qt.Horizontal) - self.buttonbox_rresavcl.setStandardButtons(QtGui.QDialogButtonBox.Close|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Reset|QtGui.QDialogButtonBox.Save) - self.buttonbox_rresavcl.setObjectName("buttonbox_rresavcl") MainWindow.setCentralWidget(self.centralwidget) self.statusbar = QtGui.QStatusBar(MainWindow) @@ -367,7 +351,7 @@ MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) - self.tabWidget.setCurrentIndex(2) + self.tabWidget.setCurrentIndex(0) QtCore.QObject.connect(self.buttonbox_rresavcl,QtCore.SIGNAL("rejected()"),MainWindow.close) QtCore.QMetaObject.connectSlotsByName(MainWindow) @@ -393,12 +377,11 @@ self.label_7.setText(QtGui.QApplication.translate("MainWindow", "Ultra", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_graphics), QtGui.QApplication.translate("MainWindow", "Graphis", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_audio), QtGui.QApplication.translate("MainWindow", "Audio", None, QtGui.QApplication.UnicodeUTF8)) - self.gb_timezone.setTitle(QtGui.QApplication.translate("MainWindow", "Time Zone", None, QtGui.QApplication.UnicodeUTF8)) - self.gb_caverntime.setTitle(QtGui.QApplication.translate("MainWindow", "Cavern Time", None, QtGui.QApplication.UnicodeUTF8)) + self.gb_caverntime.setTitle(QtGui.QApplication.translate("MainWindow", "Time zones", None, QtGui.QApplication.UnicodeUTF8)) self.label_4.setText(QtGui.QApplication.translate("MainWindow", "Cavern time:", None, QtGui.QApplication.UnicodeUTF8)) self.lb_cavern_utc.setText(QtGui.QApplication.translate("MainWindow", "UTC", None, QtGui.QApplication.UnicodeUTF8)) - self.label_5.setText(QtGui.QApplication.translate("MainWindow", "Local time:", None, QtGui.QApplication.UnicodeUTF8)) - self.lb_local_utc.setText(QtGui.QApplication.translate("MainWindow", "UTC", None, QtGui.QApplication.UnicodeUTF8)) + self.label_5.setText(QtGui.QApplication.translate("MainWindow", "Pacific time:", None, QtGui.QApplication.UnicodeUTF8)) + self.lb_pacific_utc.setText(QtGui.QApplication.translate("MainWindow", "UTC", 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.label_6.setText(QtGui.QApplication.translate("MainWindow", "pyMoul tools", None, QtGui.QApplication.UnicodeUTF8)) Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.ui =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-01-16 13:11:23 UTC (rev 36) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-01-16 20:43:19 UTC (rev 37) @@ -100,6 +100,22 @@ <pixmap resource="moulqt.qrc" >:/resources/moul_logo.png</pixmap> </property> </widget> + <widget class="QDialogButtonBox" name="buttonbox_rresavcl" > + <property name="geometry" > + <rect> + <x>10</x> + <y>480</y> + <width>441</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> @@ -113,7 +129,7 @@ <enum>QTabWidget::North</enum> </property> <property name="currentIndex" > - <number>2</number> + <number>0</number> </property> <widget class="QWidget" name="tab_graphics" > <attribute name="title" > @@ -548,65 +564,35 @@ <attribute name="title" > <string>Time</string> </attribute> - <widget class="QGroupBox" name="gb_timezone" > + <widget class="QGroupBox" name="gb_caverntime" > <property name="geometry" > <rect> <x>10</x> <y>10</y> - <width>421</width> - <height>81</height> + <width>431</width> + <height>111</height> </rect> </property> <property name="title" > - <string>Time Zone</string> + <string>Time zones</string> </property> - <widget class="QComboBox" name="cb_timezone_chooser" > + <widget class="QWidget" name="gridLayout" > <property name="geometry" > <rect> <x>10</x> - <y>30</y> - <width>271</width> - <height>21</height> - </rect> - </property> - </widget> - </widget> - <widget class="QGroupBox" name="gb_caverntime" > - <property name="geometry" > - <rect> - <x>10</x> - <y>100</y> - <width>421</width> - <height>121</height> - </rect> - </property> - <property name="title" > - <string>Cavern Time</string> - </property> - <widget class="QWidget" name="horizontalLayout_2" > - <property name="geometry" > - <rect> - <x>20</x> <y>20</y> - <width>261</width> - <height>31</height> + <width>281</width> + <height>80</height> </rect> </property> - <layout class="QHBoxLayout" > + <layout class="QGridLayout" > <property name="margin" > <number>0</number> </property> <property name="spacing" > <number>6</number> </property> - <item> - <widget class="QLabel" name="label_4" > - <property name="text" > - <string>Cavern time:</string> - </property> - </widget> - </item> - <item> + <item row="0" column="1" > <widget class="QDateTimeEdit" name="dt_cavern" > <property name="readOnly" > <bool>true</bool> @@ -616,47 +602,39 @@ </property> </widget> </item> - <item> + <item row="0" column="0" > + <widget class="QLabel" name="label_4" > + <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</string> </property> </widget> </item> - </layout> - </widget> - <widget class="QWidget" name="horizontalLayout_3" > - <property name="geometry" > - <rect> - <x>20</x> - <y>70</y> - <width>261</width> - <height>31</height> - </rect> - </property> - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> + <item row="1" column="0" > <widget class="QLabel" name="label_5" > <property name="text" > - <string>Local time:</string> + <string>Pacific time:</string> </property> </widget> </item> - <item> - <widget class="QDateTimeEdit" name="dt_local" > + <item row="1" column="1" > + <widget class="QDateTimeEdit" name="dt_pacific" > <property name="readOnly" > <bool>true</bool> </property> + <property name="buttonSymbols" > + <enum>QAbstractSpinBox::UpDownArrows</enum> + </property> </widget> </item> - <item> - <widget class="QLabel" name="lb_local_utc" > + <item row="1" column="2" > + <widget class="QLabel" name="lb_pacific_utc" > <property name="text" > <string>UTC</string> </property> @@ -669,9 +647,9 @@ <property name="geometry" > <rect> <x>10</x> - <y>230</y> - <width>421</width> - <height>111</height> + <y>130</y> + <width>431</width> + <height>211</height> </rect> </property> <property name="title" > @@ -701,22 +679,6 @@ </widget> </widget> </widget> - <widget class="QDialogButtonBox" name="buttonbox_rresavcl" > - <property name="geometry" > - <rect> - <x>10</x> - <y>480</y> - <width>441</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/time/cavern.py =================================================================== --- pymoul/trunk/src/moul/time/cavern.py 2007-01-16 13:11:23 UTC (rev 36) +++ pymoul/trunk/src/moul/time/cavern.py 2007-01-16 20:43:19 UTC (rev 37) @@ -59,11 +59,14 @@ # Cyan HQ is near Spokane / Washington # Cavern time is Mountain Time Zone (MDT) with daylight savings (MST) -CAVERN_TZ_NAME = 'US/Mountain' # MDT / MST +CAVERN_TZ_NAME = 'US/Mountain' # MST / MDT CAVERN_TZ = timezone(CAVERN_TZ_NAME) +PACIFIC_TZ_NAME = 'US/Pacific' # PST / PDT +PACIFIC_TZ = timezone(PACIFIC_TZ_NAME) + def diffTD(td1, td2): - """Difference of two objects -> int + """Difference of two objects -> int >>> from datetime import timedelta >>> type(diffTD(timedelta(0, 3600), timedelta(0, -3600))) @@ -101,31 +104,49 @@ class CavernTime(object): """Cavern time calculator - Calculates the cavern time and local time based on a given local time + Calculates the cavern time and other useful tz based on a given local time zone. Call a CavernTime object: utc datetime -- Current time in UTC as <datetime> object - cavern - datetime -- Current time in cavern TZ as <datetime> object - tz -- Cavern time zone object + cavern, pacific + datetime -- current time TZ as <datetime> object + tz -- time zone object + dst -- dst in seconds if dst utcoffset -- (signum, hours, fraction) offset from UTC - cavern - datetime -- Current time in local TZ as <datetime> object - tz -- Local time zone object - utcoffset -- (signum, hours, fraction) offset from UTC + name -- long time like US/Mountain + id -- short name like MST - >>> ct = CavernTime(local="Europe/Berlin") + >>> ct = CavernTime() >>> result = ct() - >>> 'utc' in result, 'local' in result, 'cavern' in result - (True, True, True) - >>> coff = result['cavern']['utcoffset'] - >>> coff == ('-', -7, 0.0) or coff == ('-', -8, 0.0) or coff + >>> 'utc' in result True - >>> loff = result['local']['utcoffset'] - >>> loff == ('+', 1, 0.0) or loff == ('+', 2, 0.0) or loff + + >>> cav = result['cavern'] + >>> off = cav['utcoffset'] + >>> dst = cav['dst'] + >>> (not dst and off == ('-', -7, 0.0)) or (dst and off == ('-', -8, 0.0)) or off True + >>> cav['id'] + 'MST' + >>> cav['name'] + 'US/Mountain' + >>> cav['dst'] in (0, 3600) + True + >>> del cav + >>> pst = result['pacific'] + >>> dst = pst['dst'] + >>> (not dst and off == ('-', -7, 0.0)) or (dst and off == ('-', -8, 0.0)) or off + True + >>> pst['id'] + 'PST' + >>> pst['name'] + 'US/Pacific' + >>> pst['dst'] in (0, 3600) + True + >>> del pst + >>> 'UTC' in CavernTime.timezones True >>> 'UTC' in ct.timezones @@ -133,15 +154,7 @@ """ timezones = TIMEZONE_NAMES _cavern = CAVERN_TZ - _local = None - - def __init__(self, local): - self.setLocalTZ(local) - - def setLocalTZ(self, local): - """Set local time zone - """ - self._local = timezone(local) + _pacific = PACIFIC_TZ @staticmethod def _utcnow(): @@ -160,12 +173,18 @@ def __call__(self): now = self._utcnow() result = {} - for id, tz in (('cavern', self._cavern), ('local', self._local)): + for id, tz in (('cavern', self._cavern), ('pacific', self._pacific)): info = result.setdefault(id, {}) utcoffset = td2int(tz.utcoffset(now)) signum = utcoffset < 0 and '-' or '+' info['tz'] = tz info['utcoffset'] = signum,int(utcoffset/3600), float((utcoffset%3600)/3600.0) info['datetime'] = self._normalize(tz, now) + info['name'] = str(tz) + info['id'] = tz._tzname + info['dst'] = td2int(tz.dst(now)) result['utc'] = {'datetime' : now} return result + + def __str__(self): + return str(self._cavern) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-16 13:11:23
|
Revision: 36 http://pymoul.svn.sourceforge.net/pymoul/?rev=36&view=rev Author: tiran Date: 2007-01-16 05:11:23 -0800 (Tue, 16 Jan 2007) Log Message: ----------- Minor fixes Modified Paths: -------------- pymoul/trunk/src/moul/tests/test_i18n.py pymoul/trunk/src/moul/time/cavern.py Modified: pymoul/trunk/src/moul/tests/test_i18n.py =================================================================== --- pymoul/trunk/src/moul/tests/test_i18n.py 2007-01-16 13:09:30 UTC (rev 35) +++ pymoul/trunk/src/moul/tests/test_i18n.py 2007-01-16 13:11:23 UTC (rev 36) @@ -16,6 +16,7 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # """moul.i18n unit tests +""" __author__ = "Christian Heimes" __version__ = "$Id$" __revision__ = "$Revision$" Modified: pymoul/trunk/src/moul/time/cavern.py =================================================================== --- pymoul/trunk/src/moul/time/cavern.py 2007-01-16 13:09:30 UTC (rev 35) +++ pymoul/trunk/src/moul/time/cavern.py 2007-01-16 13:11:23 UTC (rev 36) @@ -163,7 +163,7 @@ for id, tz in (('cavern', self._cavern), ('local', self._local)): info = result.setdefault(id, {}) utcoffset = td2int(tz.utcoffset(now)) - signum = utcoffset > 0 and '+' or '-' + signum = utcoffset < 0 and '-' or '+' info['tz'] = tz info['utcoffset'] = signum,int(utcoffset/3600), float((utcoffset%3600)/3600.0) info['datetime'] = self._normalize(tz, now) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-16 13:09:31
|
Revision: 35 http://pymoul.svn.sourceforge.net/pymoul/?rev=35&view=rev Author: tiran Date: 2007-01-16 05:09:30 -0800 (Tue, 16 Jan 2007) Log Message: ----------- Added author info Added svn:keywords Fixed and updated eol-styles Modified Paths: -------------- pymoul/trunk/compileui.py pymoul/trunk/setup.py pymoul/trunk/setup_win32.py pymoul/trunk/src/moul/cli/moullauncher.py pymoul/trunk/src/moul/config/darwin.py pymoul/trunk/src/moul/config/generic.py pymoul/trunk/src/moul/config/linux2.py pymoul/trunk/src/moul/config/win32.py pymoul/trunk/src/moul/crypt/elf.py pymoul/trunk/src/moul/crypt/tests/test_elf.py pymoul/trunk/src/moul/crypt/tests/test_wdys.py pymoul/trunk/src/moul/crypt/whatdoyousee.py pymoul/trunk/src/moul/file/chatlog.py pymoul/trunk/src/moul/file/kiimage.py pymoul/trunk/src/moul/file/localization.py pymoul/trunk/src/moul/file/plasmalog.py pymoul/trunk/src/moul/file/wdysini.py pymoul/trunk/src/moul/i18n.py pymoul/trunk/src/moul/log.py pymoul/trunk/src/moul/qt/mainwindow.py pymoul/trunk/src/moul/qt/moulqt.py pymoul/trunk/src/moul/qt/ui/mainwindow.py pymoul/trunk/src/moul/tests/test_i18n.py pymoul/trunk/src/moul/time/cavern.py pymoul/trunk/src/moul/time/dni.py pymoul/trunk/src/moul/time/tests/__init__.py pymoul/trunk/src/moul/time/tests/test_cavern.py Property Changed: ---------------- pymoul/trunk/compileui.py pymoul/trunk/ez_setup.py pymoul/trunk/misc/build_exe.py pymoul/trunk/setup.py pymoul/trunk/setup_win32.py pymoul/trunk/src/moul/__init__.py pymoul/trunk/src/moul/cli/__init__.py pymoul/trunk/src/moul/cli/moullauncher.py pymoul/trunk/src/moul/cli/tests/__init__.py pymoul/trunk/src/moul/config/__init__.py pymoul/trunk/src/moul/config/darwin.py pymoul/trunk/src/moul/config/generic.py pymoul/trunk/src/moul/config/linux2.py pymoul/trunk/src/moul/config/miniwinshell.py pymoul/trunk/src/moul/config/tests/__init__.py pymoul/trunk/src/moul/config/win32.py pymoul/trunk/src/moul/crypt/__init__.py pymoul/trunk/src/moul/crypt/elf.py pymoul/trunk/src/moul/crypt/tests/__init__.py pymoul/trunk/src/moul/crypt/tests/test_elf.py pymoul/trunk/src/moul/crypt/tests/test_wdys.py pymoul/trunk/src/moul/crypt/whatdoyousee.py pymoul/trunk/src/moul/crypt/xtea.py pymoul/trunk/src/moul/file/__init__.py pymoul/trunk/src/moul/file/chatlog.py pymoul/trunk/src/moul/file/kiimage.py pymoul/trunk/src/moul/file/localization.py pymoul/trunk/src/moul/file/plasmalog.py pymoul/trunk/src/moul/file/tests/__init__.py pymoul/trunk/src/moul/file/wdysini.py pymoul/trunk/src/moul/i18n.py pymoul/trunk/src/moul/log.py pymoul/trunk/src/moul/metadata.py pymoul/trunk/src/moul/qt/__init__.py pymoul/trunk/src/moul/qt/mainwindow.py pymoul/trunk/src/moul/qt/moulqt.py pymoul/trunk/src/moul/qt/tests/__init__.py pymoul/trunk/src/moul/qt/ui/__init__.py pymoul/trunk/src/moul/qt/ui/mainwindow.py pymoul/trunk/src/moul/qt/ui/moulqt_rc.py pymoul/trunk/src/moul/tests/__init__.py pymoul/trunk/src/moul/tests/test_i18n.py pymoul/trunk/src/moul/time/__init__.py pymoul/trunk/src/moul/time/cavern.py pymoul/trunk/src/moul/time/dni.py pymoul/trunk/src/moul/time/tests/__init__.py pymoul/trunk/src/moul/time/tests/test_cavern.py pymoul/trunk/test.py Modified: pymoul/trunk/compileui.py =================================================================== --- pymoul/trunk/compileui.py 2007-01-16 12:40:27 UTC (rev 34) +++ pymoul/trunk/compileui.py 2007-01-16 13:09:30 UTC (rev 35) @@ -1,6 +1,10 @@ #!/usr/bin/env python2.5 """Compile QtDesigner's UI and QRC files to Python files """ +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + import os import re from stat import ST_MTIME Property changes on: pymoul/trunk/compileui.py ___________________________________________________________________ Name: svn:keywords + Id Revision Property changes on: pymoul/trunk/ez_setup.py ___________________________________________________________________ Name: svn:keywords + Id Revision Property changes on: pymoul/trunk/misc/build_exe.py ___________________________________________________________________ Name: svn:keywords + Id Revision Modified: pymoul/trunk/setup.py =================================================================== --- pymoul/trunk/setup.py 2007-01-16 12:40:27 UTC (rev 34) +++ pymoul/trunk/setup.py 2007-01-16 13:09:30 UTC (rev 35) @@ -3,6 +3,10 @@ TODO: Long description of pyMoul """ +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + import sys import os import time Property changes on: pymoul/trunk/setup.py ___________________________________________________________________ Name: svn:keywords + Id Revision Modified: pymoul/trunk/setup_win32.py =================================================================== --- pymoul/trunk/setup_win32.py 2007-01-16 12:40:27 UTC (rev 34) +++ pymoul/trunk/setup_win32.py 2007-01-16 13:09:30 UTC (rev 35) @@ -1,5 +1,9 @@ """Win23 helpers for setup.py """ +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + import os import sys from setuptools import find_packages Property changes on: pymoul/trunk/setup_win32.py ___________________________________________________________________ Name: svn:keywords + Id Revision Property changes on: pymoul/trunk/src/moul/__init__.py ___________________________________________________________________ Name: svn:keywords + Id Revision Property changes on: pymoul/trunk/src/moul/cli/__init__.py ___________________________________________________________________ Name: svn:keywords + Id Revision Modified: pymoul/trunk/src/moul/cli/moullauncher.py =================================================================== --- pymoul/trunk/src/moul/cli/moullauncher.py 2007-01-16 12:40:27 UTC (rev 34) +++ pymoul/trunk/src/moul/cli/moullauncher.py 2007-01-16 13:09:30 UTC (rev 35) @@ -18,6 +18,10 @@ # """MOUL launcher """ +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + import os import sys from optparse import OptionParser Property changes on: pymoul/trunk/src/moul/cli/moullauncher.py ___________________________________________________________________ Name: svn:keywords + Id Revision Property changes on: pymoul/trunk/src/moul/cli/tests/__init__.py ___________________________________________________________________ Name: svn:keywords + Id Revision Name: svn:eol-style + native Property changes on: pymoul/trunk/src/moul/config/__init__.py ___________________________________________________________________ Name: svn:keywords + Id Revision Modified: pymoul/trunk/src/moul/config/darwin.py =================================================================== --- pymoul/trunk/src/moul/config/darwin.py 2007-01-16 12:40:27 UTC (rev 34) +++ pymoul/trunk/src/moul/config/darwin.py 2007-01-16 13:09:30 UTC (rev 35) @@ -19,6 +19,10 @@ XXX: untested! """ +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + import os from moul.log import LOG LOG.warning('Darwin/Mac support is not tested') Property changes on: pymoul/trunk/src/moul/config/darwin.py ___________________________________________________________________ Name: svn:keywords + Id Revision Name: svn:eol-style + native Modified: pymoul/trunk/src/moul/config/generic.py =================================================================== --- pymoul/trunk/src/moul/config/generic.py 2007-01-16 12:40:27 UTC (rev 34) +++ pymoul/trunk/src/moul/config/generic.py 2007-01-16 13:09:30 UTC (rev 35) @@ -17,6 +17,10 @@ # """cross platform configuration tools for pyMoul """ +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + # Stub for platform specific functions def getMoulUserDataDir(): """Get path of MOUL user data directory Property changes on: pymoul/trunk/src/moul/config/generic.py ___________________________________________________________________ Name: svn:keywords + Id Revision Modified: pymoul/trunk/src/moul/config/linux2.py =================================================================== --- pymoul/trunk/src/moul/config/linux2.py 2007-01-16 12:40:27 UTC (rev 34) +++ pymoul/trunk/src/moul/config/linux2.py 2007-01-16 13:09:30 UTC (rev 35) @@ -19,6 +19,10 @@ XXX: untested! """ +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + import os from moul.log import LOG LOG.warning('Linux support is not tested') Property changes on: pymoul/trunk/src/moul/config/linux2.py ___________________________________________________________________ Name: svn:keywords + Id Revision Name: svn:eol-style + native Property changes on: pymoul/trunk/src/moul/config/miniwinshell.py ___________________________________________________________________ Name: svn:keywords + Id Revision Property changes on: pymoul/trunk/src/moul/config/tests/__init__.py ___________________________________________________________________ Name: svn:keywords + Id Revision Name: svn:eol-style + native Modified: pymoul/trunk/src/moul/config/win32.py =================================================================== --- pymoul/trunk/src/moul/config/win32.py 2007-01-16 12:40:27 UTC (rev 34) +++ pymoul/trunk/src/moul/config/win32.py 2007-01-16 13:09:30 UTC (rev 35) @@ -17,6 +17,10 @@ # """Win32 configuration for pyMoul """ +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + import os from miniwinshell import my_documents from miniwinshell import application_data Property changes on: pymoul/trunk/src/moul/config/win32.py ___________________________________________________________________ Name: svn:keywords + Id Revision Property changes on: pymoul/trunk/src/moul/crypt/__init__.py ___________________________________________________________________ Name: svn:keywords + Id Revision Modified: pymoul/trunk/src/moul/crypt/elf.py =================================================================== --- pymoul/trunk/src/moul/crypt/elf.py 2007-01-16 12:40:27 UTC (rev 34) +++ pymoul/trunk/src/moul/crypt/elf.py 2007-01-16 13:09:30 UTC (rev 35) @@ -19,6 +19,10 @@ Based on the C++ code from Marack """ +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + import struct def list2int(lst): Property changes on: pymoul/trunk/src/moul/crypt/elf.py ___________________________________________________________________ Name: svn:keywords + Id Revision Property changes on: pymoul/trunk/src/moul/crypt/tests/__init__.py ___________________________________________________________________ Name: svn:keywords + Id Revision Name: svn:eol-style + native Modified: pymoul/trunk/src/moul/crypt/tests/test_elf.py =================================================================== --- pymoul/trunk/src/moul/crypt/tests/test_elf.py 2007-01-16 12:40:27 UTC (rev 34) +++ pymoul/trunk/src/moul/crypt/tests/test_elf.py 2007-01-16 13:09:30 UTC (rev 35) @@ -14,33 +14,37 @@ # 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 -# -"""moul.crypt.elf unit tests -""" -import os +# +"""moul.crypt.elf unit tests +""" +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + +import os import unittest from doctest import DocTestSuite - -import moul.file -from moul.crypt.elf import decryptElf - -base = os.path.dirname(moul.file.__file__) -elf_enc = os.path.join(base, 'tests', 'audiocaps.0.elf') -elf_dec = os.path.join(base, 'tests', 'audiocaps.0.txt') - -class ElfTest(unittest.TestCase): - def setUp(self): - self.enc = open(elf_enc, 'rb') - self.dec = open(elf_dec, 'r') - - def tearDown(self): - self.enc.close() - self.dec.close() - - def test_compare(self): - data = '\n'.join(decryptElf(self.enc)) - self.failUnlessEqual(data, self.dec.read()) - + +import moul.file +from moul.crypt.elf import decryptElf + +base = os.path.dirname(moul.file.__file__) +elf_enc = os.path.join(base, 'tests', 'audiocaps.0.elf') +elf_dec = os.path.join(base, 'tests', 'audiocaps.0.txt') + +class ElfTest(unittest.TestCase): + def setUp(self): + self.enc = open(elf_enc, 'rb') + self.dec = open(elf_dec, 'r') + + def tearDown(self): + self.enc.close() + self.dec.close() + + def test_compare(self): + data = '\n'.join(decryptElf(self.enc)) + self.failUnlessEqual(data, self.dec.read()) + def test_suite(): return unittest.TestSuite(( unittest.makeSuite(ElfTest), @@ -48,5 +52,5 @@ if __name__ == '__main__': unittest.main(defaultTest="test_suite") - - + + Property changes on: pymoul/trunk/src/moul/crypt/tests/test_elf.py ___________________________________________________________________ Name: svn:keywords + Id Revision Name: svn:eol-style + native Modified: pymoul/trunk/src/moul/crypt/tests/test_wdys.py =================================================================== --- pymoul/trunk/src/moul/crypt/tests/test_wdys.py 2007-01-16 12:40:27 UTC (rev 34) +++ pymoul/trunk/src/moul/crypt/tests/test_wdys.py 2007-01-16 13:09:30 UTC (rev 35) @@ -17,6 +17,10 @@ # """moul.crypt.whatdoyousee unit tests """ +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + import os import unittest from doctest import DocTestSuite Property changes on: pymoul/trunk/src/moul/crypt/tests/test_wdys.py ___________________________________________________________________ Name: svn:keywords + Id Revision Modified: pymoul/trunk/src/moul/crypt/whatdoyousee.py =================================================================== --- pymoul/trunk/src/moul/crypt/whatdoyousee.py 2007-01-16 12:40:27 UTC (rev 34) +++ pymoul/trunk/src/moul/crypt/whatdoyousee.py 2007-01-16 13:09:30 UTC (rev 35) @@ -24,6 +24,10 @@ Thanks to Anonymous54321 on the Clockwork Orange BBS forum for the xTEA keys. """ +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + import struct from moul.crypt.xtea import xtea_decrypt Property changes on: pymoul/trunk/src/moul/crypt/whatdoyousee.py ___________________________________________________________________ Name: svn:keywords + Id Revision Property changes on: pymoul/trunk/src/moul/crypt/xtea.py ___________________________________________________________________ Name: svn:keywords + Id Revision Property changes on: pymoul/trunk/src/moul/file/__init__.py ___________________________________________________________________ Name: svn:keywords + Id Revision Modified: pymoul/trunk/src/moul/file/chatlog.py =================================================================== --- pymoul/trunk/src/moul/file/chatlog.py 2007-01-16 12:40:27 UTC (rev 34) +++ pymoul/trunk/src/moul/file/chatlog.py 2007-01-16 13:09:30 UTC (rev 35) @@ -17,6 +17,10 @@ # """Chat log parser """ +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + import re CHAT_RE_TXT = r"^\((?P<M>\d{1,2})/(?P<D>\d{1,2})\ " \ Property changes on: pymoul/trunk/src/moul/file/chatlog.py ___________________________________________________________________ Name: svn:keywords + Id Revision Modified: pymoul/trunk/src/moul/file/kiimage.py =================================================================== --- pymoul/trunk/src/moul/file/kiimage.py 2007-01-16 12:40:27 UTC (rev 34) +++ pymoul/trunk/src/moul/file/kiimage.py 2007-01-16 13:09:30 UTC (rev 35) @@ -17,6 +17,10 @@ # """KI image module """ +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + import os import tempfile Property changes on: pymoul/trunk/src/moul/file/kiimage.py ___________________________________________________________________ Name: svn:keywords + Id Revision Modified: pymoul/trunk/src/moul/file/localization.py =================================================================== --- pymoul/trunk/src/moul/file/localization.py 2007-01-16 12:40:27 UTC (rev 34) +++ pymoul/trunk/src/moul/file/localization.py 2007-01-16 13:09:30 UTC (rev 35) @@ -19,6 +19,11 @@ """ from __future__ import with_statement +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + + __all__ = ('translationRegistry', 'parseLocDirectory') import os Property changes on: pymoul/trunk/src/moul/file/localization.py ___________________________________________________________________ Name: svn:keywords + Id Revision Modified: pymoul/trunk/src/moul/file/plasmalog.py =================================================================== --- pymoul/trunk/src/moul/file/plasmalog.py 2007-01-16 12:40:27 UTC (rev 34) +++ pymoul/trunk/src/moul/file/plasmalog.py 2007-01-16 13:09:30 UTC (rev 35) @@ -1,108 +1,112 @@ -# 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 -# -"""Module to automagically zip MOUL's log files -""" -import os -from stat import ST_MTIME -import time -import zipfile -import re - -from moul.config import getMoulDir -from moul.config import getConfigOption -from moul.crypt.elf import decryptElf - -PLASMA_LOG = "plasmalog.txt" -_marker = object() -RE_SAFEEXT_TEXT = "\.(elf|txt|log|zip|jpg|jpeg)$" -RE_SAFEXT = re.compile(RE_SAFEEXT_TEXT, re.IGNORECASE) - -def getTimeStamp(path): - """Get time stamp yyyymmdd_hhmm based in the modification time - """ - sec = os.stat(path)[ST_MTIME] - return time.strftime("%Y%m%d_%H%M", time.gmtime(sec)) - -def isLogDir(path): - """Check if a path is a valid plasma log directory - - Just checks for the plasmalog.txt file - - Returns either False or a time stamp - """ - pl = os.path.join(path, PLASMA_LOG) - if not os.path.isfile(pl): - return False - return getTimeStamp(pl) - -def zipLogDir(logdir=None, destdir=None, remove=_marker): - """Zip all log files - - This function also zips subdirectories. - """ - if logdir is None: - logdir = getMoulDir('log') - if destdir is None: - destdir = getMoulDir('userdata') - if remove is _marker: - remove = getConfigOption('moul', 'removelogs', default=False) - - stored_dirs = [] - - for root, dirs, files in os.walk(logdir): - stamp = isLogDir(root) - if not stamp: - continue - name = os.path.basename(root) - zipname = "%s_%s.zip" % (name, stamp) - zipfd = zipfile.ZipFile(os.path.join(destdir, zipname), - 'w', zipfile.ZIP_DEFLATED) - for file in files: - if file.lower().startswith('chat.'): - # omit chatlogs from the logs - continue - fname = os.path.join(root, file) - arcname = os.path.join(name, file) - zipfd.write(fname, arcname) - #zipfd.printdir() - zipfd.close() - stored_dirs.append((root, zipname)) - - if remove: - removeLogs(logdir) - - return stored_dirs - -def removeLogs(logdir=None): - """Removes log directories - - The removeLogs function removes only files considered as safe - """ - if logdir is None: - logdir = getMoulDir('log') - - for root, dirs, files in os.walk(logdir, topdown=False): - for name in files: - if RE_SAFEXT.search(name): - os.remove(os.path.join(root, name)) - else: - print name # XXX - for name in dirs: - os.rmdir(os.path.join(root, name)) - - os.rmdir(logdir) +# 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 +# +"""Module to automagically zip MOUL's log files +""" +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + +import os +from stat import ST_MTIME +import time +import zipfile +import re + +from moul.config import getMoulDir +from moul.config import getConfigOption +from moul.crypt.elf import decryptElf + +PLASMA_LOG = "plasmalog.txt" +_marker = object() +RE_SAFEEXT_TEXT = "\.(elf|txt|log|zip|jpg|jpeg)$" +RE_SAFEXT = re.compile(RE_SAFEEXT_TEXT, re.IGNORECASE) + +def getTimeStamp(path): + """Get time stamp yyyymmdd_hhmm based in the modification time + """ + sec = os.stat(path)[ST_MTIME] + return time.strftime("%Y%m%d_%H%M", time.gmtime(sec)) + +def isLogDir(path): + """Check if a path is a valid plasma log directory + + Just checks for the plasmalog.txt file + + Returns either False or a time stamp + """ + pl = os.path.join(path, PLASMA_LOG) + if not os.path.isfile(pl): + return False + return getTimeStamp(pl) + +def zipLogDir(logdir=None, destdir=None, remove=_marker): + """Zip all log files + + This function also zips subdirectories. + """ + if logdir is None: + logdir = getMoulDir('log') + if destdir is None: + destdir = getMoulDir('userdata') + if remove is _marker: + remove = getConfigOption('moul', 'removelogs', default=False) + + stored_dirs = [] + + for root, dirs, files in os.walk(logdir): + stamp = isLogDir(root) + if not stamp: + continue + name = os.path.basename(root) + zipname = "%s_%s.zip" % (name, stamp) + zipfd = zipfile.ZipFile(os.path.join(destdir, zipname), + 'w', zipfile.ZIP_DEFLATED) + for file in files: + if file.lower().startswith('chat.'): + # omit chatlogs from the logs + continue + fname = os.path.join(root, file) + arcname = os.path.join(name, file) + zipfd.write(fname, arcname) + #zipfd.printdir() + zipfd.close() + stored_dirs.append((root, zipname)) + + if remove: + removeLogs(logdir) + + return stored_dirs + +def removeLogs(logdir=None): + """Removes log directories + + The removeLogs function removes only files considered as safe + """ + if logdir is None: + logdir = getMoulDir('log') + + for root, dirs, files in os.walk(logdir, topdown=False): + for name in files: + if RE_SAFEXT.search(name): + os.remove(os.path.join(root, name)) + else: + print name # XXX + for name in dirs: + os.rmdir(os.path.join(root, name)) + + os.rmdir(logdir) Property changes on: pymoul/trunk/src/moul/file/plasmalog.py ___________________________________________________________________ Name: svn:keywords + Id Revision Property changes on: pymoul/trunk/src/moul/file/tests/__init__.py ___________________________________________________________________ Name: svn:keywords + Id Revision Name: svn:eol-style + native Modified: pymoul/trunk/src/moul/file/wdysini.py =================================================================== --- pymoul/trunk/src/moul/file/wdysini.py 2007-01-16 12:40:27 UTC (rev 34) +++ pymoul/trunk/src/moul/file/wdysini.py 2007-01-16 13:09:30 UTC (rev 35) @@ -17,6 +17,10 @@ # """Configuration file parser """ +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + from moul.crypt.whatdoyousee import decryptWDYS from moul.crypt.whatdoyousee import encryptWDYS Property changes on: pymoul/trunk/src/moul/file/wdysini.py ___________________________________________________________________ Name: svn:keywords + Id Revision Modified: pymoul/trunk/src/moul/i18n.py =================================================================== --- pymoul/trunk/src/moul/i18n.py 2007-01-16 12:40:27 UTC (rev 34) +++ pymoul/trunk/src/moul/i18n.py 2007-01-16 13:09:30 UTC (rev 35) @@ -50,6 +50,10 @@ ... TypeError: default must be a unicode string """ +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + from string import Template __all__ = ['_', 'PymoulMessageFactory', 'MessageFactory'] Property changes on: pymoul/trunk/src/moul/i18n.py ___________________________________________________________________ Name: svn:keywords + Id Revision Name: svn:eol-style + native Modified: pymoul/trunk/src/moul/log.py =================================================================== --- pymoul/trunk/src/moul/log.py 2007-01-16 12:40:27 UTC (rev 34) +++ pymoul/trunk/src/moul/log.py 2007-01-16 13:09:30 UTC (rev 35) @@ -17,6 +17,10 @@ # """pyMoul logger """ +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + import logging logging.basicConfig(level=logging.DEBUG, Property changes on: pymoul/trunk/src/moul/log.py ___________________________________________________________________ Name: svn:keywords + Id Revision Property changes on: pymoul/trunk/src/moul/metadata.py ___________________________________________________________________ Name: svn:keywords + Id Revision Property changes on: pymoul/trunk/src/moul/qt/__init__.py ___________________________________________________________________ Name: svn:keywords + Id Revision Modified: pymoul/trunk/src/moul/qt/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/mainwindow.py 2007-01-16 12:40:27 UTC (rev 34) +++ pymoul/trunk/src/moul/qt/mainwindow.py 2007-01-16 13:09:30 UTC (rev 35) @@ -1,3 +1,26 @@ +# 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 +# +"""Moul QT GUI main windows +""" +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + import sys from PyQt4 import QtGui Property changes on: pymoul/trunk/src/moul/qt/mainwindow.py ___________________________________________________________________ Name: svn:keywords + Id Revision Modified: pymoul/trunk/src/moul/qt/moulqt.py =================================================================== --- pymoul/trunk/src/moul/qt/moulqt.py 2007-01-16 12:40:27 UTC (rev 34) +++ pymoul/trunk/src/moul/qt/moulqt.py 2007-01-16 13:09:30 UTC (rev 35) @@ -18,6 +18,10 @@ # """Moul QT GUI main module """ +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + import sys from PyQt4 import QtGui Property changes on: pymoul/trunk/src/moul/qt/moulqt.py ___________________________________________________________________ Name: svn:keywords + Id Revision Property changes on: pymoul/trunk/src/moul/qt/tests/__init__.py ___________________________________________________________________ Name: svn:keywords + Id Revision Name: svn:eol-style + native Property changes on: pymoul/trunk/src/moul/qt/ui/__init__.py ___________________________________________________________________ Name: svn:keywords + Id Revision Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-01-16 12:40:27 UTC (rev 34) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-01-16 13:09:30 UTC (rev 35) @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'src\moul\qt\ui\mainwindow.ui' # -# Created: Tue Jan 16 12:47:17 2007 +# Created: Tue Jan 16 13:40:50 2007 # by: PyQt4 UI code generator 4.1.1 # # WARNING! All changes made in this file will be lost! Property changes on: pymoul/trunk/src/moul/qt/ui/mainwindow.py ___________________________________________________________________ Name: svn:keywords + Id Revision Property changes on: pymoul/trunk/src/moul/qt/ui/moulqt_rc.py ___________________________________________________________________ Name: svn:keywords + Id Revision Property changes on: pymoul/trunk/src/moul/tests/__init__.py ___________________________________________________________________ Name: svn:keywords + Id Revision Name: svn:eol-style + native Modified: pymoul/trunk/src/moul/tests/test_i18n.py =================================================================== --- pymoul/trunk/src/moul/tests/test_i18n.py 2007-01-16 12:40:27 UTC (rev 34) +++ pymoul/trunk/src/moul/tests/test_i18n.py 2007-01-16 13:09:30 UTC (rev 35) @@ -15,6 +15,11 @@ # with this program; if not, write to the Free Software Foundation, Inc., 59 # Temple Place, Suite 330, Boston, MA 02111-1307 USA # +"""moul.i18n unit tests +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + import unittest from doctest import DocTestSuite Property changes on: pymoul/trunk/src/moul/tests/test_i18n.py ___________________________________________________________________ Name: svn:keywords + Id Revision Name: svn:eol-style + native Property changes on: pymoul/trunk/src/moul/time/__init__.py ___________________________________________________________________ Name: svn:keywords + Id Revision Modified: pymoul/trunk/src/moul/time/cavern.py =================================================================== --- pymoul/trunk/src/moul/time/cavern.py 2007-01-16 12:40:27 UTC (rev 34) +++ pymoul/trunk/src/moul/time/cavern.py 2007-01-16 13:09:30 UTC (rev 35) @@ -17,6 +17,10 @@ # """pyMoul cavern time tool """ +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + __all__ = ['TIMEZONE_NAMES', 'CavernTime'] from datetime import datetime Property changes on: pymoul/trunk/src/moul/time/cavern.py ___________________________________________________________________ Name: svn:keywords + Id Revision Modified: pymoul/trunk/src/moul/time/dni.py =================================================================== --- pymoul/trunk/src/moul/time/dni.py 2007-01-16 12:40:27 UTC (rev 34) +++ pymoul/trunk/src/moul/time/dni.py 2007-01-16 13:09:30 UTC (rev 35) @@ -17,6 +17,10 @@ # """pyMoul D'ni time tool """ +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + from operator import mul FARAH_1 = -7656 # hahrtee fahrah 1 starts at April 21st 7656 B.C Property changes on: pymoul/trunk/src/moul/time/dni.py ___________________________________________________________________ Name: svn:keywords + Id Revision Modified: pymoul/trunk/src/moul/time/tests/__init__.py =================================================================== --- pymoul/trunk/src/moul/time/tests/__init__.py 2007-01-16 12:40:27 UTC (rev 34) +++ pymoul/trunk/src/moul/time/tests/__init__.py 2007-01-16 13:09:30 UTC (rev 35) @@ -1,2 +1,2 @@ -# testing package - +# testing package + Property changes on: pymoul/trunk/src/moul/time/tests/__init__.py ___________________________________________________________________ Name: svn:keywords + Id Revision Name: svn:eol-style + native Modified: pymoul/trunk/src/moul/time/tests/test_cavern.py =================================================================== --- pymoul/trunk/src/moul/time/tests/test_cavern.py 2007-01-16 12:40:27 UTC (rev 34) +++ pymoul/trunk/src/moul/time/tests/test_cavern.py 2007-01-16 13:09:30 UTC (rev 35) @@ -17,6 +17,10 @@ # """moul.time.cavern unit tests """ +__author__ = "Christian Heimes" +__version__ = "$Id$" +__revision__ = "$Revision$" + import os import unittest from doctest import DocTestSuite Property changes on: pymoul/trunk/src/moul/time/tests/test_cavern.py ___________________________________________________________________ Name: svn:keywords + Id Revision Property changes on: pymoul/trunk/test.py ___________________________________________________________________ Name: svn:keywords + Id Revision Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-16 12:40:27
|
Revision: 34 http://pymoul.svn.sourceforge.net/pymoul/?rev=34&view=rev Author: tiran Date: 2007-01-16 04:40:27 -0800 (Tue, 16 Jan 2007) Log Message: ----------- * Time zone tab with time zone chooser partly working Modified Paths: -------------- pymoul/trunk/src/moul/qt/mainwindow.py pymoul/trunk/src/moul/qt/ui/mainwindow.py pymoul/trunk/src/moul/qt/ui/mainwindow.ui pymoul/trunk/src/moul/time/cavern.py Modified: pymoul/trunk/src/moul/qt/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/mainwindow.py 2007-01-16 11:16:50 UTC (rev 33) +++ pymoul/trunk/src/moul/qt/mainwindow.py 2007-01-16 12:40:27 UTC (rev 34) @@ -1,10 +1,16 @@ import sys -from PyQt4 import QtCore from PyQt4 import QtGui +from PyQt4.QtCore import QDir +from PyQt4.QtCore import QString +from PyQt4.QtCore import QStringList +from PyQt4.QtCore import pyqtSignature +from PyQt4.QtCore import SIGNAL +from PyQt4.QtCore import QFileInfo from moul.qt.ui.mainwindow import Ui_MainWindow -from moul.time import cavern as caverntime +from moul.time.cavern import CavernTime +from moul.time.cavern import TIMEZONE_NAMES class MainWindow(QtGui.QMainWindow, Ui_MainWindow): def __init__(self): @@ -12,6 +18,46 @@ # Set up the user interface from Designer. self.setupUi(self) - # timezone - self.cb_timezone_chooser.addItems(caverntime.TIMEZONE_NAMES) + self._timezone_init() + + def _timezone_init(self): + """Init time zone tab""" + tz = 'Europe/Berlin' + self._caverntime = CavernTime(tz) + + chooser = self.cb_timezone_chooser + curidx = TIMEZONE_NAMES.index(tz) + chooser.addItems(QStringList(TIMEZONE_NAMES)) + chooser.setCurrentIndex(curidx) + + self.connect(self.cb_timezone_chooser, + SIGNAL("currentIndexChanged (const QString&)"), + self.on_cb_timezone_chooser_changed) + + self._timezone_update() + + def _timezone_update(self, ct=None): + """Update datetime widgets""" + if ct is None: + ct = self._caverntime() + + self.dt_cavern.setDateTime(ct['cavern']['datetime']) + self.dt_local.setDateTime(ct['local']['datetime']) + + # TODO: handle fractions + off = ct['cavern']['utcoffset'] + txt = "UTC %s%i" % (off[0], abs(off[1])) + self.lb_cavern_utc.setText(QString(txt)) + + off = ct['local']['utcoffset'] + txt = "UTC %s%i" % (off[0], abs(off[1])) + self.lb_local_utc.setText(QString(txt)) + + def on_cb_timezone_chooser_changed(self, name): + """Change time zone event + SIGNAL: currentIndexChanged (const QString&) + """ + name = str(name) + self._caverntime.setLocalTZ(name) + self._timezone_update() Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-01-16 11:16:50 UTC (rev 33) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-01-16 12:40:27 UTC (rev 34) @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'src\moul\qt\ui\mainwindow.ui' # -# Created: Tue Jan 16 01:02:23 2007 +# Created: Tue Jan 16 12:47:17 2007 # by: PyQt4 UI code generator 4.1.1 # # WARNING! All changes made in this file will be lost! @@ -58,12 +58,6 @@ self.pushButton.setObjectName("pushButton") self.hboxlayout.addWidget(self.pushButton) - self.buttonbox_rresavcl = QtGui.QDialogButtonBox(self.centralwidget) - self.buttonbox_rresavcl.setGeometry(QtCore.QRect(10,480,441,32)) - self.buttonbox_rresavcl.setOrientation(QtCore.Qt.Horizontal) - self.buttonbox_rresavcl.setStandardButtons(QtGui.QDialogButtonBox.Close|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Reset|QtGui.QDialogButtonBox.Save) - self.buttonbox_rresavcl.setObjectName("buttonbox_rresavcl") - self.label = QtGui.QLabel(self.centralwidget) self.label.setGeometry(QtCore.QRect(15,10,430,58)) self.label.setFrameShape(QtGui.QFrame.StyledPanel) @@ -290,6 +284,14 @@ self.tab_time = QtGui.QWidget() self.tab_time.setObjectName("tab_time") + self.gb_timezone = QtGui.QGroupBox(self.tab_time) + self.gb_timezone.setGeometry(QtCore.QRect(10,10,421,81)) + self.gb_timezone.setObjectName("gb_timezone") + + self.cb_timezone_chooser = QtGui.QComboBox(self.gb_timezone) + self.cb_timezone_chooser.setGeometry(QtCore.QRect(10,30,271,21)) + self.cb_timezone_chooser.setObjectName("cb_timezone_chooser") + self.gb_caverntime = QtGui.QGroupBox(self.tab_time) self.gb_caverntime.setGeometry(QtCore.QRect(10,100,421,121)) self.gb_caverntime.setObjectName("gb_caverntime") @@ -309,12 +311,13 @@ self.dt_cavern = QtGui.QDateTimeEdit(self.horizontalLayout_2) self.dt_cavern.setReadOnly(True) + self.dt_cavern.setButtonSymbols(QtGui.QAbstractSpinBox.UpDownArrows) self.dt_cavern.setObjectName("dt_cavern") self.hboxlayout5.addWidget(self.dt_cavern) - self.label_3 = QtGui.QLabel(self.horizontalLayout_2) - self.label_3.setObjectName("label_3") - self.hboxlayout5.addWidget(self.label_3) + self.lb_cavern_utc = QtGui.QLabel(self.horizontalLayout_2) + self.lb_cavern_utc.setObjectName("lb_cavern_utc") + self.hboxlayout5.addWidget(self.lb_cavern_utc) self.horizontalLayout_3 = QtGui.QWidget(self.gb_caverntime) self.horizontalLayout_3.setGeometry(QtCore.QRect(20,70,261,31)) @@ -334,21 +337,13 @@ self.dt_local.setObjectName("dt_local") self.hboxlayout6.addWidget(self.dt_local) - self.label_11 = QtGui.QLabel(self.horizontalLayout_3) - self.label_11.setObjectName("label_11") - self.hboxlayout6.addWidget(self.label_11) + self.lb_local_utc = QtGui.QLabel(self.horizontalLayout_3) + self.lb_local_utc.setObjectName("lb_local_utc") + self.hboxlayout6.addWidget(self.lb_local_utc) self.gb_dnitime = QtGui.QGroupBox(self.tab_time) self.gb_dnitime.setGeometry(QtCore.QRect(10,230,421,111)) self.gb_dnitime.setObjectName("gb_dnitime") - - self.gb_timezone = QtGui.QGroupBox(self.tab_time) - self.gb_timezone.setGeometry(QtCore.QRect(10,10,421,81)) - self.gb_timezone.setObjectName("gb_timezone") - - self.cb_timezone_chooser = QtGui.QComboBox(self.gb_timezone) - self.cb_timezone_chooser.setGeometry(QtCore.QRect(10,30,271,21)) - self.cb_timezone_chooser.setObjectName("cb_timezone_chooser") self.tabWidget.addTab(self.tab_time,"") self.tab_4 = QtGui.QWidget() @@ -359,6 +354,12 @@ self.label_6.setAlignment(QtCore.Qt.AlignCenter) self.label_6.setObjectName("label_6") self.tabWidget.addTab(self.tab_4,"") + + self.buttonbox_rresavcl = QtGui.QDialogButtonBox(self.centralwidget) + self.buttonbox_rresavcl.setGeometry(QtCore.QRect(10,480,441,32)) + self.buttonbox_rresavcl.setOrientation(QtCore.Qt.Horizontal) + self.buttonbox_rresavcl.setStandardButtons(QtGui.QDialogButtonBox.Close|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Reset|QtGui.QDialogButtonBox.Save) + self.buttonbox_rresavcl.setObjectName("buttonbox_rresavcl") MainWindow.setCentralWidget(self.centralwidget) self.statusbar = QtGui.QStatusBar(MainWindow) @@ -392,13 +393,13 @@ self.label_7.setText(QtGui.QApplication.translate("MainWindow", "Ultra", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_graphics), QtGui.QApplication.translate("MainWindow", "Graphis", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_audio), QtGui.QApplication.translate("MainWindow", "Audio", None, QtGui.QApplication.UnicodeUTF8)) + self.gb_timezone.setTitle(QtGui.QApplication.translate("MainWindow", "Time Zone", None, QtGui.QApplication.UnicodeUTF8)) self.gb_caverntime.setTitle(QtGui.QApplication.translate("MainWindow", "Cavern Time", None, QtGui.QApplication.UnicodeUTF8)) self.label_4.setText(QtGui.QApplication.translate("MainWindow", "Cavern time:", None, QtGui.QApplication.UnicodeUTF8)) - self.label_3.setText(QtGui.QApplication.translate("MainWindow", "UTC", None, QtGui.QApplication.UnicodeUTF8)) + self.lb_cavern_utc.setText(QtGui.QApplication.translate("MainWindow", "UTC", None, QtGui.QApplication.UnicodeUTF8)) self.label_5.setText(QtGui.QApplication.translate("MainWindow", "Local time:", None, QtGui.QApplication.UnicodeUTF8)) - self.label_11.setText(QtGui.QApplication.translate("MainWindow", "UTC", None, QtGui.QApplication.UnicodeUTF8)) + self.lb_local_utc.setText(QtGui.QApplication.translate("MainWindow", "UTC", None, QtGui.QApplication.UnicodeUTF8)) self.gb_dnitime.setTitle(QtGui.QApplication.translate("MainWindow", "D\'ni time", None, QtGui.QApplication.UnicodeUTF8)) - self.gb_timezone.setTitle(QtGui.QApplication.translate("MainWindow", "Time Zone", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_time), QtGui.QApplication.translate("MainWindow", "Time", None, QtGui.QApplication.UnicodeUTF8)) self.label_6.setText(QtGui.QApplication.translate("MainWindow", "pyMoul tools", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_4), 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-01-16 11:16:50 UTC (rev 33) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-01-16 12:40:27 UTC (rev 34) @@ -78,22 +78,6 @@ </item> </layout> </widget> - <widget class="QDialogButtonBox" name="buttonbox_rresavcl" > - <property name="geometry" > - <rect> - <x>10</x> - <y>480</y> - <width>441</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="QLabel" name="label" > <property name="geometry" > <rect> @@ -564,6 +548,29 @@ <attribute name="title" > <string>Time</string> </attribute> + <widget class="QGroupBox" name="gb_timezone" > + <property name="geometry" > + <rect> + <x>10</x> + <y>10</y> + <width>421</width> + <height>81</height> + </rect> + </property> + <property name="title" > + <string>Time Zone</string> + </property> + <widget class="QComboBox" name="cb_timezone_chooser" > + <property name="geometry" > + <rect> + <x>10</x> + <y>30</y> + <width>271</width> + <height>21</height> + </rect> + </property> + </widget> + </widget> <widget class="QGroupBox" name="gb_caverntime" > <property name="geometry" > <rect> @@ -604,10 +611,13 @@ <property name="readOnly" > <bool>true</bool> </property> + <property name="buttonSymbols" > + <enum>QAbstractSpinBox::UpDownArrows</enum> + </property> </widget> </item> <item> - <widget class="QLabel" name="label_3" > + <widget class="QLabel" name="lb_cavern_utc" > <property name="text" > <string>UTC</string> </property> @@ -646,7 +656,7 @@ </widget> </item> <item> - <widget class="QLabel" name="label_11" > + <widget class="QLabel" name="lb_local_utc" > <property name="text" > <string>UTC</string> </property> @@ -668,29 +678,6 @@ <string>D'ni time</string> </property> </widget> - <widget class="QGroupBox" name="gb_timezone" > - <property name="geometry" > - <rect> - <x>10</x> - <y>10</y> - <width>421</width> - <height>81</height> - </rect> - </property> - <property name="title" > - <string>Time Zone</string> - </property> - <widget class="QComboBox" name="cb_timezone_chooser" > - <property name="geometry" > - <rect> - <x>10</x> - <y>30</y> - <width>271</width> - <height>21</height> - </rect> - </property> - </widget> - </widget> </widget> <widget class="QWidget" name="tab_4" > <attribute name="title" > @@ -714,6 +701,22 @@ </widget> </widget> </widget> + <widget class="QDialogButtonBox" name="buttonbox_rresavcl" > + <property name="geometry" > + <rect> + <x>10</x> + <y>480</y> + <width>441</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/time/cavern.py =================================================================== --- pymoul/trunk/src/moul/time/cavern.py 2007-01-16 11:16:50 UTC (rev 33) +++ pymoul/trunk/src/moul/time/cavern.py 2007-01-16 12:40:27 UTC (rev 34) @@ -17,10 +17,9 @@ # """pyMoul cavern time tool """ -__all__ = ['TIMEZONE_NAMES',] +__all__ = ['TIMEZONE_NAMES', 'CavernTime'] from datetime import datetime -from datetime import timedelta #from pytz import common_timezones from pytz import all_timezones @@ -40,6 +39,9 @@ else: unsupported.append(tz) continue + split = tz.split('/') + if len(split) > 2: + continue prefix, postfix = tz.split('/')[:2] if prefix in SUPPORTED_TZ: supported.append(tz) @@ -57,8 +59,9 @@ CAVERN_TZ = timezone(CAVERN_TZ_NAME) def diffTD(td1, td2): - """Difference of two timedelta objects -> int + """Difference of two objects -> int + >>> from datetime import timedelta >>> type(diffTD(timedelta(0, 3600), timedelta(0, -3600))) <type 'int'> >>> diffTD(timedelta(0, 3600), timedelta(0, -3600)) @@ -82,6 +85,8 @@ def td2int(td): """timedelta to int + + >>> from datetime import timedelta >>> td2int(timedelta(0, 3600)) 3600 >>> td2int(timedelta(0, -3600)) @@ -100,41 +105,40 @@ cavern datetime -- Current time in cavern TZ as <datetime> object tz -- Cavern time zone object - utcoffset -- (hours, fraction) offset from UTC + utcoffset -- (signum, hours, fraction) offset from UTC cavern datetime -- Current time in local TZ as <datetime> object tz -- Local time zone object - utcoffset -- (hours, fraction) offset from UTC + utcoffset -- (signum, hours, fraction) offset from UTC >>> ct = CavernTime(local="Europe/Berlin") >>> result = ct() >>> 'utc' in result, 'local' in result, 'cavern' in result (True, True, True) >>> coff = result['cavern']['utcoffset'] - >>> coff == (-7, 0.0) or coff == (-8, 0.0) or coff + >>> coff == ('-', -7, 0.0) or coff == ('-', -8, 0.0) or coff True >>> loff = result['local']['utcoffset'] - >>> loff == (1, 0.0) or loff == (2, 0.0) or loff + >>> loff == ('+', 1, 0.0) or loff == ('+', 2, 0.0) or loff True + + >>> 'UTC' in CavernTime.timezones + True + >>> 'UTC' in ct.timezones + True """ - _timezones = TIMEZONE_NAMES + timezones = TIMEZONE_NAMES _cavern = CAVERN_TZ _local = None def __init__(self, local): - self.setLocal(local) + self.setLocalTZ(local) - def setLocal(self, local): + def setLocalTZ(self, local): """Set local time zone """ self._local = timezone(local) - @property - def timezones(self): - """Available time zones as strings - """ - return self._timezones - @staticmethod def _utcnow(): """Get current time in UTC @@ -155,8 +159,9 @@ for id, tz in (('cavern', self._cavern), ('local', self._local)): info = result.setdefault(id, {}) utcoffset = td2int(tz.utcoffset(now)) + signum = utcoffset > 0 and '+' or '-' info['tz'] = tz - info['utcoffset'] = int(utcoffset/3600), float((utcoffset%3600)/3600.0) + info['utcoffset'] = signum,int(utcoffset/3600), float((utcoffset%3600)/3600.0) info['datetime'] = self._normalize(tz, now) result['utc'] = {'datetime' : now} return result This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-16 11:16:49
|
Revision: 33 http://pymoul.svn.sourceforge.net/pymoul/?rev=33&view=rev Author: tiran Date: 2007-01-16 03:16:50 -0800 (Tue, 16 Jan 2007) Log Message: ----------- * Changed compileui.py. It doesn't recompile the files if the orig files are older than the source files * Ignore eric4 files Modified Paths: -------------- pymoul/trunk/compileui.py Property Changed: ---------------- pymoul/trunk/ Property changes on: pymoul/trunk ___________________________________________________________________ Name: svn:ignore - build dist + build dist *.e4? Modified: pymoul/trunk/compileui.py =================================================================== --- pymoul/trunk/compileui.py 2007-01-16 11:13:44 UTC (rev 32) +++ pymoul/trunk/compileui.py 2007-01-16 11:16:50 UTC (rev 33) @@ -3,6 +3,7 @@ """ import os import re +from stat import ST_MTIME from PyQt4 import uic @@ -16,6 +17,9 @@ QRC_COMPILER = "pyrcc4 -o %(py)s %(qrc)s" UI_MODULE = "moul.qt.ui" +def _newer(orig, py): + return os.stat(orig)[ST_MTIME] > os.stat(py)[ST_MTIME] + def previewUi(uifname): """Copied from PyQt.uic.pyuic """ @@ -46,6 +50,8 @@ py_name = ui_name.lower()[:-len(UI_EXT)]+PY_EXT ui_path = os.path.join(root, ui_name) py_path = os.path.join(root, py_name) + if not _newer(ui_path, py_path): + continue ui = open(ui_path, 'r') py = open(py_path, 'w') err = uic.compileUi(ui, py, execute) @@ -63,7 +69,6 @@ lines = [] fin = open(fname, 'r') for line in fin: - if line.startswith('import'): # faster than re match = RE_RC.match(line) @@ -82,6 +87,8 @@ kw = {} kw['qrc'] = os.path.join(root, qrc_name) kw['py'] = os.path.join(root, py_name) + if not _newer(kw['qrc'], kw['py']): + continue err = os.system(QRC_COMPILER % kw) if err != 0: raise RuntimeError("pyrcc error") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-16 11:13:44
|
Revision: 32 http://pymoul.svn.sourceforge.net/pymoul/?rev=32&view=rev Author: tiran Date: 2007-01-16 03:13:44 -0800 (Tue, 16 Jan 2007) Log Message: ----------- * Created CavernTime calculator class Modified Paths: -------------- pymoul/trunk/src/moul/time/cavern.py pymoul/trunk/src/moul/time/tests/__init__.py Added Paths: ----------- pymoul/trunk/src/moul/time/tests/test_cavern.py Modified: pymoul/trunk/src/moul/time/cavern.py =================================================================== --- pymoul/trunk/src/moul/time/cavern.py 2007-01-16 00:03:34 UTC (rev 31) +++ pymoul/trunk/src/moul/time/cavern.py 2007-01-16 11:13:44 UTC (rev 32) @@ -56,3 +56,107 @@ CAVERN_TZ_NAME = 'US/Mountain' # MDT / MST CAVERN_TZ = timezone(CAVERN_TZ_NAME) +def diffTD(td1, td2): + """Difference of two timedelta objects -> int + + >>> type(diffTD(timedelta(0, 3600), timedelta(0, -3600))) + <type 'int'> + >>> diffTD(timedelta(0, 3600), timedelta(0, -3600)) + 7200 + >>> diffTD(timedelta(0, 3600), timedelta(0, 3600)) + 0 + >>> diffTD(timedelta(0, -3600), timedelta(0, -3600)) + 0 + >>> diffTD(timedelta(0, -7200), timedelta(0, -3600)) + -3600 + >>> diffTD(timedelta(0, -3600), timedelta(0, -7200)) + 3600 + >>> diffTD(timedelta(0, 3600, 1), timedelta(0, -3600)) + Traceback (most recent call last): + ... + ValueError: Can't handle microseconds + """ + if td1.microseconds or td2.microseconds: + raise ValueError("Can't handle microseconds") + return (td1.seconds + 86400 * td1.days) - (td2.seconds + 86400 * td2.days) + +def td2int(td): + """timedelta to int + >>> td2int(timedelta(0, 3600)) + 3600 + >>> td2int(timedelta(0, -3600)) + -3600 + """ + return td.seconds + 86400 * td.days + +class CavernTime(object): + """Cavern time calculator + + Calculates the cavern time and local time based on a given local time + zone. Call a CavernTime object: + + utc + datetime -- Current time in UTC as <datetime> object + cavern + datetime -- Current time in cavern TZ as <datetime> object + tz -- Cavern time zone object + utcoffset -- (hours, fraction) offset from UTC + cavern + datetime -- Current time in local TZ as <datetime> object + tz -- Local time zone object + utcoffset -- (hours, fraction) offset from UTC + + >>> ct = CavernTime(local="Europe/Berlin") + >>> result = ct() + >>> 'utc' in result, 'local' in result, 'cavern' in result + (True, True, True) + >>> coff = result['cavern']['utcoffset'] + >>> coff == (-7, 0.0) or coff == (-8, 0.0) or coff + True + >>> loff = result['local']['utcoffset'] + >>> loff == (1, 0.0) or loff == (2, 0.0) or loff + True + """ + _timezones = TIMEZONE_NAMES + _cavern = CAVERN_TZ + _local = None + + def __init__(self, local): + self.setLocal(local) + + def setLocal(self, local): + """Set local time zone + """ + self._local = timezone(local) + + @property + def timezones(self): + """Available time zones as strings + """ + return self._timezones + + @staticmethod + def _utcnow(): + """Get current time in UTC + """ + return UTC.localize(datetime.utcnow()) + + @staticmethod + def _normalize(tz, utc_dt=None): + """Normalize a datetime object with UTC tz using another tz + """ + if utc_dt is None: + utc_dt = self._utcnow() + return tz.normalize(utc_dt.astimezone(tz)) + + def __call__(self): + now = self._utcnow() + result = {} + for id, tz in (('cavern', self._cavern), ('local', self._local)): + info = result.setdefault(id, {}) + utcoffset = td2int(tz.utcoffset(now)) + info['tz'] = tz + info['utcoffset'] = int(utcoffset/3600), float((utcoffset%3600)/3600.0) + info['datetime'] = self._normalize(tz, now) + result['utc'] = {'datetime' : now} + return result Modified: pymoul/trunk/src/moul/time/tests/__init__.py =================================================================== --- pymoul/trunk/src/moul/time/tests/__init__.py 2007-01-16 00:03:34 UTC (rev 31) +++ pymoul/trunk/src/moul/time/tests/__init__.py 2007-01-16 11:13:44 UTC (rev 32) @@ -1,2 +1,2 @@ -# testing package - +# testing package + Added: pymoul/trunk/src/moul/time/tests/test_cavern.py =================================================================== --- pymoul/trunk/src/moul/time/tests/test_cavern.py (rev 0) +++ pymoul/trunk/src/moul/time/tests/test_cavern.py 2007-01-16 11:13:44 UTC (rev 32) @@ -0,0 +1,30 @@ +# 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 +# +"""moul.time.cavern unit tests +""" +import os +import unittest +from doctest import DocTestSuite + +def test_suite(): + return unittest.TestSuite(( + DocTestSuite('moul.time.cavern'), + )) + +if __name__ == '__main__': + unittest.main(defaultTest="test_suite") Property changes on: pymoul/trunk/src/moul/time/tests/test_cavern.py ___________________________________________________________________ Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-16 00:03:34
|
Revision: 31 http://pymoul.svn.sourceforge.net/pymoul/?rev=31&view=rev Author: tiran Date: 2007-01-15 16:03:34 -0800 (Mon, 15 Jan 2007) Log Message: ----------- Some UI work to test integration of cavern time into the QT ui Modified Paths: -------------- pymoul/trunk/setup_win32.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/ui/moulqt_rc.py pymoul/trunk/src/moul/time/cavern.py Modified: pymoul/trunk/setup_win32.py =================================================================== --- pymoul/trunk/setup_win32.py 2007-01-15 19:55:56 UTC (rev 30) +++ pymoul/trunk/setup_win32.py 2007-01-16 00:03:34 UTC (rev 31) @@ -31,13 +31,19 @@ # PyTz uses some import magic def findPyTz(): - import pytz - pytz_dir = os.path.dirname(pytz.__file__) - if not os.path.isdir(pytz_dir): - raise ValueError('Install pytz with easy_install -Z pytz') - packages = find_packages(pytz_dir) - packages = ['pytz.%s.*' % pack for pack in packages] + packages = ['pytz.zoneinfo'] + for tz in ('GMT', 'UTC'): + packages.append('pytz.zoneinfo.%s' % tz) + for tz in ('America', 'Canada', 'Etc', 'Europe', 'US'): + packages.append('pytz.zoneinfo.%s.*' % tz) return packages +# import pytz +# pytz_dir = os.path.dirname(pytz.__file__) +# if not os.path.isdir(pytz_dir): +# raise ValueError('Install pytz with easy_install -Z pytz') +# packages = find_packages(pytz_dir) +# packages = ['pytz.%s.*' % pack for pack in packages] +# return packages def inEnvPath(name): result = [] @@ -79,7 +85,7 @@ pexe['optimize'] = 0 # 0,1,2 pexe['includes'] = ['sip', 'PyQt4', 'encodings', 'encodings.*'] # not required at the moment - #pexe['includes'].extend(findPyTz()) + pexe['includes'].extend(findPyTz()) kw['zipfile'] = 'library.zip' def updateSetupOptionsQT(kw): Modified: pymoul/trunk/src/moul/qt/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/mainwindow.py 2007-01-15 19:55:56 UTC (rev 30) +++ pymoul/trunk/src/moul/qt/mainwindow.py 2007-01-16 00:03:34 UTC (rev 31) @@ -4,9 +4,14 @@ from PyQt4 import QtGui from moul.qt.ui.mainwindow import Ui_MainWindow +from moul.time import cavern as caverntime class MainWindow(QtGui.QMainWindow, Ui_MainWindow): def __init__(self): QtGui.QMainWindow.__init__(self) # Set up the user interface from Designer. self.setupUi(self) + + # timezone + self.cb_timezone_chooser.addItems(caverntime.TIMEZONE_NAMES) + Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-01-15 19:55:56 UTC (rev 30) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-01-16 00:03:34 UTC (rev 31) @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'src\moul\qt\ui\mainwindow.ui' # -# Created: Mon Jan 15 19:26:00 2007 +# Created: Tue Jan 16 01:02:23 2007 # by: PyQt4 UI code generator 4.1.1 # # WARNING! All changes made in this file will be lost! @@ -58,6 +58,12 @@ self.pushButton.setObjectName("pushButton") self.hboxlayout.addWidget(self.pushButton) + self.buttonbox_rresavcl = QtGui.QDialogButtonBox(self.centralwidget) + self.buttonbox_rresavcl.setGeometry(QtCore.QRect(10,480,441,32)) + self.buttonbox_rresavcl.setOrientation(QtCore.Qt.Horizontal) + self.buttonbox_rresavcl.setStandardButtons(QtGui.QDialogButtonBox.Close|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Reset|QtGui.QDialogButtonBox.Save) + self.buttonbox_rresavcl.setObjectName("buttonbox_rresavcl") + self.label = QtGui.QLabel(self.centralwidget) self.label.setGeometry(QtCore.QRect(15,10,430,58)) self.label.setFrameShape(QtGui.QFrame.StyledPanel) @@ -65,12 +71,6 @@ self.label.setPixmap(QtGui.QPixmap(":/resources/moul_logo.png")) self.label.setObjectName("label") - self.buttonbox_rresavcl = QtGui.QDialogButtonBox(self.centralwidget) - self.buttonbox_rresavcl.setGeometry(QtCore.QRect(10,480,441,32)) - self.buttonbox_rresavcl.setOrientation(QtCore.Qt.Horizontal) - self.buttonbox_rresavcl.setStandardButtons(QtGui.QDialogButtonBox.Close|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Reset|QtGui.QDialogButtonBox.Save) - self.buttonbox_rresavcl.setObjectName("buttonbox_rresavcl") - self.tabWidget = QtGui.QTabWidget(self.centralwidget) self.tabWidget.setGeometry(QtCore.QRect(5,100,450,375)) self.tabWidget.setTabPosition(QtGui.QTabWidget.North) @@ -153,7 +153,7 @@ self.vboxlayout1.addLayout(self.hboxlayout1) self.verticalLayout_6 = QtGui.QWidget(self.groupBox_2) - self.verticalLayout_6.setGeometry(QtCore.QRect(220,130,179,73)) + self.verticalLayout_6.setGeometry(QtCore.QRect(230,140,179,73)) self.verticalLayout_6.setObjectName("verticalLayout_6") self.vboxlayout2 = QtGui.QVBoxLayout(self.verticalLayout_6) @@ -287,6 +287,70 @@ self.tab_audio.setObjectName("tab_audio") self.tabWidget.addTab(self.tab_audio,"") + self.tab_time = QtGui.QWidget() + self.tab_time.setObjectName("tab_time") + + self.gb_caverntime = QtGui.QGroupBox(self.tab_time) + self.gb_caverntime.setGeometry(QtCore.QRect(10,100,421,121)) + self.gb_caverntime.setObjectName("gb_caverntime") + + self.horizontalLayout_2 = QtGui.QWidget(self.gb_caverntime) + self.horizontalLayout_2.setGeometry(QtCore.QRect(20,20,261,31)) + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + + self.hboxlayout5 = QtGui.QHBoxLayout(self.horizontalLayout_2) + self.hboxlayout5.setMargin(0) + self.hboxlayout5.setSpacing(6) + self.hboxlayout5.setObjectName("hboxlayout5") + + self.label_4 = QtGui.QLabel(self.horizontalLayout_2) + self.label_4.setObjectName("label_4") + self.hboxlayout5.addWidget(self.label_4) + + self.dt_cavern = QtGui.QDateTimeEdit(self.horizontalLayout_2) + self.dt_cavern.setReadOnly(True) + self.dt_cavern.setObjectName("dt_cavern") + self.hboxlayout5.addWidget(self.dt_cavern) + + self.label_3 = QtGui.QLabel(self.horizontalLayout_2) + self.label_3.setObjectName("label_3") + self.hboxlayout5.addWidget(self.label_3) + + self.horizontalLayout_3 = QtGui.QWidget(self.gb_caverntime) + self.horizontalLayout_3.setGeometry(QtCore.QRect(20,70,261,31)) + self.horizontalLayout_3.setObjectName("horizontalLayout_3") + + self.hboxlayout6 = QtGui.QHBoxLayout(self.horizontalLayout_3) + self.hboxlayout6.setMargin(0) + self.hboxlayout6.setSpacing(6) + self.hboxlayout6.setObjectName("hboxlayout6") + + self.label_5 = QtGui.QLabel(self.horizontalLayout_3) + self.label_5.setObjectName("label_5") + self.hboxlayout6.addWidget(self.label_5) + + self.dt_local = QtGui.QDateTimeEdit(self.horizontalLayout_3) + self.dt_local.setReadOnly(True) + self.dt_local.setObjectName("dt_local") + self.hboxlayout6.addWidget(self.dt_local) + + self.label_11 = QtGui.QLabel(self.horizontalLayout_3) + self.label_11.setObjectName("label_11") + self.hboxlayout6.addWidget(self.label_11) + + self.gb_dnitime = QtGui.QGroupBox(self.tab_time) + self.gb_dnitime.setGeometry(QtCore.QRect(10,230,421,111)) + self.gb_dnitime.setObjectName("gb_dnitime") + + self.gb_timezone = QtGui.QGroupBox(self.tab_time) + self.gb_timezone.setGeometry(QtCore.QRect(10,10,421,81)) + self.gb_timezone.setObjectName("gb_timezone") + + self.cb_timezone_chooser = QtGui.QComboBox(self.gb_timezone) + self.cb_timezone_chooser.setGeometry(QtCore.QRect(10,30,271,21)) + self.cb_timezone_chooser.setObjectName("cb_timezone_chooser") + self.tabWidget.addTab(self.tab_time,"") + self.tab_4 = QtGui.QWidget() self.tab_4.setObjectName("tab_4") @@ -302,7 +366,7 @@ MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) - self.tabWidget.setCurrentIndex(0) + self.tabWidget.setCurrentIndex(2) QtCore.QObject.connect(self.buttonbox_rresavcl,QtCore.SIGNAL("rejected()"),MainWindow.close) QtCore.QMetaObject.connectSlotsByName(MainWindow) @@ -328,6 +392,14 @@ self.label_7.setText(QtGui.QApplication.translate("MainWindow", "Ultra", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_graphics), QtGui.QApplication.translate("MainWindow", "Graphis", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_audio), QtGui.QApplication.translate("MainWindow", "Audio", None, QtGui.QApplication.UnicodeUTF8)) + self.gb_caverntime.setTitle(QtGui.QApplication.translate("MainWindow", "Cavern Time", None, QtGui.QApplication.UnicodeUTF8)) + self.label_4.setText(QtGui.QApplication.translate("MainWindow", "Cavern time:", None, QtGui.QApplication.UnicodeUTF8)) + self.label_3.setText(QtGui.QApplication.translate("MainWindow", "UTC", None, QtGui.QApplication.UnicodeUTF8)) + self.label_5.setText(QtGui.QApplication.translate("MainWindow", "Local time:", None, QtGui.QApplication.UnicodeUTF8)) + self.label_11.setText(QtGui.QApplication.translate("MainWindow", "UTC", None, QtGui.QApplication.UnicodeUTF8)) + self.gb_dnitime.setTitle(QtGui.QApplication.translate("MainWindow", "D\'ni time", None, QtGui.QApplication.UnicodeUTF8)) + self.gb_timezone.setTitle(QtGui.QApplication.translate("MainWindow", "Time Zone", None, QtGui.QApplication.UnicodeUTF8)) + self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_time), QtGui.QApplication.translate("MainWindow", "Time", None, QtGui.QApplication.UnicodeUTF8)) self.label_6.setText(QtGui.QApplication.translate("MainWindow", "pyMoul tools", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_4), 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-01-15 19:55:56 UTC (rev 30) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-01-16 00:03:34 UTC (rev 31) @@ -78,6 +78,22 @@ </item> </layout> </widget> + <widget class="QDialogButtonBox" name="buttonbox_rresavcl" > + <property name="geometry" > + <rect> + <x>10</x> + <y>480</y> + <width>441</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="QLabel" name="label" > <property name="geometry" > <rect> @@ -100,22 +116,6 @@ <pixmap resource="moulqt.qrc" >:/resources/moul_logo.png</pixmap> </property> </widget> - <widget class="QDialogButtonBox" name="buttonbox_rresavcl" > - <property name="geometry" > - <rect> - <x>10</x> - <y>480</y> - <width>441</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> @@ -129,7 +129,7 @@ <enum>QTabWidget::North</enum> </property> <property name="currentIndex" > - <number>0</number> + <number>2</number> </property> <widget class="QWidget" name="tab_graphics" > <attribute name="title" > @@ -296,8 +296,8 @@ <widget class="QWidget" name="verticalLayout_6" > <property name="geometry" > <rect> - <x>220</x> - <y>130</y> + <x>230</x> + <y>140</y> <width>179</width> <height>73</height> </rect> @@ -560,6 +560,138 @@ <string>Audio</string> </attribute> </widget> + <widget class="QWidget" name="tab_time" > + <attribute name="title" > + <string>Time</string> + </attribute> + <widget class="QGroupBox" name="gb_caverntime" > + <property name="geometry" > + <rect> + <x>10</x> + <y>100</y> + <width>421</width> + <height>121</height> + </rect> + </property> + <property name="title" > + <string>Cavern Time</string> + </property> + <widget class="QWidget" name="horizontalLayout_2" > + <property name="geometry" > + <rect> + <x>20</x> + <y>20</y> + <width>261</width> + <height>31</height> + </rect> + </property> + <layout class="QHBoxLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QLabel" name="label_4" > + <property name="text" > + <string>Cavern time:</string> + </property> + </widget> + </item> + <item> + <widget class="QDateTimeEdit" name="dt_cavern" > + <property name="readOnly" > + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_3" > + <property name="text" > + <string>UTC</string> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="horizontalLayout_3" > + <property name="geometry" > + <rect> + <x>20</x> + <y>70</y> + <width>261</width> + <height>31</height> + </rect> + </property> + <layout class="QHBoxLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QLabel" name="label_5" > + <property name="text" > + <string>Local time:</string> + </property> + </widget> + </item> + <item> + <widget class="QDateTimeEdit" name="dt_local" > + <property name="readOnly" > + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_11" > + <property name="text" > + <string>UTC</string> + </property> + </widget> + </item> + </layout> + </widget> + </widget> + <widget class="QGroupBox" name="gb_dnitime" > + <property name="geometry" > + <rect> + <x>10</x> + <y>230</y> + <width>421</width> + <height>111</height> + </rect> + </property> + <property name="title" > + <string>D'ni time</string> + </property> + </widget> + <widget class="QGroupBox" name="gb_timezone" > + <property name="geometry" > + <rect> + <x>10</x> + <y>10</y> + <width>421</width> + <height>81</height> + </rect> + </property> + <property name="title" > + <string>Time Zone</string> + </property> + <widget class="QComboBox" name="cb_timezone_chooser" > + <property name="geometry" > + <rect> + <x>10</x> + <y>30</y> + <width>271</width> + <height>21</height> + </rect> + </property> + </widget> + </widget> + </widget> <widget class="QWidget" name="tab_4" > <attribute name="title" > <string>About</string> Modified: pymoul/trunk/src/moul/qt/ui/moulqt_rc.py =================================================================== --- pymoul/trunk/src/moul/qt/ui/moulqt_rc.py 2007-01-15 19:55:56 UTC (rev 30) +++ pymoul/trunk/src/moul/qt/ui/moulqt_rc.py 2007-01-16 00:03:34 UTC (rev 31) @@ -2,7 +2,7 @@ # Resource object code # -# Created: Mo 15. Jan 19:26:00 2007 +# Created: Di 16. Jan 01:02:23 2007 # by: The Resource Compiler for PyQt (Qt v4.2.2) # # WARNING! All changes made in this file will be lost! Modified: pymoul/trunk/src/moul/time/cavern.py =================================================================== --- pymoul/trunk/src/moul/time/cavern.py 2007-01-15 19:55:56 UTC (rev 30) +++ pymoul/trunk/src/moul/time/cavern.py 2007-01-16 00:03:34 UTC (rev 31) @@ -22,12 +22,35 @@ from datetime import datetime from datetime import timedelta -from pytz import common_timezones +#from pytz import common_timezones +from pytz import all_timezones from pytz import timezone from pytz import utc as UTC -TIMEZONE_NAMES = common_timezones +SUPPORTED_TZ = ('America', 'Canada', 'Etc', 'Europe', 'US') +ADDITIONAL_TZ = ('GMT', 'UTC') +def _listSupported(tz_list): + supported = [] + unsupported = [] + for tz in tz_list: + if tz.find('/') == -1: + if tz in ADDITIONAL_TZ: + supported.append(tz) + else: + unsupported.append(tz) + continue + prefix, postfix = tz.split('/')[:2] + if prefix in SUPPORTED_TZ: + supported.append(tz) + else: + unsupported.append(tz) + supported.sort() + unsupported.sort() + return supported, unsupported + +TIMEZONE_NAMES, UNSUPPORTED = _listSupported(all_timezones) + # Cyan HQ is near Spokane / Washington # Cavern time is Mountain Time Zone (MDT) with daylight savings (MST) CAVERN_TZ_NAME = 'US/Mountain' # MDT / MST This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-15 19:55:56
|
Revision: 30 http://pymoul.svn.sourceforge.net/pymoul/?rev=30&view=rev Author: tiran Date: 2007-01-15 11:55:56 -0800 (Mon, 15 Jan 2007) Log Message: ----------- * Added WDYS test * setup handler for PyTz * misc Modified Paths: -------------- pymoul/trunk/setup_win32.py pymoul/trunk/src/moul/file/plasmalog.py pymoul/trunk/src/moul/qt/moulqt.py Added Paths: ----------- pymoul/trunk/src/moul/crypt/tests/test_wdys.py Modified: pymoul/trunk/setup_win32.py =================================================================== --- pymoul/trunk/setup_win32.py 2007-01-15 19:05:55 UTC (rev 29) +++ pymoul/trunk/setup_win32.py 2007-01-15 19:55:56 UTC (rev 30) @@ -29,6 +29,16 @@ # no build path setup, no worries. pass +# PyTz uses some import magic +def findPyTz(): + import pytz + pytz_dir = os.path.dirname(pytz.__file__) + if not os.path.isdir(pytz_dir): + raise ValueError('Install pytz with easy_install -Z pytz') + packages = find_packages(pytz_dir) + packages = ['pytz.%s.*' % pack for pack in packages] + return packages + def inEnvPath(name): result = [] for path in os.environ['PATH'].split(';'): @@ -67,7 +77,9 @@ pexe = kw['options'].setdefault('py2exe', {}) pexe['compressed'] = 100 # compress zip file pexe['optimize'] = 0 # 0,1,2 - #pexe['includes'] = 'encodings,encodings.*' + pexe['includes'] = ['sip', 'PyQt4', 'encodings', 'encodings.*'] + # not required at the moment + #pexe['includes'].extend(findPyTz()) kw['zipfile'] = 'library.zip' def updateSetupOptionsQT(kw): Added: pymoul/trunk/src/moul/crypt/tests/test_wdys.py =================================================================== --- pymoul/trunk/src/moul/crypt/tests/test_wdys.py (rev 0) +++ pymoul/trunk/src/moul/crypt/tests/test_wdys.py 2007-01-15 19:55:56 UTC (rev 30) @@ -0,0 +1,66 @@ +# 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 +# +"""moul.crypt.whatdoyousee unit tests +""" +import os +import unittest +from doctest import DocTestSuite + +import moul.file +from moul.crypt.whatdoyousee import decryptWDYS +from moul.crypt.whatdoyousee import encryptWDYS + +base = os.path.join(os.path.dirname(moul.file.__file__), 'tests') +gra_enc = os.path.join(base, 'graphics.ini') +gra_dec = os.path.join(base, 'graphics.txt') +aud_enc = os.path.join(base, 'audio.ini') +aud_dec = os.path.join(base, 'audio.txt') + + +class WDYSTest(unittest.TestCase): + def setUp(self): + self.gra_enc = open(aud_enc, 'rb') + self.gra_dec = open(aud_dec, 'r') + self.aud_enc = open(aud_enc, 'rb') + self.aud_dec = open(aud_dec, 'r') + + def tearDown(self): + self.gra_enc.close() + self.gra_dec.close() + self.aud_enc.close() + self.aud_dec.close() + + def _compareEnc(self, enc, dec): + data = decryptWDYS(enc) + self.failUnlessEqual(data, dec.read()) + + def test_audioini(self): + self._compareEnc(self.aud_enc, self.aud_dec) + + def test_graphicsini(self): + self._compareEnc(self.gra_enc, self.gra_dec) + +def test_suite(): + return unittest.TestSuite(( + unittest.makeSuite(WDYSTest), + )) + +if __name__ == '__main__': + unittest.main(defaultTest="test_suite") + + Property changes on: pymoul/trunk/src/moul/crypt/tests/test_wdys.py ___________________________________________________________________ Name: svn:eol-style + native Modified: pymoul/trunk/src/moul/file/plasmalog.py =================================================================== --- pymoul/trunk/src/moul/file/plasmalog.py 2007-01-15 19:05:55 UTC (rev 29) +++ pymoul/trunk/src/moul/file/plasmalog.py 2007-01-15 19:55:56 UTC (rev 30) @@ -25,6 +25,7 @@ from moul.config import getMoulDir from moul.config import getConfigOption +from moul.crypt.elf import decryptElf PLASMA_LOG = "plasmalog.txt" _marker = object() Modified: pymoul/trunk/src/moul/qt/moulqt.py =================================================================== --- pymoul/trunk/src/moul/qt/moulqt.py 2007-01-15 19:05:55 UTC (rev 29) +++ pymoul/trunk/src/moul/qt/moulqt.py 2007-01-15 19:55:56 UTC (rev 30) @@ -1,11 +1,40 @@ #!/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 +# +"""Moul QT GUI main module +""" import sys -from PyQt4 import QtCore, QtGui +from PyQt4 import QtGui + from moul.qt.mainwindow import MainWindow from moul.file import plasmalog +from moul.file import wdysini +from moul.file import kiimage +from moul.time import cavern as caverntime +from moul.time import dni as dnitime -app = QtGui.QApplication(sys.argv) -mainWindow = MainWindow() -mainWindow.show() -sys.exit(app.exec_()) +def main(*args): + app = QtGui.QApplication(*args) + mainWindow = MainWindow() + mainWindow.show() + return app.exec_() + +if __name__ == '__main__': + err = main(sys.argv) + sys.exit(err) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-15 19:33:01
|
Revision: 21 http://pymoul.svn.sourceforge.net/pymoul/?rev=21&view=rev Author: tiran Date: 2007-01-15 05:15:11 -0800 (Mon, 15 Jan 2007) Log Message: ----------- pymoul.sf.net website import Added Paths: ----------- htdocs/ htdocs/trunk/ htdocs/trunk/index.html Added: htdocs/trunk/index.html =================================================================== --- htdocs/trunk/index.html (rev 0) +++ htdocs/trunk/index.html 2007-01-15 13:15:11 UTC (rev 21) @@ -0,0 +1,12 @@ +<html> +<head> + <title>pyMoul</title> +</head> +<body> +<h1>pyMoul</h1> +<p>Go to <a href="http://sourceforge.net/projects/pymoul">project page</a> +<p> +<p><a href="http://sourceforge.net"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=186624&type=1" width="88" height="31" border="0" alt="SourceForge.net Logo" /></a></p> +</body> +</html> + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-15 19:05:54
|
Revision: 29 http://pymoul.svn.sourceforge.net/pymoul/?rev=29&view=rev Author: tiran Date: 2007-01-15 11:05:55 -0800 (Mon, 15 Jan 2007) Log Message: ----------- Minor tweaks for the setup system Modified Paths: -------------- pymoul/trunk/Makefile pymoul/trunk/setup.py Property Changed: ---------------- pymoul/trunk/Makefile Modified: pymoul/trunk/Makefile =================================================================== --- pymoul/trunk/Makefile 2007-01-15 19:01:38 UTC (rev 28) +++ pymoul/trunk/Makefile 2007-01-15 19:05:55 UTC (rev 29) @@ -1,5 +1,5 @@ -PYTHON?=python2.5 -TESTFLAGS=-p -v +PYTHON?=python +TESTFLAGS=-v TESTOPTS= SETUPFLAGS= @@ -18,10 +18,13 @@ bdist_egg: $(PYTHON) setup.py $(SETUPFLAGS) bdist_egg +run: + $(PYTHON) src/moul/qt/moulqt.py + test_build: build $(PYTHON) test.py $(TESTFLAGS) $(TESTOPTS) -test_inplace: inplace +test_inplace: $(PYTHON) test.py $(TESTFLAGS) $(TESTOPTS) ftest_build: build Property changes on: pymoul/trunk/Makefile ___________________________________________________________________ Name: svn:eol-style + native Modified: pymoul/trunk/setup.py =================================================================== --- pymoul/trunk/setup.py 2007-01-15 19:01:38 UTC (rev 28) +++ pymoul/trunk/setup.py 2007-01-15 19:05:55 UTC (rev 29) @@ -12,6 +12,7 @@ use_setuptools(version=SETUPTOOLS_VERSION) from setuptools import setup from setuptools import find_packages +from compileui import compileUi VERSION = "0.0" @@ -69,6 +70,7 @@ # Write Metadata and compile UI files writeMetadata() +compileUi() kwargs = {} kwargs.update(setup_infos) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-15 19:01:47
|
Revision: 28 http://pymoul.svn.sourceforge.net/pymoul/?rev=28&view=rev Author: tiran Date: 2007-01-15 11:01:38 -0800 (Mon, 15 Jan 2007) Log Message: ----------- * Added example WDYS, ELF and KI image * Added unittests for ELF and WDYS files * Fixed implementation of WDYS and ELF crypt functions Modified Paths: -------------- pymoul/trunk/src/moul/crypt/elf.py pymoul/trunk/src/moul/crypt/whatdoyousee.py Added Paths: ----------- pymoul/trunk/src/moul/crypt/tests/test_elf.py pymoul/trunk/src/moul/file/tests/audio.ini pymoul/trunk/src/moul/file/tests/audio.txt pymoul/trunk/src/moul/file/tests/audiocaps.0.elf pymoul/trunk/src/moul/file/tests/audiocaps.0.txt pymoul/trunk/src/moul/file/tests/avatar.jpg pymoul/trunk/src/moul/file/tests/graphics.ini pymoul/trunk/src/moul/file/tests/graphics.txt Modified: pymoul/trunk/src/moul/crypt/elf.py =================================================================== --- pymoul/trunk/src/moul/crypt/elf.py 2007-01-15 19:00:16 UTC (rev 27) +++ pymoul/trunk/src/moul/crypt/elf.py 2007-01-15 19:01:38 UTC (rev 28) @@ -19,6 +19,8 @@ Based on the C++ code from Marack """ +import struct + def list2int(lst): return [ord(s) for s in lst] @@ -26,7 +28,7 @@ return [chr(s) for s in lst] def decryptElf(fin): - """Decrypts an encrypted log file (MOUL elf file) + """Decrypt an encrypted log file (MOUL elf file) fin - log file opened in binary mode result - list of unencrypted lines @@ -40,21 +42,30 @@ out = [] while True: fpos = fin.tell() - if fpos == fsize: + if fpos >= fsize: + # EOF reached, add an empty line + out.append('') break seghead = fin.read(2) # Kudos to the programmer who thought up this little trick # Very nice work (and highly confusing to reverse engineer)! - segsize = str2int(seghead) ^ (fpos & 0xffff) + segsize = struct.unpack("<H", seghead)[0] ^ (fpos & 0xffff) key = fpos & 0xff - - #print "Pos: %s, size: %s, key: %s" % (fpos, segsize, key) seg = fin.read(segsize) uncrypt = decipher(seg, segsize, key) out.append(uncrypt) return out +def encryptElf(instr, fout): + """Encrypt an encrypted log file (MOUL elf file) + + instr - input as string + fout - log file to write (binary mode) + """ + # XXX NotImplemented + raise NotImplementedError + def decipher(crypt, size, key): """decipher for ELF (encrypted log files) Added: pymoul/trunk/src/moul/crypt/tests/test_elf.py =================================================================== --- pymoul/trunk/src/moul/crypt/tests/test_elf.py (rev 0) +++ pymoul/trunk/src/moul/crypt/tests/test_elf.py 2007-01-15 19:01:38 UTC (rev 28) @@ -0,0 +1,52 @@ +# 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 +# +"""moul.crypt.elf unit tests +""" +import os +import unittest +from doctest import DocTestSuite + +import moul.file +from moul.crypt.elf import decryptElf + +base = os.path.dirname(moul.file.__file__) +elf_enc = os.path.join(base, 'tests', 'audiocaps.0.elf') +elf_dec = os.path.join(base, 'tests', 'audiocaps.0.txt') + +class ElfTest(unittest.TestCase): + def setUp(self): + self.enc = open(elf_enc, 'rb') + self.dec = open(elf_dec, 'r') + + def tearDown(self): + self.enc.close() + self.dec.close() + + def test_compare(self): + data = '\n'.join(decryptElf(self.enc)) + self.failUnlessEqual(data, self.dec.read()) + +def test_suite(): + return unittest.TestSuite(( + unittest.makeSuite(ElfTest), + )) + +if __name__ == '__main__': + unittest.main(defaultTest="test_suite") + + Modified: pymoul/trunk/src/moul/crypt/whatdoyousee.py =================================================================== --- pymoul/trunk/src/moul/crypt/whatdoyousee.py 2007-01-15 19:00:16 UTC (rev 27) +++ pymoul/trunk/src/moul/crypt/whatdoyousee.py 2007-01-15 19:01:38 UTC (rev 28) @@ -46,7 +46,7 @@ raise IOError("Not a whatdoyousee/xTEA encrypted file") header = fin.read(4) - struct.unpack(ENDIAN+"L", header) + length = struct.unpack(ENDIAN+"L", header)[0] out = [] pos = 0 @@ -59,7 +59,9 @@ else: out.append(block) pos += 8 - return ''.join(out) + data = ''.join(out) + # XXX: dos format + return data.replace("\r\n", "\n") def encryptWDYS(instr, fout): """Encrypt whatdoyousee files @@ -68,6 +70,8 @@ fout - out file descriptor in write and binary mode return - None """ + # XXX: dos format + instr = instr.replace("\n", "\r\n") fin.seek(0) fout.write(HEADER) Added: pymoul/trunk/src/moul/file/tests/audio.ini =================================================================== (Binary files differ) Property changes on: pymoul/trunk/src/moul/file/tests/audio.ini ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: pymoul/trunk/src/moul/file/tests/audio.txt =================================================================== --- pymoul/trunk/src/moul/file/tests/audio.txt (rev 0) +++ pymoul/trunk/src/moul/file/tests/audio.txt 2007-01-15 19:01:38 UTC (rev 28) @@ -0,0 +1,11 @@ +Audio.Initialize true +Audio.UseEAX true +Audio.SetPriorityCutoff 6 +Audio.MuteAll 0 +Audio.SetChannelVolume SoundFX 1 +Audio.SetChannelVolume BgndMusic 1 +Audio.SetChannelVolume Ambience 1 +Audio.SetChannelVolume NPCVoice 1 +Audio.EnableVoiceRecording 1 +Audio.SetDeviceName "Generic Hardware" +Audio.SetChannelVolume GUI 1 Property changes on: pymoul/trunk/src/moul/file/tests/audio.txt ___________________________________________________________________ Name: svn:eol-style + native Added: pymoul/trunk/src/moul/file/tests/audiocaps.0.elf =================================================================== (Binary files differ) Property changes on: pymoul/trunk/src/moul/file/tests/audiocaps.0.elf ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: pymoul/trunk/src/moul/file/tests/audiocaps.0.txt =================================================================== --- pymoul/trunk/src/moul/file/tests/audiocaps.0.txt (rev 0) +++ pymoul/trunk/src/moul/file/tests/audiocaps.0.txt 2007-01-15 19:01:38 UTC (rev 28) @@ -0,0 +1,6 @@ +SB Audigy 2 ZS Audio [C800] +Bluetooth Audio +Default DirectSound Device +Default WaveOut Device +DirectSound: Bluetooth Audio +DirectSound: SB Audigy 2 ZS Audio [C800] Property changes on: pymoul/trunk/src/moul/file/tests/audiocaps.0.txt ___________________________________________________________________ Name: svn:eol-style + native Added: pymoul/trunk/src/moul/file/tests/avatar.jpg =================================================================== (Binary files differ) Property changes on: pymoul/trunk/src/moul/file/tests/avatar.jpg ___________________________________________________________________ Name: svn:mime-type + image/jpeg Added: pymoul/trunk/src/moul/file/tests/graphics.ini =================================================================== (Binary files differ) Property changes on: pymoul/trunk/src/moul/file/tests/graphics.ini ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: pymoul/trunk/src/moul/file/tests/graphics.txt =================================================================== --- pymoul/trunk/src/moul/file/tests/graphics.txt (rev 0) +++ pymoul/trunk/src/moul/file/tests/graphics.txt 2007-01-15 19:01:38 UTC (rev 28) @@ -0,0 +1,12 @@ +Graphics.Width 1024 +Graphics.Height 768 +Graphics.ColorDepth 32 +Graphics.Windowed true +Graphics.AntiAliasAmount 2 +Graphics.AnisotropicLevel 2 +Graphics.TextureQuality 2 +Quality.Level 2 +Graphics.Shadow.Enable 1 +Graphics.EnablePlanarReflections 1 +Graphics.EnableVSync false +Graphics.Shadow.VisibleDistance 0.337126016617 Property changes on: pymoul/trunk/src/moul/file/tests/graphics.txt ___________________________________________________________________ Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-15 17:50:07
|
Revision: 26 http://pymoul.svn.sourceforge.net/pymoul/?rev=26&view=rev Author: tiran Date: 2007-01-15 09:28:51 -0800 (Mon, 15 Jan 2007) Log Message: ----------- Added dummy i18n message and message factory inspired by Zope3 Added unit test packages and first doc test Modified Paths: -------------- pymoul/trunk/src/moul/config/generic.py pymoul/trunk/src/moul/crypt/elf.py pymoul/trunk/src/moul/crypt/whatdoyousee.py pymoul/trunk/src/moul/log.py pymoul/trunk/src/moul/time/dni.py Added Paths: ----------- pymoul/trunk/src/moul/cli/tests/ pymoul/trunk/src/moul/cli/tests/__init__.py pymoul/trunk/src/moul/config/tests/ pymoul/trunk/src/moul/config/tests/__init__.py pymoul/trunk/src/moul/crypt/tests/ pymoul/trunk/src/moul/crypt/tests/__init__.py pymoul/trunk/src/moul/file/tests/ pymoul/trunk/src/moul/file/tests/__init__.py pymoul/trunk/src/moul/i18n.py pymoul/trunk/src/moul/qt/tests/ pymoul/trunk/src/moul/qt/tests/__init__.py pymoul/trunk/src/moul/tests/__init__.py pymoul/trunk/src/moul/tests/test_i18n.py pymoul/trunk/src/moul/time/tests/ pymoul/trunk/src/moul/time/tests/__init__.py Removed Paths: ------------- pymoul/trunk/src/moul/crypt/bitops.py Property Changed: ---------------- pymoul/trunk/test.py Added: pymoul/trunk/src/moul/cli/tests/__init__.py =================================================================== --- pymoul/trunk/src/moul/cli/tests/__init__.py (rev 0) +++ pymoul/trunk/src/moul/cli/tests/__init__.py 2007-01-15 17:28:51 UTC (rev 26) @@ -0,0 +1,2 @@ +# testing package + Modified: pymoul/trunk/src/moul/config/generic.py =================================================================== --- pymoul/trunk/src/moul/config/generic.py 2007-01-15 16:08:38 UTC (rev 25) +++ pymoul/trunk/src/moul/config/generic.py 2007-01-15 17:28:51 UTC (rev 26) @@ -17,20 +17,6 @@ # """cross platform configuration tools for pyMoul """ -from ConfigParser import SafeConfigParser - -class PyMoulConfig(object): - _default = { - 'pyMoul': { - 'moul_install_dir' : 'C:\\Program Files\\Myst Online', - } - } - - def __init__(self, fname): - self._parser = SafeConfigParser() - self._fname = fname - self._data = {} - # Stub for platform specific functions def getMoulUserDataDir(): """Get path of MOUL user data directory Added: pymoul/trunk/src/moul/config/tests/__init__.py =================================================================== --- pymoul/trunk/src/moul/config/tests/__init__.py (rev 0) +++ pymoul/trunk/src/moul/config/tests/__init__.py 2007-01-15 17:28:51 UTC (rev 26) @@ -0,0 +1,2 @@ +# testing package + Deleted: pymoul/trunk/src/moul/crypt/bitops.py =================================================================== --- pymoul/trunk/src/moul/crypt/bitops.py 2007-01-15 16:08:38 UTC (rev 25) +++ pymoul/trunk/src/moul/crypt/bitops.py 2007-01-15 17:28:51 UTC (rev 26) @@ -1,49 +0,0 @@ -# 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 -# -"""Misc bit operation helpers -""" -# str2int, lshift, rshift, list2int, list2str - -def str2int(s): - """converts a string to an integer""" - out = 0 - for i, e in enumerate(s): - out += ord(e) << 8*i - return out - -def int2str(i): - """ """ - out = [] - for j in (0,1,2,3): - s = rshift(i, 8*j) - out.append(chr(s)) - return ''.join(out) - -def lshift(a, b, mask=0xff): - """8 bit integer <<""" - return (a << b) & mask - -def rshift(a, b, mask=0xff): - """8 bit integer >>""" - return (a >> b) & mask - -def list2int(lst): - return [ord(s) for s in lst] - -def list2str(lst): - return [chr(s) for s in lst] Modified: pymoul/trunk/src/moul/crypt/elf.py =================================================================== --- pymoul/trunk/src/moul/crypt/elf.py 2007-01-15 16:08:38 UTC (rev 25) +++ pymoul/trunk/src/moul/crypt/elf.py 2007-01-15 17:28:51 UTC (rev 26) @@ -19,8 +19,12 @@ Based on the C++ code from Marack """ -from mounl.crypt.bitops import str2int, lshift, rshift, list2int, list2str +def list2int(lst): + return [ord(s) for s in lst] +def list2str(lst): + return [chr(s) for s in lst] + def decryptElf(fin): """Decrypts an encrypted log file (MOUL elf file) @@ -65,20 +69,20 @@ b = key d = v[0] d = d ^ b - d = rshift(d, 5) # d >> 5 + d = (d >> 5) & 0xff i = size - 1 while i >=0: a = v[i] a = a ^ b c = a - a = lshift(a, 3) # a << 3 + a = (a << 3) & 0xff a = a | d d = a - d = rshift(d, 6) # d >> 6 - a = lshift(a, 2) # a << 2 + d = (d >> 6) & 0xff + a = (a << 2) & 0xff d = d | a - c = rshift(c, 5) # c >> 5 + c = (c >> 5) & 0xff v[i] = d d = c @@ -97,28 +101,24 @@ # Startup c = v[len - 1]; c &= 0xfc; - c = lshift(c, 3) # c << 3; + c = (c << 3) & 0xff i = 0 while i < len: d = v[i] a = d - a = lshift(a, 6) # a << 6 - d = rshift(d, 2) # d >> 2 + a = (a << 6) & 0xff + d = (d >> 2) & 0xff a = a | d d = a - a = rshift(a, 3) # a >> 3 + a = (a >> 3) & 0xff a = a | c c = key a = a ^ c - d = lshift(d, 5) # d << 5 + d = (d << 5) & 0xff v[i] = a c = d i+=1 return ''.join(list2str(v)) - -if __name__ == '__main__': - fd = open("Python.0.elf", 'rb') - print '\n'.join(decryptElf(fd)) Added: pymoul/trunk/src/moul/crypt/tests/__init__.py =================================================================== --- pymoul/trunk/src/moul/crypt/tests/__init__.py (rev 0) +++ pymoul/trunk/src/moul/crypt/tests/__init__.py 2007-01-15 17:28:51 UTC (rev 26) @@ -0,0 +1,2 @@ +# testing package + Modified: pymoul/trunk/src/moul/crypt/whatdoyousee.py =================================================================== --- pymoul/trunk/src/moul/crypt/whatdoyousee.py 2007-01-15 16:08:38 UTC (rev 25) +++ pymoul/trunk/src/moul/crypt/whatdoyousee.py 2007-01-15 17:28:51 UTC (rev 26) @@ -26,8 +26,6 @@ """ import struct -from moul.crypt.bitops import str2int -from moul.crypt.bitops import int2str from moul.crypt.xtea import xtea_decrypt from moul.crypt.xtea import xtea_encrypt @@ -48,7 +46,7 @@ raise IOError("Not a whatdoyousee/xTEA encrypted file") header = fin.read(4) - length = str2int(header) + struct.unpack(ENDIAN+"L", header) out = [] pos = 0 @@ -74,7 +72,7 @@ fout.write(HEADER) flen = len(instr) - length = int2str(flen) + length = struct.pack(ENDIAN+"L", flen) fout.write(length) pos = 0 Added: pymoul/trunk/src/moul/file/tests/__init__.py =================================================================== --- pymoul/trunk/src/moul/file/tests/__init__.py (rev 0) +++ pymoul/trunk/src/moul/file/tests/__init__.py 2007-01-15 17:28:51 UTC (rev 26) @@ -0,0 +1,2 @@ +# testing package + Added: pymoul/trunk/src/moul/i18n.py =================================================================== --- pymoul/trunk/src/moul/i18n.py (rev 0) +++ pymoul/trunk/src/moul/i18n.py 2007-01-15 17:28:51 UTC (rev 26) @@ -0,0 +1,91 @@ +# 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 +# +"""pyMoul i18n + +A dumb and do nearly nothing i18n message factory and message implementation. +It's a kind of a place holder. + +Inspired by zope.i18nmessage + +>>> _ = MessageFactory('test') +>>> msg = _(u'test') +>>> msg +u'test' +>>> msg.domain +'test' +>>> msg.default +u'test' +>>> msg.mapping is None +True + +>>> template = _(u'id', u'This is a ${name}!') +>>> template +u'id' +>>> template % {'name' : u'test'} +u'This is a test!' +>>> template % {'name' : u'another test'} +u'This is a another test!' + +>>> error = _('id') +Traceback (most recent call last): +... +TypeError: ustr must be a unicode string +>>> error = _(u'id', 'This is a ${name}!') +Traceback (most recent call last): +... +TypeError: default must be a unicode string +""" +from string import Template + +__all__ = ['_', 'PymoulMessageFactory', 'MessageFactory'] + +class Message(unicode, Template): + __slots__ = ('domain', 'default', 'mapping') + + def __new__(cls, ustr, domain=None, default=None, mapping=None): + if not isinstance(ustr, unicode): + raise TypeError("ustr must be a unicode string") + if default is not None and not isinstance(default, unicode): + raise TypeError("default must be a unicode string") + + self = unicode.__new__(cls, ustr) + self.domain = domain + if default is None: + self.default = unicode(ustr) + else: + self.default = unicode(default) + self.mapping = mapping + return self + + def __init__(self, *args, **kwargs): + return Template.__init__(self, self.default) + + def __mod__(self, other): + return self.substitute(other) + +class MessageFactory(object): + """Factory for Messages""" + + def __init__(self, domain): + self._domain = domain + + def __call__(self, ustr, default=None, mapping=None): + return Message(ustr, self._domain, default, mapping) + +_ = PymoulMessageFactory = MessageFactory('pymoul') + Modified: pymoul/trunk/src/moul/log.py =================================================================== --- pymoul/trunk/src/moul/log.py 2007-01-15 16:08:38 UTC (rev 25) +++ pymoul/trunk/src/moul/log.py 2007-01-15 17:28:51 UTC (rev 26) @@ -25,5 +25,4 @@ ) LOG = logging.getLogger('pyMoul') - - +getLogger = logging.getLogger Added: pymoul/trunk/src/moul/qt/tests/__init__.py =================================================================== --- pymoul/trunk/src/moul/qt/tests/__init__.py (rev 0) +++ pymoul/trunk/src/moul/qt/tests/__init__.py 2007-01-15 17:28:51 UTC (rev 26) @@ -0,0 +1,2 @@ +# testing package + Added: pymoul/trunk/src/moul/tests/__init__.py =================================================================== --- pymoul/trunk/src/moul/tests/__init__.py (rev 0) +++ pymoul/trunk/src/moul/tests/__init__.py 2007-01-15 17:28:51 UTC (rev 26) @@ -0,0 +1,2 @@ +# testing package + Added: pymoul/trunk/src/moul/tests/test_i18n.py =================================================================== --- pymoul/trunk/src/moul/tests/test_i18n.py (rev 0) +++ pymoul/trunk/src/moul/tests/test_i18n.py 2007-01-15 17:28:51 UTC (rev 26) @@ -0,0 +1,28 @@ +# 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 +# +import unittest +from doctest import DocTestSuite + +def test_suite(): + return unittest.TestSuite(( + DocTestSuite('moul.i18n'), + )) + +if __name__ == '__main__': + unittest.main(defaultTest="test_suite") + Modified: pymoul/trunk/src/moul/time/dni.py =================================================================== --- pymoul/trunk/src/moul/time/dni.py 2007-01-15 16:08:38 UTC (rev 25) +++ pymoul/trunk/src/moul/time/dni.py 2007-01-15 17:28:51 UTC (rev 26) @@ -29,7 +29,7 @@ ('tah-vo', 25), ('gor-ahn', 25), ('pro-rahn', 1), - ) +) VAILATEE = ( ('Leefo', ( 4, 21), ( 5, 27)), # 1: April 21st to May 27th @@ -42,7 +42,8 @@ ('Leevosahn', ( 1, 2), ( 2, 7)), # 8: January 2nd to February 7th ('Leevotar', ( 2, 7), ( 3, 15)), # 9: February 7th to March 15th ('Leenovoo', ( 3, 16), ( 4, 21)), # 10: March 16th to April 21st - ) +) + PRORAHN_PER_HAHR = reduce(mul, [float(factor) for name, factor in DNI_FACTORS[1:-1]]) Added: pymoul/trunk/src/moul/time/tests/__init__.py =================================================================== --- pymoul/trunk/src/moul/time/tests/__init__.py (rev 0) +++ pymoul/trunk/src/moul/time/tests/__init__.py 2007-01-15 17:28:51 UTC (rev 26) @@ -0,0 +1,2 @@ +# testing package + Property changes on: pymoul/trunk/test.py ___________________________________________________________________ Name: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-15 15:52:39
|
Revision: 24 http://pymoul.svn.sourceforge.net/pymoul/?rev=24&view=rev Author: tiran Date: 2007-01-15 07:52:35 -0800 (Mon, 15 Jan 2007) Log Message: ----------- Removed egg info stuff from svn Updated some scripts to support Linux and Mac although both systems aren't supported yet Modified Paths: -------------- pymoul/trunk/setup.py pymoul/trunk/setup_win32.py pymoul/trunk/src/moul/cli/moullauncher.py pymoul/trunk/src/moul/config/__init__.py pymoul/trunk/src/moul/qt/moulqt.py Added Paths: ----------- pymoul/trunk/src/moul/config/darwin.py pymoul/trunk/src/moul/config/linux2.py Removed Paths: ------------- pymoul/trunk/src/pyMoul.egg-info/ Property Changed: ---------------- pymoul/trunk/setup.py pymoul/trunk/src/ pymoul/trunk/src/moul/cli/moullauncher.py pymoul/trunk/src/moul/qt/moulqt.py Modified: pymoul/trunk/setup.py =================================================================== --- pymoul/trunk/setup.py 2007-01-15 15:19:00 UTC (rev 23) +++ pymoul/trunk/setup.py 2007-01-15 15:52:35 UTC (rev 24) @@ -1,4 +1,4 @@ -#/usr/bin/env python2.5 +#!/usr/bin/env python2.5 """pyMoul: Python tools for Myst Online - URU Live (MOUL) TODO: Long description of pyMoul @@ -7,8 +7,9 @@ import os import time # boot strap easy setup +SETUPTOOLS_VERSION = "0.6c1" from ez_setup import use_setuptools -use_setuptools() +use_setuptools(version=SETUPTOOLS_VERSION) from setuptools import setup from setuptools import find_packages @@ -42,14 +43,13 @@ ) setup_options = dict( - setup_requires = ["setuptools>=0.6c"], + setup_requires = ["setuptools>="+SETUPTOOLS_VERSION,], install_requires = [], - options = {}, data_files = [], package_dir = {'' : 'src'}, packages = find_packages('src', exclude="moul.qt"), include_package_data = True, - zip_safe = True, + zip_safe = False, ) def writeMetadata(): @@ -75,12 +75,14 @@ kwargs.update(setup_options) # Do some windows stuff -if sys.platform.startswith('win'): +if sys.platform.startswith('win32'): from setup_win32 import updateSetupOptions from setup_win32 import updateSetupOptionsQT from setup_win32 import upxPack updateSetupOptions(kwargs) updateSetupOptionsQT(kwargs) +elif sys.platform.startswith('linux2'): + kwargs['packages'].append('moul.qt') setup(**kwargs) Property changes on: pymoul/trunk/setup.py ___________________________________________________________________ Name: svn:executable + * Modified: pymoul/trunk/setup_win32.py =================================================================== --- pymoul/trunk/setup_win32.py 2007-01-15 15:19:00 UTC (rev 23) +++ pymoul/trunk/setup_win32.py 2007-01-15 15:52:35 UTC (rev 24) @@ -63,6 +63,7 @@ "icon_resources": [(1, "src/moul/uru.ico")] } ] + kw.setdefault('options', {}) pexe = kw['options'].setdefault('py2exe', {}) pexe['compressed'] = 100 # compress zip file pexe['optimize'] = 0 # 0,1,2 Property changes on: pymoul/trunk/src ___________________________________________________________________ Name: svn:ignore + pyMoul.egg-info Modified: pymoul/trunk/src/moul/cli/moullauncher.py =================================================================== --- pymoul/trunk/src/moul/cli/moullauncher.py 2007-01-15 15:19:00 UTC (rev 23) +++ pymoul/trunk/src/moul/cli/moullauncher.py 2007-01-15 15:52:35 UTC (rev 24) @@ -1,3 +1,4 @@ +#!/usr/bin/env python2.5 # pyMoul - Python interface to Myst Online URU Live # Copyright (C) 2007 Christian Heimes <christian (at) cheimes (dot) de> Property changes on: pymoul/trunk/src/moul/cli/moullauncher.py ___________________________________________________________________ Name: svn:executable + * Modified: pymoul/trunk/src/moul/config/__init__.py =================================================================== --- pymoul/trunk/src/moul/config/__init__.py 2007-01-15 15:19:00 UTC (rev 23) +++ pymoul/trunk/src/moul/config/__init__.py 2007-01-15 15:52:35 UTC (rev 24) @@ -23,7 +23,7 @@ import sys _marker=object() - +# XXX: what about cygwin, bsd and others? if sys.platform.startswith('win32'): from moul.config.win32 import ( getMoulUserDataDir, @@ -31,6 +31,20 @@ _startMOUL, EXEC_NAME ) +elif sys.platform.startswith('linux2'): + from moul.config.linux import ( + getMoulUserDataDir, + getPyMoulIniLocation, + _startMOUL, + EXEC_NAME + ) +elif sys.platform.startswith('darwin'): + from moul.config.darwin import ( + getMoulUserDataDir, + getPyMoulIniLocation, + _startMOUL, + EXEC_NAME + ) else: raise RuntimeError('platform %s not supported' % sys.platform) Added: pymoul/trunk/src/moul/config/darwin.py =================================================================== --- pymoul/trunk/src/moul/config/darwin.py (rev 0) +++ pymoul/trunk/src/moul/config/darwin.py 2007-01-15 15:52:35 UTC (rev 24) @@ -0,0 +1,53 @@ +# 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 +# +"""Darwin (Mac OS X) configuration for pyMoul + +XXX: untested! +""" +import os +from moul.log import LOG +LOG.warning('Darwin/Mac support is not tested') + +MOUL_DIR = "Uru Live" +INI_FILE = ('pyMoul', 'pymoul.ini') +EXEC_NAME = "UruLauncher" +HOME = os.environ('HOME') + +def getMoulUserDataDir(): + """Get path of MOUL data directory + + The MOUL data directory contains log files, chatlogs, KI images and many + more things. + """ + moul_data = os.path.join(HOME, MOUL_DIR) + +def getPyMoulIniLocation(): + """Get path to the pyMoul ini file + """ + ini_file = os.path.join(HOME, *INI_FILE) + return ini_file + +def _startMOUL(installdir, *args): + """Start MOUL + """ + # P_DETACH is similar to P_NOWAIT, but the new process is detached from + # the console of the calling process. + mode = os.P_DETACH + path = os.path.join(installdir, EXEC_NAME) + args = (EXEC_NAME,) + args + return os.spawnv(mode, path, args) Added: pymoul/trunk/src/moul/config/linux2.py =================================================================== --- pymoul/trunk/src/moul/config/linux2.py (rev 0) +++ pymoul/trunk/src/moul/config/linux2.py 2007-01-15 15:52:35 UTC (rev 24) @@ -0,0 +1,53 @@ +# 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 +# +"""Linux configuration for pyMoul + +XXX: untested! +""" +import os +from moul.log import LOG +LOG.warning('Linux support is not tested') + +MOUL_DIR = "Uru Live" +INI_FILE = ('pyMoul', 'pymoul.ini') +EXEC_NAME = "UruLauncher" +HOME = os.environ('HOME') + +def getMoulUserDataDir(): + """Get path of MOUL data directory + + The MOUL data directory contains log files, chatlogs, KI images and many + more things. + """ + moul_data = os.path.join(HOME, MOUL_DIR) + +def getPyMoulIniLocation(): + """Get path to the pyMoul ini file + """ + ini_file = os.path.join(HOME, *INI_FILE) + return ini_file + +def _startMOUL(installdir, *args): + """Start MOUL + """ + # P_DETACH is similar to P_NOWAIT, but the new process is detached from + # the console of the calling process. + mode = os.P_DETACH + path = os.path.join(installdir, EXEC_NAME) + args = (EXEC_NAME,) + args + return os.spawnv(mode, path, args) Modified: pymoul/trunk/src/moul/qt/moulqt.py =================================================================== --- pymoul/trunk/src/moul/qt/moulqt.py 2007-01-15 15:19:00 UTC (rev 23) +++ pymoul/trunk/src/moul/qt/moulqt.py 2007-01-15 15:52:35 UTC (rev 24) @@ -1,3 +1,4 @@ +#!/usr/bin/env python2.5 import sys from PyQt4 import QtCore, QtGui Property changes on: pymoul/trunk/src/moul/qt/moulqt.py ___________________________________________________________________ Name: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-15 15:19:01
|
Revision: 23 http://pymoul.svn.sourceforge.net/pymoul/?rev=23&view=rev Author: tiran Date: 2007-01-15 07:19:00 -0800 (Mon, 15 Jan 2007) Log Message: ----------- propset svn:eol-style native for all py, txt, ui and qrc files Modified Paths: -------------- pymoul/trunk/compileui.py pymoul/trunk/setup_win32.py Property Changed: ---------------- pymoul/trunk/compileui.py pymoul/trunk/ez_setup.py pymoul/trunk/misc/build_exe.py pymoul/trunk/setup.py pymoul/trunk/setup_win32.py pymoul/trunk/src/moul/__init__.py pymoul/trunk/src/moul/cli/__init__.py pymoul/trunk/src/moul/cli/moullauncher.py pymoul/trunk/src/moul/config/__init__.py pymoul/trunk/src/moul/config/generic.py pymoul/trunk/src/moul/config/miniwinshell.py pymoul/trunk/src/moul/config/win32.py pymoul/trunk/src/moul/crypt/__init__.py pymoul/trunk/src/moul/crypt/bitops.py pymoul/trunk/src/moul/crypt/elf.py pymoul/trunk/src/moul/crypt/whatdoyousee.py pymoul/trunk/src/moul/crypt/xtea.py pymoul/trunk/src/moul/file/__init__.py pymoul/trunk/src/moul/file/chatlog.py pymoul/trunk/src/moul/file/kiimage.py pymoul/trunk/src/moul/file/localization.py pymoul/trunk/src/moul/file/plasmalog.py pymoul/trunk/src/moul/file/wdysini.py pymoul/trunk/src/moul/log.py pymoul/trunk/src/moul/metadata.py pymoul/trunk/src/moul/qt/__init__.py pymoul/trunk/src/moul/qt/moulqt.py pymoul/trunk/src/moul/qt/ui/__init__.py pymoul/trunk/src/moul/qt/ui/mainwindow.py pymoul/trunk/src/moul/qt/ui/mainwindow.ui pymoul/trunk/src/moul/qt/ui/moulqt.qrc pymoul/trunk/src/moul/qt/ui/moulqt_rc.py pymoul/trunk/src/moul/time/__init__.py pymoul/trunk/src/moul/time/cavern.py pymoul/trunk/src/moul/time/dni.py Modified: pymoul/trunk/compileui.py =================================================================== --- pymoul/trunk/compileui.py 2007-01-15 15:15:25 UTC (rev 22) +++ pymoul/trunk/compileui.py 2007-01-15 15:19:00 UTC (rev 23) @@ -1,100 +1,100 @@ -#!/usr/bin/env python2.5 -"""Compile QtDesigner's UI and QRC files to Python files -""" -import os -import re - -from PyQt4 import uic - -RE_RC_TEXT = "^import\ (?P<module>[a-zA-Z]\w*_rc)\s$" -RE_RC = re.compile(RE_RC_TEXT) - -UI_EXT = '.ui' -PY_EXT = '.py' -QRC_EXT = '.qrc' -PY_QRC_EXT = '_rc.py' -QRC_COMPILER = "pyrcc4 -o %(py)s %(qrc)s" -UI_MODULE = "moul.qt.ui" - -def previewUi(uifname): - """Copied from PyQt.uic.pyuic - """ - from PyQt4 import QtGui - app = QtGui.QApplication([uifname]) - widget = uic.loadUi(uifname) - widget.show() - return app.exec_() - -def findFiles(base): - uis = [] - qrcs = [] - if not os.path.isdir(base): - raise IOError("%s is not a directory" % root) - for root, dirs, files in os.walk(base): - if '.svn' in dirs: - dirs.remove('.svn') - for file in files: - if file.endswith(UI_EXT): - uis.append((root, file)) - if file.endswith(QRC_EXT): - qrcs.append((root, file)) - return uis, qrcs - -def compileUiFiles(uis, execute=False, preview=False): - pys = [] - for root, ui_name in uis: - py_name = ui_name.lower()[:-len(UI_EXT)]+PY_EXT - ui_path = os.path.join(root, ui_name) - py_path = os.path.join(root, py_name) - ui = open(ui_path, 'r') - py = open(py_path, 'w') - err = uic.compileUi(ui, py, execute) - ui.close() - py.close() - if err: - raise RuntimeError("%s: %s" % (ui_path, str(err))) - fixRelativeImport(py_path) - if preview: - previewUi(ui_path) - pys.append(py_path) - return pys - -def fixRelativeImport(fname): - lines = [] - fin = open(fname, 'r') - for line in fin: - - if line.startswith('import'): - # faster than re - match = RE_RC.match(line) - if match: - line = match.expand("from %s import \g<module>" % UI_MODULE) - lines.append(line) - fin.close() - fout = open(fname, 'w') - fout.write(''.join(lines)) - fout.close() - -def compileQRCFiles(qrcs): - pys = [] - for root, qrc_name in qrcs: - py_name = qrc_name.lower()[:-len(QRC_EXT)]+PY_QRC_EXT - kw = {} - kw['qrc'] = os.path.join(root, qrc_name) - kw['py'] = os.path.join(root, py_name) - err = os.system(QRC_COMPILER % kw) - if err != 0: - raise RuntimeError("pyrcc error") - pys.append(kw['py']) - return pys - -def compileUi(base='src', execute=True, preview=False): - uis, qrcs = findFiles(base) - upys = compileUiFiles(uis, execute=execute, preview=preview) - qpys = compileQRCFiles(qrcs) - return upys + qpys - -if __name__ == '__main__': - pys = compileUi() - print "Python files written:\n" - print '\n'.join(pys) +#!/usr/bin/env python2.5 +"""Compile QtDesigner's UI and QRC files to Python files +""" +import os +import re + +from PyQt4 import uic + +RE_RC_TEXT = "^import\ (?P<module>[a-zA-Z]\w*_rc)\s$" +RE_RC = re.compile(RE_RC_TEXT) + +UI_EXT = '.ui' +PY_EXT = '.py' +QRC_EXT = '.qrc' +PY_QRC_EXT = '_rc.py' +QRC_COMPILER = "pyrcc4 -o %(py)s %(qrc)s" +UI_MODULE = "moul.qt.ui" + +def previewUi(uifname): + """Copied from PyQt.uic.pyuic + """ + from PyQt4 import QtGui + app = QtGui.QApplication([uifname]) + widget = uic.loadUi(uifname) + widget.show() + return app.exec_() + +def findFiles(base): + uis = [] + qrcs = [] + if not os.path.isdir(base): + raise IOError("%s is not a directory" % root) + for root, dirs, files in os.walk(base): + if '.svn' in dirs: + dirs.remove('.svn') + for file in files: + if file.endswith(UI_EXT): + uis.append((root, file)) + if file.endswith(QRC_EXT): + qrcs.append((root, file)) + return uis, qrcs + +def compileUiFiles(uis, execute=False, preview=False): + pys = [] + for root, ui_name in uis: + py_name = ui_name.lower()[:-len(UI_EXT)]+PY_EXT + ui_path = os.path.join(root, ui_name) + py_path = os.path.join(root, py_name) + ui = open(ui_path, 'r') + py = open(py_path, 'w') + err = uic.compileUi(ui, py, execute) + ui.close() + py.close() + if err: + raise RuntimeError("%s: %s" % (ui_path, str(err))) + fixRelativeImport(py_path) + if preview: + previewUi(ui_path) + pys.append(py_path) + return pys + +def fixRelativeImport(fname): + lines = [] + fin = open(fname, 'r') + for line in fin: + + if line.startswith('import'): + # faster than re + match = RE_RC.match(line) + if match: + line = match.expand("from %s import \g<module>" % UI_MODULE) + lines.append(line) + fin.close() + fout = open(fname, 'w') + fout.write(''.join(lines)) + fout.close() + +def compileQRCFiles(qrcs): + pys = [] + for root, qrc_name in qrcs: + py_name = qrc_name.lower()[:-len(QRC_EXT)]+PY_QRC_EXT + kw = {} + kw['qrc'] = os.path.join(root, qrc_name) + kw['py'] = os.path.join(root, py_name) + err = os.system(QRC_COMPILER % kw) + if err != 0: + raise RuntimeError("pyrcc error") + pys.append(kw['py']) + return pys + +def compileUi(base='src', execute=True, preview=False): + uis, qrcs = findFiles(base) + upys = compileUiFiles(uis, execute=execute, preview=preview) + qpys = compileQRCFiles(qrcs) + return upys + qpys + +if __name__ == '__main__': + pys = compileUi() + print "Python files written:\n" + print '\n'.join(pys) Property changes on: pymoul/trunk/compileui.py ___________________________________________________________________ Name: eol-style + native Name: svn:eol-style + native Property changes on: pymoul/trunk/ez_setup.py ___________________________________________________________________ Name: eol-style + native Property changes on: pymoul/trunk/misc/build_exe.py ___________________________________________________________________ Name: eol-style + native Property changes on: pymoul/trunk/setup.py ___________________________________________________________________ Name: eol-style + native Modified: pymoul/trunk/setup_win32.py =================================================================== --- pymoul/trunk/setup_win32.py 2007-01-15 15:15:25 UTC (rev 22) +++ pymoul/trunk/setup_win32.py 2007-01-15 15:19:00 UTC (rev 23) @@ -1,81 +1,81 @@ -"""Win23 helpers for setup.py -""" -import os -import sys -from setuptools import find_packages - -try: - import py2exe -except ImportError: - print >>sys.stderr, "py2exe missing, unable to create executables" -else: - # If run without args, build executables, in quiet mode. - if len(sys.argv) == 1: - sys.argv.append("py2exe") - -# py2exe's ModuleFinder can't handle runtime changes to __path__, -# but win32com uses them -try: - import modulefinder - import win32com - for p in win32com.__path__[1:]: - modulefinder.AddPackagePath("win32com", p) - for extra in ["win32com.shell"]: - __import__(extra) - m = sys.modules[extra] - for p in m.__path__[1:]: - modulefinder.AddPackagePath(extra, p) -except ImportError: - # no build path setup, no worries. - pass - -def inEnvPath(name): - result = [] - for path in os.environ['PATH'].split(';'): - upx = os.path.join(path, name) - if os.path.isfile(upx): - result.append(upx) - if result: - return result[0] - -def upxPack(dst): - """Pack PE executables with UPX http://upx.sourceforge.net/ - - UPX can shrink dll, exe and pyd files 50 to 70% without disadvantage - """ - if not inEnvPath('upx.exe'): - print >>sys.stderr, "UPX not available - skipping" - upx_pack = [] - for root, dirs, files in os.walk(dst): - for file in files: - if file[-4:] in ('.pyd', '.dll', '.exe'): - upx_pack.append(os.path.join(root, file)) - # --best --all-methods --all-filters - os.system("upx -q --mono %s" % ' '.join(upx_pack)) - -def updateSetupOptions(kw): - for req in ("py2exe >=0.6.5",): - kw['setup_requires'].append(req) - for req in (): - kw['install_requires'].append(req) - kw['console'] = [ - { "script" : "src/moul/cli/moullauncher.py", - "icon_resources": [(1, "src/moul/uru.ico")] - } - ] - pexe = kw['options'].setdefault('py2exe', {}) - pexe['compressed'] = 100 # compress zip file - pexe['optimize'] = 0 # 0,1,2 - #pexe['includes'] = 'encodings,encodings.*' - kw['zipfile'] = 'library.zip' - -def updateSetupOptionsQT(kw): - pexe = kw['options'].setdefault('py2exe', {}) - #pexe['includes'] = 'PyQt4' - kw['packages'].append('moul.qt') - windows = kw.setdefault('windows', []) - windows.append({ - "script" : "src/moul/qt/moulqt.py", - "icon_resources": [(1, "src/moul/uru.ico")] - } - ) +"""Win23 helpers for setup.py +""" +import os +import sys +from setuptools import find_packages + +try: + import py2exe +except ImportError: + print >>sys.stderr, "py2exe missing, unable to create executables" +else: + # If run without args, build executables, in quiet mode. + if len(sys.argv) == 1: + sys.argv.append("py2exe") + +# py2exe's ModuleFinder can't handle runtime changes to __path__, +# but win32com uses them +try: + import modulefinder + import win32com + for p in win32com.__path__[1:]: + modulefinder.AddPackagePath("win32com", p) + for extra in ["win32com.shell"]: + __import__(extra) + m = sys.modules[extra] + for p in m.__path__[1:]: + modulefinder.AddPackagePath(extra, p) +except ImportError: + # no build path setup, no worries. + pass + +def inEnvPath(name): + result = [] + for path in os.environ['PATH'].split(';'): + upx = os.path.join(path, name) + if os.path.isfile(upx): + result.append(upx) + if result: + return result[0] + +def upxPack(dst): + """Pack PE executables with UPX http://upx.sourceforge.net/ + + UPX can shrink dll, exe and pyd files 50 to 70% without disadvantage + """ + if not inEnvPath('upx.exe'): + print >>sys.stderr, "UPX not available - skipping" + upx_pack = [] + for root, dirs, files in os.walk(dst): + for file in files: + if file[-4:] in ('.pyd', '.dll', '.exe'): + upx_pack.append(os.path.join(root, file)) + # --best --all-methods --all-filters + os.system("upx -q --mono %s" % ' '.join(upx_pack)) + +def updateSetupOptions(kw): + for req in ("py2exe >=0.6.5",): + kw['setup_requires'].append(req) + for req in (): + kw['install_requires'].append(req) + kw['console'] = [ + { "script" : "src/moul/cli/moullauncher.py", + "icon_resources": [(1, "src/moul/uru.ico")] + } + ] + pexe = kw['options'].setdefault('py2exe', {}) + pexe['compressed'] = 100 # compress zip file + pexe['optimize'] = 0 # 0,1,2 + #pexe['includes'] = 'encodings,encodings.*' + kw['zipfile'] = 'library.zip' + +def updateSetupOptionsQT(kw): + pexe = kw['options'].setdefault('py2exe', {}) + #pexe['includes'] = 'PyQt4' + kw['packages'].append('moul.qt') + windows = kw.setdefault('windows', []) + windows.append({ + "script" : "src/moul/qt/moulqt.py", + "icon_resources": [(1, "src/moul/uru.ico")] + } + ) Property changes on: pymoul/trunk/setup_win32.py ___________________________________________________________________ Name: eol-style + native Name: svn:eol-style + native Property changes on: pymoul/trunk/src/moul/__init__.py ___________________________________________________________________ Name: eol-style + native Property changes on: pymoul/trunk/src/moul/cli/__init__.py ___________________________________________________________________ Name: eol-style + native Property changes on: pymoul/trunk/src/moul/cli/moullauncher.py ___________________________________________________________________ Name: eol-style + native Property changes on: pymoul/trunk/src/moul/config/__init__.py ___________________________________________________________________ Name: eol-style + native Property changes on: pymoul/trunk/src/moul/config/generic.py ___________________________________________________________________ Name: eol-style + native Property changes on: pymoul/trunk/src/moul/config/miniwinshell.py ___________________________________________________________________ Name: eol-style + native Property changes on: pymoul/trunk/src/moul/config/win32.py ___________________________________________________________________ Name: eol-style + native Property changes on: pymoul/trunk/src/moul/crypt/__init__.py ___________________________________________________________________ Name: eol-style + native Property changes on: pymoul/trunk/src/moul/crypt/bitops.py ___________________________________________________________________ Name: eol-style + native Property changes on: pymoul/trunk/src/moul/crypt/elf.py ___________________________________________________________________ Name: eol-style + native Property changes on: pymoul/trunk/src/moul/crypt/whatdoyousee.py ___________________________________________________________________ Name: eol-style + native Property changes on: pymoul/trunk/src/moul/crypt/xtea.py ___________________________________________________________________ Name: eol-style + native Property changes on: pymoul/trunk/src/moul/file/__init__.py ___________________________________________________________________ Name: eol-style + native Property changes on: pymoul/trunk/src/moul/file/chatlog.py ___________________________________________________________________ Name: eol-style + native Property changes on: pymoul/trunk/src/moul/file/kiimage.py ___________________________________________________________________ Name: eol-style + native Property changes on: pymoul/trunk/src/moul/file/localization.py ___________________________________________________________________ Name: eol-style + native Property changes on: pymoul/trunk/src/moul/file/plasmalog.py ___________________________________________________________________ Name: eol-style + native Property changes on: pymoul/trunk/src/moul/file/wdysini.py ___________________________________________________________________ Name: eol-style + native Property changes on: pymoul/trunk/src/moul/log.py ___________________________________________________________________ Name: eol-style + native Property changes on: pymoul/trunk/src/moul/metadata.py ___________________________________________________________________ Name: eol-style + native Property changes on: pymoul/trunk/src/moul/qt/__init__.py ___________________________________________________________________ Name: eol-style + native Property changes on: pymoul/trunk/src/moul/qt/moulqt.py ___________________________________________________________________ Name: eol-style + native Property changes on: pymoul/trunk/src/moul/qt/ui/__init__.py ___________________________________________________________________ Name: eol-style + native Property changes on: pymoul/trunk/src/moul/qt/ui/mainwindow.py ___________________________________________________________________ Name: eol-style + native Property changes on: pymoul/trunk/src/moul/qt/ui/mainwindow.ui ___________________________________________________________________ Name: svn:eol-style + native Property changes on: pymoul/trunk/src/moul/qt/ui/moulqt.qrc ___________________________________________________________________ Name: svn:eol-style + native Property changes on: pymoul/trunk/src/moul/qt/ui/moulqt_rc.py ___________________________________________________________________ Name: eol-style + native Property changes on: pymoul/trunk/src/moul/time/__init__.py ___________________________________________________________________ Name: eol-style + native Name: svn:eol-style + native Property changes on: pymoul/trunk/src/moul/time/cavern.py ___________________________________________________________________ Name: eol-style + native Name: svn:eol-style + native Property changes on: pymoul/trunk/src/moul/time/dni.py ___________________________________________________________________ Name: eol-style + native Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-15 15:15:28
|
Revision: 22 http://pymoul.svn.sourceforge.net/pymoul/?rev=22&view=rev Author: tiran Date: 2007-01-15 07:15:25 -0800 (Mon, 15 Jan 2007) Log Message: ----------- Added stub to handle D'ni time and Cavern time Added Paths: ----------- pymoul/trunk/src/moul/time/ pymoul/trunk/src/moul/time/README.txt pymoul/trunk/src/moul/time/__init__.py pymoul/trunk/src/moul/time/cavern.py pymoul/trunk/src/moul/time/dni.py Added: pymoul/trunk/src/moul/time/README.txt =================================================================== --- pymoul/trunk/src/moul/time/README.txt (rev 0) +++ pymoul/trunk/src/moul/time/README.txt 2007-01-15 15:15:25 UTC (rev 22) @@ -0,0 +1,30 @@ +Cavern time +----------- + +Cavern time is MDT (mountain time with daylight saving) + +D'ni time +--------- + +sources: + http://www.mystlore.com/wiki/D%27ni_time + http://www.mystlore.com/wiki/D%27ni_timekeeping_conversion_algorithms + +year 0: 7656 B.C. +hahrtee fahrah -> 625 hahr (100 pentovigesimal years) +hahr -> year +vai-lee (pl vai-lee-tee) -> month + hahr as 10 vai-lee-tee +yahr (pl yahr-tee) -> day with about 30h 14mins (1.26 earth days) + vai-lee has 29 yahr-tee +gahr-tah-vo-tee -> 6h 3mins (5 per yahr) +tah-vo-tee -> 14.5mins (25 per gahr-tah-vo) +gor-ahn-tee -> 36secs (25 per tah-vo) +pro-rahn-tee -> 1.5sec (25 per gor-ahn) + +The ten vaileetee are Leefo (April 21st to May 27th), Leebro (May 28th to July 3rd), Leesahn (July 3rd to August 8th), Leetar (August 9th and September 14th), Leevot (September 14th to October 20th), Leevofo (October 21st to November 26th), Leevobro (November 26th to January 1st), Leevosahn (January 2nd to February 7th), Leevotar (February 7th to March 15th) and Leenovoo (March 16th to April 21st). +New Year, traditionally a significant holiday, therefore occurs on April 21st in human terms: i.e., on Leefo 1. + +solar year: 365 days, 6 hours, 9 minutes and 9 seconds -> 31556925 seconds +D'ni hahr: 10×29×5×25×25×25 prorahntee -> 22656250 prorahntee +factor: 1.39285738 Added: pymoul/trunk/src/moul/time/__init__.py =================================================================== --- pymoul/trunk/src/moul/time/__init__.py (rev 0) +++ pymoul/trunk/src/moul/time/__init__.py 2007-01-15 15:15:25 UTC (rev 22) @@ -0,0 +1,8 @@ +# MOUL package +# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages +try: + __import__('pkg_resources').declare_namespace(__name__) +except ImportError: + from pkgutil import extend_path + __path__ = extend_path(__path__, __name__) + Added: pymoul/trunk/src/moul/time/cavern.py =================================================================== --- pymoul/trunk/src/moul/time/cavern.py (rev 0) +++ pymoul/trunk/src/moul/time/cavern.py 2007-01-15 15:15:25 UTC (rev 22) @@ -0,0 +1,35 @@ +# 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 +# +"""pyMoul cavern time tool +""" +__all__ = ['TIMEZONE_NAMES',] + +from datetime import datetime +from datetime import timedelta + +from pytz import common_timezones +from pytz import timezone +from pytz import utc as UTC + +TIMEZONE_NAMES = common_timezones + +# Cyan HQ is near Spokane / Washington +# Cavern time is Mountain Time Zone (MDT) with daylight savings (MST) +CAVERN_TZ_NAME = 'US/Mountain' # MDT / MST +CAVERN_TZ = timezone(CAVERN_TZ_NAME) + Added: pymoul/trunk/src/moul/time/dni.py =================================================================== --- pymoul/trunk/src/moul/time/dni.py (rev 0) +++ pymoul/trunk/src/moul/time/dni.py 2007-01-15 15:15:25 UTC (rev 22) @@ -0,0 +1,55 @@ +# 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 +# +"""pyMoul D'ni time tool +""" +from operator import mul + +FARAH_1 = -7656 # hahrtee fahrah 1 starts at April 21st 7656 B.C +DNI_FACTORS = ( + ('hahrtee fahrah', 625), + ('hahr', 10), + ('vai-lee', 29), + ('yahr', 5), + ('gahr-tah-vo', 25), + ('tah-vo', 25), + ('gor-ahn', 25), + ('pro-rahn', 1), + ) + +VAILATEE = ( + ('Leefo', ( 4, 21), ( 5, 27)), # 1: April 21st to May 27th + ('Leebro', ( 5, 28), ( 7, 3)), # 2: May 28th to July 3rd + ('Leesahn', ( 7, 3), ( 8, 8)), # 3: July 3rd to August 8th + ('Leetar', ( 8, 9), ( 9, 15)), # 4: August 9th and September 14th + ('Leevot', ( 9, 14), (10, 20)), # 5: September 14th to October 20th + ('Leevofo', (10, 21), (11, 26)), # 6: October 21st to November 26th + ('Leevobro', (11, 26), ( 1, 1)), # 7: November 26th to January 1st + ('Leevosahn', ( 1, 2), ( 2, 7)), # 8: January 2nd to February 7th + ('Leevotar', ( 2, 7), ( 3, 15)), # 9: February 7th to March 15th + ('Leenovoo', ( 3, 16), ( 4, 21)), # 10: March 16th to April 21st + ) +PRORAHN_PER_HAHR = reduce(mul, + [float(factor) for name, factor in DNI_FACTORS[1:-1]]) + +# Official SI year 365.25 days = 31.557.600 seconds +YEAR_SI = 31557600 +# Sidereal year: 365.256 363 051 days (365 d 6 h 9 min 9 s) +YEAR_SIDEREAL = (((((365 * 24) + 6 ) * 60 ) + 9 ) * 60 ) + 9 +YEAR = float(YEAR_SIDEREAL) + +FACTOR = YEAR / PRORAHN_PER_HAHR This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-12 18:19:54
|
Revision: 19 http://pymoul.svn.sourceforge.net/pymoul/?rev=19&view=rev Author: tiran Date: 2007-01-12 10:19:48 -0800 (Fri, 12 Jan 2007) Log Message: ----------- * Added compileui script to compile QtDesigner's UI files to Python files * Moved UI files to seperate subfolder Modified Paths: -------------- pymoul/trunk/setup.py pymoul/trunk/src/moul/qt/moulqt.py pymoul/trunk/src/pyMoul.egg-info/SOURCES.txt Added Paths: ----------- pymoul/trunk/compileui.py pymoul/trunk/src/moul/qt/ui/ pymoul/trunk/src/moul/qt/ui/README.txt pymoul/trunk/src/moul/qt/ui/__init__.py pymoul/trunk/src/moul/qt/ui/mainwindow.py pymoul/trunk/src/moul/qt/ui/mainwindow.ui Removed Paths: ------------- pymoul/trunk/src/moul/qt/MainWindow.ui pymoul/trunk/src/moul/qt/mainwindow.py Added: pymoul/trunk/compileui.py =================================================================== --- pymoul/trunk/compileui.py (rev 0) +++ pymoul/trunk/compileui.py 2007-01-12 18:19:48 UTC (rev 19) @@ -0,0 +1,55 @@ +#!/usr/bin/env python2.5 +"""Compile QtDesigner's UI files to Python files +""" +import os +from PyQt4 import uic + +UI_EXT = '.ui' +PY_EXT = '.py' + +def previewUi(uifname): + """Copied from PyQt.uic.pyuic + """ + from PyQt4 import QtGui + app = QtGui.QApplication([uifname]) + widget = uic.loadUi(uifname) + widget.show() + return app.exec_() + +def findUiFiles(base): + uis = [] + if not os.path.isdir(base): + raise IOError("%s is not a directory" % root) + for root, dirs, files in os.walk(base): + if '.svn' in dirs: + dirs.remove('.svn') + for file in files: + if file.endswith(UI_EXT): + uis.append((root, file)) + return uis + +def compileUiFiles(uis, execute=False, preview=False): + pys = [] + for root, ui_name in uis: + py_name = ui_name.lower()[:-len(UI_EXT)]+PY_EXT + ui_path = os.path.join(root, ui_name) + py_path = os.path.join(root, py_name) + ui = open(ui_path, 'r') + py = open(py_path, 'w') + err = uic.compileUi(ui, py, execute) + if err: + raise RuntimeError("%s: %s" % (ui_path, str(err))) + if preview: + previewUi(ui_path) + pys.append(py_path) + return pys + +def compileUi(base='src', execute=True, preview=False): + uis = findUiFiles(base) + pys = compileUiFiles(uis, execute=execute, preview=preview) + return pys + +if __name__ == '__main__': + pys = compileUi() + print "Python files written:\n" + print '\n'.join(pys) Modified: pymoul/trunk/setup.py =================================================================== --- pymoul/trunk/setup.py 2007-01-12 18:15:06 UTC (rev 18) +++ pymoul/trunk/setup.py 2007-01-12 18:19:48 UTC (rev 19) @@ -1,3 +1,4 @@ +#/usr/bin/env python2.5 """pyMoul: Python tools for Myst Online - URU Live (MOUL) TODO: Long description of pyMoul @@ -9,6 +10,7 @@ use_setuptools() from setuptools import setup from setuptools import find_packages +from compileui import compileUi VERSION = "0.0" @@ -65,10 +67,15 @@ fd.write("%s = '''%s'''\n" % (name, value)) fd.close() +# Write Metadata and compile UI files +writeMetadata() +compileUi() + kwargs = {} kwargs.update(setup_infos) kwargs.update(setup_options) +# Do some windows stuff if sys.platform.startswith('win'): from setup_win32 import updateSetupOptions from setup_win32 import updateSetupOptionsQT @@ -78,8 +85,6 @@ setup(**kwargs) -writeMetadata() - if sys.platform.startswith('win') and 'py2exe' in sys.argv: pass upxPack('dist') Deleted: pymoul/trunk/src/moul/qt/MainWindow.ui =================================================================== --- pymoul/trunk/src/moul/qt/MainWindow.ui 2007-01-12 18:15:06 UTC (rev 18) +++ pymoul/trunk/src/moul/qt/MainWindow.ui 2007-01-12 18:19:48 UTC (rev 19) @@ -1,137 +0,0 @@ -<ui version="4.0" > - <class>MainWindow</class> - <widget class="QMainWindow" name="MainWindow" > - <property name="windowModality" > - <enum>Qt::ApplicationModal</enum> - </property> - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>350</width> - <height>450</height> - </rect> - </property> - <property name="sizePolicy" > - <sizepolicy> - <hsizetype>13</hsizetype> - <vsizetype>13</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize" > - <size> - <width>350</width> - <height>450</height> - </size> - </property> - <property name="maximumSize" > - <size> - <width>350</width> - <height>450</height> - </size> - </property> - <property name="windowTitle" > - <string>MainWindow</string> - </property> - <widget class="QWidget" name="centralwidget" > - <property name="enabled" > - <bool>true</bool> - </property> - <widget class="QTabWidget" name="tabWidget" > - <property name="geometry" > - <rect> - <x>0</x> - <y>40</y> - <width>351</width> - <height>391</height> - </rect> - </property> - <property name="currentIndex" > - <number>0</number> - </property> - <widget class="QWidget" name="tab" > - <attribute name="title" > - <string>Tab 1</string> - </attribute> - </widget> - <widget class="QWidget" name="tab_3" > - <attribute name="title" > - <string>Page</string> - </attribute> - <widget class="QGroupBox" name="groupBox" > - <property name="geometry" > - <rect> - <x>10</x> - <y>10</y> - <width>181</width> - <height>81</height> - </rect> - </property> - <property name="title" > - <string>GroupBox</string> - </property> - <widget class="QSlider" name="horizontalSlider" > - <property name="geometry" > - <rect> - <x>10</x> - <y>30</y> - <width>160</width> - <height>16</height> - </rect> - </property> - <property name="maximum" > - <number>11</number> - </property> - <property name="pageStep" > - <number>1</number> - </property> - <property name="sliderPosition" > - <number>0</number> - </property> - <property name="tracking" > - <bool>true</bool> - </property> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="tickPosition" > - <enum>QSlider::TicksBelow</enum> - </property> - <property name="tickInterval" > - <number>1</number> - </property> - </widget> - </widget> - <widget class="QGroupBox" name="groupBox_2" > - <property name="geometry" > - <rect> - <x>10</x> - <y>100</y> - <width>331</width> - <height>251</height> - </rect> - </property> - <property name="title" > - <string>GroupBox</string> - </property> - </widget> - </widget> - <widget class="QWidget" name="tab_2" > - <attribute name="title" > - <string>Tab 2</string> - </attribute> - </widget> - <widget class="QWidget" name="tab_4" > - <attribute name="title" > - <string>Page</string> - </attribute> - </widget> - </widget> - </widget> - <widget class="QStatusBar" name="statusbar" /> - </widget> - <resources/> - <connections/> -</ui> Deleted: pymoul/trunk/src/moul/qt/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/mainwindow.py 2007-01-12 18:15:06 UTC (rev 18) +++ pymoul/trunk/src/moul/qt/mainwindow.py 2007-01-12 18:19:48 UTC (rev 19) @@ -1,48 +0,0 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'MainWindow.ui' -# -# Created: Fri Jan 12 11:52:01 2007 -# by: PyQt4 UI code generator 4.1.1 -# -# WARNING! All changes made in this file will be lost! - -import sys -from PyQt4 import QtCore, QtGui - -class Ui_MainWindow(object): - def setupUi(self, MainWindow): - MainWindow.setObjectName("MainWindow") - MainWindow.resize(QtCore.QSize(QtCore.QRect(0,0,350,450).size()).expandedTo(MainWindow.minimumSizeHint())) - - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(0),QtGui.QSizePolicy.Policy(0)) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth()) - MainWindow.setSizePolicy(sizePolicy) - - self.centralwidget = QtGui.QWidget(MainWindow) - self.centralwidget.setObjectName("centralwidget") - - self.horizontalSlider = QtGui.QSlider(self.centralwidget) - self.horizontalSlider.setGeometry(QtCore.QRect(100,230,160,16)) - self.horizontalSlider.setMaximum(11) - self.horizontalSlider.setPageStep(1) - self.horizontalSlider.setSliderPosition(0) - self.horizontalSlider.setTracking(True) - self.horizontalSlider.setOrientation(QtCore.Qt.Horizontal) - self.horizontalSlider.setTickPosition(QtGui.QSlider.TicksBelow) - self.horizontalSlider.setTickInterval(1) - self.horizontalSlider.setObjectName("horizontalSlider") - MainWindow.setCentralWidget(self.centralwidget) - - self.statusbar = QtGui.QStatusBar(MainWindow) - self.statusbar.setObjectName("statusbar") - MainWindow.setStatusBar(self.statusbar) - - self.retranslateUi(MainWindow) - QtCore.QMetaObject.connectSlotsByName(MainWindow) - - def retranslateUi(self, MainWindow): - MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8)) - Modified: pymoul/trunk/src/moul/qt/moulqt.py =================================================================== --- pymoul/trunk/src/moul/qt/moulqt.py 2007-01-12 18:15:06 UTC (rev 18) +++ pymoul/trunk/src/moul/qt/moulqt.py 2007-01-12 18:19:48 UTC (rev 19) @@ -1,21 +1,12 @@ import sys -from PyQt4 import QtGui -from PyQt4.uic import loadUiType +from PyQt4 import QtCore, QtGui -# XXX IMPORTS! -import _elementtree -import sip -#from moul.qt.mainwindow import Ui_MainWindow +from moul.qt.ui.mainwindow import Ui_MainWindow +from moul.file import plasmalog -import moul.config -import moul.files.plasmalog - -Ui_MainWindow, Qt_MainWindow = loadUiType('mainwindow.ui') - app = QtGui.QApplication(sys.argv) -window = QtGui.QMainWindow() +MainWindow = QtGui.QMainWindow() ui = Ui_MainWindow() -ui.setupUi(window) - -window.show() +ui.setupUi(MainWindow) +MainWindow.show() sys.exit(app.exec_()) Added: pymoul/trunk/src/moul/qt/ui/README.txt =================================================================== --- pymoul/trunk/src/moul/qt/ui/README.txt (rev 0) +++ pymoul/trunk/src/moul/qt/ui/README.txt 2007-01-12 18:19:48 UTC (rev 19) @@ -0,0 +1,8 @@ +WARNING! +======== + +All Python files in this directory are autogenerated! + +DO NOT CHANGE THEM MANUALLY! + +Use compileui.py to compile the UI files to Python files. \ No newline at end of file Property changes on: pymoul/trunk/src/moul/qt/ui/README.txt ___________________________________________________________________ Name: svn:eol-style + native Added: pymoul/trunk/src/moul/qt/ui/__init__.py =================================================================== --- pymoul/trunk/src/moul/qt/ui/__init__.py (rev 0) +++ pymoul/trunk/src/moul/qt/ui/__init__.py 2007-01-12 18:19:48 UTC (rev 19) @@ -0,0 +1,7 @@ +# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages +try: + __import__('pkg_resources').declare_namespace(__name__) +except ImportError: + from pkgutil import extend_path + __path__ = extend_path(__path__, __name__) + Property changes on: pymoul/trunk/src/moul/qt/ui/__init__.py ___________________________________________________________________ Name: svn:eol-style + native Added: pymoul/trunk/src/moul/qt/ui/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.py (rev 0) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-01-12 18:19:48 UTC (rev 19) @@ -0,0 +1,96 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'src\moul\qt\ui\mainwindow.ui' +# +# Created: Fri Jan 12 19:11:35 2007 +# by: PyQt4 UI code generator 4.1.1 +# +# WARNING! All changes made in this file will be lost! + +import sys +from PyQt4 import QtCore, QtGui + +class Ui_MainWindow(object): + def setupUi(self, MainWindow): + MainWindow.setObjectName("MainWindow") + MainWindow.setWindowModality(QtCore.Qt.ApplicationModal) + MainWindow.resize(QtCore.QSize(QtCore.QRect(0,0,350,450).size()).expandedTo(MainWindow.minimumSizeHint())) + + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(13),QtGui.QSizePolicy.Policy(13)) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth()) + MainWindow.setSizePolicy(sizePolicy) + MainWindow.setMinimumSize(QtCore.QSize(350,450)) + MainWindow.setMaximumSize(QtCore.QSize(350,450)) + + self.centralwidget = QtGui.QWidget(MainWindow) + self.centralwidget.setEnabled(True) + self.centralwidget.setObjectName("centralwidget") + + self.tabWidget = QtGui.QTabWidget(self.centralwidget) + self.tabWidget.setGeometry(QtCore.QRect(0,40,351,391)) + self.tabWidget.setObjectName("tabWidget") + + self.tab = QtGui.QWidget() + self.tab.setObjectName("tab") + self.tabWidget.addTab(self.tab,"") + + self.tab_3 = QtGui.QWidget() + self.tab_3.setObjectName("tab_3") + + self.groupBox = QtGui.QGroupBox(self.tab_3) + self.groupBox.setGeometry(QtCore.QRect(10,10,181,81)) + self.groupBox.setObjectName("groupBox") + + self.horizontalSlider = QtGui.QSlider(self.groupBox) + self.horizontalSlider.setGeometry(QtCore.QRect(10,30,160,16)) + self.horizontalSlider.setMaximum(11) + self.horizontalSlider.setPageStep(1) + self.horizontalSlider.setSliderPosition(0) + self.horizontalSlider.setTracking(True) + self.horizontalSlider.setOrientation(QtCore.Qt.Horizontal) + self.horizontalSlider.setTickPosition(QtGui.QSlider.TicksBelow) + self.horizontalSlider.setTickInterval(1) + self.horizontalSlider.setObjectName("horizontalSlider") + + self.groupBox_2 = QtGui.QGroupBox(self.tab_3) + self.groupBox_2.setGeometry(QtCore.QRect(10,100,331,251)) + self.groupBox_2.setObjectName("groupBox_2") + self.tabWidget.addTab(self.tab_3,"") + + self.tab_2 = QtGui.QWidget() + self.tab_2.setObjectName("tab_2") + self.tabWidget.addTab(self.tab_2,"") + + self.tab_4 = QtGui.QWidget() + self.tab_4.setObjectName("tab_4") + self.tabWidget.addTab(self.tab_4,"") + MainWindow.setCentralWidget(self.centralwidget) + + self.statusbar = QtGui.QStatusBar(MainWindow) + self.statusbar.setObjectName("statusbar") + MainWindow.setStatusBar(self.statusbar) + + self.retranslateUi(MainWindow) + self.tabWidget.setCurrentIndex(0) + QtCore.QMetaObject.connectSlotsByName(MainWindow) + + def retranslateUi(self, MainWindow): + MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8)) + self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QtGui.QApplication.translate("MainWindow", "Tab 1", None, QtGui.QApplication.UnicodeUTF8)) + self.groupBox.setTitle(QtGui.QApplication.translate("MainWindow", "GroupBox", None, QtGui.QApplication.UnicodeUTF8)) + self.groupBox_2.setTitle(QtGui.QApplication.translate("MainWindow", "GroupBox", None, QtGui.QApplication.UnicodeUTF8)) + self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3), QtGui.QApplication.translate("MainWindow", "Page", None, QtGui.QApplication.UnicodeUTF8)) + self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), QtGui.QApplication.translate("MainWindow", "Tab 2", None, QtGui.QApplication.UnicodeUTF8)) + self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_4), QtGui.QApplication.translate("MainWindow", "Page", None, QtGui.QApplication.UnicodeUTF8)) + + + +if __name__ == "__main__": + app = QtGui.QApplication(sys.argv) + MainWindow = QtGui.QMainWindow() + ui = Ui_MainWindow() + ui.setupUi(MainWindow) + MainWindow.show() + sys.exit(app.exec_()) Property changes on: pymoul/trunk/src/moul/qt/ui/mainwindow.py ___________________________________________________________________ Name: svn:eol-style + native Added: pymoul/trunk/src/moul/qt/ui/mainwindow.ui =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.ui (rev 0) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-01-12 18:19:48 UTC (rev 19) @@ -0,0 +1,137 @@ +<ui version="4.0" > + <class>MainWindow</class> + <widget class="QMainWindow" name="MainWindow" > + <property name="windowModality" > + <enum>Qt::ApplicationModal</enum> + </property> + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>350</width> + <height>450</height> + </rect> + </property> + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>13</hsizetype> + <vsizetype>13</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize" > + <size> + <width>350</width> + <height>450</height> + </size> + </property> + <property name="maximumSize" > + <size> + <width>350</width> + <height>450</height> + </size> + </property> + <property name="windowTitle" > + <string>MainWindow</string> + </property> + <widget class="QWidget" name="centralwidget" > + <property name="enabled" > + <bool>true</bool> + </property> + <widget class="QTabWidget" name="tabWidget" > + <property name="geometry" > + <rect> + <x>0</x> + <y>40</y> + <width>351</width> + <height>391</height> + </rect> + </property> + <property name="currentIndex" > + <number>0</number> + </property> + <widget class="QWidget" name="tab" > + <attribute name="title" > + <string>Tab 1</string> + </attribute> + </widget> + <widget class="QWidget" name="tab_3" > + <attribute name="title" > + <string>Page</string> + </attribute> + <widget class="QGroupBox" name="groupBox" > + <property name="geometry" > + <rect> + <x>10</x> + <y>10</y> + <width>181</width> + <height>81</height> + </rect> + </property> + <property name="title" > + <string>GroupBox</string> + </property> + <widget class="QSlider" name="horizontalSlider" > + <property name="geometry" > + <rect> + <x>10</x> + <y>30</y> + <width>160</width> + <height>16</height> + </rect> + </property> + <property name="maximum" > + <number>11</number> + </property> + <property name="pageStep" > + <number>1</number> + </property> + <property name="sliderPosition" > + <number>0</number> + </property> + <property name="tracking" > + <bool>true</bool> + </property> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="tickPosition" > + <enum>QSlider::TicksBelow</enum> + </property> + <property name="tickInterval" > + <number>1</number> + </property> + </widget> + </widget> + <widget class="QGroupBox" name="groupBox_2" > + <property name="geometry" > + <rect> + <x>10</x> + <y>100</y> + <width>331</width> + <height>251</height> + </rect> + </property> + <property name="title" > + <string>GroupBox</string> + </property> + </widget> + </widget> + <widget class="QWidget" name="tab_2" > + <attribute name="title" > + <string>Tab 2</string> + </attribute> + </widget> + <widget class="QWidget" name="tab_4" > + <attribute name="title" > + <string>Page</string> + </attribute> + </widget> + </widget> + </widget> + <widget class="QStatusBar" name="statusbar" /> + </widget> + <resources/> + <connections/> +</ui> Modified: pymoul/trunk/src/pyMoul.egg-info/SOURCES.txt =================================================================== --- pymoul/trunk/src/pyMoul.egg-info/SOURCES.txt 2007-01-12 18:15:06 UTC (rev 18) +++ pymoul/trunk/src/pyMoul.egg-info/SOURCES.txt 2007-01-12 18:19:48 UTC (rev 19) @@ -1,5 +1,6 @@ GPL.txt INSTALL.txt +README.qt.txt README.txt ez_setup.py setup.py @@ -27,14 +28,7 @@ src/moul/files/localization.py src/moul/files/plasmalog.py src/moul/files/wdysini.py -src/moul/gtk/MOULGT~1.GLAp -src/moul/gtk/SimpleGladeApp.py -src/moul/gtk/__init__.py -src/moul/gtk/build.bat -src/moul/gtk/moulgtk.glade -src/moul/gtk/moulgtk.py -src/moul/gtk/moulgtk.py.orig -src/moul/gtk/patchgtkpath.py +src/moul/qt/MainWindow.ui src/moul/qt/__init__.py src/moul/qt/mainwindow.py src/moul/qt/moulqt.py This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-12 18:15:06
|
Revision: 18 http://pymoul.svn.sourceforge.net/pymoul/?rev=18&view=rev Author: tiran Date: 2007-01-12 10:15:06 -0800 (Fri, 12 Jan 2007) Log Message: ----------- Let's stick to singular package and module names Modified Paths: -------------- pymoul/trunk/src/moul/cli/moullauncher.py Modified: pymoul/trunk/src/moul/cli/moullauncher.py =================================================================== --- pymoul/trunk/src/moul/cli/moullauncher.py 2007-01-12 18:14:31 UTC (rev 17) +++ pymoul/trunk/src/moul/cli/moullauncher.py 2007-01-12 18:15:06 UTC (rev 18) @@ -22,8 +22,8 @@ from optparse import OptionParser from optparse import OptionValueError -from moul.files import plasmalog -from moul.files import chatlog +from moul.file import plasmalog +from moul.file import chatlog from moul import config from moul import metadata This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ti...@us...> - 2007-01-12 18:14:33
|
Revision: 17 http://pymoul.svn.sourceforge.net/pymoul/?rev=17&view=rev Author: tiran Date: 2007-01-12 10:14:31 -0800 (Fri, 12 Jan 2007) Log Message: ----------- Let's stick to singular package and module names Added Paths: ----------- pymoul/trunk/src/moul/file/ Removed Paths: ------------- pymoul/trunk/src/moul/files/ Copied: pymoul/trunk/src/moul/file (from rev 13, pymoul/trunk/src/moul/files) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |