[Pymoul-svn] SF.net SVN: pymoul: [259] pymoul/trunk/src/moul
Status: Alpha
Brought to you by:
tiran
From: <ti...@us...> - 2007-03-15 08:43:34
|
Revision: 259 http://pymoul.svn.sourceforge.net/pymoul/?rev=259&view=rev Author: tiran Date: 2007-03-15 01:43:34 -0700 (Thu, 15 Mar 2007) Log Message: ----------- Unit test fixes Fixed tab view order Modified Paths: -------------- pymoul/trunk/src/moul/osdependent/tests/test_singleapp.py pymoul/trunk/src/moul/qt/ui/mainwindow.py pymoul/trunk/src/moul/qt/ui/mainwindow.ui Modified: pymoul/trunk/src/moul/osdependent/tests/test_singleapp.py =================================================================== --- pymoul/trunk/src/moul/osdependent/tests/test_singleapp.py 2007-03-15 08:39:32 UTC (rev 258) +++ pymoul/trunk/src/moul/osdependent/tests/test_singleapp.py 2007-03-15 08:43:34 UTC (rev 259) @@ -37,7 +37,9 @@ from moul.osdependent.singleapp import unlock if os.name == 'nt': - rmcmd = "cmd /c del %(testfile)s" + rmcmd = (r'%(exe)s -c "import os; ' + 'os.unlink(%(testfile)s)"' % {'exe' : sys.executable, + 'testfile' : r"'%(testfile)s'"}) else: rmcmd = ("%(exe)s -c 'from fcntl import *; " "fd = open(%(testfile)s, %(mode)s); " @@ -61,22 +63,36 @@ #False class SingleAppTest(unittest.TestCase): + def setUp(self): + hndl, tmpfile = tempfile.mkstemp() + self.tmpfile = os.path.normcase(tmpfile).replace('\\', '/') + os.close(hndl) + self.fd = open(self.tmpfile, mode='w+') - def test_locking(self): + def tearDown(self): + try: + unlock(self.fd) + self.fd.close() + except: + pass + os.unlink(self.tmpfile) + + def test_locking(self): FLAGS = LOCK_SH | LOCK_NB - fd = tempfile.NamedTemporaryFile(mode='w+', suffix='lck') - testfile = fd.name - fd.write('testdata') - fd.flush() - self.failUnless(os.path.isfile(testfile)) - lock(fd, FLAGS) - popen = Popen(rmcmd % {'testfile' : testfile}, stdout=PIPE, - stderr=PIPE, shell=True, env = {'LC_ALL' : 'C'}) - + self.fd.write('testdata') + self.fd.flush() + self.failUnless(os.path.isfile(self.tmpfile)) + lock(self.fd, FLAGS) + env = os.environ.copy() + env['LC_ALL'] = 'C' + popen = Popen(rmcmd % {'testfile' : self.tmpfile}, stdout=PIPE, + stderr=PIPE, shell=True, env=env) popen.wait() + self.failUnless(os.path.isfile(self.tmpfile)) + out = popen.stdout.read() if os.name == 'nt': - self.failUnlessEqual(out, '') + self.failUnless(self.tmpfile in out or out == '', out) elif os.name =='posix': self.failUnlessEqual(out, '') else: @@ -84,16 +100,12 @@ err = popen.stderr.read() if os.name == 'nt': - self.failUnless('IOError: [Errno 11] Resource temporarily unavailable' in err, err) + self.failUnless('WindowsError: [Error 13]' in err, err) elif os.name =='posix': - self.failUnless('IOError: [Errno 11] Resource temporarily unavailable' in err, err) + self.failUnless('IOError: [Errno 11]' in err, err) else: raise OSError("unsupported os") - self.failUnless(os.path.isfile(testfile)) - unlock(fd) - fd.close() - def test_suite(): return unittest.TestSuite(( unittest.makeSuite(SingleAppTest), Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.py =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-03-15 08:39:32 UTC (rev 258) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.py 2007-03-15 08:43:34 UTC (rev 259) @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file 'src/moul/qt/ui/mainwindow.ui' +# Form implementation generated from reading ui file 'src\moul\qt\ui\mainwindow.ui' # -# Created: Sat Mar 10 15:51:37 2007 +# Created: Thu Mar 15 09:09:39 2007 # by: PyQt4 UI code generator 4.1.1 # # WARNING! All changes made in this file will be lost! @@ -959,11 +959,11 @@ self.groupBox_4.setGeometry(QtCore.QRect(10,0,451,371)) self.groupBox_4.setObjectName("groupBox_4") - self.widget = QtGui.QWidget(self.groupBox_4) - self.widget.setGeometry(QtCore.QRect(7,20,441,58)) - self.widget.setObjectName("widget") + self.layoutWidget4 = QtGui.QWidget(self.groupBox_4) + self.layoutWidget4.setGeometry(QtCore.QRect(7,20,441,58)) + self.layoutWidget4.setObjectName("layoutWidget4") - self.gridlayout3 = QtGui.QGridLayout(self.widget) + self.gridlayout3 = QtGui.QGridLayout(self.layoutWidget4) self.gridlayout3.setMargin(0) self.gridlayout3.setSpacing(6) self.gridlayout3.setObjectName("gridlayout3") @@ -971,39 +971,39 @@ spacerItem9 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) self.gridlayout3.addItem(spacerItem9,0,2,1,1) - self.label_6 = QtGui.QLabel(self.widget) + self.label_6 = QtGui.QLabel(self.layoutWidget4) self.label_6.setObjectName("label_6") self.gridlayout3.addWidget(self.label_6,1,0,1,1) - self.le_eg_status = QtGui.QLineEdit(self.widget) + self.le_eg_status = QtGui.QLineEdit(self.layoutWidget4) self.le_eg_status.setReadOnly(True) self.le_eg_status.setObjectName("le_eg_status") self.gridlayout3.addWidget(self.le_eg_status,1,1,1,1) - self.le_eg_length = QtGui.QLineEdit(self.widget) + self.le_eg_length = QtGui.QLineEdit(self.layoutWidget4) self.le_eg_length.setReadOnly(True) self.le_eg_length.setObjectName("le_eg_length") self.gridlayout3.addWidget(self.le_eg_length,1,4,1,1) - self.le_eg_light = QtGui.QLineEdit(self.widget) + self.le_eg_light = QtGui.QLineEdit(self.layoutWidget4) self.le_eg_light.setReadOnly(True) self.le_eg_light.setObjectName("le_eg_light") self.gridlayout3.addWidget(self.le_eg_light,0,4,1,1) - self.le_eg_time = QtGui.QLineEdit(self.widget) + self.le_eg_time = QtGui.QLineEdit(self.layoutWidget4) self.le_eg_time.setReadOnly(True) self.le_eg_time.setObjectName("le_eg_time") self.gridlayout3.addWidget(self.le_eg_time,0,1,1,1) - self.label_13 = QtGui.QLabel(self.widget) + self.label_13 = QtGui.QLabel(self.layoutWidget4) self.label_13.setObjectName("label_13") self.gridlayout3.addWidget(self.label_13,0,3,1,1) - self.label_14 = QtGui.QLabel(self.widget) + self.label_14 = QtGui.QLabel(self.layoutWidget4) self.label_14.setObjectName("label_14") self.gridlayout3.addWidget(self.label_14,1,3,1,1) - self.label_4 = QtGui.QLabel(self.widget) + self.label_4 = QtGui.QLabel(self.layoutWidget4) self.label_4.setObjectName("label_4") self.gridlayout3.addWidget(self.label_4,0,0,1,1) @@ -1205,9 +1205,9 @@ self.lb_doc_status.setBuddy(self.pb_doc_loadjournals) self.retranslateUi(MainWindow) - self.tabwidget.setCurrentIndex(3) + self.tabwidget.setCurrentIndex(0) self.tab_sub_settings.setCurrentIndex(1) - self.tabWidget_2.setCurrentIndex(2) + self.tabWidget_2.setCurrentIndex(0) self.tabWidget.setCurrentIndex(2) self.tabwidget_about.setCurrentIndex(0) QtCore.QObject.connect(self.main_buttonbox,QtCore.SIGNAL("rejected()"),MainWindow.close) @@ -1335,8 +1335,8 @@ self.groupBox_5.setTitle(QtGui.QApplication.translate("MainWindow", "Read chatlogs", None, QtGui.QApplication.UnicodeUTF8)) self.tb_chatlog_view.setHtml(QtGui.QApplication.translate("MainWindow", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" - "</style></head><body style=\" font-family:\'Sans Serif\'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;\">\n" - "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Not implemented</p></body></html>", None, QtGui.QApplication.UnicodeUTF8)) + "</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;\">\n" + "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:\'Sans Serif\'; font-size:9pt;\">Not implemented</p></body></html>", None, QtGui.QApplication.UnicodeUTF8)) self.cb_chatlog.addItem(QtGui.QApplication.translate("MainWindow", "Not implemented", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_sub_chatlogs), QtGui.QApplication.translate("MainWindow", "Chat logs", None, QtGui.QApplication.UnicodeUTF8)) self.gb_documents.setTitle(QtGui.QApplication.translate("MainWindow", "Browse journals and notes", None, QtGui.QApplication.UnicodeUTF8)) @@ -1352,13 +1352,13 @@ self.tabwidget.setTabText(self.tabwidget.indexOf(self.tab_browse), QtGui.QApplication.translate("MainWindow", "Browse", None, QtGui.QApplication.UnicodeUTF8)) self.tb_abouttext.setHtml(QtGui.QApplication.translate("MainWindow", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" - "</style></head><body style=\" font-family:\'Sans Serif\'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;\">\n" - "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"></p></body></html>", None, QtGui.QApplication.UnicodeUTF8)) + "</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;\">\n" + "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:\'Sans Serif\'; font-size:9pt;\"></p></body></html>", None, QtGui.QApplication.UnicodeUTF8)) self.tabwidget_about.setTabText(self.tabwidget_about.indexOf(self.tab_sub_about), QtGui.QApplication.translate("MainWindow", "About pyMoul", None, QtGui.QApplication.UnicodeUTF8)) self.tb_license.setHtml(QtGui.QApplication.translate("MainWindow", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" - "</style></head><body style=\" font-family:\'Sans Serif\'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;\">\n" - "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"></p></body></html>", None, QtGui.QApplication.UnicodeUTF8)) + "</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;\">\n" + "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:\'Sans Serif\'; font-size:9pt;\"></p></body></html>", None, QtGui.QApplication.UnicodeUTF8)) self.tabwidget_about.setTabText(self.tabwidget_about.indexOf(self.tab_sub_license), QtGui.QApplication.translate("MainWindow", "License", None, QtGui.QApplication.UnicodeUTF8)) self.tabwidget.setTabText(self.tabwidget.indexOf(self.tab_about), QtGui.QApplication.translate("MainWindow", "About", None, QtGui.QApplication.UnicodeUTF8)) Modified: pymoul/trunk/src/moul/qt/ui/mainwindow.ui =================================================================== --- pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-03-15 08:39:32 UTC (rev 258) +++ pymoul/trunk/src/moul/qt/ui/mainwindow.ui 2007-03-15 08:43:34 UTC (rev 259) @@ -110,7 +110,7 @@ <enum>QTabWidget::North</enum> </property> <property name="currentIndex" > - <number>3</number> + <number>0</number> </property> <widget class="QWidget" name="tab_tasks" > <attribute name="title" > @@ -1513,7 +1513,7 @@ </rect> </property> <property name="currentIndex" > - <number>2</number> + <number>0</number> </property> <widget class="QWidget" name="tab_time_dni" > <attribute name="title" > @@ -2080,7 +2080,7 @@ <property name="title" > <string>Eder Gira day cycle</string> </property> - <widget class="QWidget" name="" > + <widget class="QWidget" name="layoutWidget" > <property name="geometry" > <rect> <x>7</x> @@ -2320,8 +2320,8 @@ <property name="html" > <string><html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Not implemented</p></body></html></string> +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;">Not implemented</p></body></html></string> </property> <property name="textInteractionFlags" > <enum>Qt::TextSelectableByMouse</enum> @@ -2564,8 +2564,8 @@ <property name="html" > <string><html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> -<p style="-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> +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;"></p></body></html></string> </property> <property name="textInteractionFlags" > <enum>Qt::TextBrowserInteraction</enum> @@ -2591,8 +2591,8 @@ <property name="html" > <string><html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> -<p style="-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> +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;"></p></body></html></string> </property> <property name="textInteractionFlags" > <enum>Qt::TextSelectableByMouse</enum> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |