fclient-commit Mailing List for fclient (Page 2)
Status: Pre-Alpha
Brought to you by:
jurner
You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(23) |
Nov
(54) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(17) |
Feb
(209) |
Mar
(63) |
Apr
(31) |
May
(7) |
Jun
(39) |
Jul
(390) |
Aug
(122) |
Sep
(6) |
Oct
|
Nov
|
Dec
|
From: <jU...@us...> - 2008-08-19 11:41:45
|
Revision: 945 http://fclient.svn.sourceforge.net/fclient/?rev=945&view=rev Author: jUrner Date: 2008-08-19 11:41:55 +0000 (Tue, 19 Aug 2008) Log Message: ----------- remove some superfluous code Modified Paths: -------------- trunk/fclient/fclient/impl/config.py Modified: trunk/fclient/fclient/impl/config.py =================================================================== --- trunk/fclient/fclient/impl/config.py 2008-08-19 09:21:44 UTC (rev 944) +++ trunk/fclient/fclient/impl/config.py 2008-08-19 11:41:55 UTC (rev 945) @@ -62,8 +62,7 @@ def __getitem__(self, viewObjectName): return self._viewObjects[self._names.index(viewObjectName)] - - + def get(self, viewObjectName, default=None): try: return self[viewObjectName] @@ -167,21 +166,6 @@ if mthd is not None: self.titleBar = mthd() - def setVisible(self, flag): - pass - - -class ViewObject(QtCore.QObject): - """base class for view objects""" - - def __init__(self, parent): - QtCore.QObject.__init__(self, parent) - - self.name = '' #unique name of the view - self.displayName = '' # name as shown t the user - self.icon = None # QIcon associated to the view - - #******************************************************************************** # #******************************************************************************** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-19 09:21:36
|
Revision: 944 http://fclient.svn.sourceforge.net/fclient/?rev=944&view=rev Author: jUrner Date: 2008-08-19 09:21:44 +0000 (Tue, 19 Aug 2008) Log Message: ----------- fix: request flag Started is set when a request is restored Modified Paths: -------------- trunk/fclient/fclient/impl/lib/fcp2/test/test_client.py Modified: trunk/fclient/fclient/impl/lib/fcp2/test/test_client.py =================================================================== --- trunk/fclient/fclient/impl/lib/fcp2/test/test_client.py 2008-08-19 07:38:38 UTC (rev 943) +++ trunk/fclient/fclient/impl/lib/fcp2/test/test_client.py 2008-08-19 09:21:44 UTC (rev 944) @@ -1120,7 +1120,7 @@ self.client.events.RequestStarted, fcp2.MsgClientGet, ('Identifier', myRequest['Identifier']), - ('RequestStatus', fcp2.ConstRequestStatus.Restored), # no RequestStatus.Pending flag should be set here + ('RequestStatus', fcp2.ConstRequestStatus.Started | fcp2.ConstRequestStatus.Restored), # no RequestStatus.Pending flag should be set here ) @@ -1998,7 +1998,9 @@ self.assertHasNextMessage(fcp2.MsgRemoveRequest) # of our request should be marked as removed - self.assertEqual(myRequest['RequestStatus'], fcp2.ConstRequestStatus.Removed | + self.assertEqual(myRequest['RequestStatus'], + fcp2.ConstRequestStatus.Started | + fcp2.ConstRequestStatus.Removed | fcp2.ConstRequestStatus.Completed ) @@ -2014,7 +2016,9 @@ self.assertHasNextEvent( self.client.events.RequestRemoved, fcp2.MsgClientGet, - ('RequestStatus', fcp2.ConstRequestStatus.Removed | + ('RequestStatus', + fcp2.ConstRequestStatus.Started | + fcp2.ConstRequestStatus.Removed | fcp2.ConstRequestStatus.RemovedFromQueue | fcp2.ConstRequestStatus.Completed ), @@ -2099,7 +2103,7 @@ self.client.events.RequestStarted, fcp2.MsgClientGet, ('Identifier', myRequest['Identifier']), - ('RequestStatus', fcp2.ConstRequestStatus.Restored), # no RequestStatus.Pending flag should be set here + ('RequestStatus', fcp2.ConstRequestStatus.Started | fcp2.ConstRequestStatus.Restored), # no RequestStatus.Pending flag should be set here ) self.failUnless(myRequest['Identifier'] in requestsAll) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-19 07:38:28
|
Revision: 943 http://fclient.svn.sourceforge.net/fclient/?rev=943&view=rev Author: jUrner Date: 2008-08-19 07:38:38 +0000 (Tue, 19 Aug 2008) Log Message: ----------- persistent dls where not resored. fixed Modified Paths: -------------- trunk/fclient/fclient/impl/BaseRequestsWidget/BaseRequestsWidget.py trunk/fclient/fclient/impl/ViewDownloads/ViewDownloads.py trunk/fclient/fclient/impl/ViewUploads/ViewUploads.py Modified: trunk/fclient/fclient/impl/BaseRequestsWidget/BaseRequestsWidget.py =================================================================== --- trunk/fclient/fclient/impl/BaseRequestsWidget/BaseRequestsWidget.py 2008-08-19 07:37:55 UTC (rev 942) +++ trunk/fclient/fclient/impl/BaseRequestsWidget/BaseRequestsWidget.py 2008-08-19 07:38:38 UTC (rev 943) @@ -181,7 +181,16 @@ # #********************************************************************************** class RequestsWidget(QtGui.QWidget, Ui_ViewRequestsWidget): + """base class for upload/download widgets + @note: make shure objectName() of each derrived subclass is unique. it is used to associate persistent + requests to the individual widget + + + + """ + + IdTree = 'tree' def __init__(self, parent, idGlobalFeedback=config.IdViewObjectMainWindow): @@ -548,6 +557,7 @@ except pmstruct.PMStructError: pass else: + print requestData.get('ClientName', None), self.objectName() if requestData.get('ClientName', None) == self.objectName(): item = self.addFcpRequest(fcpRequest) else: Modified: trunk/fclient/fclient/impl/ViewDownloads/ViewDownloads.py =================================================================== --- trunk/fclient/fclient/impl/ViewDownloads/ViewDownloads.py 2008-08-19 07:37:55 UTC (rev 942) +++ trunk/fclient/fclient/impl/ViewDownloads/ViewDownloads.py 2008-08-19 07:38:38 UTC (rev 943) @@ -95,6 +95,7 @@ self.menuRemoveGroup = None BaseRequestsWidget.RequestsWidget.__init__(self, parent) + self.setObjectName('ViewDownloadsWidget') self.fcSettings = DownloadsWidgetSettings(self).restore() self.fcGlobalFeedback = DownloadsWidgetGlobalFeedback(self, idGlobalFeedback) Modified: trunk/fclient/fclient/impl/ViewUploads/ViewUploads.py =================================================================== --- trunk/fclient/fclient/impl/ViewUploads/ViewUploads.py 2008-08-19 07:37:55 UTC (rev 942) +++ trunk/fclient/fclient/impl/ViewUploads/ViewUploads.py 2008-08-19 07:38:38 UTC (rev 943) @@ -95,6 +95,7 @@ self.menuRemoveGroup = None BaseRequestsWidget.RequestsWidget.__init__(self, parent) + self.setObjectName('ViewUploadsWidget') self.fcSettings = UploadsWidgetSettings(self).restore() self.fcGlobalFeedback = UploadsWidgetGlobalFeedback(self, idGlobalFeedback) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-19 07:37:48
|
Revision: 942 http://fclient.svn.sourceforge.net/fclient/?rev=942&view=rev Author: jUrner Date: 2008-08-19 07:37:55 +0000 (Tue, 19 Aug 2008) Log Message: ----------- fix min Qt version and a hint on installing Modified Paths: -------------- trunk/web/download-fclient.html Modified: trunk/web/download-fclient.html =================================================================== --- trunk/web/download-fclient.html 2008-08-18 19:36:54 UTC (rev 941) +++ trunk/web/download-fclient.html 2008-08-19 07:37:55 UTC (rev 942) @@ -12,7 +12,7 @@ <div class="topic"> <br> - <br> + <br> <h3>Prerequesites:</h3> @@ -24,13 +24,19 @@ <li> Python >= 2.5 from [<a href="http://python.org/download/">http://python.org/download/</a>] <li> - Qt >= 4.4.3 from trolltech [<a href="http://trolltech.com/downloads/">http://trolltech.com/downloads/</a>] + Qt >= 4.4.0 from trolltech [<a href="http://trolltech.com/downloads/">http://trolltech.com/downloads/</a>] <li> PyQt >= 4.4.3 from riverbank computing [<a href="http://www.riverbankcomputing.co.uk/software/pyqt/download/">http://www.riverbankcomputing.co.uk/software/pyqt/download/</a>] </ul> - <br> + to make thing easier on debian or ubuntu, you may use the following repositories to fetch Qt4.4.0 and PyQt4.3 (use at your own risk): + + <pre> +deb http://mirror.switch.ch/ftp/mirror/debian/ sid main non-free contrib +deb-src http://mirror.switch.ch/ftp/mirror/debian/ sid main non-free contrib + </pre> + Finally, download the latest release of fclient from sourceforge [<a href="http://sourceforge.net/projects/fclient">http://sourceforge.net/projects/fclient</a>] <br> <br> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-18 19:36:58
|
Revision: 941 http://fclient.svn.sourceforge.net/fclient/?rev=941&view=rev Author: jUrner Date: 2008-08-18 19:36:54 +0000 (Mon, 18 Aug 2008) Log Message: ----------- more package layout changes Modified Paths: -------------- trunk/fclient/fclient/fclient.py trunk/fclient/fclient/impl/MainWindow/MainWindow.py Added Paths: ----------- trunk/fclient/fclient/impl/dlgs/ trunk/fclient/fclient/impl/dlgs/DlgPrefs.py trunk/fclient/fclient/impl/dlgs/DlgSingleAppError.py trunk/fclient/fclient/impl/dlgs/DlgSingleAppErrorTpl.ui trunk/fclient/fclient/impl/dlgs/Ui_DlgSingleAppErrorTpl.py trunk/fclient/fclient/impl/dlgs/__init__.py trunk/fclient/fclient/impl/dlgs/_fix_mexec.py Removed Paths: ------------- trunk/fclient/fclient/impl/tpls/ Modified: trunk/fclient/fclient/fclient.py =================================================================== --- trunk/fclient/fclient/fclient.py 2008-08-17 13:00:14 UTC (rev 940) +++ trunk/fclient/fclient/fclient.py 2008-08-18 19:36:54 UTC (rev 941) @@ -20,7 +20,7 @@ from .impl.ViewLogger.ViewObject import ViewObjectLogger from .impl.ViewUploads.ViewObject import ViewObjectUploads -from .impl.DlgSingleAppError import DlgSingleAppError +from .impl.dlgs.DlgSingleAppError import DlgSingleAppError #************************************************************* # #************************************************************* Modified: trunk/fclient/fclient/impl/MainWindow/MainWindow.py =================================================================== --- trunk/fclient/fclient/impl/MainWindow/MainWindow.py 2008-08-17 13:00:14 UTC (rev 940) +++ trunk/fclient/fclient/impl/MainWindow/MainWindow.py 2008-08-18 19:36:54 UTC (rev 941) @@ -14,7 +14,7 @@ from PyQt4 import QtCore, QtGui from .. import config -from .. import Prefs +from ..dlgs import DlgPrefs from ..lib.qt4ex import dlgabout from . import Actions @@ -63,7 +63,7 @@ ## event onrs ################################### def onActPreferencesTriggered(self): - dlg = Prefs.PrefsDlg(self) + dlg = DlgPrefs.DlgPrefs(self) if dlg.exec_() == dlg.Accepted: pass @@ -94,8 +94,11 @@ #********************************************************************************** if __name__ == '__main__': import sys + app = QtGui.QApplication(sys.argv) - w = MainWindow(None) - w.show() + + mainWindow = MainWindow(None) + + mainWindow.show() res = app.exec_() - sys.exit(res) + sys.exit(res) \ No newline at end of file Added: trunk/fclient/fclient/impl/dlgs/DlgPrefs.py =================================================================== --- trunk/fclient/fclient/impl/dlgs/DlgPrefs.py (rev 0) +++ trunk/fclient/fclient/impl/dlgs/DlgPrefs.py 2008-08-18 19:36:54 UTC (rev 941) @@ -0,0 +1,96 @@ +# some fixes for relative imports +# see --> [http://bugs.python.org/issue1510172] absolute/rellative import not working (works only current dir and below) +# see --> [http://mail.python.org/pipermail/python-ideas/2007-February/000232.html] PEP for executing a module in a +# ...package containing relative imports +from __future__ import absolute_import +if __name__ == '__main__': + import os + __path__ = [os.path.dirname(__file__)] + from ._fix_mexec import fix_mexec + fix_mexec(__name__, __file__) + del fix_mexec + + +from PyQt4 import QtCore, QtGui + +from .. import config +from ..lib.qt4ex import dlgpreferences +#********************************************************************************** +# +#********************************************************************************** +class Settings(config.SettingsBase): + _key_ = config.IdDlgPrefs + _settings_ = ( + ('DlgState', 'String', QtCore.QString('')), + ) + + +#*********************************************************************** +# +#*********************************************************************** +class PrefsPageRoot(dlgpreferences.Page): + + UUID = '{a61e2758-4c66-11dd-a3e6-8814a37cbeed}' + + def __init__(self): + dlgpreferences.Page.__init__(self, self.UUID) + self._widget = None + self.setDirty(True) + + def displayName(self): + return QtGui.QApplication.translate("PreferencesGlobal", 'All', None, QtGui.QApplication.UnicodeUTF8) + + def canApply(self): return False + def canHelp(self): return False + + def setVisible(self, parent, flag): + createdNew = False + if flag and self._widget is None: + createdNew = True + self._widget = QtGui.QWidget(parent) + self._widget.setVisible(flag) + return (createdNew, self._widget) + +#********************************************************************************** +# +#********************************************************************************** +class DlgPrefs(dlgpreferences.DlgPreferencesFlatTree): + + def __init__(self, parent): + root = PrefsPageRoot() + for viewObject in config.ObjectRegistry: + prefsPage = viewObject.prefsPage() + if prefsPage is not None: + root(prefsPage) + dlgpreferences.DlgPreferencesFlatTree.__init__(self, + parent, + pages=root, + startPage=root.children()[0].uuid() if root.children() else None, + ) + self.setObjectName(config.IdDlgPrefs) + self.fcSettings = Settings(self).restore() + + + def showEvent(self, event): + self.restoreState(self.fcSettings.value('DlgState')) + + def hideEvent(self, event): + self.fcSettings.setValues(DlgState=self.saveState()) + + def closeEvent(self, event): + pass + + +#********************************************************************************** +# +#********************************************************************************** +if __name__ == '__main__': + import sys + + app = QtGui.QApplication(sys.argv) + w = DlgPrefs(None) + w.show() + res = app.exec_() + sys.exit(res) + + Added: trunk/fclient/fclient/impl/dlgs/DlgSingleAppError.py =================================================================== --- trunk/fclient/fclient/impl/dlgs/DlgSingleAppError.py (rev 0) +++ trunk/fclient/fclient/impl/dlgs/DlgSingleAppError.py 2008-08-18 19:36:54 UTC (rev 941) @@ -0,0 +1,139 @@ +#*************************************************************************************** +#TODO: +# x. error icon +# +#************************************************************************************* +# some fixes for relative imports +# see --> [http://bugs.python.org/issue1510172] absolute/rellative import not working (works only current dir and below) +# see --> [http://mail.python.org/pipermail/python-ideas/2007-February/000232.html] PEP for executing a module in a +# ...package containing relative imports +from __future__ import absolute_import +if __name__ == '__main__': + import os + __path__ = [os.path.dirname(__file__)] + from ._fix_mexec import fix_mexec + fix_mexec(__name__, __file__) + del fix_mexec + +import os +from PyQt4 import QtCore, QtGui + +from .. import config + +from .Ui_DlgSingleAppErrorTpl import Ui_DlgSingleAppError +#********************************************************************************** +# +#********************************************************************************** +class Settings(config.SettingsBase): + _key_ = 'DlgSingleAppError' + _settings_ = ( + ('Geometry', 'ByteArray', QtCore.QByteArray()), + ('SplitterPos', 'ByteArray', QtCore.QByteArray()), + ) + + +#********************************************************************************** +# +#********************************************************************************** +class DlgSingleAppError(QtGui.QDialog, Ui_DlgSingleAppError): + + IdTextEdit = 'textEdit' + IdEdHost = 'edHost' + IdSpinPort = 'spinPort' + IdSplitter = 'splitter' + + + def __init__(self, parent=None, fcpKey=None): + QtGui.QDialog.__init__(self, parent) + + self.setupUi(self) + self.fcSettings = Settings(self).restore() + + # setup dialog + self.restoreGeometry(self.fcSettings.value('Geometry')) + self.setWindowTitle(config.FcAppName + self.trUtf8(' - Error starting up')) + + + # setup host / port + edHost = self.controlById(self.IdEdHost) + edHost.setText(config.fcSettings.value('SingleAppHost')) + + spinPort = self.controlById(self.IdSpinPort) + spinPort.setRange(0, 0xFFFF) #TODO: no idea if port range (0, 0xFFFF) this is reasonable + spinPort.setValue(config.fcSettings.value('SingleAppPort')) + + + # setup text edit + ed = self.controlById(self.IdTextEdit) + text = self.trUtf8('<b>%1 could not be started!</b>').arg(config.FcAppName) + ed.insertHtml(text) + ed.insertHtml('<br><br>') + text = self.trUtf8('%1 could not establish a socket connection needed to enshure only one application is running at a time. Possible reasons are:').arg(config.FcAppName) + ed.insertHtml(text) + + text = '''<ol> + <li>%s</li> + <li>%s</li> + + </ol> + ''' % ( + self.trUtf8('Your firewall blocks the connection. Adjust your firewall to allow the connection as shown to the left.'), + self.trUtf8('Another application may already use host and port as shown. Adjust host and port to your needs. In most cases setting port to an arbitrary (high) number should do the job.'), + + ) + ed.insertHtml(text) + cursor = ed.textCursor() + cursor.movePosition(cursor.Start, cursor.MoveAnchor) + ed.setTextCursor(cursor) + + # setup splitter + splitter = self.controlById(self.IdSplitter) + splitter.restoreState(self.fcSettings.value('SplitterPos')) + self.connect(splitter, QtCore.SIGNAL('splitterMoved(int, int)'), self.onSplitterMoved) + + ############################## + ## methods + ############################## + def controlById(self, idControl): + return getattr(self, idControl) + + ############################## + ## overwritten methods + ############################## + def accept(self): + edHost = self.controlById(self.IdEdHost) + spinPort = self.controlById(self.IdSpinPort) + config.fcSettings.setValues( + SingleAppHost=edHost.text(), + SingleAppPort=spinPort.value(), + ) + + + self.done(self.Accepted) + + ############################## + ## overwritten events + ############################## + def hideEvent(self, event): + self.fcSettings.setValues(Geometry=self.saveGeometry()) + + ############################## + ## event handlers + ############################## + def onSplitterMoved(self, pos, index): + splitter = self.controlById(self.IdSplitter) + self.fcSettings.setValues(SplitterPos=splitter.saveState()) + +#********************************************************************************** +# +#********************************************************************************** +if __name__ == '__main__': + import sys + + app = QtGui.QApplication(sys.argv) + w = DlgSingleAppError() + w.show() + res = app.exec_() + sys.exit(res) + + Added: trunk/fclient/fclient/impl/dlgs/DlgSingleAppErrorTpl.ui =================================================================== --- trunk/fclient/fclient/impl/dlgs/DlgSingleAppErrorTpl.ui (rev 0) +++ trunk/fclient/fclient/impl/dlgs/DlgSingleAppErrorTpl.ui 2008-08-18 19:36:54 UTC (rev 941) @@ -0,0 +1,119 @@ +<ui version="4.0" > + <class>DlgSingleAppError</class> + <widget class="QDialog" name="DlgSingleAppError" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>410</width> + <height>277</height> + </rect> + </property> + <property name="windowTitle" > + <string>Dialog</string> + </property> + <layout class="QGridLayout" name="gridLayout" > + <item row="1" column="0" > + <widget class="Line" name="line" > + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item row="2" column="0" > + <widget class="QDialogButtonBox" name="buttonBox" > + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons" > + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + <item row="0" column="0" > + <widget class="QSplitter" name="splitter" > + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <widget class="QTextEdit" name="textEdit" /> + <widget class="QWidget" name="layoutWidget" > + <layout class="QVBoxLayout" name="verticalLayout_2" > + <item> + <layout class="QVBoxLayout" name="verticalLayout" > + <item> + <widget class="QLabel" name="fieldHeader" > + <property name="text" > + <string>Host: </string> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="edHost" /> + </item> + <item> + <widget class="QLabel" name="fieldHeader_2" > + <property name="text" > + <string>Port: </string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="spinPort" /> + </item> + </layout> + </item> + <item> + <spacer name="verticalSpacer" > + <property name="orientation" > + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0" > + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>DlgSingleAppError</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel" > + <x>248</x> + <y>254</y> + </hint> + <hint type="destinationlabel" > + <x>157</x> + <y>274</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>DlgSingleAppError</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel" > + <x>316</x> + <y>260</y> + </hint> + <hint type="destinationlabel" > + <x>286</x> + <y>274</y> + </hint> + </hints> + </connection> + </connections> +</ui> Added: trunk/fclient/fclient/impl/dlgs/Ui_DlgSingleAppErrorTpl.py =================================================================== --- trunk/fclient/fclient/impl/dlgs/Ui_DlgSingleAppErrorTpl.py (rev 0) +++ trunk/fclient/fclient/impl/dlgs/Ui_DlgSingleAppErrorTpl.py 2008-08-18 19:36:54 UTC (rev 941) @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file '/home/me/src/fclient/trunk/fclient/fclient/impl/tpls/DlgSingleAppErrorTpl.ui' +# +# Created: Thu Jul 31 20:24:37 2008 +# by: PyQt4 UI code generator 4.4.3-snapshot-20080705 +# +# WARNING! All changes made in this file will be lost! + +from PyQt4 import QtCore, QtGui + +class Ui_DlgSingleAppError(object): + def setupUi(self, DlgSingleAppError): + DlgSingleAppError.setObjectName("DlgSingleAppError") + DlgSingleAppError.resize(410, 277) + self.gridLayout = QtGui.QGridLayout(DlgSingleAppError) + self.gridLayout.setObjectName("gridLayout") + self.line = QtGui.QFrame(DlgSingleAppError) + self.line.setFrameShape(QtGui.QFrame.HLine) + self.line.setFrameShadow(QtGui.QFrame.Sunken) + self.line.setObjectName("line") + self.gridLayout.addWidget(self.line, 1, 0, 1, 1) + self.buttonBox = QtGui.QDialogButtonBox(DlgSingleAppError) + self.buttonBox.setOrientation(QtCore.Qt.Horizontal) + self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) + self.buttonBox.setObjectName("buttonBox") + self.gridLayout.addWidget(self.buttonBox, 2, 0, 1, 1) + self.splitter = QtGui.QSplitter(DlgSingleAppError) + self.splitter.setOrientation(QtCore.Qt.Horizontal) + self.splitter.setObjectName("splitter") + self.textEdit = QtGui.QTextEdit(self.splitter) + self.textEdit.setObjectName("textEdit") + self.layoutWidget = QtGui.QWidget(self.splitter) + self.layoutWidget.setObjectName("layoutWidget") + self.verticalLayout_2 = QtGui.QVBoxLayout(self.layoutWidget) + self.verticalLayout_2.setObjectName("verticalLayout_2") + self.verticalLayout = QtGui.QVBoxLayout() + self.verticalLayout.setObjectName("verticalLayout") + self.fieldHeader = QtGui.QLabel(self.layoutWidget) + self.fieldHeader.setObjectName("fieldHeader") + self.verticalLayout.addWidget(self.fieldHeader) + self.edHost = QtGui.QLineEdit(self.layoutWidget) + self.edHost.setObjectName("edHost") + self.verticalLayout.addWidget(self.edHost) + self.fieldHeader_2 = QtGui.QLabel(self.layoutWidget) + self.fieldHeader_2.setObjectName("fieldHeader_2") + self.verticalLayout.addWidget(self.fieldHeader_2) + self.spinPort = QtGui.QSpinBox(self.layoutWidget) + self.spinPort.setObjectName("spinPort") + self.verticalLayout.addWidget(self.spinPort) + self.verticalLayout_2.addLayout(self.verticalLayout) + spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.verticalLayout_2.addItem(spacerItem) + self.gridLayout.addWidget(self.splitter, 0, 0, 1, 1) + + self.retranslateUi(DlgSingleAppError) + QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), DlgSingleAppError.accept) + QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), DlgSingleAppError.reject) + QtCore.QMetaObject.connectSlotsByName(DlgSingleAppError) + + def retranslateUi(self, DlgSingleAppError): + DlgSingleAppError.setWindowTitle(QtGui.QApplication.translate("DlgSingleAppError", "Dialog", None, QtGui.QApplication.UnicodeUTF8)) + self.fieldHeader.setText(QtGui.QApplication.translate("DlgSingleAppError", "Host: ", None, QtGui.QApplication.UnicodeUTF8)) + self.fieldHeader_2.setText(QtGui.QApplication.translate("DlgSingleAppError", "Port: ", None, QtGui.QApplication.UnicodeUTF8)) + + +if __name__ == "__main__": + import sys + app = QtGui.QApplication(sys.argv) + DlgSingleAppError = QtGui.QDialog() + ui = Ui_DlgSingleAppError() + ui.setupUi(DlgSingleAppError) + DlgSingleAppError.show() + sys.exit(app.exec_()) + Added: trunk/fclient/fclient/impl/dlgs/__init__.py =================================================================== --- trunk/fclient/fclient/impl/dlgs/__init__.py (rev 0) +++ trunk/fclient/fclient/impl/dlgs/__init__.py 2008-08-18 19:36:54 UTC (rev 941) @@ -0,0 +1 @@ + Added: trunk/fclient/fclient/impl/dlgs/_fix_mexec.py =================================================================== --- trunk/fclient/fclient/impl/dlgs/_fix_mexec.py (rev 0) +++ trunk/fclient/fclient/impl/dlgs/_fix_mexec.py 2008-08-18 19:36:54 UTC (rev 941) @@ -0,0 +1,99 @@ +'''in python 2.5 relative impports are srsly broken ..fix this to make relative imports work +when executing a module as main (-m), including relative imports up to the root package + +see: [http://mail.python.org/pipermail/python-ideas/2007-February/000232.html] + +@note: root package is the highest available package in the package hirarchy. +don't look at __name__ too closely. it gets adjusted for a module to just "do the right +thing" in __name__ == '__main__' comparisons +@note: this patch does not work if relative imports are done in __init__.py. no idea why +and to be honest, I don't wanna* know.. +@note: this is more or less a hack. so it may have unwanted side effects for example +when importing parent packages. use at your own risk. could improve this module +by adding a __main__.py to stop at this level or by fixing the __init__.py bug, but +I don't think its worth it. see what python2.6 or 3k brings.. + +usage:: + + # place this at the top a module, before doing any relative imports + from fix_mexec import fix_mexec + fix_mexec(__name__, __file__) + del fix_mexec + + from ...foo import bar + + + +##<-- copy and paste code, assuming _fix_mexec resides in the current dir.. + +# some fixes for relative imports +# see --> [http://bugs.python.org/issue1510172] absolute/rellative import not working (works only current dir and below) +# see --> [http://mail.python.org/pipermail/python-ideas/2007-February/000232.html] PEP for executing a module in a +# ...package containing relative imports +from __future__ import absolute_import +if __name__ == '__main__': + import os + __path__ = [os.path.dirname(__file__)] + from ._fix_mexec import fix_mexec + fix_mexec(__name__, __file__) + del fix_mexec + + +##--> copy and paste code +''' + +import imp, os, sys +#******************************************************************************** +# +#******************************************************************************** +class MainName(str): + def __eq__(self, other): + if other == '__main__': return True + return str.__eq__(self, other) + def __ne__(self, other): + if other == '__main__': return False + return str.__ne__(self, other) + + +def fix_mexec(_name_, _file_): + """bugfix for relative imports not working + @param _name_: __name__ of the module + @param _file_: __file__ of the module + + @note: not complete: relies on __init__.py, .pyo (...) is ignored currently + """ + if _name_ == '__main__': + out = [] + # find allparent packages + p = os.path.dirname(os.path.abspath(_file_)) + prev = p + while True: + pkg = os.path.join(p, '__init__.py') + if os.path.isfile(pkg): + out.append([pkg, os.path.basename(p)]) + else: + break + prev = p + p = os.path.dirname(p) + if p == prev: + break + out.reverse() + + # adjust sub package names an import parent modules + name = None + for n, (fpath, name) in enumerate(out): + if n > 0: + name = out[n][1] = out[n -1][1] + '.' + out[n][1] + m = imp.load_source(name, fpath) + m.__path__ = [os.path.dirname(fpath)] + + # adjust name of the __main__ module + if name is not None: + m = sys.modules.pop('__main__') + # 'foo.bar..__main__' does not work for some reason. 'foo.bar' seems to work as expected + ##m.__name__ = _Name_(name + '.' + '__main__') + m.__name__ = MainName(name) + sys.modules[m.__name__] = m + + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-17 13:00:05
|
Revision: 940 http://fclient.svn.sourceforge.net/fclient/?rev=940&view=rev Author: jUrner Date: 2008-08-17 13:00:14 +0000 (Sun, 17 Aug 2008) Log Message: ----------- this and that Modified Paths: -------------- trunk/fclient/fclient/impl/MainWindow/ViewObject.py Modified: trunk/fclient/fclient/impl/MainWindow/ViewObject.py =================================================================== --- trunk/fclient/fclient/impl/MainWindow/ViewObject.py 2008-08-17 12:59:35 UTC (rev 939) +++ trunk/fclient/fclient/impl/MainWindow/ViewObject.py 2008-08-17 13:00:14 UTC (rev 940) @@ -17,6 +17,8 @@ from .. import ViewObject from . import MainWindow +from .prefs.PrefsGlobal import PrefsPageGlobal +from .prefs.PrefsSingleApp import PrefsPageSingleApp #************************************************************************************ # #************************************************************************************ @@ -25,12 +27,13 @@ def __init__(self, parentView=None): ViewObject.ViewObject.__init__(self, parentView) self._widget = None - + def close(self): - pass + ViewObject.ViewObject.close(self) def create(self): self._widget = MainWindow.MainWindow(self.parentWidget()) + ViewObject.ViewObject.create(self) return self.widget() def displayName(self): @@ -43,7 +46,9 @@ return config.IdViewObjectMainWindow def prefsPage(self): - pass + return PrefsPageGlobal()( + PrefsPageSingleApp(), + ) def widget(self): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-17 12:59:27
|
Revision: 939 http://fclient.svn.sourceforge.net/fclient/?rev=939&view=rev Author: jUrner Date: 2008-08-17 12:59:35 +0000 (Sun, 17 Aug 2008) Log Message: ----------- need fixed order for object registry Modified Paths: -------------- trunk/fclient/fclient/impl/config.py Modified: trunk/fclient/fclient/impl/config.py =================================================================== --- trunk/fclient/fclient/impl/config.py 2008-08-17 12:58:43 UTC (rev 938) +++ trunk/fclient/fclient/impl/config.py 2008-08-17 12:59:35 UTC (rev 939) @@ -6,7 +6,6 @@ import posixpath import os -import weakref from PyQt4 import QtCore from .lib import fcp2 @@ -47,26 +46,45 @@ IdDlgPrefs = 'DlgPrefs' #TODO: turn into view object? -class ObjectRegistry(weakref.WeakValueDictionary): +class ObjectRegistry(object): """global object registry - use the registry to register and retrieve ui objects previously registerd by their object ids (Id*). - ObjectRegistry is actually a WeakValueDictionary. so use as a dict + use the registry to register and retrieve view objects. order of the view objects is guaranteed to + be stable in order of the objects registering """ + def __init__(self): + self._names = [] + self._viewObjects = [] + + def __iter__(self): + return iter(self._viewObjects) + + def __getitem__(self, viewObjectName): + return self._viewObjects[self._names.index(viewObjectName)] + + + def get(self, viewObjectName, default=None): + try: + return self[viewObjectName] + except ValueError: + return default + def register(self, viewObject): """regisdters an object in the registry @param viewObject: view object to register @note: QObject.objectName() is taken as id. ids have to be unique throughout the runtime of the gui """ - ido = viewObject.name() - if ido in self: - raise ValueError('view object already registered: %s' % ido) - self[ido] = viewObject - + viewObjectName = viewObject.name() + if viewObjectName in self._names: + raise ValueError('view object already registered: %s' % viewObjectName) + self._names.append(viewObjectName) + self._viewObjects.append(viewObject) + def unregister(self, viewObject): - del self[str(viewObject.name())] - + viewObjectName = viewObject.name() + self._names.remove(viewObjectName) + self._viewObjects.remove(viewObject) ObjectRegistry = ObjectRegistry() #********************************************************************************** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-17 12:58:33
|
Revision: 938 http://fclient.svn.sourceforge.net/fclient/?rev=938&view=rev Author: jUrner Date: 2008-08-17 12:58:43 +0000 (Sun, 17 Aug 2008) Log Message: ----------- this and that Modified Paths: -------------- trunk/fclient/fclient/impl/ViewObject.py Modified: trunk/fclient/fclient/impl/ViewObject.py =================================================================== --- trunk/fclient/fclient/impl/ViewObject.py 2008-08-17 12:58:35 UTC (rev 937) +++ trunk/fclient/fclient/impl/ViewObject.py 2008-08-17 12:58:43 UTC (rev 938) @@ -25,33 +25,49 @@ def __init__(self, parentView=None): QtCore.QObject.__init__(self, parentView) config.ObjectRegistry.register(self) + self.emit(QtCore.SIGNAL('viewObjectRegistered(QObject*)'), self) def close(self): - pass + """closes the view""" + config.ObjectRegistry.unregister(self) + self.emit(QtCore.SIGNAL('viewObjectUnregistered(QObject*)'), self) def create(self): - pass + """creates the underlaying widget of the view object + @return: (QWidget) + @note: make shure to call the base class method after* creating the widget + """ + self.emit(QtCore.SIGNAL('viewObjectWidgetCreated(QObject*)'), self) def displayName(self): - pass + """returns the display name of the view object + @return: (QString) + """ + return QtCore.QString() def icon(self): - pass - + """returns the icon associated to the view + @return (QIcon) + """ + def name(self): - return '' + """returns the unique name of the view object + @return: (QString) + """ + return QtCore.QString() def parentWidget(self): + """returns the parent widget of the parent view""" parentView = self.parent() if parentView is not None: return parentView.widget() return None def prefsPage(self): - pass + """returns the preferences page of the view or None""" def widget(self): - pass + """returns the widget of the view or None""" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-17 12:58:27
|
Revision: 937 http://fclient.svn.sourceforge.net/fclient/?rev=937&view=rev Author: jUrner Date: 2008-08-17 12:58:35 +0000 (Sun, 17 Aug 2008) Log Message: ----------- this and that Modified Paths: -------------- trunk/fclient/fclient/impl/ViewView/ViewObject.py Modified: trunk/fclient/fclient/impl/ViewView/ViewObject.py =================================================================== --- trunk/fclient/fclient/impl/ViewView/ViewObject.py 2008-08-17 12:58:26 UTC (rev 936) +++ trunk/fclient/fclient/impl/ViewView/ViewObject.py 2008-08-17 12:58:35 UTC (rev 937) @@ -27,10 +27,11 @@ self._widget = None def close(self): - pass + ViewObject.ViewObject.close(self) def create(self): self._widget = View.ViewWidget(self.parentWidget()) + ViewObject.ViewObject.create(self) return self.widget() def displayName(self): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-17 12:58:17
|
Revision: 936 http://fclient.svn.sourceforge.net/fclient/?rev=936&view=rev Author: jUrner Date: 2008-08-17 12:58:26 +0000 (Sun, 17 Aug 2008) Log Message: ----------- this and that Modified Paths: -------------- trunk/fclient/fclient/impl/ViewUploads/ViewObject.py Modified: trunk/fclient/fclient/impl/ViewUploads/ViewObject.py =================================================================== --- trunk/fclient/fclient/impl/ViewUploads/ViewObject.py 2008-08-17 12:58:18 UTC (rev 935) +++ trunk/fclient/fclient/impl/ViewUploads/ViewObject.py 2008-08-17 12:58:26 UTC (rev 936) @@ -27,10 +27,11 @@ self._widget = None def close(self): - pass + ViewObject.ViewObject.close(self) def create(self): self._widget = ViewUploads.ViewUploadsWidget(self.parentWidget()) + ViewObject.ViewObject.create(self) return self.widget() def displayName(self): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-17 12:58:09
|
Revision: 935 http://fclient.svn.sourceforge.net/fclient/?rev=935&view=rev Author: jUrner Date: 2008-08-17 12:58:18 +0000 (Sun, 17 Aug 2008) Log Message: ----------- this and that Modified Paths: -------------- trunk/fclient/fclient/impl/ViewLogger/ViewObject.py Modified: trunk/fclient/fclient/impl/ViewLogger/ViewObject.py =================================================================== --- trunk/fclient/fclient/impl/ViewLogger/ViewObject.py 2008-08-17 12:58:09 UTC (rev 934) +++ trunk/fclient/fclient/impl/ViewLogger/ViewObject.py 2008-08-17 12:58:18 UTC (rev 935) @@ -27,10 +27,11 @@ self._widget = None def close(self): - pass + ViewObject.ViewObject.close(self) def create(self): self._widget = ViewLogger.ViewLoggerWidget(self.parentWidget()) + ViewObject.ViewObject.create(self) return self.widget() def displayName(self): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-17 12:57:59
|
Revision: 934 http://fclient.svn.sourceforge.net/fclient/?rev=934&view=rev Author: jUrner Date: 2008-08-17 12:58:09 +0000 (Sun, 17 Aug 2008) Log Message: ----------- this and that Modified Paths: -------------- trunk/fclient/fclient/impl/ViewDownloads/ViewObject.py Modified: trunk/fclient/fclient/impl/ViewDownloads/ViewObject.py =================================================================== --- trunk/fclient/fclient/impl/ViewDownloads/ViewObject.py 2008-08-17 12:58:01 UTC (rev 933) +++ trunk/fclient/fclient/impl/ViewDownloads/ViewObject.py 2008-08-17 12:58:09 UTC (rev 934) @@ -27,10 +27,11 @@ self._widget = None def close(self): - pass + ViewObject.ViewObject.close(self) def create(self): self._widget = ViewDownloads.ViewDownloadsWidget(self.parentWidget()) + ViewObject.ViewObject.create(self) return self.widget() def displayName(self): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-17 12:57:52
|
Revision: 933 http://fclient.svn.sourceforge.net/fclient/?rev=933&view=rev Author: jUrner Date: 2008-08-17 12:58:01 +0000 (Sun, 17 Aug 2008) Log Message: ----------- this and that Modified Paths: -------------- trunk/fclient/fclient/impl/ViewBrowser/ViewObject.py Modified: trunk/fclient/fclient/impl/ViewBrowser/ViewObject.py =================================================================== --- trunk/fclient/fclient/impl/ViewBrowser/ViewObject.py 2008-08-17 12:57:52 UTC (rev 932) +++ trunk/fclient/fclient/impl/ViewBrowser/ViewObject.py 2008-08-17 12:58:01 UTC (rev 933) @@ -17,6 +17,7 @@ from .. import ViewObject from . import ViewBrowser +from .prefs.PrefsBrowserWidget import PrefsPageBrowser #************************************************************************************ # #************************************************************************************ @@ -27,10 +28,11 @@ self._widget = None def close(self): - pass + ViewObject.ViewObject.close(self) def create(self): self._widget = ViewBrowser.ViewBrowserWidget(self.parentWidget()) + ViewObject.ViewObject.create(self) return self.widget() def displayName(self): @@ -43,7 +45,7 @@ return config.IdViewObjectBrowser def prefsPage(self): - pass + return PrefsPageBrowser() def widget(self): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-17 12:57:43
|
Revision: 932 http://fclient.svn.sourceforge.net/fclient/?rev=932&view=rev Author: jUrner Date: 2008-08-17 12:57:52 +0000 (Sun, 17 Aug 2008) Log Message: ----------- this and that Modified Paths: -------------- trunk/fclient/fclient/impl/ViewConnection/ViewObject.py Modified: trunk/fclient/fclient/impl/ViewConnection/ViewObject.py =================================================================== --- trunk/fclient/fclient/impl/ViewConnection/ViewObject.py 2008-08-16 19:16:39 UTC (rev 931) +++ trunk/fclient/fclient/impl/ViewConnection/ViewObject.py 2008-08-17 12:57:52 UTC (rev 932) @@ -17,6 +17,7 @@ from .. import ViewObject from . import ViewConnection +from .prefs.PrefsConnectionWidget import PrefsPageConnectionExpertSettings #************************************************************************************ # #************************************************************************************ @@ -27,10 +28,11 @@ self._widget = None def close(self): - pass + ViewObject.ViewObject.close(self) def create(self): self._widget = ViewConnection.ViewConnectionWidget(self.parentWidget()) + ViewObject.ViewObject.create(self) return self.widget() def displayName(self): @@ -43,7 +45,7 @@ return config.IdViewObjectConnection def prefsPage(self): - pass + return PrefsPageConnectionExpertSettings() def widget(self): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-16 19:16:32
|
Revision: 931 http://fclient.svn.sourceforge.net/fclient/?rev=931&view=rev Author: jUrner Date: 2008-08-16 19:16:39 +0000 (Sat, 16 Aug 2008) Log Message: ----------- fixes related to the latest restructuring of the package Modified Paths: -------------- trunk/fclient/fclient/impl/BaseRequestsWidget/BaseRequestsWidget.py trunk/fclient/fclient/impl/MainWindow/Settings.py trunk/fclient/fclient/impl/ViewBrowser/GlobalFeedback.py trunk/fclient/fclient/impl/ViewBrowser/Settings.py trunk/fclient/fclient/impl/ViewBrowser/SideBars/SideBarLoadDetails.py trunk/fclient/fclient/impl/ViewBrowser/ViewBrowser.py trunk/fclient/fclient/impl/ViewBrowser/prefs/PrefsBrowserWidget.py trunk/fclient/fclient/impl/ViewConnection/ViewConnection.py trunk/fclient/fclient/impl/ViewConnection/prefs/PrefsConnectionWidget.py trunk/fclient/fclient/impl/ViewDownloads/ViewDownloads.py trunk/fclient/fclient/impl/ViewLogger/ViewLogger.py trunk/fclient/fclient/impl/ViewUploads/ViewUploads.py trunk/fclient/fclient/impl/ViewView/View.py trunk/fclient/fclient/impl/config.py Modified: trunk/fclient/fclient/impl/BaseRequestsWidget/BaseRequestsWidget.py =================================================================== --- trunk/fclient/fclient/impl/BaseRequestsWidget/BaseRequestsWidget.py 2008-08-16 10:57:37 UTC (rev 930) +++ trunk/fclient/fclient/impl/BaseRequestsWidget/BaseRequestsWidget.py 2008-08-16 19:16:39 UTC (rev 931) @@ -184,7 +184,7 @@ IdTree = 'tree' - def __init__(self, parent, idGlobalFeedback=config.IdMainWindow): + def __init__(self, parent, idGlobalFeedback=config.IdViewObjectMainWindow): QtGui.QWidget.__init__(self, parent) self._isCreated = False self.fcHeaderLabels = {} # fcpIdentifier --> treeItem Modified: trunk/fclient/fclient/impl/MainWindow/Settings.py =================================================================== --- trunk/fclient/fclient/impl/MainWindow/Settings.py 2008-08-16 10:57:37 UTC (rev 930) +++ trunk/fclient/fclient/impl/MainWindow/Settings.py 2008-08-16 19:16:39 UTC (rev 931) @@ -18,7 +18,7 @@ #********************************************************************************** class Settings(config.SettingsBase): - _key_ = config.IdMainWindow + _key_ = config.IdViewObjectMainWindow _settings_ = ( ('Geometry', 'ByteArray', QtCore.QByteArray()), ('ConnectionLabelFlashRate', 'UInt', 800), Modified: trunk/fclient/fclient/impl/ViewBrowser/GlobalFeedback.py =================================================================== --- trunk/fclient/fclient/impl/ViewBrowser/GlobalFeedback.py 2008-08-16 10:57:37 UTC (rev 930) +++ trunk/fclient/fclient/impl/ViewBrowser/GlobalFeedback.py 2008-08-16 19:16:39 UTC (rev 931) @@ -27,8 +27,9 @@ # menus self.menus = [] - if self.menuBar is not None and hasattr(parent, 'fcViewObject'): - menu = QtGui.QMenu(parent.fcViewObject.displayName, self.menuBar) + if self.menuBar is not None: + viewObject = config.ObjectRegistry.get(config.IdViewObjectBrowser, None) + menu = QtGui.QMenu(viewObject.displayName(), self.menuBar) parent.populateMenu(menu) self.menus.append(menu) self.menuBar.addViewMenu(menu) @@ -55,4 +56,4 @@ def setFeedback(self, qString): if self.labelFeedbackWrap is not None: - self.labelFeedbackWrap.setPath(unicode(qString)) \ No newline at end of file + self.labelFeedbackWrap.setPath(unicode(qString)) Modified: trunk/fclient/fclient/impl/ViewBrowser/Settings.py =================================================================== --- trunk/fclient/fclient/impl/ViewBrowser/Settings.py 2008-08-16 10:57:37 UTC (rev 930) +++ trunk/fclient/fclient/impl/ViewBrowser/Settings.py 2008-08-16 19:16:39 UTC (rev 931) @@ -17,7 +17,7 @@ # #********************************************************************************** class Settings(config.SettingsBase): - _key_ = config.IdViewBrowserWidget + _key_ = config.IdViewObjectBrowser _settings_ = ( ('OpenLinksInNewTab', 'Bool', False), ('OpenAddressBarInNewTab', 'Bool', False), Modified: trunk/fclient/fclient/impl/ViewBrowser/SideBars/SideBarLoadDetails.py =================================================================== --- trunk/fclient/fclient/impl/ViewBrowser/SideBars/SideBarLoadDetails.py 2008-08-16 10:57:37 UTC (rev 930) +++ trunk/fclient/fclient/impl/ViewBrowser/SideBars/SideBarLoadDetails.py 2008-08-16 19:16:39 UTC (rev 931) @@ -29,7 +29,7 @@ # #********************************************************************************** class SideBarLoadDetailsSettings(config.SettingsBase): - _key_ = config.IdSideBarLoadDetails + _key_ = 'SideBarLoadDetails' _settings_ = ( ('ColorFgItem', 'QColor', QtGui.QColor('black')), ('ColorBgItem', 'QColor', QtGui.QColor('white')), Modified: trunk/fclient/fclient/impl/ViewBrowser/ViewBrowser.py =================================================================== --- trunk/fclient/fclient/impl/ViewBrowser/ViewBrowser.py 2008-08-16 10:57:37 UTC (rev 930) +++ trunk/fclient/fclient/impl/ViewBrowser/ViewBrowser.py 2008-08-16 19:16:39 UTC (rev 931) @@ -105,7 +105,7 @@ ForcedMinBrowserTabText = 5 # forced minimum number of chars on browser tabBar - def __init__(self, parent, idGlobalFeedback=config.IdMainWindow): + def __init__(self, parent, idGlobalFeedback=config.IdViewObjectMainWindow): QtGui.QWidget.__init__(self, parent) self.menuSideBars = QtGui.QMenu(self.trUtf8('Side bars')) #TODO: retranslate @@ -722,7 +722,7 @@ menu.addAction(self.fcActions['ActionCloseAllTabs']) act = menu.exec_(pt) if act == self.fcActions['ActionCloseBrowserUnderMouse']: - tabWidget.removeTab(i) + tabWidget.removeTab(index) self._adjustCurrentBrowserDependendStuff() def onTabCurrentChanged(self, i): Modified: trunk/fclient/fclient/impl/ViewBrowser/prefs/PrefsBrowserWidget.py =================================================================== --- trunk/fclient/fclient/impl/ViewBrowser/prefs/PrefsBrowserWidget.py 2008-08-16 10:57:37 UTC (rev 930) +++ trunk/fclient/fclient/impl/ViewBrowser/prefs/PrefsBrowserWidget.py 2008-08-16 19:16:39 UTC (rev 931) @@ -37,10 +37,11 @@ self.setupUi(self) - browserWidget = config.ObjectRegistry.get(config.IdViewBrowserWidget, None) - if browserWidget is None: + browserView = config.ObjectRegistry.get(config.IdViewObjectBrowser, None) + if browserView is None: self.setEnabled(False) else: + browserWidget = browserView.widget() self.fcSettingsControler = settings.SettingsControler(browserWidget.fcSettings, parent=self) if page is not None: page.connect(self.fcSettingsControler, QtCore.SIGNAL('isDirty(bool)'), page.setDirty) Modified: trunk/fclient/fclient/impl/ViewConnection/ViewConnection.py =================================================================== --- trunk/fclient/fclient/impl/ViewConnection/ViewConnection.py 2008-08-16 10:57:37 UTC (rev 930) +++ trunk/fclient/fclient/impl/ViewConnection/ViewConnection.py 2008-08-16 19:16:39 UTC (rev 931) @@ -36,8 +36,9 @@ # menus self.menus = [] - if self.menuBar is not None and hasattr(parent, 'fcViewObject'): - menu = QtGui.QMenu(parent.fcViewObject.displayName, self.menuBar) + if self.menuBar is not None: + viewObject = config.ObjectRegistry.get(config.IdViewObjectConnection, None) + menu = QtGui.QMenu(viewObject.displayName(), self.menuBar) parent.populateMenu(menu) self.menus.append(menu) self.menuBar.addViewMenu(menu) @@ -55,7 +56,7 @@ class Settings(config.SettingsBase): - _key_ = config.IdViewConnectionWidget + _key_ = config.IdViewObjectConnection _settings_ = ( ('FcpAutoConnect', 'Bool', True), ('FcpConnectionName', 'String', config.FcConnectionName), @@ -155,7 +156,7 @@ IdFproxySpinConnectionPort = 'spinFproxyConnectionPort' - def __init__(self, parent, idGlobalFeedback=config.IdMainWindow): + def __init__(self, parent, idGlobalFeedback=config.IdViewObjectMainWindow): QtGui.QWidget.__init__(self, parent) self.setupUi(self) Modified: trunk/fclient/fclient/impl/ViewConnection/prefs/PrefsConnectionWidget.py =================================================================== --- trunk/fclient/fclient/impl/ViewConnection/prefs/PrefsConnectionWidget.py 2008-08-16 10:57:37 UTC (rev 930) +++ trunk/fclient/fclient/impl/ViewConnection/prefs/PrefsConnectionWidget.py 2008-08-16 19:16:39 UTC (rev 931) @@ -46,10 +46,11 @@ self.fcSettingsControler = None # - connectionWidget = config.ObjectRegistry.get(config.IdViewConnectionWidget, None) - if connectionWidget is None: + connectionView = config.ObjectRegistry.get(config.IdViewObjectConnection, None) + if connectionView is None: self.setEnabled(False) else: + connectionWidget = connectionView.widget() self.fcSettingsControler = settings.SettingsControler(connectionWidget.fcSettings, parent=self) if page is not None: page.connect(self.fcSettingsControler, QtCore.SIGNAL('isDirty(bool)'), page.setDirty) Modified: trunk/fclient/fclient/impl/ViewDownloads/ViewDownloads.py =================================================================== --- trunk/fclient/fclient/impl/ViewDownloads/ViewDownloads.py 2008-08-16 10:57:37 UTC (rev 930) +++ trunk/fclient/fclient/impl/ViewDownloads/ViewDownloads.py 2008-08-16 19:16:39 UTC (rev 931) @@ -28,8 +28,9 @@ # menus self.menus = [] - if self.menuBar is not None and hasattr(parent, 'fcViewObject'): - menu = QtGui.QMenu(parent.fcViewObject.displayName, self.menuBar) + if self.menuBar is not None: + viewObject = config.ObjectRegistry.get(config.IdViewObjectDownloads, None) + menu = QtGui.QMenu(viewObject.displayName(), self.menuBar) parent.populateMenu(menu) self.menus.append(menu) self.menuBar.addViewMenu(menu) @@ -81,7 +82,7 @@ class DownloadsWidgetSettings(config.SettingsBase): - _key_ = config.IdViewDownloadsWidget + _key_ = config.IdViewObjectDownloads _settings_ = ( ('MaxSimultaneousDownloads', 'UInt', 3), ) @@ -89,13 +90,11 @@ class ViewDownloadsWidget(BaseRequestsWidget.RequestsWidget): - def __init__(self, parent, idGlobalFeedback=config.IdMainWindow): + def __init__(self, parent, idGlobalFeedback=config.IdViewObjectMainWindow): self.menuRemoveGroup = None BaseRequestsWidget.RequestsWidget.__init__(self, parent) - - self.setObjectName(config.IdViewDownloadsWidget) self.fcSettings = DownloadsWidgetSettings(self).restore() self.fcGlobalFeedback = DownloadsWidgetGlobalFeedback(self, idGlobalFeedback) Modified: trunk/fclient/fclient/impl/ViewLogger/ViewLogger.py =================================================================== --- trunk/fclient/fclient/impl/ViewLogger/ViewLogger.py 2008-08-16 10:57:37 UTC (rev 930) +++ trunk/fclient/fclient/impl/ViewLogger/ViewLogger.py 2008-08-16 19:16:39 UTC (rev 931) @@ -84,8 +84,9 @@ # menus self.menus = [] - if self.menuBar is not None and hasattr(parent, 'fcViewObject'): - menu = QtGui.QMenu(parent.fcViewObject.displayName, self.menuBar) + if self.menuBar is not None: + viewObject = config.ObjectRegistry.get(config.IdViewObjectLogger, None) + menu = QtGui.QMenu(viewObject.displayName(), self.menuBar) parent.populateMenu(menu) self.menus.append(menu) self.menuBar.addViewMenu(menu) @@ -106,7 +107,7 @@ PrefixVerbosityColorFg = 'ColorFgVerbosity' - _key_ = config.IdViewLoggerWidget + _key_ = config.IdViewObjectLogger _settings_ = ( ('MaxLines', 'UInt', 1000), ('Verbosity', 'PyString', 'Info'), @@ -141,7 +142,7 @@ IdEdLogger = 'edLogger' - def __init__(self, parent, idGlobalFeedback=config.IdMainWindow): + def __init__(self, parent, idGlobalFeedback=config.IdViewObjectMainWindow): QtGui.QWidget.__init__(self, parent) self._isCreated = False self._mainWindowMenus = {} #TODO: wrap along with toolbars to a handy class MainWindowStuff Modified: trunk/fclient/fclient/impl/ViewUploads/ViewUploads.py =================================================================== --- trunk/fclient/fclient/impl/ViewUploads/ViewUploads.py 2008-08-16 10:57:37 UTC (rev 930) +++ trunk/fclient/fclient/impl/ViewUploads/ViewUploads.py 2008-08-16 19:16:39 UTC (rev 931) @@ -29,8 +29,9 @@ # menus self.menus = [] - if self.menuBar is not None and hasattr(parent, 'fcViewObject'): - menu = QtGui.QMenu(parent.fcViewObject.displayName, self.menuBar) + if self.menuBar is not None: + viewObject = config.ObjectRegistry.get(config.IdViewObjectUploads, None) + menu = QtGui.QMenu(viewObject.displayName(), self.menuBar) parent.populateMenu(menu) self.menus.append(menu) self.menuBar.addViewMenu(menu) @@ -82,20 +83,18 @@ class UploadsWidgetSettings(config.SettingsBase): - _key_ = config.IdViewUploadsWidget + _key_ = config.IdViewObjectUploads _settings_ = ( ) class ViewUploadsWidget(BaseRequestsWidget.RequestsWidget): - def __init__(self, parent, idGlobalFeedback=config.IdMainWindow): + def __init__(self, parent, idGlobalFeedback=config.IdViewObjectMainWindow): self.menuRemoveGroup = None BaseRequestsWidget.RequestsWidget.__init__(self, parent) - - self.setObjectName(config.IdViewUploadsWidget) self.fcSettings = UploadsWidgetSettings(self).restore() self.fcGlobalFeedback = UploadsWidgetGlobalFeedback(self, idGlobalFeedback) Modified: trunk/fclient/fclient/impl/ViewView/View.py =================================================================== --- trunk/fclient/fclient/impl/ViewView/View.py 2008-08-16 10:57:37 UTC (rev 930) +++ trunk/fclient/fclient/impl/ViewView/View.py 2008-08-16 19:16:39 UTC (rev 931) @@ -55,8 +55,9 @@ # menus self.menu = None - if self.menuBar is not None and hasattr(parent, 'fcViewObject'): - self.menu = QtGui.QMenu(parent.fcViewObject.displayName, self.menuBar) + if self.menuBar is not None: + viewObject = config.ObjectRegistry.get(config.IdViewObjectView, None) + self.menu = QtGui.QMenu(viewObject.displayName(), self.menuBar) parent.populateMenu(self.menu) self.menuBar.addViewMenu(self.menu) @@ -66,7 +67,7 @@ class Settings(config.SettingsBase): - _key_ = config.IdViewWidget + _key_ = config.IdViewObjectView _settings_ = ( ('LastViewTop', 'String', QtCore.QString('')), ('LastViewBottom', 'String', QtCore.QString('')), @@ -95,7 +96,7 @@ IdTabTop = 'tabTop' IdTabBottom = 'tabBottom' - def __init__(self, parent, idGlobalFeedback=config.IdMainWindow): + def __init__(self, parent, idGlobalFeedback=config.IdViewObjectMainWindow): QtGui.QWidget.__init__(self, parent) # setup ui Modified: trunk/fclient/fclient/impl/config.py =================================================================== --- trunk/fclient/fclient/impl/config.py 2008-08-16 10:57:37 UTC (rev 930) +++ trunk/fclient/fclient/impl/config.py 2008-08-16 19:16:39 UTC (rev 931) @@ -34,23 +34,8 @@ FcDefaultStyleSheet = os.path.join(unicode(FcResDir), 'stylesheets', 'default.css') del _implDir, _fclientDir #********************************************************************************** -# looks like QObject.findChild() does not always work. docs mention troubles -# with MSVC 6 where you should use qFindChild(). can not test this. so keep -# a dict for lookups... +# view ids guaranteed always being present #********************************************************************************** -IdMainWindow = 'MainWindow' -IdViewWidget = 'ViewWidget' -IdViewBrowserWidget = 'ViewBrowserWidget' -IdViewConnectionWidget = 'ViewConnectionWidget' -IdViewDownloadsWidget = 'ViewDownloadsWidget' -IdViewLoggerWidget = 'ViewDownloadsWidget' -IdViewLoggerWidget = 'ViewLoggerWidget' -IdViewUploadsWidget = 'ViewUploadsWidget' -IdDlgPrefs = 'DlgPrefs' - -IdSideBarLoadDetails = 'SideBarLoadDetails' - -##### IdViewObjectBrowser = QtCore.QString('ViewObjectBrowser') IdViewObjectConnection = QtCore.QString('ViewObjectConnection') IdViewObjectDownloads = QtCore.QString('ViewObjectDownloads') @@ -59,7 +44,9 @@ IdViewObjectUploads = QtCore.QString('ViewObjectUploads') IdViewObjectView = QtCore.QString('ViewObjectView') +IdDlgPrefs = 'DlgPrefs' #TODO: turn into view object? + class ObjectRegistry(weakref.WeakValueDictionary): """global object registry @@ -144,20 +131,21 @@ def __init__(self, parent, idGlobalFeedback): - self.id = idGlobalFeedback + self.idGlobalFeedback = idGlobalFeedback self.menuBar = None self.statusBar = None self.titleBar = None - feedbackParent = ObjectRegistry.get(idGlobalFeedback, None) - if feedbackParent is not None: - mthd = getattr(feedbackParent, 'menuBar', None) + feedbackView = ObjectRegistry.get(idGlobalFeedback, None) + if feedbackView is not None: + feedbackWidget = feedbackView.widget() + mthd = getattr(feedbackWidget, 'menuBar', None) if mthd is not None: self.menuBar = mthd() - mthd = getattr(feedbackParent, 'statusBar', None) + mthd = getattr(feedbackWidget, 'statusBar', None) if mthd is not None: self.statusBar = mthd() - mthd = getattr(feedbackParent, 'titleBar', None) + mthd = getattr(feedbackWidget, 'titleBar', None) if mthd is not None: self.titleBar = mthd() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-16 10:57:27
|
Revision: 930 http://fclient.svn.sourceforge.net/fclient/?rev=930&view=rev Author: jUrner Date: 2008-08-16 10:57:37 +0000 (Sat, 16 Aug 2008) Log Message: ----------- isolated view Added Paths: ----------- trunk/fclient/fclient/impl/ViewView/ trunk/fclient/fclient/impl/ViewView/Ui_ViewWidget.py trunk/fclient/fclient/impl/ViewView/View.py trunk/fclient/fclient/impl/ViewView/ViewObject.py trunk/fclient/fclient/impl/ViewView/ViewWidget.ui trunk/fclient/fclient/impl/ViewView/__init__.py trunk/fclient/fclient/impl/ViewView/_fix_mexec.py Added: trunk/fclient/fclient/impl/ViewView/Ui_ViewWidget.py =================================================================== --- trunk/fclient/fclient/impl/ViewView/Ui_ViewWidget.py (rev 0) +++ trunk/fclient/fclient/impl/ViewView/Ui_ViewWidget.py 2008-08-16 10:57:37 UTC (rev 930) @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file '/home/me/src/fclient/trunk/fclient/fclient/impl/ViewView/ViewWidget.ui' +# +# Created: Sat Aug 16 11:03:09 2008 +# by: PyQt4 UI code generator 4.4.3-snapshot-20080705 +# +# WARNING! All changes made in this file will be lost! + +from PyQt4 import QtCore, QtGui + +class Ui_ViewWidget(object): + def setupUi(self, ViewWidget): + ViewWidget.setObjectName("ViewWidget") + ViewWidget.resize(530, 237) + self.gridLayout = QtGui.QGridLayout(ViewWidget) + self.gridLayout.setMargin(0) + self.gridLayout.setSpacing(0) + self.gridLayout.setObjectName("gridLayout") + self.splitter = QtGui.QSplitter(ViewWidget) + self.splitter.setOrientation(QtCore.Qt.Vertical) + self.splitter.setObjectName("splitter") + self.tabTop = QtGui.QTabWidget(self.splitter) + self.tabTop.setObjectName("tabTop") + self.tab = QtGui.QWidget() + self.tab.setGeometry(QtCore.QRect(0, 0, 526, 72)) + self.tab.setObjectName("tab") + self.tabTop.addTab(self.tab, "") + self.tabBottom = QtGui.QTabWidget(self.splitter) + self.tabBottom.setObjectName("tabBottom") + self.tab_3 = QtGui.QWidget() + self.tab_3.setGeometry(QtCore.QRect(0, 0, 526, 103)) + self.tab_3.setObjectName("tab_3") + self.tabBottom.addTab(self.tab_3, "") + self.gridLayout.addWidget(self.splitter, 0, 0, 1, 1) + + self.retranslateUi(ViewWidget) + self.tabTop.setCurrentIndex(0) + self.tabBottom.setCurrentIndex(0) + QtCore.QMetaObject.connectSlotsByName(ViewWidget) + + def retranslateUi(self, ViewWidget): + ViewWidget.setWindowTitle(QtGui.QApplication.translate("ViewWidget", "Form", None, QtGui.QApplication.UnicodeUTF8)) + self.tabTop.setTabText(self.tabTop.indexOf(self.tab), QtGui.QApplication.translate("ViewWidget", "Tab 1", None, QtGui.QApplication.UnicodeUTF8)) + self.tabBottom.setTabText(self.tabBottom.indexOf(self.tab_3), QtGui.QApplication.translate("ViewWidget", "Tab 1", None, QtGui.QApplication.UnicodeUTF8)) + + +if __name__ == "__main__": + import sys + app = QtGui.QApplication(sys.argv) + ViewWidget = QtGui.QWidget() + ui = Ui_ViewWidget() + ui.setupUi(ViewWidget) + ViewWidget.show() + sys.exit(app.exec_()) + Added: trunk/fclient/fclient/impl/ViewView/View.py =================================================================== --- trunk/fclient/fclient/impl/ViewView/View.py (rev 0) +++ trunk/fclient/fclient/impl/ViewView/View.py 2008-08-16 10:57:37 UTC (rev 930) @@ -0,0 +1,320 @@ +#*************************************************************************** +#TODO: +# +# x. shortcuts for "Go to" menus and items +# x. detatch tabs +# +#*************************************************************************** +# some fixes for relative imports +# see --> [http://bugs.python.org/issue1510172] absolute/rellative import not working (works only current dir and below) +# see --> [http://mail.python.org/pipermail/python-ideas/2007-February/000232.html] PEP for executing a module in a +# ...package containing relative imports +from __future__ import absolute_import +if __name__ == '__main__': + import os + __path__ = [os.path.dirname(__file__)] + from ._fix_mexec import fix_mexec + fix_mexec(__name__, __file__) + del fix_mexec + + +from PyQt4 import QtCore, QtGui + + +from .. import config +from ..lib import fcp2 +from .Ui_ViewWidget import Ui_ViewWidget +#********************************************************************************** +# +#********************************************************************************** +class ViewActions(config.ActionsBase): + + def __init__(self, parent): + config.ActionsBase.__init__(self, parent) + + self.action( + name='ActionShowTopTabBar', + text=self.trUtf8('Show top &tabs'), + trigger=parent.onActionShowTabsTop, + isCheckable=True, + isChecked=True, + ) + self.action( + name='ActionShowBottomTabBar', + text=self.trUtf8('Show bottom &tabs'), + trigger=parent.onActionShowTabsBottom, + isCheckable=True, + isChecked=True, + ) + +class GlobalFeedback(config.GlobalFeedbackBase): + """wrapper for global statusbar widgets, menus""" + + def __init__(self, parent, idGlobalFeedback): + config.GlobalFeedbackBase.__init__(self, parent, idGlobalFeedback) + + # menus + self.menu = None + if self.menuBar is not None and hasattr(parent, 'fcViewObject'): + self.menu = QtGui.QMenu(parent.fcViewObject.displayName, self.menuBar) + parent.populateMenu(self.menu) + self.menuBar.addViewMenu(self.menu) + + def setVisible(self, flag): + if self.menu is not None: + self.menu.children()[0].setEnabled(flag) + + +class Settings(config.SettingsBase): + _key_ = config.IdViewWidget + _settings_ = ( + ('LastViewTop', 'String', QtCore.QString('')), + ('LastViewBottom', 'String', QtCore.QString('')), + ('SplitterPos', 'ByteArray', QtCore.QByteArray()), + ('ShowTopTabBar', 'Bool', True), + ('ShowBottomTabBar', 'Bool', True), + ) + + +class ViewData(object): + """data structure to hold data for a view""" + + def __init__(self, tab, view): + self.tab = tab + self.view = view + self.actions = { + 'ActionGoTo': None, + } + +#*********************************************************************** +# +#*********************************************************************** +class ViewWidget(QtGui.QWidget, Ui_ViewWidget): + + IdSplitter = 'splitter' + IdTabTop = 'tabTop' + IdTabBottom = 'tabBottom' + + def __init__(self, parent, idGlobalFeedback=config.IdMainWindow): + QtGui.QWidget.__init__(self, parent) + + # setup ui + self.isCreated = False + self.menuGoToTopView = QtGui.QMenu(self) + self.menuGoToBottomView = QtGui.QMenu(self) + self.setupUi(self) + + # setup ... + self.fcActions = ViewActions(self) + self.fcSettings = Settings().restore() + self.fcGlobalFeedback = GlobalFeedback(self, idGlobalFeedback) + + # setup views + self.viewData = {} # viewName --> ViewData + self.actionGroupGoToTopView = QtGui.QActionGroup(self.menuGoToTopView) + self.actionGroupGoToTopView.setExclusive(True) + self.actionGroupGoToBottomView = QtGui.QActionGroup(self.menuGoToBottomView) + self.actionGroupGoToBottomView.setExclusive(True) + + # setup tab widgets + tabWidgetTop = self.controlById(self.IdTabTop) + tabWidgetTop.removeTab(0) + tabWidgetBottom = self.controlById(self.IdTabBottom) + tabWidgetBottom.removeTab(0) + + # setup splitter + splitter = self.controlById(self.IdSplitter) + splitter.restoreState(self.fcSettings.value('SplitterPos')) + self.connect(splitter, QtCore.SIGNAL('splitterMoved(int, int)'), self.onSplitterMoved) + + ################################### + ## private methods + ################################### + def _addViews(self, toTop, *views): + """private method to add one or more views ro bottom or top tabs""" + tabWidget = self.controlById(self.IdTabTop) if toTop else self.controlById(self.IdTabBottom) + for view in views: + viewName = view.name() + if not viewName: + raise ValueError('view must have a name') + if viewName in self.viewData: + raise ValueError('view with that name is already present: %s' % viewName) + view.widget().setParent(tabWidget) + index = tabWidget.addTab(view.widget(), view.icon(), view.displayName()) + self.viewData[viewName] = viewData = ViewData(tabWidget, view) + tabWidget.tabBar().setTabData(index, QtCore.QVariant(viewName)) + + # add some actions dynamically + menu = self.menuGoToTopView if toTop else self.menuGoToBottomView + actionGroup = self.actionGroupGoToTopView if toTop else self.actionGroupGoToBottomView + act = QtGui.QAction(actionGroup) + act.setObjectName(viewName) + act.setText(view.displayName()) + act.setCheckable(True) + self.connect(act, QtCore.SIGNAL('triggered()'), self.onActionGoToView) + viewData.actions['ActionGoTo'] = act + menu.addAction(act) + actionGroup.addAction(act) + #tab.tabBar().setVisible(tab.count() > 1) + + ################################### + ## overwritten methods + ################################### + def retranslateUi(self, me): + Ui_ViewWidget.retranslateUi(self, me) + self.menuGoToTopView.setTitle(self.trUtf8('Top go to')) + self.menuGoToBottomView.setTitle(self.trUtf8('Bottom go to')) + + ################################### + ## methods + ################################### + def addBottomViews(self, *views): + """adds one or more L{View}s to the bottom area of the view widget""" + return self._addViews(False, *views) + + def addTopViews(self, *views): + """adds one or more L{View}s to the top area of the view widget""" + return self._addViews(True, *views) + + def controlById(self, idControl): + return getattr(self, idControl) + + def currentView(self, top=True): + """returns the name of the current view + @param top: if True, returns the name of the current view on the top tabWidget, else the name + of current view on the bottom tabWidget + @return: (QString) name or None + """ + tabWidget = self.controlById(self.IdTabTop) if top else self.controlById(self.IdTabBottom) + index = tabWidget.currentIndex() + if index > -1: + return tabWidget.tabBar().tabData(index).toString() + return None + + def populateMenu(self, menu): + """populates a menu with actions the view widget defines""" + menu.addAction(self.fcActions['ActionShowTopTabBar']) + menu.addAction(self.fcActions['ActionShowBottomTabBar']) + menu.addSeparator() + menu.addMenu(self.menuGoToTopView) + menu.addMenu(self.menuGoToBottomView) + return menu + + def setCurrentView(self, name): + """sets the current view on the tabWidgtes given the views name + @return: Lname of the current view or None + """ + viewData = self.viewData.get(name, None) + if viewData is not None: + viewData.tab.setCurrentWidget(viewData.view.widget()) + return name + return None + + def viewDataFromName(self, name): + """returns L{ViewData} associated to a view + @param name: (QString) name of the view + @return: L{ViewData} or None + """ + viewData = self.viewData.get(name, None) + if viewData is not None: + return viewData + return None + + ######################################################### + ## overwritten events + ######################################################### + def closeEvent(self, event): + for viewData in self.viewData.values(): + viewData.view.close() + + def hideEvent(self, event): + self.fcGlobalFeedback.setVisible(False) + + def showEvent(self, event): + self.fcGlobalFeedback.setVisible(True) + if self.isCreated: + return + self.isCreated = True + + # restore last selected views (could be costy, so do it here) + tabWidgetTop = self.controlById(self.IdTabTop) + viewName = self.fcSettings.value('LastViewTop') + viewName = self.setCurrentView(viewName) + if viewName is None: + viewName = self.currentView(top=True) + if viewName is not None: + viewData = self.viewDataFromName(viewName) + viewData.actions['ActionGoTo'].setChecked(True) + + tabWidgetBottom = self.controlById(self.IdTabBottom) + viewName = self.fcSettings.value('LastViewBottom') + viewName = self.setCurrentView(viewName) + if viewName is None: + viewName = self.currentView(top=False) + if viewName is not None: + viewData = self.viewDataFromName(viewName) + viewData.actions['ActionGoTo'].setChecked(True) + + # finally connect... not to overwrite settings + self.connect(tabWidgetTop, QtCore.SIGNAL('currentChanged(int)'), self.onTabTopCurrentChanged) + self.connect(tabWidgetBottom, QtCore.SIGNAL('currentChanged(int)'), self.onTabBottomCurrentChanged) + + # adjust tabWidgets + showTopTabBar = self.fcSettings.value('ShowTopTabBar') + self.fcActions['ActionShowTopTabBar'].setChecked(showTopTabBar) + tabWidgetTop.tabBar().setVisible(showTopTabBar) + + showBottomTabBar = self.fcSettings.value('ShowBottomTabBar') + self.fcActions['ActionShowBottomTabBar'].setChecked(showBottomTabBar) + tabWidgetBottom.tabBar().setVisible(showBottomTabBar) + + + ################################## + ## event handlers + ################################## + def onActionGoToView(self): + act = self.sender() + viewData = self.viewData[act.objectName()] + viewData.tab.setCurrentWidget(viewData.view) + + def onActionShowTabsBottom(self, action): + tabWidgetTop = self.controlById(self.IdTabBottom) + tabWidgetTop.tabBar().setVisible(action.isChecked()) + self.fcSettings.setValues(ShowBottomTabBar=action.isChecked()) + + def onActionShowTabsTop(self, action): + tabWidgetTop = self.controlById(self.IdTabTop) + tabWidgetTop.tabBar().setVisible(action.isChecked()) + self.fcSettings.setValues(ShowTopTabBar=action.isChecked()) + + def onSplitterMoved(self, pos, index): + splitter = self.controlById(self.IdSplitter) + self.fcSettings.setValues(SplitterPos=splitter.saveState()) + + def onTabTopCurrentChanged(self, index): + viewName = self.currentView(top=True) + viewData = self.viewData[viewName] + viewData.actions['ActionGoTo'].setChecked(True) + self.fcSettings.setValues(LastViewTop=viewName) + + def onTabBottomCurrentChanged(self, index): + viewName = self.currentView(top=False) + viewData = self.viewData[viewName] + viewData.actions['ActionGoTo'].setChecked(True) + self.fcSettings.setValues(LastViewTop=viewName) + +#********************************************************************************** +# +#********************************************************************************** +if __name__ == '__main__': + import sys + + app = QtGui.QApplication(sys.argv) + w = ViewWidget(None) + w.show() + res = app.exec_() + sys.exit(res) + + + + Added: trunk/fclient/fclient/impl/ViewView/ViewObject.py =================================================================== --- trunk/fclient/fclient/impl/ViewView/ViewObject.py (rev 0) +++ trunk/fclient/fclient/impl/ViewView/ViewObject.py 2008-08-16 10:57:37 UTC (rev 930) @@ -0,0 +1,51 @@ +# some fixes for relative imports +# see --> [http://bugs.python.org/issue1510172] absolute/rellative import not working (works only current dir and below) +# see --> [http://mail.python.org/pipermail/python-ideas/2007-February/000232.html] PEP for executing a module in a +# ...package containing relative imports +from __future__ import absolute_import +if __name__ == '__main__': + import os + __path__ = [os.path.dirname(__file__)] + from ._fix_mexec import fix_mexec + fix_mexec(__name__, __file__) + del fix_mexec + + +from PyQt4 import QtGui + +from .. import config +from .. import ViewObject + +from . import View +#************************************************************************************ +# +#************************************************************************************ +class ViewObjectView(ViewObject.ViewObject): + + def __init__(self, parentView=None): + ViewObject.ViewObject.__init__(self, parentView) + self._widget = None + + def close(self): + pass + + def create(self): + self._widget = View.ViewWidget(self.parentWidget()) + return self.widget() + + def displayName(self): + return self.trUtf8('View') + + def icon(self): + return QtGui.QIcon() + + def name(self): + return config.IdViewObjectView + + def prefsPage(self): + pass + + + def widget(self): + return self._widget + Added: trunk/fclient/fclient/impl/ViewView/ViewWidget.ui =================================================================== --- trunk/fclient/fclient/impl/ViewView/ViewWidget.ui (rev 0) +++ trunk/fclient/fclient/impl/ViewView/ViewWidget.ui 2008-08-16 10:57:37 UTC (rev 930) @@ -0,0 +1,69 @@ +<ui version="4.0" > + <class>ViewWidget</class> + <widget class="QWidget" name="ViewWidget" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>530</width> + <height>237</height> + </rect> + </property> + <property name="windowTitle" > + <string>Form</string> + </property> + <layout class="QGridLayout" name="gridLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>0</number> + </property> + <item row="0" column="0" > + <widget class="QSplitter" name="splitter" > + <property name="orientation" > + <enum>Qt::Vertical</enum> + </property> + <widget class="QTabWidget" name="tabTop" > + <property name="currentIndex" > + <number>0</number> + </property> + <widget class="QWidget" name="tab" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>526</width> + <height>72</height> + </rect> + </property> + <attribute name="title" > + <string>Tab 1</string> + </attribute> + </widget> + </widget> + <widget class="QTabWidget" name="tabBottom" > + <property name="currentIndex" > + <number>0</number> + </property> + <widget class="QWidget" name="tab_3" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>526</width> + <height>103</height> + </rect> + </property> + <attribute name="title" > + <string>Tab 1</string> + </attribute> + </widget> + </widget> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> Added: trunk/fclient/fclient/impl/ViewView/__init__.py =================================================================== --- trunk/fclient/fclient/impl/ViewView/__init__.py (rev 0) +++ trunk/fclient/fclient/impl/ViewView/__init__.py 2008-08-16 10:57:37 UTC (rev 930) @@ -0,0 +1 @@ + Added: trunk/fclient/fclient/impl/ViewView/_fix_mexec.py =================================================================== --- trunk/fclient/fclient/impl/ViewView/_fix_mexec.py (rev 0) +++ trunk/fclient/fclient/impl/ViewView/_fix_mexec.py 2008-08-16 10:57:37 UTC (rev 930) @@ -0,0 +1,99 @@ +'''in python 2.5 relative impports are srsly broken ..fix this to make relative imports work +when executing a module as main (-m), including relative imports up to the root package + +see: [http://mail.python.org/pipermail/python-ideas/2007-February/000232.html] + +@note: root package is the highest available package in the package hirarchy. +don't look at __name__ too closely. it gets adjusted for a module to just "do the right +thing" in __name__ == '__main__' comparisons +@note: this patch does not work if relative imports are done in __init__.py. no idea why +and to be honest, I don't wanna* know.. +@note: this is more or less a hack. so it may have unwanted side effects for example +when importing parent packages. use at your own risk. could improve this module +by adding a __main__.py to stop at this level or by fixing the __init__.py bug, but +I don't think its worth it. see what python2.6 or 3k brings.. + +usage:: + + # place this at the top a module, before doing any relative imports + from fix_mexec import fix_mexec + fix_mexec(__name__, __file__) + del fix_mexec + + from ...foo import bar + + + +##<-- copy and paste code, assuming _fix_mexec resides in the current dir.. + +# some fixes for relative imports +# see --> [http://bugs.python.org/issue1510172] absolute/rellative import not working (works only current dir and below) +# see --> [http://mail.python.org/pipermail/python-ideas/2007-February/000232.html] PEP for executing a module in a +# ...package containing relative imports +from __future__ import absolute_import +if __name__ == '__main__': + import os + __path__ = [os.path.dirname(__file__)] + from ._fix_mexec import fix_mexec + fix_mexec(__name__, __file__) + del fix_mexec + + +##--> copy and paste code +''' + +import imp, os, sys +#******************************************************************************** +# +#******************************************************************************** +class MainName(str): + def __eq__(self, other): + if other == '__main__': return True + return str.__eq__(self, other) + def __ne__(self, other): + if other == '__main__': return False + return str.__ne__(self, other) + + +def fix_mexec(_name_, _file_): + """bugfix for relative imports not working + @param _name_: __name__ of the module + @param _file_: __file__ of the module + + @note: not complete: relies on __init__.py, .pyo (...) is ignored currently + """ + if _name_ == '__main__': + out = [] + # find allparent packages + p = os.path.dirname(os.path.abspath(_file_)) + prev = p + while True: + pkg = os.path.join(p, '__init__.py') + if os.path.isfile(pkg): + out.append([pkg, os.path.basename(p)]) + else: + break + prev = p + p = os.path.dirname(p) + if p == prev: + break + out.reverse() + + # adjust sub package names an import parent modules + name = None + for n, (fpath, name) in enumerate(out): + if n > 0: + name = out[n][1] = out[n -1][1] + '.' + out[n][1] + m = imp.load_source(name, fpath) + m.__path__ = [os.path.dirname(fpath)] + + # adjust name of the __main__ module + if name is not None: + m = sys.modules.pop('__main__') + # 'foo.bar..__main__' does not work for some reason. 'foo.bar' seems to work as expected + ##m.__name__ = _Name_(name + '.' + '__main__') + m.__name__ = MainName(name) + sys.modules[m.__name__] = m + + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-16 10:57:03
|
Revision: 929 http://fclient.svn.sourceforge.net/fclient/?rev=929&view=rev Author: jUrner Date: 2008-08-16 10:57:13 +0000 (Sat, 16 Aug 2008) Log Message: ----------- redesign view objects Added Paths: ----------- trunk/fclient/fclient/impl/ViewObject.py Added: trunk/fclient/fclient/impl/ViewObject.py =================================================================== --- trunk/fclient/fclient/impl/ViewObject.py (rev 0) +++ trunk/fclient/fclient/impl/ViewObject.py 2008-08-16 10:57:13 UTC (rev 929) @@ -0,0 +1,57 @@ +# some fixes for relative imports +# see --> [http://bugs.python.org/issue1510172] absolute/rellative import not working (works only current dir and below) +# see --> [http://mail.python.org/pipermail/python-ideas/2007-February/000232.html] PEP for executing a module in a +# ...package containing relative imports +from __future__ import absolute_import +if __name__ == '__main__': + import os + __path__ = [os.path.dirname(__file__)] + +from PyQt4 import QtCore + +from . import config +#************************************************************************************ +# +#************************************************************************************ + + +#************************************************************************************ +# +#************************************************************************************ +class ViewObject(QtCore.QObject): + """base class for view objects""" + + + def __init__(self, parentView=None): + QtCore.QObject.__init__(self, parentView) + config.ObjectRegistry.register(self) + + def close(self): + pass + + def create(self): + pass + + def displayName(self): + pass + + def icon(self): + pass + + def name(self): + return '' + + def parentWidget(self): + parentView = self.parent() + if parentView is not None: + return parentView.widget() + return None + + def prefsPage(self): + pass + + def widget(self): + pass + + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-16 10:56:43
|
Revision: 928 http://fclient.svn.sourceforge.net/fclient/?rev=928&view=rev Author: jUrner Date: 2008-08-16 10:56:48 +0000 (Sat, 16 Aug 2008) Log Message: ----------- no longer needed Removed Paths: ------------- trunk/fclient/fclient/impl/View.py Deleted: trunk/fclient/fclient/impl/View.py =================================================================== --- trunk/fclient/fclient/impl/View.py 2008-08-16 10:56:12 UTC (rev 927) +++ trunk/fclient/fclient/impl/View.py 2008-08-16 10:56:48 UTC (rev 928) @@ -1,358 +0,0 @@ -#*************************************************************************** -#TODO: -# -# x. shortcuts for "Go to" menus and items -# x. detatch tabs -# -#*************************************************************************** -from __future__ import absolute_import -if __name__ == '__main__': # see --> http://bugs.python.org/issue1510172 . works only current dir and below - import os; __path__ = [os.path.dirname(__file__)] - - -from PyQt4 import QtCore, QtGui - - -from . import config -from .lib import fcp2 -from .tpls.Ui_ViewWidgetTpl import Ui_ViewWidget -#********************************************************************************** -# -#********************************************************************************** -class ViewActions(config.ActionsBase): - - def __init__(self, parent): - config.ActionsBase.__init__(self, parent) - - self.action( - name='ActionShowTopTabBar', - text=self.trUtf8('Show top &tabs'), - trigger=parent.onActionShowTabsTop, - isCheckable=True, - isChecked=True, - ) - self.action( - name='ActionShowBottomTabBar', - text=self.trUtf8('Show bottom &tabs'), - trigger=parent.onActionShowTabsBottom, - isCheckable=True, - isChecked=True, - ) - -class GlobalFeedback(config.GlobalFeedbackBase): - """wrapper for global statusbar widgets, menus""" - - def __init__(self, parent, idGlobalFeedback): - config.GlobalFeedbackBase.__init__(self, parent, idGlobalFeedback) - - # menus - self.menu = None - if self.menuBar is not None and hasattr(parent, 'fcViewObject'): - self.menu = QtGui.QMenu(parent.fcViewObject.displayName, self.menuBar) - parent.populateMenu(self.menu) - self.menuBar.addViewMenu(self.menu) - - def setVisible(self, flag): - if self.menu is not None: - self.menu.children()[0].setEnabled(flag) - - -class Settings(config.SettingsBase): - _key_ = config.IdViewWidget - _settings_ = ( - ('LastViewTop', 'String', QtCore.QString('')), - ('LastViewBottom', 'String', QtCore.QString('')), - ('SplitterPos', 'ByteArray', QtCore.QByteArray()), - ('ShowTopTabBar', 'Bool', True), - ('ShowBottomTabBar', 'Bool', True), - ) - - -class ViewViewObject(config.ViewObject): - - def __init__(self, parent): - config.ViewObject. __init__(self, parent) - - self.name=parent.objectName() - self.displayName=self.trUtf8('View') - self.icon=QtGui.QIcon() - - -class ViewData(object): - """data structure to hold data for a view""" - - def __init__(self, tab, view): - self.tab = tab - self.view = view - self.actions = { - 'ActionGoTo': None, - } - -#*********************************************************************** -# -#*********************************************************************** -class ViewWidget(QtGui.QWidget, Ui_ViewWidget): - - IdSplitter = 'splitter' - IdTabTop = 'tabTop' - IdTabBottom = 'tabBottom' - - def __init__(self, parent, idGlobalFeedback=config.IdMainWindow): - QtGui.QWidget.__init__(self, parent) - - # setup ui - self.isCreated = False - self.menuGoToTopView = QtGui.QMenu(self) - self.menuGoToBottomView = QtGui.QMenu(self) - self.setupUi(self) - - # setup ... - config.ObjectRegistry.register(self) - self.fcActions = ViewActions(self) - self.fcSettings = Settings().restore() - self.fcViewObject = ViewViewObject(self) - self.fcGlobalFeedback = GlobalFeedback(self, idGlobalFeedback) - - # setup views - self.viewData = {} # viewName --> ViewData - self.actionGroupGoToTopView = QtGui.QActionGroup(self.menuGoToTopView) - self.actionGroupGoToTopView.setExclusive(True) - self.actionGroupGoToBottomView = QtGui.QActionGroup(self.menuGoToBottomView) - self.actionGroupGoToBottomView.setExclusive(True) - - # setup tab widgets - tabWidgetTop = self.controlById(self.IdTabTop) - tabWidgetTop.removeTab(0) - tabWidgetBottom = self.controlById(self.IdTabBottom) - tabWidgetBottom.removeTab(0) - - # setup splitter - splitter = self.controlById(self.IdSplitter) - splitter.restoreState(self.fcSettings.value('SplitterPos')) - self.connect(splitter, QtCore.SIGNAL('splitterMoved(int, int)'), self.onSplitterMoved) - - ################################### - ## private methods - ################################### - def _addViews(self, toTop, *views): - """private method to add one or more views ro bottom or top tabs""" - tabWidget = self.controlById(self.IdTabTop) if toTop else self.controlById(self.IdTabBottom) - for view in views: - viewName = view.fcViewObject.name - if not viewName: - raise ValueError('view must have a name') - if viewName in self.viewData: - raise ValueError('view with that name is already present: %s' % viewName) - view.setParent(tabWidget) - tabWidget.addTab(view, view.fcViewObject.icon, view.fcViewObject.displayName) - self.viewData[viewName] = viewData = ViewData(tabWidget, view) - - # add some actions dynamically - menu = self.menuGoToTopView if toTop else self.menuGoToBottomView - actionGroup = self.actionGroupGoToTopView if toTop else self.actionGroupGoToBottomView - act = QtGui.QAction(actionGroup) - act.setObjectName(viewName) - act.setText(view.fcViewObject.displayName) - act.setCheckable(True) - self.connect(act, QtCore.SIGNAL('triggered()'), self.onActionGoToView) - viewData.actions['ActionGoTo'] = act - menu.addAction(act) - actionGroup.addAction(act) - #tab.tabBar().setVisible(tab.count() > 1) - - ################################### - ## overwritten methods - ################################### - def retranslateUi(self, me): - Ui_ViewWidget.retranslateUi(self, me) - self.menuGoToTopView.setTitle(self.trUtf8('Top go to')) - self.menuGoToBottomView.setTitle(self.trUtf8('Bottom go to')) - - ################################### - ## methods - ################################### - def addBottomViews(self, *views): - """adds one or more L{View}s to the bottom area of the view widget""" - return self._addViews(False, *views) - - def addTopViews(self, *views): - """adds one or more L{View}s to the top area of the view widget""" - return self._addViews(True, *views) - - def controlById(self, idControl): - return getattr(self, idControl) - - def currentView(self, top=True): - """returns the name of the current view - @param top: if True, returns the name of the current view on the top tabWidget, else the name - of current view on the bottom tabWidget - @return: (QString) name or None - """ - tabWidget = self.controlById(self.IdTabTop) if top else self.controlById(self.IdTabBottom) - view = tabWidget.currentWidget() - if view is not None: - return view.objectName() - return None - - def populateMenu(self, menu): - """populates a menu with actions the view widget defines""" - menu.addAction(self.fcActions['ActionShowTopTabBar']) - menu.addAction(self.fcActions['ActionShowBottomTabBar']) - menu.addSeparator() - menu.addMenu(self.menuGoToTopView) - menu.addMenu(self.menuGoToBottomView) - return menu - - def setCurrentView(self, name): - """sets the current view on the tabWidgtes given the views name - @return: Lname of the current view or None - """ - viewData = self.viewData.get(name, None) - if viewData is not None: - viewData.tab.setCurrentWidget(viewData.view) - return name - return None - - def viewDataFromName(self, name): - """returns L{ViewData} associated to a view - @param name: (QString) name of the view - @return: L{ViewData} or None - """ - viewData = self.viewData.get(name, None) - if viewData is not None: - return viewData - return None - - ######################################################### - ## overwritten events - ######################################################### - def closeEvent(self, event): - for viewData in self.viewData.values(): - viewData.view.viewClose() - - def hideEvent(self, event): - self.fcGlobalFeedback.setVisible(False) - - def showEvent(self, event): - self.fcGlobalFeedback.setVisible(True) - if self.isCreated: - return - self.isCreated = True - - # restore last selected views (could be costy, so do it here) - tabWidgetTop = self.controlById(self.IdTabTop) - viewName = self.fcSettings.value('LastViewTop') - viewName = self.setCurrentView(viewName) - if viewName is None: - viewName = self.currentView(top=True) - if viewName is not None: - viewData = self.viewDataFromName(viewName) - viewData.actions['ActionGoTo'].setChecked(True) - - tabWidgetBottom = self.controlById(self.IdTabBottom) - viewName = self.fcSettings.value('LastViewBottom') - viewName = self.setCurrentView(viewName) - if viewName is None: - viewName = self.currentView(top=False) - if viewName is not None: - viewData = self.viewDataFromName(viewName) - viewData.actions['ActionGoTo'].setChecked(True) - - # finally connect... not to overwrite settings - self.connect(tabWidgetTop, QtCore.SIGNAL('currentChanged(int)'), self.onTabTopCurrentChanged) - self.connect(tabWidgetBottom, QtCore.SIGNAL('currentChanged(int)'), self.onTabBottomCurrentChanged) - - # adjust tabWidgets - showTopTabBar = self.fcSettings.value('ShowTopTabBar') - self.fcActions['ActionShowTopTabBar'].setChecked(showTopTabBar) - tabWidgetTop.tabBar().setVisible(showTopTabBar) - - showBottomTabBar = self.fcSettings.value('ShowBottomTabBar') - self.fcActions['ActionShowBottomTabBar'].setChecked(showBottomTabBar) - tabWidgetBottom.tabBar().setVisible(showBottomTabBar) - - - ################################## - ## event handlers - ################################## - def onActionGoToView(self): - act = self.sender() - viewData = self.viewData[act.objectName()] - viewData.tab.setCurrentWidget(viewData.view) - - def onActionShowTabsBottom(self, action): - tabWidgetTop = self.controlById(self.IdTabBottom) - tabWidgetTop.tabBar().setVisible(action.isChecked()) - self.fcSettings.setValues(ShowBottomTabBar=action.isChecked()) - - def onActionShowTabsTop(self, action): - tabWidgetTop = self.controlById(self.IdTabTop) - tabWidgetTop.tabBar().setVisible(action.isChecked()) - self.fcSettings.setValues(ShowTopTabBar=action.isChecked()) - - def onSplitterMoved(self, pos, index): - splitter = self.controlById(self.IdSplitter) - self.fcSettings.setValues(SplitterPos=splitter.saveState()) - - def onTabTopCurrentChanged(self, index): - tabWidget = self.controlById(self.IdTabTop) - view = tabWidget.currentWidget() - viewData = self.viewData[view.objectName()] - viewData.actions['ActionGoTo'].setChecked(True) - self.fcSettings.setValues(LastViewTop=view.fcViewObject.name) - - def onTabBottomCurrentChanged(self, index): - tab = self.controlById(self.IdTabBottom) - view = tab.currentWidget() - viewData = self.viewData[view.objectName()] - viewData.actions['ActionGoTo'].setChecked(True) - self.fcSettings.setValues(LastViewBottom=view.fcViewObject.name) - -#********************************************************************************** -# -#********************************************************************************** -#NOTE: to self. no need to register views to config.ObjectRegistry. they are just -# opaque objects private to ViewWidget -class View(object): - """base class for views ond by L{ViewWidget}""" - - def __init__(self): - raise NotImplemetedError() - - def viewClose(self): - """called when the view is about to be closed""" - - def viewDisplayName(self): - """should return the user visible name of the view - @return: (QString) - """ - raise NotImplemetedError() - - - def viewIcon(self): - """should return the icon associated to the view - @return: (QIcon) - """ - raise NotImplemetedError() - - def viewName(self): - """should return the internally used id of the view - @return: (str) id - """ - raise NotImplemetedError() - -#********************************************************************************** -# -#********************************************************************************** -if __name__ == '__main__': - import sys - - app = QtGui.QApplication(sys.argv) - w = ViewWidget(None) - w.show() - res = app.exec_() - sys.exit(res) - - - - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-16 10:56:03
|
Revision: 927 http://fclient.svn.sourceforge.net/fclient/?rev=927&view=rev Author: jUrner Date: 2008-08-16 10:56:12 +0000 (Sat, 16 Aug 2008) Log Message: ----------- redesdigned view objects Added Paths: ----------- trunk/fclient/fclient/impl/ViewUploads/ViewObject.py Added: trunk/fclient/fclient/impl/ViewUploads/ViewObject.py =================================================================== --- trunk/fclient/fclient/impl/ViewUploads/ViewObject.py (rev 0) +++ trunk/fclient/fclient/impl/ViewUploads/ViewObject.py 2008-08-16 10:56:12 UTC (rev 927) @@ -0,0 +1,51 @@ +# some fixes for relative imports +# see --> [http://bugs.python.org/issue1510172] absolute/rellative import not working (works only current dir and below) +# see --> [http://mail.python.org/pipermail/python-ideas/2007-February/000232.html] PEP for executing a module in a +# ...package containing relative imports +from __future__ import absolute_import +if __name__ == '__main__': + import os + __path__ = [os.path.dirname(__file__)] + from ._fix_mexec import fix_mexec + fix_mexec(__name__, __file__) + del fix_mexec + + +from PyQt4 import QtGui + +from .. import config +from .. import ViewObject + +from . import ViewUploads +#************************************************************************************ +# +#************************************************************************************ +class ViewObjectUploads(ViewObject.ViewObject): + + def __init__(self, parentView=None): + ViewObject.ViewObject.__init__(self) + self._widget = None + + def close(self): + pass + + def create(self): + self._widget = ViewUploads.ViewUploadsWidget(self.parentWidget()) + return self.widget() + + def displayName(self): + return self.trUtf8('Uploads') + + def icon(self): + return QtGui.QIcon() + + def name(self): + return config.IdViewObjectUploads + + def prefsPage(self): + pass + + + def widget(self): + return self._widget + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-16 10:55:56
|
Revision: 926 http://fclient.svn.sourceforge.net/fclient/?rev=926&view=rev Author: jUrner Date: 2008-08-16 10:56:04 +0000 (Sat, 16 Aug 2008) Log Message: ----------- redesdigned view objects Added Paths: ----------- trunk/fclient/fclient/impl/ViewLogger/ViewObject.py Added: trunk/fclient/fclient/impl/ViewLogger/ViewObject.py =================================================================== --- trunk/fclient/fclient/impl/ViewLogger/ViewObject.py (rev 0) +++ trunk/fclient/fclient/impl/ViewLogger/ViewObject.py 2008-08-16 10:56:04 UTC (rev 926) @@ -0,0 +1,51 @@ +# some fixes for relative imports +# see --> [http://bugs.python.org/issue1510172] absolute/rellative import not working (works only current dir and below) +# see --> [http://mail.python.org/pipermail/python-ideas/2007-February/000232.html] PEP for executing a module in a +# ...package containing relative imports +from __future__ import absolute_import +if __name__ == '__main__': + import os + __path__ = [os.path.dirname(__file__)] + from ._fix_mexec import fix_mexec + fix_mexec(__name__, __file__) + del fix_mexec + + +from PyQt4 import QtGui + +from .. import config +from .. import ViewObject + +from . import ViewLogger +#************************************************************************************ +# +#************************************************************************************ +class ViewObjectLogger(ViewObject.ViewObject): + + def __init__(self, parentView=None): + ViewObject.ViewObject.__init__(self, parentView) + self._widget = None + + def close(self): + pass + + def create(self): + self._widget = ViewLogger.ViewLoggerWidget(self.parentWidget()) + return self.widget() + + def displayName(self): + return self.trUtf8('Logger') + + def icon(self): + return QtGui.QIcon() + + def name(self): + return config.IdViewObjectLogger + + def prefsPage(self): + pass + + + def widget(self): + return self._widget + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-16 10:55:47
|
Revision: 925 http://fclient.svn.sourceforge.net/fclient/?rev=925&view=rev Author: jUrner Date: 2008-08-16 10:55:56 +0000 (Sat, 16 Aug 2008) Log Message: ----------- redesdigned view objects Added Paths: ----------- trunk/fclient/fclient/impl/ViewDownloads/ViewObject.py Added: trunk/fclient/fclient/impl/ViewDownloads/ViewObject.py =================================================================== --- trunk/fclient/fclient/impl/ViewDownloads/ViewObject.py (rev 0) +++ trunk/fclient/fclient/impl/ViewDownloads/ViewObject.py 2008-08-16 10:55:56 UTC (rev 925) @@ -0,0 +1,51 @@ +# some fixes for relative imports +# see --> [http://bugs.python.org/issue1510172] absolute/rellative import not working (works only current dir and below) +# see --> [http://mail.python.org/pipermail/python-ideas/2007-February/000232.html] PEP for executing a module in a +# ...package containing relative imports +from __future__ import absolute_import +if __name__ == '__main__': + import os + __path__ = [os.path.dirname(__file__)] + from ._fix_mexec import fix_mexec + fix_mexec(__name__, __file__) + del fix_mexec + + +from PyQt4 import QtGui + +from .. import config +from .. import ViewObject + +from . import ViewDownloads +#************************************************************************************ +# +#************************************************************************************ +class ViewObjectDownloads(ViewObject.ViewObject): + + def __init__(self, parentView=None): + ViewObject.ViewObject.__init__(self, parentView) + self._widget = None + + def close(self): + pass + + def create(self): + self._widget = ViewDownloads.ViewDownloadsWidget(self.parentWidget()) + return self.widget() + + def displayName(self): + return self.trUtf8('Downloads') + + def icon(self): + return QtGui.QIcon() + + def name(self): + return config.IdViewObjectDownloads + + def prefsPage(self): + pass + + + def widget(self): + return self._widget + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-16 10:55:38
|
Revision: 924 http://fclient.svn.sourceforge.net/fclient/?rev=924&view=rev Author: jUrner Date: 2008-08-16 10:55:48 +0000 (Sat, 16 Aug 2008) Log Message: ----------- redesdigned view objects Added Paths: ----------- trunk/fclient/fclient/impl/ViewConnection/ViewObject.py Added: trunk/fclient/fclient/impl/ViewConnection/ViewObject.py =================================================================== --- trunk/fclient/fclient/impl/ViewConnection/ViewObject.py (rev 0) +++ trunk/fclient/fclient/impl/ViewConnection/ViewObject.py 2008-08-16 10:55:48 UTC (rev 924) @@ -0,0 +1,51 @@ +# some fixes for relative imports +# see --> [http://bugs.python.org/issue1510172] absolute/rellative import not working (works only current dir and below) +# see --> [http://mail.python.org/pipermail/python-ideas/2007-February/000232.html] PEP for executing a module in a +# ...package containing relative imports +from __future__ import absolute_import +if __name__ == '__main__': + import os + __path__ = [os.path.dirname(__file__)] + from ._fix_mexec import fix_mexec + fix_mexec(__name__, __file__) + del fix_mexec + + +from PyQt4 import QtGui + +from .. import config +from .. import ViewObject + +from . import ViewConnection +#************************************************************************************ +# +#************************************************************************************ +class ViewObjectConnection(ViewObject.ViewObject): + + def __init__(self, parentView=None): + ViewObject.ViewObject.__init__(self, parentView) + self._widget = None + + def close(self): + pass + + def create(self): + self._widget = ViewConnection.ViewConnectionWidget(self.parentWidget()) + return self.widget() + + def displayName(self): + return self.trUtf8('Connection') + + def icon(self): + return QtGui.QIcon() + + def name(self): + return config.IdViewObjectConnection + + def prefsPage(self): + pass + + + def widget(self): + return self._widget + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-16 10:55:30
|
Revision: 923 http://fclient.svn.sourceforge.net/fclient/?rev=923&view=rev Author: jUrner Date: 2008-08-16 10:55:40 +0000 (Sat, 16 Aug 2008) Log Message: ----------- redesdigned view objects Added Paths: ----------- trunk/fclient/fclient/impl/ViewBrowser/ViewObject.py Added: trunk/fclient/fclient/impl/ViewBrowser/ViewObject.py =================================================================== --- trunk/fclient/fclient/impl/ViewBrowser/ViewObject.py (rev 0) +++ trunk/fclient/fclient/impl/ViewBrowser/ViewObject.py 2008-08-16 10:55:40 UTC (rev 923) @@ -0,0 +1,51 @@ +# some fixes for relative imports +# see --> [http://bugs.python.org/issue1510172] absolute/rellative import not working (works only current dir and below) +# see --> [http://mail.python.org/pipermail/python-ideas/2007-February/000232.html] PEP for executing a module in a +# ...package containing relative imports +from __future__ import absolute_import +if __name__ == '__main__': + import os + __path__ = [os.path.dirname(__file__)] + from ._fix_mexec import fix_mexec + fix_mexec(__name__, __file__) + del fix_mexec + + +from PyQt4 import QtGui + +from .. import config +from .. import ViewObject + +from . import ViewBrowser +#************************************************************************************ +# +#************************************************************************************ +class ViewObjectBrowser(ViewObject.ViewObject): + + def __init__(self, parentView=None): + ViewObject.ViewObject.__init__(self, parentView) + self._widget = None + + def close(self): + pass + + def create(self): + self._widget = ViewBrowser.ViewBrowserWidget(self.parentWidget()) + return self.widget() + + def displayName(self): + return self.trUtf8('Browser') + + def icon(self): + return QtGui.QIcon() + + def name(self): + return config.IdViewObjectBrowser + + def prefsPage(self): + pass + + + def widget(self): + return self._widget + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-16 10:55:19
|
Revision: 922 http://fclient.svn.sourceforge.net/fclient/?rev=922&view=rev Author: jUrner Date: 2008-08-16 10:55:28 +0000 (Sat, 16 Aug 2008) Log Message: ----------- redesdigned view objects Added Paths: ----------- trunk/fclient/fclient/impl/MainWindow/ViewObject.py Added: trunk/fclient/fclient/impl/MainWindow/ViewObject.py =================================================================== --- trunk/fclient/fclient/impl/MainWindow/ViewObject.py (rev 0) +++ trunk/fclient/fclient/impl/MainWindow/ViewObject.py 2008-08-16 10:55:28 UTC (rev 922) @@ -0,0 +1,51 @@ +# some fixes for relative imports +# see --> [http://bugs.python.org/issue1510172] absolute/rellative import not working (works only current dir and below) +# see --> [http://mail.python.org/pipermail/python-ideas/2007-February/000232.html] PEP for executing a module in a +# ...package containing relative imports +from __future__ import absolute_import +if __name__ == '__main__': + import os + __path__ = [os.path.dirname(__file__)] + from ._fix_mexec import fix_mexec + fix_mexec(__name__, __file__) + del fix_mexec + + +from PyQt4 import QtGui + +from .. import config +from .. import ViewObject + +from . import MainWindow +#************************************************************************************ +# +#************************************************************************************ +class ViewObjectMainWindow(ViewObject.ViewObject): + + def __init__(self, parentView=None): + ViewObject.ViewObject.__init__(self, parentView) + self._widget = None + + def close(self): + pass + + def create(self): + self._widget = MainWindow.MainWindow(self.parentWidget()) + return self.widget() + + def displayName(self): + return self.trUtf8('Main window') + + def icon(self): + return QtGui.QIcon() + + def name(self): + return config.IdViewObjectMainWindow + + def prefsPage(self): + pass + + + def widget(self): + return self._widget + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-16 10:54:52
|
Revision: 921 http://fclient.svn.sourceforge.net/fclient/?rev=921&view=rev Author: jUrner Date: 2008-08-16 10:55:00 +0000 (Sat, 16 Aug 2008) Log Message: ----------- redesdigned view objects Modified Paths: -------------- trunk/fclient/fclient/fclient.py trunk/fclient/fclient/impl/MainWindow/MainWindow.py trunk/fclient/fclient/impl/ViewBrowser/SideBars/SideBarLoadDetails.py trunk/fclient/fclient/impl/ViewBrowser/ViewBrowser.py trunk/fclient/fclient/impl/ViewConnection/ViewConnection.py trunk/fclient/fclient/impl/ViewDownloads/ViewDownloads.py trunk/fclient/fclient/impl/ViewLogger/ViewLogger.py trunk/fclient/fclient/impl/ViewUploads/ViewUploads.py trunk/fclient/fclient/impl/config.py Modified: trunk/fclient/fclient/fclient.py =================================================================== --- trunk/fclient/fclient/fclient.py 2008-08-16 08:22:18 UTC (rev 920) +++ trunk/fclient/fclient/fclient.py 2008-08-16 10:55:00 UTC (rev 921) @@ -12,13 +12,13 @@ from .impl import config from .impl.lib.qt4ex import singleapp -from .impl.MainWindow import MainWindow -from .impl.View import ViewWidget -from .impl.ViewBrowser import ViewBrowser -from .impl.ViewConnection import ViewConnection -from .impl.ViewDownloads import ViewDownloads -from .impl.ViewLogger import ViewLogger -from .impl.ViewUploads import ViewUploads +from .impl.MainWindow.ViewObject import ViewObjectMainWindow +from .impl.ViewView.ViewObject import ViewObjectView +from .impl.ViewConnection.ViewObject import ViewObjectConnection +from .impl.ViewBrowser.ViewObject import ViewObjectBrowser +from .impl.ViewDownloads.ViewObject import ViewObjectDownloads +from .impl.ViewLogger.ViewObject import ViewObjectLogger +from .impl.ViewUploads.ViewObject import ViewObjectUploads from .impl.DlgSingleAppError import DlgSingleAppError #************************************************************* @@ -30,8 +30,8 @@ #TODO: looks like no way to bring the window to the foreground # the calls do not work on x11. may work on windows though # - ##QtGui.QApplication.instance().setActiveWindow(self.userData) - ##self.userData.activateWindow() + ##QtGui.QApplication.instance().setActiveWindow(self.userData.widget()) + ##self.userData.widget().activateWindow() pass def main(): @@ -70,20 +70,37 @@ else: # everything went well. start gui app = QtGui.QApplication(sys.argv) - mainWindow = MainWindow.MainWindow() - singleApp.userData = mainWindow + + #print MainWindow.ViewObject + + voMainWindow = ViewObjectMainWindow(None) + voMainWindow.create() + singleApp.userData = voMainWindow - viewWidget = ViewWidget(mainWindow) - mainWindow.setCentralWidget(viewWidget) - viewWidget.addTopViews( - ViewConnection.ViewConnectionWidget(mainWindow), - ViewBrowser.ViewBrowserWidget(mainWindow), - ViewDownloads.ViewDownloadsWidget(mainWindow), - ViewUploads.ViewUploadsWidget(mainWindow), + voView = ViewObjectView(voMainWindow) + viewWidget = voView.create() + voMainWindow.widget().setCentralWidget(viewWidget) + + topViews = ( + ViewObjectConnection, + ViewObjectBrowser, + ViewObjectDownloads, + ViewObjectUploads, ) - viewWidget.addBottomViews(ViewLogger.ViewLoggerWidget(mainWindow)) + for view in topViews: + view = view(voView) + view.create() + viewWidget.addTopViews(view) - mainWindow.show() + bottomViews = ( + ViewObjectLogger, + ) + for view in bottomViews: + view = view(voView) + view.create() + viewWidget.addBottomViews(view) + + voMainWindow.widget().show() res = app.exec_() sys.exit(res) Modified: trunk/fclient/fclient/impl/MainWindow/MainWindow.py =================================================================== --- trunk/fclient/fclient/impl/MainWindow/MainWindow.py 2008-08-16 08:22:18 UTC (rev 920) +++ trunk/fclient/fclient/impl/MainWindow/MainWindow.py 2008-08-16 10:55:00 UTC (rev 921) @@ -33,8 +33,6 @@ self._isCreated = False self.setupUi(self) - config.ObjectRegistry.register(self) - self.fcSettings = Settings.Settings().restore() self.fcActions = Actions.Actions(self) self.setMenuBar(MenuBar.MenuBar(self)) Modified: trunk/fclient/fclient/impl/ViewBrowser/SideBars/SideBarLoadDetails.py =================================================================== --- trunk/fclient/fclient/impl/ViewBrowser/SideBars/SideBarLoadDetails.py 2008-08-16 08:22:18 UTC (rev 920) +++ trunk/fclient/fclient/impl/ViewBrowser/SideBars/SideBarLoadDetails.py 2008-08-16 10:55:00 UTC (rev 921) @@ -68,8 +68,6 @@ self.statusNames = {} # TreeItem.Status* --> displayName self.setupUi(self) - - config.ObjectRegistry.register(self) self.fcSettings = SideBarLoadDetailsSettings(self).restore() self.baseKey = None # base key of the page Modified: trunk/fclient/fclient/impl/ViewBrowser/ViewBrowser.py =================================================================== --- trunk/fclient/fclient/impl/ViewBrowser/ViewBrowser.py 2008-08-16 08:22:18 UTC (rev 920) +++ trunk/fclient/fclient/impl/ViewBrowser/ViewBrowser.py 2008-08-16 10:55:00 UTC (rev 921) @@ -82,18 +82,6 @@ #***************************************************************************************** # #***************************************************************************************** -class BrowserWidgetViewObject(config.ViewObject): - - def __init__(self, parent): - config.ViewObject. __init__(self, parent) - - self.name=parent.objectName() - self.displayName=self.trUtf8('Browser') - self.icon=QtGui.QIcon() - -#***************************************************************************************** -# -#***************************************************************************************** class ViewBrowserWidget(QtGui.QWidget, Ui_ViewBrowserWidget): IdTabBrowsers = 'tabBrowsers' @@ -123,14 +111,9 @@ self.menuSideBars = QtGui.QMenu(self.trUtf8('Side bars')) #TODO: retranslate self.setupUi(self) - config.ObjectRegistry.register(self) - self.isCreated = False - self._initialConfigDataArrived = False - self.fcSettings = Settings.Settings(self).restore() self.fcActions = Actions.Actions(self) - self.fcViewObject = BrowserWidgetViewObject(self) self.fcGlobalFeedback = GlobalFeedback.GlobalFeedback(self, idGlobalFeedback) # setup @@ -308,9 +291,10 @@ if browser is None: return False - connectionWidget = config.ObjectRegistry.get(config.IdViewConnectionWidget, None) - if connectionWidget is None: - raise ValueError('No connection widget found') + connectionView = config.ObjectRegistry.get(config.IdViewObjectConnection, None) + if connectionView is None: + raise ValueError('No connection view found') + connectionWidget = connectionView.widget() # load url url.setScheme('http') @@ -774,29 +758,38 @@ #********************************************************************************** if __name__ == '__main__': import sys - from ..ViewLogger import ViewLoggerWidget - from ..MainWindow import MainWindow - from ..View import ViewWidget - from ..ViewConnection import ViewConnectionWidget - from ..ViewDownloads import ViewDownloadsWidget + from ..MainWindow.ViewObject import ViewObjectMainWindow + from ..ViewView.ViewObject import ViewObjectView + from ..ViewConnection.ViewObject import ViewObjectConnection + from ..ViewLogger.ViewObject import ViewObjectLogger + from ..ViewBrowser.ViewObject import ViewObjectBrowser app = QtGui.QApplication(sys.argv) - mainWindow = MainWindow.MainWindow() - viewWidget = ViewWidget(mainWindow) - mainWindow.setCentralWidget(viewWidget) - - browserWidget = ViewBrowserWidget(mainWindow) - viewWidget.addTopViews( - ViewConnectionWidget(mainWindow), - browserWidget, - ViewDownloadsWidget(mainWindow), + voMainWindow = ViewObjectMainWindow(None) + voMainWindow.create() + + voView = ViewObjectView(voMainWindow) + viewWidget = voView.create() + voMainWindow.widget().setCentralWidget(viewWidget) + + topViews = ( + ViewObjectConnection, + ViewObjectBrowser, ) - viewWidget.addBottomViews( - ViewLoggerWidget(mainWindow), - ) - - mainWindow.show() + for view in topViews: + view = view(voView) + view.create() + viewWidget.addTopViews(view) + + bottomViews = ( + ViewObjectLogger, + ) + for view in bottomViews: + view = view(voView) + view.create() + viewWidget.addBottomViews(view) + + voMainWindow.widget().show() res = app.exec_() sys.exit(res) - Modified: trunk/fclient/fclient/impl/ViewConnection/ViewConnection.py =================================================================== --- trunk/fclient/fclient/impl/ViewConnection/ViewConnection.py 2008-08-16 08:22:18 UTC (rev 920) +++ trunk/fclient/fclient/impl/ViewConnection/ViewConnection.py 2008-08-16 10:55:00 UTC (rev 921) @@ -95,17 +95,6 @@ spinPort = parent.controlById(parent.IdFproxySpinConnectionPort) spinPort.setValue(self.value('FproxyConnectionPort')) - -class ConnectionViewObject(config.ViewObject): - - def __init__(self, parent): - config.ViewObject. __init__(self, parent) - - self.name=parent.objectName() - self.displayName=self.trUtf8('Connection') - self.icon=QtGui.QIcon() - - #********************************************************************************** # #********************************************************************************** @@ -177,10 +166,8 @@ spinPort.setRange(0, 0xFFFF) #TODO: no idea if port range (0, 0xFFFF) this is reasonable self._isCreated = False - config.ObjectRegistry.register(self) self.fcSettings = Settings(self).restore() self.fcActions = Actions(self) - self.fcViewObject = ConnectionViewObject(self) self.fcGlobalFeedback = GlobalFeedback(self,idGlobalFeedback) self._connectionTimer = ConnectionTimer(self) Modified: trunk/fclient/fclient/impl/ViewDownloads/ViewDownloads.py =================================================================== --- trunk/fclient/fclient/impl/ViewDownloads/ViewDownloads.py 2008-08-16 08:22:18 UTC (rev 920) +++ trunk/fclient/fclient/impl/ViewDownloads/ViewDownloads.py 2008-08-16 10:55:00 UTC (rev 921) @@ -78,17 +78,6 @@ # self.labelFeedbackWrap.setPath(unicode(qString)) - -class DownloadsViewObject(config.ViewObject): - - def __init__(self, parent): - config.ViewObject. __init__(self, parent) - - self.name=parent.objectName() - self.displayName=self.trUtf8('Downloads') - self.icon=QtGui.QIcon() - - class DownloadsWidgetSettings(config.SettingsBase): @@ -107,9 +96,7 @@ BaseRequestsWidget.RequestsWidget.__init__(self, parent) self.setObjectName(config.IdViewDownloadsWidget) - config.ObjectRegistry.register(self) self.fcSettings = DownloadsWidgetSettings(self).restore() - self.fcViewObject = DownloadsViewObject(self) self.fcGlobalFeedback = DownloadsWidgetGlobalFeedback(self, idGlobalFeedback) # setup menus @@ -181,23 +168,39 @@ #********************************************************************************** if __name__ == '__main__': import sys - from .. import View - from ..ViewConnection import ViewConnection - from ..ViewLogger import ViewLogger - from ..MainWindow import MainWindow - + from ..MainWindow.ViewObject import ViewObjectMainWindow + from ..ViewView.ViewObject import ViewObjectView + from ..ViewConnection.ViewObject import ViewObjectConnection + from ..ViewLogger.ViewObject import ViewObjectLogger + from ..ViewDownloads.ViewObject import ViewObjectDownloads + app = QtGui.QApplication(sys.argv) - mainWindow = MainWindow.MainWindow() - viewWidget = View.ViewWidget(mainWindow) - mainWindow.setCentralWidget(viewWidget) - - viewWidget.addTopViews( - ViewConnection.ViewConnectionWidget(None), - ViewDownloadsWidget(None), + voMainWindow = ViewObjectMainWindow(None) + voMainWindow.create() + + voView = ViewObjectView(voMainWindow) + viewWidget = voView.create() + voMainWindow.widget().setCentralWidget(viewWidget) + + topViews = ( + ViewObjectConnection, + ViewObjectDownloads, ) - viewWidget.addBottomViews(ViewLogger.ViewLoggerWidget(None)) + for view in topViews: + view = view(voView) + view.create() + viewWidget.addTopViews(view) + + bottomViews = ( + ViewObjectLogger, + ) + for view in bottomViews: + view = view(voView) + view.create() + viewWidget.addBottomViews(view) + + voMainWindow.widget().show() + res = app.exec_() + sys.exit(res) - mainWindow.show() - res = app.exec_() - sys.exit(res) \ No newline at end of file Modified: trunk/fclient/fclient/impl/ViewLogger/ViewLogger.py =================================================================== --- trunk/fclient/fclient/impl/ViewLogger/ViewLogger.py 2008-08-16 08:22:18 UTC (rev 920) +++ trunk/fclient/fclient/impl/ViewLogger/ViewLogger.py 2008-08-16 10:55:00 UTC (rev 921) @@ -121,17 +121,6 @@ ('ColorFgVerbosityCHATTY', 'QColor', QtGui.QColor('lightslategray')), ) - -class LoggerViewObject(config.ViewObject): - - def __init__(self, parent): - config.ViewObject. __init__(self, parent) - - self.name=parent.objectName() - self.displayName=self.trUtf8('Logger') - self.icon=QtGui.QIcon() - - #*********************************************************************** # #*********************************************************************** @@ -158,11 +147,8 @@ self._mainWindowMenus = {} #TODO: wrap along with toolbars to a handy class MainWindowStuff self.setupUi(self) - config.ObjectRegistry.register(self) - self.fcActions = Actions(self) self.fcSettings = Settings(self).restore() - self.fcViewObject = LoggerViewObject(self) self.fcGlobalFeedback = GlobalFeedback(self, idGlobalFeedback) Modified: trunk/fclient/fclient/impl/ViewUploads/ViewUploads.py =================================================================== --- trunk/fclient/fclient/impl/ViewUploads/ViewUploads.py 2008-08-16 08:22:18 UTC (rev 920) +++ trunk/fclient/fclient/impl/ViewUploads/ViewUploads.py 2008-08-16 10:55:00 UTC (rev 921) @@ -79,17 +79,6 @@ # self.labelFeedbackWrap.setPath(unicode(qString)) - -class DownloadsViewObject(config.ViewObject): - - def __init__(self, parent): - config.ViewObject. __init__(self, parent) - - self.name=parent.objectName() - self.displayName=self.trUtf8('Uploads') - self.icon=QtGui.QIcon() - - class UploadsWidgetSettings(config.SettingsBase): @@ -107,9 +96,7 @@ BaseRequestsWidget.RequestsWidget.__init__(self, parent) self.setObjectName(config.IdViewUploadsWidget) - config.ObjectRegistry.register(self) self.fcSettings = UploadsWidgetSettings(self).restore() - self.fcViewObject = DownloadsViewObject(self) self.fcGlobalFeedback = UploadsWidgetGlobalFeedback(self, idGlobalFeedback) # setup menus @@ -159,23 +146,38 @@ #********************************************************************************** if __name__ == '__main__': import sys - from .. import View - from ..ViewConnection import ViewConnection - from ..ViewLogger import ViewLogger - from ..MainWindow import MainWindow - + from ..MainWindow.ViewObject import ViewObjectMainWindow + from ..ViewView.ViewObject import ViewObjectView + from ..ViewConnection.ViewObject import ViewObjectConnection + from ..ViewLogger.ViewObject import ViewObjectLogger + from ..ViewUploads.ViewObject import ViewObjectUploads + app = QtGui.QApplication(sys.argv) - mainWindow = MainWindow.MainWindow() - viewWidget = View.ViewWidget(mainWindow) - mainWindow.setCentralWidget(viewWidget) - - viewWidget.addTopViews( - ViewConnection.ViewConnectionWidget(None), - ViewUploadsWidget(None), + voMainWindow = ViewObjectMainWindow(None) + voMainWindow.create() + + voView = ViewObjectView(voMainWindow) + viewWidget = voView.create() + voMainWindow.widget().setCentralWidget(viewWidget) + + topViews = ( + ViewObjectConnection, + ViewObjectUploads, ) - viewWidget.addBottomViews(ViewLogger.ViewLoggerWidget(None)) - - mainWindow.show() + for view in topViews: + view = view(voView) + view.create() + viewWidget.addTopViews(view) + + bottomViews = ( + ViewObjectLogger, + ) + for view in bottomViews: + view = view(voView) + view.create() + viewWidget.addBottomViews(view) + + voMainWindow.widget().show() res = app.exec_() sys.exit(res) \ No newline at end of file Modified: trunk/fclient/fclient/impl/config.py =================================================================== --- trunk/fclient/fclient/impl/config.py 2008-08-16 08:22:18 UTC (rev 920) +++ trunk/fclient/fclient/impl/config.py 2008-08-16 10:55:00 UTC (rev 921) @@ -50,6 +50,16 @@ IdSideBarLoadDetails = 'SideBarLoadDetails' +##### +IdViewObjectBrowser = QtCore.QString('ViewObjectBrowser') +IdViewObjectConnection = QtCore.QString('ViewObjectConnection') +IdViewObjectDownloads = QtCore.QString('ViewObjectDownloads') +IdViewObjectLogger = QtCore.QString('ViewObjectLogger') +IdViewObjectMainWindow = QtCore.QString('ViewObjectMainWindow') +IdViewObjectUploads = QtCore.QString('ViewObjectUploads') +IdViewObjectView = QtCore.QString('ViewObjectView') + + class ObjectRegistry(weakref.WeakValueDictionary): """global object registry @@ -57,19 +67,19 @@ ObjectRegistry is actually a WeakValueDictionary. so use as a dict """ - def register(self, obj): + def register(self, viewObject): """regisdters an object in the registry - @param obj: (QObject) object to register + @param viewObject: view object to register @note: QObject.objectName() is taken as id. ids have to be unique throughout the runtime of the gui """ - ido = str(obj.objectName()) + ido = viewObject.name() if ido in self: - raise ValueError('ui object already registered: %s' % ido) - self[ido] = obj + raise ValueError('view object already registered: %s' % ido) + self[ido] = viewObject + + def unregister(self, viewObject): + del self[str(viewObject.name())] - def unregister(self, obj): - del self[str(obj.objectName())] - ObjectRegistry = ObjectRegistry() #********************************************************************************** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |