SF.net SVN: fclient:[911] trunk/fclient/fclient
Status: Pre-Alpha
Brought to you by:
jurner
From: <jU...@us...> - 2008-08-16 07:54:30
|
Revision: 911 http://fclient.svn.sourceforge.net/fclient/?rev=911&view=rev Author: jUrner Date: 2008-08-16 07:54:39 +0000 (Sat, 16 Aug 2008) Log Message: ----------- isolated connection view Modified Paths: -------------- trunk/fclient/fclient/fclient.py trunk/fclient/fclient/impl/Prefs.py Added Paths: ----------- trunk/fclient/fclient/impl/ViewConnection/ trunk/fclient/fclient/impl/ViewConnection/ConnectionWidgetTpl.ui trunk/fclient/fclient/impl/ViewConnection/Ui_ConnectionWidgetTpl.py trunk/fclient/fclient/impl/ViewConnection/ViewConnection.py trunk/fclient/fclient/impl/ViewConnection/__init__.py trunk/fclient/fclient/impl/ViewConnection/_fix_mexec.py trunk/fclient/fclient/impl/ViewConnection/prefs/ trunk/fclient/fclient/impl/ViewConnection/prefs/PrefsConnectionExpertSettings.ui trunk/fclient/fclient/impl/ViewConnection/prefs/PrefsConnectionWidget.py trunk/fclient/fclient/impl/ViewConnection/prefs/Ui_PrefsConnectionExpertSettings.py trunk/fclient/fclient/impl/ViewConnection/prefs/__init__.py trunk/fclient/fclient/impl/ViewConnection/prefs/_fix_mexec.py Removed Paths: ------------- trunk/fclient/fclient/impl/PrefsConnectionWidget.py trunk/fclient/fclient/impl/ViewConnection.py trunk/fclient/fclient/impl/tpls/PrefsConnectionExpertSettingsTpl.ui trunk/fclient/fclient/impl/tpls/Ui_PrefsConnectionExpertSettingsTpl.py trunk/fclient/fclient/impl/tpls/Ui_ViewConnectionWidgetTpl.py trunk/fclient/fclient/impl/tpls/ViewConnectionWidgetTpl.ui Modified: trunk/fclient/fclient/fclient.py =================================================================== --- trunk/fclient/fclient/fclient.py 2008-08-16 07:43:18 UTC (rev 910) +++ trunk/fclient/fclient/fclient.py 2008-08-16 07:54:39 UTC (rev 911) @@ -15,7 +15,7 @@ from .impl.MainWindow import MainWindow from .impl.View import ViewWidget from .impl.ViewBrowser import ViewBrowser -from .impl.ViewConnection import ViewConnectionWidget +from .impl.ViewConnection import ViewConnection from .impl.ViewDownloads import ViewDownloadsWidget from .impl.ViewLogger import ViewLoggerWidget from .impl.ViewUploads import ViewUploadsWidget @@ -76,7 +76,7 @@ viewWidget = ViewWidget(mainWindow) mainWindow.setCentralWidget(viewWidget) viewWidget.addTopViews( - ViewConnectionWidget(mainWindow), + ViewConnection.ViewConnectionWidget(mainWindow), ViewBrowser.ViewBrowserWidget(mainWindow), ViewDownloadsWidget(mainWindow), ViewUploadsWidget(mainWindow), Modified: trunk/fclient/fclient/impl/Prefs.py =================================================================== --- trunk/fclient/fclient/impl/Prefs.py 2008-08-16 07:43:18 UTC (rev 910) +++ trunk/fclient/fclient/impl/Prefs.py 2008-08-16 07:54:39 UTC (rev 911) @@ -9,7 +9,7 @@ from .lib.qt4ex import dlgpreferences from .PrefsGlobal import PrefsPageGlobal from .ViewBrowser.prefs import PrefsBrowserWidget -from .PrefsConnectionWidget import PrefsPageConnectionExpertSettings +from .ViewConnection.prefs.PrefsConnectionWidget import PrefsPageConnectionExpertSettings from .PrefsSingleApp import PrefsPageSingleApp #********************************************************************************** # Deleted: trunk/fclient/fclient/impl/PrefsConnectionWidget.py =================================================================== --- trunk/fclient/fclient/impl/PrefsConnectionWidget.py 2008-08-16 07:43:18 UTC (rev 910) +++ trunk/fclient/fclient/impl/PrefsConnectionWidget.py 2008-08-16 07:54:39 UTC (rev 911) @@ -1,128 +0,0 @@ -""" -""" -#******************************************************************************* -#TODO: -# -# x. should we reconnect when the user changes the fcp connection name? -# -# -#****************************************************************************** - -from __future__ import absolute_import -if __name__ == '__main__': # see --> http://bugs.Fc.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.qt4ex import dlgpreferences -from .lib.qt4ex.lib import settings - -from .tpls.Ui_PrefsConnectionExpertSettingsTpl import Ui_PrefsConnectionExpertSettings -#********************************************************************************** -# -#********************************************************************************** -class PrefsConnectionExpertSettingsWidget(QtGui.QWidget, Ui_PrefsConnectionExpertSettings): - - IdEdFcpConnectionName = 'edFcpConnectionName' - IdSpinFcpConnectionTimerMaxDuration = 'spinFcpConnectionTimerMaxDuration' - IdSpinConnectionTimerTimeout = 'spinConnectionTimerTimeout' - IdSpinFcpPollTimerTimeout = 'spinFcpPollTimerTimeout' - - - def __init__(self, parent=None, page=None): - QtGui.QWidget.__init__(self, parent) - - self.setupUi(self) - self.setWindowTitle(config.FcAppName + self.trUtf8(' - Connection expert settings')) - self.fcSettingsControler = None - - # - connectionWidget = config.ObjectRegistry.get(config.IdViewConnectionWidget, None) - if connectionWidget is None: - self.setEnabled(False) - else: - self.fcSettingsControler = settings.SettingsControler(connectionWidget.fcSettings, parent=self) - if page is not None: - page.connect(self.fcSettingsControler, QtCore.SIGNAL('isDirty(bool)'), page.setDirty) - self.fcSettingsControler.addLineEdit( - self.controlById(self.IdEdFcpConnectionName), - 'FcpConnectionName', - ) - self.fcSettingsControler.addSpinBox( - self.controlById(self.IdSpinFcpConnectionTimerMaxDuration), - 'FcpConnectionTimerMaxDuration', - ) - self.fcSettingsControler.addSpinBox( - self.controlById(self.IdSpinConnectionTimerTimeout), - 'FcpConnectionTimerTimeout', - ) - self.fcSettingsControler.addSpinBox( - self.controlById(self.IdSpinFcpPollTimerTimeout), - 'FcpPollTimerTimeout', - ) - - def controlById(self, idControl): - return getattr(self, idControl) - - def doApply(self): - if self.fcSettingsControler is not None: - return self.fcSettingsControler.apply() - return False - - def doRestoreDefaults(self): - if self.fcSettingsControler is not None: - return self.fcSettingsControler.restoreDefaults() - return False - -#*********************************************************************** -# -#*********************************************************************** -class PrefsPageConnectionExpertSettings(dlgpreferences.Page): - - UUID = '{{98c7efcb-5636-4bf5-8192-10e7ccb09314}' - - def __init__(self): - dlgpreferences.Page.__init__(self, self.UUID) - self._widget = None - - def displayName(self): - return self.trUtf8('Connection') - - def canApply(self): return True - def canHelp(self): return False - def canRestoreDefaults(self): return True - - def doApply(self): - self._widget.doApply() - return True - - def doRestoreDefaults(self): - self._widget.doRestoreDefaults() - return True - - def setVisible(self, parent, flag): - createdNew = False - if flag and self._widget is None: - createdNew = True - self._widget = PrefsConnectionExpertSettingsWidget(parent, page=self) - self.connect(self._widget, QtCore.SIGNAL('setDirty(bool)'), self.setDirty) - self._widget.setVisible(flag) - return (createdNew, self._widget) - - - -#*********************************************************************** -# -#*********************************************************************** -if __name__ == '__main__': - from PyQt4 import QtGui - import sys - - app = QtGui.QApplication(sys.argv) - w = PrefsConnectionExpertSettingsWidget(None) - w.show() - res = app.exec_() - sys.exit(res) - Added: trunk/fclient/fclient/impl/ViewConnection/ConnectionWidgetTpl.ui =================================================================== --- trunk/fclient/fclient/impl/ViewConnection/ConnectionWidgetTpl.ui (rev 0) +++ trunk/fclient/fclient/impl/ViewConnection/ConnectionWidgetTpl.ui 2008-08-16 07:54:39 UTC (rev 911) @@ -0,0 +1,170 @@ +<ui version="4.0" > + <class>ViewConnectionWidget</class> + <widget class="QWidget" name="ViewConnectionWidget" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>421</width> + <height>558</height> + </rect> + </property> + <property name="windowTitle" > + <string>Form</string> + </property> + <layout class="QGridLayout" name="gridLayout" > + <item row="0" column="0" > + <widget class="QLabel" name="fieldHeader" > + <property name="text" > + <string>Fcp connection:</string> + </property> + </widget> + </item> + <item row="1" column="0" > + <layout class="QHBoxLayout" name="horizontalLayout" > + <item> + <layout class="QVBoxLayout" name="verticalLayout" > + <item> + <widget class="QLabel" name="fieldName" > + <property name="text" > + <string>Host:</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="fieldName_2" > + <property name="text" > + <string>Port:</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QVBoxLayout" > + <item> + <widget class="QLineEdit" name="edFcpConnectionHost" > + <property name="dragEnabled" > + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="spinFcpConnectionPort" /> + </item> + </layout> + </item> + </layout> + </item> + <item rowspan="5" row="1" column="1" > + <widget class="Line" name="line" > + <property name="orientation" > + <enum>Qt::Vertical</enum> + </property> + </widget> + </item> + <item row="1" column="2" > + <spacer name="horizontalSpacer" > + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0" > + <size> + <width>229</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="2" column="0" > + <widget class="QCheckBox" name="ckFcpAutoConnect" > + <property name="text" > + <string>Auto Connect</string> + </property> + </widget> + </item> + <item row="3" column="0" > + <widget class="Line" name="line_2" > + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item row="4" column="0" > + <widget class="QLabel" name="fieldHeader_2" > + <property name="text" > + <string>Fproxy connection:</string> + </property> + </widget> + </item> + <item row="5" column="0" > + <layout class="QVBoxLayout" name="verticalLayout_5" > + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2" > + <item> + <layout class="QVBoxLayout" name="verticalLayout_3" > + <item> + <widget class="QLabel" name="fieldName_3" > + <property name="text" > + <string>Host:</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="fieldName_4" > + <property name="text" > + <string>Port:</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout_2" > + <item> + <widget class="QLineEdit" name="edFproxyConnectionHost" > + <property name="dragEnabled" > + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="spinFproxyConnectionPort" /> + </item> + </layout> + </item> + </layout> + </item> + </layout> + </item> + <item row="6" column="0" > + <spacer name="verticalSpacer" > + <property name="orientation" > + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0" > + <size> + <width>20</width> + <height>97</height> + </size> + </property> + </spacer> + </item> + <item row="7" column="0" colspan="3" > + <widget class="QPushButton" name="btConnect" > + <property name="text" > + <string>Connect</string> + </property> + <property name="checkable" > + <bool>true</bool> + </property> + <property name="autoExclusive" > + <bool>false</bool> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> Added: trunk/fclient/fclient/impl/ViewConnection/Ui_ConnectionWidgetTpl.py =================================================================== --- trunk/fclient/fclient/impl/ViewConnection/Ui_ConnectionWidgetTpl.py (rev 0) +++ trunk/fclient/fclient/impl/ViewConnection/Ui_ConnectionWidgetTpl.py 2008-08-16 07:54:39 UTC (rev 911) @@ -0,0 +1,117 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file '/home/me/src/fclient/trunk/fclient/fclient/impl/ViewConnection/ConnectionWidgetTpl.ui' +# +# Created: Sat Aug 16 09:44:39 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_ViewConnectionWidget(object): + def setupUi(self, ViewConnectionWidget): + ViewConnectionWidget.setObjectName("ViewConnectionWidget") + ViewConnectionWidget.resize(421, 558) + self.gridLayout = QtGui.QGridLayout(ViewConnectionWidget) + self.gridLayout.setObjectName("gridLayout") + self.fieldHeader = QtGui.QLabel(ViewConnectionWidget) + self.fieldHeader.setObjectName("fieldHeader") + self.gridLayout.addWidget(self.fieldHeader, 0, 0, 1, 1) + self.horizontalLayout = QtGui.QHBoxLayout() + self.horizontalLayout.setObjectName("horizontalLayout") + self.verticalLayout = QtGui.QVBoxLayout() + self.verticalLayout.setObjectName("verticalLayout") + self.fieldName = QtGui.QLabel(ViewConnectionWidget) + self.fieldName.setObjectName("fieldName") + self.verticalLayout.addWidget(self.fieldName) + self.fieldName_2 = QtGui.QLabel(ViewConnectionWidget) + self.fieldName_2.setObjectName("fieldName_2") + self.verticalLayout.addWidget(self.fieldName_2) + self.horizontalLayout.addLayout(self.verticalLayout) + self.vboxlayout = QtGui.QVBoxLayout() + self.vboxlayout.setObjectName("vboxlayout") + self.edFcpConnectionHost = QtGui.QLineEdit(ViewConnectionWidget) + self.edFcpConnectionHost.setDragEnabled(True) + self.edFcpConnectionHost.setObjectName("edFcpConnectionHost") + self.vboxlayout.addWidget(self.edFcpConnectionHost) + self.spinFcpConnectionPort = QtGui.QSpinBox(ViewConnectionWidget) + self.spinFcpConnectionPort.setObjectName("spinFcpConnectionPort") + self.vboxlayout.addWidget(self.spinFcpConnectionPort) + self.horizontalLayout.addLayout(self.vboxlayout) + self.gridLayout.addLayout(self.horizontalLayout, 1, 0, 1, 1) + self.line = QtGui.QFrame(ViewConnectionWidget) + self.line.setFrameShape(QtGui.QFrame.VLine) + self.line.setFrameShadow(QtGui.QFrame.Sunken) + self.line.setObjectName("line") + self.gridLayout.addWidget(self.line, 1, 1, 5, 1) + spacerItem = QtGui.QSpacerItem(229, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.gridLayout.addItem(spacerItem, 1, 2, 1, 1) + self.ckFcpAutoConnect = QtGui.QCheckBox(ViewConnectionWidget) + self.ckFcpAutoConnect.setObjectName("ckFcpAutoConnect") + self.gridLayout.addWidget(self.ckFcpAutoConnect, 2, 0, 1, 1) + self.line_2 = QtGui.QFrame(ViewConnectionWidget) + self.line_2.setFrameShape(QtGui.QFrame.HLine) + self.line_2.setFrameShadow(QtGui.QFrame.Sunken) + self.line_2.setObjectName("line_2") + self.gridLayout.addWidget(self.line_2, 3, 0, 1, 1) + self.fieldHeader_2 = QtGui.QLabel(ViewConnectionWidget) + self.fieldHeader_2.setObjectName("fieldHeader_2") + self.gridLayout.addWidget(self.fieldHeader_2, 4, 0, 1, 1) + self.verticalLayout_5 = QtGui.QVBoxLayout() + self.verticalLayout_5.setObjectName("verticalLayout_5") + self.horizontalLayout_2 = QtGui.QHBoxLayout() + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.verticalLayout_3 = QtGui.QVBoxLayout() + self.verticalLayout_3.setObjectName("verticalLayout_3") + self.fieldName_3 = QtGui.QLabel(ViewConnectionWidget) + self.fieldName_3.setObjectName("fieldName_3") + self.verticalLayout_3.addWidget(self.fieldName_3) + self.fieldName_4 = QtGui.QLabel(ViewConnectionWidget) + self.fieldName_4.setObjectName("fieldName_4") + self.verticalLayout_3.addWidget(self.fieldName_4) + self.horizontalLayout_2.addLayout(self.verticalLayout_3) + self.verticalLayout_2 = QtGui.QVBoxLayout() + self.verticalLayout_2.setObjectName("verticalLayout_2") + self.edFproxyConnectionHost = QtGui.QLineEdit(ViewConnectionWidget) + self.edFproxyConnectionHost.setDragEnabled(True) + self.edFproxyConnectionHost.setObjectName("edFproxyConnectionHost") + self.verticalLayout_2.addWidget(self.edFproxyConnectionHost) + self.spinFproxyConnectionPort = QtGui.QSpinBox(ViewConnectionWidget) + self.spinFproxyConnectionPort.setObjectName("spinFproxyConnectionPort") + self.verticalLayout_2.addWidget(self.spinFproxyConnectionPort) + self.horizontalLayout_2.addLayout(self.verticalLayout_2) + self.verticalLayout_5.addLayout(self.horizontalLayout_2) + self.gridLayout.addLayout(self.verticalLayout_5, 5, 0, 1, 1) + spacerItem1 = QtGui.QSpacerItem(20, 97, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.gridLayout.addItem(spacerItem1, 6, 0, 1, 1) + self.btConnect = QtGui.QPushButton(ViewConnectionWidget) + self.btConnect.setCheckable(True) + self.btConnect.setAutoExclusive(False) + self.btConnect.setObjectName("btConnect") + self.gridLayout.addWidget(self.btConnect, 7, 0, 1, 3) + + self.retranslateUi(ViewConnectionWidget) + QtCore.QMetaObject.connectSlotsByName(ViewConnectionWidget) + + def retranslateUi(self, ViewConnectionWidget): + ViewConnectionWidget.setWindowTitle(QtGui.QApplication.translate("ViewConnectionWidget", "Form", None, QtGui.QApplication.UnicodeUTF8)) + self.fieldHeader.setText(QtGui.QApplication.translate("ViewConnectionWidget", "Fcp connection:", None, QtGui.QApplication.UnicodeUTF8)) + self.fieldName.setText(QtGui.QApplication.translate("ViewConnectionWidget", "Host:", None, QtGui.QApplication.UnicodeUTF8)) + self.fieldName_2.setText(QtGui.QApplication.translate("ViewConnectionWidget", "Port:", None, QtGui.QApplication.UnicodeUTF8)) + self.ckFcpAutoConnect.setText(QtGui.QApplication.translate("ViewConnectionWidget", "Auto Connect", None, QtGui.QApplication.UnicodeUTF8)) + self.fieldHeader_2.setText(QtGui.QApplication.translate("ViewConnectionWidget", "Fproxy connection:", None, QtGui.QApplication.UnicodeUTF8)) + self.fieldName_3.setText(QtGui.QApplication.translate("ViewConnectionWidget", "Host:", None, QtGui.QApplication.UnicodeUTF8)) + self.fieldName_4.setText(QtGui.QApplication.translate("ViewConnectionWidget", "Port:", None, QtGui.QApplication.UnicodeUTF8)) + self.btConnect.setText(QtGui.QApplication.translate("ViewConnectionWidget", "Connect", None, QtGui.QApplication.UnicodeUTF8)) + + +if __name__ == "__main__": + import sys + app = QtGui.QApplication(sys.argv) + ViewConnectionWidget = QtGui.QWidget() + ui = Ui_ViewConnectionWidget() + ui.setupUi(ViewConnectionWidget) + ViewConnectionWidget.show() + sys.exit(app.exec_()) + Added: trunk/fclient/fclient/impl/ViewConnection/ViewConnection.py =================================================================== --- trunk/fclient/fclient/impl/ViewConnection/ViewConnection.py (rev 0) +++ trunk/fclient/fclient/impl/ViewConnection/ViewConnection.py 2008-08-16 07:54:39 UTC (rev 911) @@ -0,0 +1,324 @@ +#********************************************************************* +#TODO: +# x. setting fcp/fproxy connection params currently won't reset connection. how to handle? +# +# +#********************************************************************* +# 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_ConnectionWidgetTpl import Ui_ViewConnectionWidget +#********************************************************************************** +# +#********************************************************************************** +class Actions(config.ActionsBase): + pass + + +class GlobalFeedback(config.GlobalFeedbackBase): + """wrapper for global statusbar widgets, menus""" + + def __init__(self, parent,idGlobalFeedback): + config.GlobalFeedbackBase.__init__(self, parent,idGlobalFeedback) + + # menus + self.menus = [] + if self.menuBar is not None and hasattr(parent, 'fcViewObject'): + menu = QtGui.QMenu(parent.fcViewObject.displayName, self.menuBar) + parent.populateMenu(menu) + self.menus.append(menu) + self.menuBar.addViewMenu(menu) + + # status bar widgets + self.label1 = None + #if self.statusBar is not None: + # self.label1 = QtGui.QLabel('foo here', self.statusBar) + + def setVisible(self, flag): + for menu in self.menus: + menu.children()[0].setEnabled(flag) + if self.label1 is not None: + self.label1.setVisible(flag) + + +class Settings(config.SettingsBase): + _key_ = config.IdViewConnectionWidget + _settings_ = ( + ('FcpAutoConnect', 'Bool', True), + ('FcpConnectionName', 'String', config.FcConnectionName), + ('FcpConnectionHost', 'String', fcp2.Client.DefaultFcpHost), + ('FcpConnectionPort', 'UInt', fcp2.Client.DefaultFcpPort), + ('FcpConnectionTimerTimeout', 'UInt', 500), + ('FcpConnectionTimerMaxDuration', 'UInt', 20), + ('FcpPollTimerTimeout', 'UInt', 200), + + ('FproxyConnectionHost', 'String','127.0.0.1'), + ('FproxyConnectionPort', 'UInt', 8888), + ) + + def setValues(self, **kws): + config.SettingsBase.setValues(self, **kws) + parent = self.parent() + + # set fcp connection params + if 'FcpConnectionHost' in kws: + edHost = parent.controlById(parent.IdEdFcpConnectionHost) + edHost.setText(self.value('FcpConnectionHost')) + + if 'FcpConnectionPort' in kws: + spinPort = parent.controlById(parent.IdFcpSpinFcpConnectionPort) + spinPort.setValue(self.value('FcpConnectionPort')) + + if 'FcpAutoConnect' in kws: + ck = parent.controlById(parent.IdCkFcpAutoConnect) + ck.setChecked(self.value('FcpAutoConnect')) + + # set fproxy connection params + if 'FproxyConnectionHost' in kws: + edHost = parent.controlById(parent.IdEdFproxyConnectionHost) + edHost.setText(self.value('FproxyConnectionHost')) + + if 'FproxyConnectionPort' in kws: + 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() + + +#********************************************************************************** +# +#********************************************************************************** +class ConnectionTimer(QtCore.QTimer): + + def __init__(self,parent): + QtCore.QTimer.__init__(self, parent) + self.fcpIterConnect = None + self.connect(self, QtCore.SIGNAL('timeout()'), self.onNext) + + def start(self, settings): + config.fcpClient.setConnectionName(settings.value('FcpConnectionName')) + self.fcpIterConnect = config.fcpClient.iterConnect( + host=settings.value('FcpConnectionHost'), + port=settings.value('FcpConnectionPort'), + duration=settings.value('FcpConnectionTimerMaxDuration'), + timeout=0 + ) + if not self.onNext(): + QtCore.QTimer.start(self, settings.value('FcpConnectionTimerTimeout')) + + def onNext(self): + try: + result = self.fcpIterConnect.next() + except StopIteration: + self.stop() + else: + if result is not None: + self.stop() + return True + return False + + +class PollTimer(QtCore.QTimer): + + def __init__(self,parent): + QtCore.QTimer.__init__(self, parent) + self.connect(self, QtCore.SIGNAL('timeout()'), self.onNext) + + def start(self, settings): + QtCore.QTimer.start(self, settings.value('FcpPollTimerTimeout')) + + def onNext(self): + if config.fcpClient.isConnected(): + result = config.fcpClient.next() + +#*********************************************************************** +# +#*********************************************************************** +class ViewConnectionWidget(QtGui.QWidget, Ui_ViewConnectionWidget): + + IdBtConnect = 'btConnect' + IdEdFcpConnectionHost = 'edFcpConnectionHost' + IdFcpSpinFcpConnectionPort = 'spinFcpConnectionPort' + IdCkFcpAutoConnect = 'ckFcpAutoConnect' + + IdEdFproxyConnectionHost = 'edFproxyConnectionHost' + IdFproxySpinConnectionPort = 'spinFproxyConnectionPort' + + + def __init__(self, parent, idGlobalFeedback=config.IdMainWindow): + QtGui.QWidget.__init__(self, parent) + self.setupUi(self) + + # adjust spin box ranges + spinPort = self.controlById(self.IdFcpSpinFcpConnectionPort) + spinPort.setRange(0, 0xFFFF) #TODO: no idea if port range (0, 0xFFFF) this is reasonable + spinPort = self.controlById(self.IdFproxySpinConnectionPort) + 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) + self._pollTimer = PollTimer(self) + self._fcpEventonrs = ( + (config.fcpClient.events.ClientConnected, self.onFcpClientConected), + (config.fcpClient.events.ClientDisconnected, self.onFcpClientDisconected), + ) + config.fcpClient.events += self._fcpEventonrs + self._mainWindowMenus = () + + ######################################### + ## methods + ######################################### + def connected(self): + return self.controlById(self.IdBtConnect).isChecked() + + def controlById(self, idControl): + return getattr(self, idControl) + + def populateMenu(self, menu): + return menu + + def setConnected(self, flag): + bt = self.controlById(self.IdBtConnect) + if (bt.isChecked() and not flag) or (not bt.isChecked() and flag): + bt.click() + return True + return False + + ######################################### + ## view methods + ######################################### + def viewClose(self): + config.fcpClient.events -= self._fcpEventonrs + + ######################################### + ## overwritten events + ######################################### + def closeEvent(self, event): + self.viewClose() + + def hideEvent(self, event): + self.fcGlobalFeedback.setVisible(False) + + def showEvent(self, event): + self.fcGlobalFeedback.setVisible(True) + if self._isCreated: + return + self._isCreated = True + + doAutoConnect = self.fcSettings.value('FcpAutoConnect') + ck = self.controlById(self.IdCkFcpAutoConnect) + ck.setChecked(doAutoConnect) + self.connect(ck, QtCore.SIGNAL('stateChanged(int)'), self.onCkFcpAutoConnectStateChanged) + + spinPort = self.controlById(self.IdFcpSpinFcpConnectionPort) + self.connect(spinPort, QtCore.SIGNAL('valueChanged(int)'), self.onSpinFcpConnectionPortChanged) + + spinPort = self.controlById(self.IdFproxySpinConnectionPort) + self.connect(spinPort, QtCore.SIGNAL('valueChanged(int)'), self.onSpinFproxyConnectionPortChanged) + + # setup fproxy host / port + edHost = self.controlById(self.IdEdFproxyConnectionHost) + self.connect(edHost, QtCore.SIGNAL('textChanged(const QString &)'), self.onEdFproxyConnectionHostChanged) + + bt = self.controlById(self.IdBtConnect) + self.connect(bt, QtCore.SIGNAL('clicked(bool)'), self.onBtConnectClicked) + if doAutoConnect: + self.controlById(self.IdBtConnect).click() + + ######################################## + ## overwritten methods + ######################################### + def retranslateUi(self, w): + Ui_ViewConnectionWidget.retranslateUi(self, w) + bt = self.controlById(self.IdBtConnect) + bt.setText(self.trUtf8('Disconnect') if self.connected() else self.trUtf8('Connect')) + + + ######################################### + ## event onrs + ######################################### + def onBtConnectClicked(self, isChecked): + bt = self.controlById(self.IdBtConnect) + bt.setText(self.trUtf8('Disconnect') if isChecked else self.trUtf8('Connect')) + if isChecked: + if config.fcpClient.isConnected(): + config.fcpClient.close() + self._connectionTimer.start(self.fcSettings) + else: + self._connectionTimer.stop() + if config.fcpClient.isConnected(): + self._pollTimer.stop() + config.fcpClient.close() + + + def onCkFcpAutoConnectStateChanged(self, state): + self.fcSettings.setValues(FcpAutoConnect=state == QtCore.Qt.Checked) + + def onEdFcpConnectionHostChanged(self, text): + self.fcSettings.setValues(FcpConnectionHost=text) + + def onSpinFcpConnectionPortChanged(self, value): + self.fcSettings.setValues(FcpConnectionPort=value) + + def onEdFproxyConnectionHostChanged(self, text): + self.fcSettings.setValues(FproxyConnectionHost=text) + + def onSpinFproxyConnectionPortChanged(self, value): + self.fcSettings.setValues(FproxyConnectionPort=value) + + ######################################### + ## fcp event onrs + ######################################### + def onFcpClientDisconected(self, event, msg): + bt = self.controlById(self.IdBtConnect) + if bt.isChecked(): + bt.click() + + def onFcpClientConected(self, event, msg): + self._pollTimer.start(self.fcSettings) + +#********************************************************************************** +# +#********************************************************************************** +if __name__ == '__main__': + import sys + from .. import View, ViewLogger + + app = QtGui.QApplication(sys.argv) + w = View.ViewWidget(None) + w.addTopViews(ViewConnectionWidget(None)) + w.addBottomViews(ViewLogger.ViewLoggerWidget(None)) + + w.show() + res = app.exec_() + sys.exit(res) + + + Added: trunk/fclient/fclient/impl/ViewConnection/__init__.py =================================================================== --- trunk/fclient/fclient/impl/ViewConnection/__init__.py (rev 0) +++ trunk/fclient/fclient/impl/ViewConnection/__init__.py 2008-08-16 07:54:39 UTC (rev 911) @@ -0,0 +1 @@ + Added: trunk/fclient/fclient/impl/ViewConnection/_fix_mexec.py =================================================================== --- trunk/fclient/fclient/impl/ViewConnection/_fix_mexec.py (rev 0) +++ trunk/fclient/fclient/impl/ViewConnection/_fix_mexec.py 2008-08-16 07:54:39 UTC (rev 911) @@ -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 + + + Added: trunk/fclient/fclient/impl/ViewConnection/prefs/PrefsConnectionExpertSettings.ui =================================================================== --- trunk/fclient/fclient/impl/ViewConnection/prefs/PrefsConnectionExpertSettings.ui (rev 0) +++ trunk/fclient/fclient/impl/ViewConnection/prefs/PrefsConnectionExpertSettings.ui 2008-08-16 07:54:39 UTC (rev 911) @@ -0,0 +1,235 @@ +<ui version="4.0" > + <class>PrefsConnectionExpertSettings</class> + <widget class="QWidget" name="PrefsConnectionExpertSettings" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>520</width> + <height>502</height> + </rect> + </property> + <property name="windowTitle" > + <string>Form</string> + </property> + <layout class="QGridLayout" name="gridLayout" > + <item row="0" column="0" > + <layout class="QVBoxLayout" name="verticalLayout_3" > + <item> + <widget class="QLabel" name="fieldHeader" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Connection name:</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_5" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Preferred" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Adjusts the name the client uses to connect to the node. Use this for example to adjust the connection name in case the name is already in use by other clients. WARNING: changing this will loose your current qequests untill you connect under that name again</string> + </property> + <property name="alignment" > + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> + <property name="wordWrap" > + <bool>true</bool> + </property> + <property name="textInteractionFlags" > + <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard</set> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="edFcpConnectionName" /> + </item> + <item> + <widget class="QLabel" name="fieldHeader_2" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Connect duration and timeout:</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_6" > + <property name="text" > + <string>How long should the client try to connect to the node before finally giving up? How long should he wait before retrying to establish a connection? WARNING: setting timeout to low values may cause the gui to slow down</string> + </property> + <property name="wordWrap" > + <bool>true</bool> + </property> + <property name="textInteractionFlags" > + <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard</set> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout" > + <item> + <layout class="QVBoxLayout" name="verticalLayout" > + <item> + <widget class="QLabel" name="fieldName" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Preferred" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Duration: </string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="fieldName_2" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Preferred" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Timeout:</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout_2" > + <item> + <widget class="QSpinBox" name="spinFcpConnectionTimerMaxDuration" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Expanding" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="suffix" > + <string> seconds</string> + </property> + <property name="maximum" > + <number>999</number> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="spinConnectionTimerTimeout" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Expanding" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="suffix" > + <string> miliseconds</string> + </property> + <property name="maximum" > + <number>99999</number> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + <item> + <widget class="QLabel" name="fieldHeader_3" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Poll frequency: </string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_7" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Preferred" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>How long should the client wait before polling the node for a the next message? Warning: setting this to high values will make messages come in more slowly. Setting it to low values may cause the gui to slow down.</string> + </property> + <property name="wordWrap" > + <bool>true</bool> + </property> + <property name="textInteractionFlags" > + <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard</set> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="spinFcpPollTimerTimeout" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Expanding" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="suffix" > + <string> miliseconds</string> + </property> + <property name="maximum" > + <number>99999</number> + </property> + </widget> + </item> + </layout> + </item> + <item row="1" column="0" > + <spacer name="verticalSpacer" > + <property name="orientation" > + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0" > + <size> + <width>20</width> + <height>87</height> + </size> + </property> + </spacer> + </item> + </layout> + <zorder>tabWidget</zorder> + <zorder>label</zorder> + <zorder>fieldHeader</zorder> + <zorder>label_5</zorder> + <zorder>edFcpConnectionName</zorder> + <zorder>fieldHeader_2</zorder> + <zorder>label_6</zorder> + <zorder>fieldName</zorder> + <zorder>spinFcpConnectionTimerMaxDuration</zorder> + <zorder>fieldName_2</zorder> + <zorder>spinConnectionTimerTimeout</zorder> + <zorder>label_7</zorder> + <zorder>spinFcpPollTimerTimeout</zorder> + <zorder>fieldHeader_3</zorder> + <zorder>verticalSpacer</zorder> + <zorder></zorder> + </widget> + <resources/> + <connections/> +</ui> Added: trunk/fclient/fclient/impl/ViewConnection/prefs/PrefsConnectionWidget.py =================================================================== --- trunk/fclient/fclient/impl/ViewConnection/prefs/PrefsConnectionWidget.py (rev 0) +++ trunk/fclient/fclient/impl/ViewConnection/prefs/PrefsConnectionWidget.py 2008-08-16 07:54:39 UTC (rev 911) @@ -0,0 +1,135 @@ +""" +""" +#******************************************************************************* +#TODO: +# +# x. should we reconnect when the user changes the fcp connection name? +# +# +#****************************************************************************** +# 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 +from ...lib.qt4ex.lib import settings + +from .Ui_PrefsConnectionExpertSettings import Ui_PrefsConnectionExpertSettings +#********************************************************************************** +# +#********************************************************************************** +class PrefsConnectionExpertSettingsWidget(QtGui.QWidget, Ui_PrefsConnectionExpertSettings): + + IdEdFcpConnectionName = 'edFcpConnectionName' + IdSpinFcpConnectionTimerMaxDuration = 'spinFcpConnectionTimerMaxDuration' + IdSpinConnectionTimerTimeout = 'spinConnectionTimerTimeout' + IdSpinFcpPollTimerTimeout = 'spinFcpPollTimerTimeout' + + + def __init__(self, parent=None, page=None): + QtGui.QWidget.__init__(self, parent) + + self.setupUi(self) + self.setWindowTitle(config.FcAppName + self.trUtf8(' - Connection expert settings')) + self.fcSettingsControler = None + + # + connectionWidget = config.ObjectRegistry.get(config.IdViewConnectionWidget, None) + if connectionWidget is None: + self.setEnabled(False) + else: + self.fcSettingsControler = settings.SettingsControler(connectionWidget.fcSettings, parent=self) + if page is not None: + page.connect(self.fcSettingsControler, QtCore.SIGNAL('isDirty(bool)'), page.setDirty) + self.fcSettingsControler.addLineEdit( + self.controlById(self.IdEdFcpConnectionName), + 'FcpConnectionName', + ) + self.fcSettingsControler.addSpinBox( + self.controlById(self.IdSpinFcpConnectionTimerMaxDuration), + 'FcpConnectionTimerMaxDuration', + ) + self.fcSettingsControler.addSpinBox( + self.controlById(self.IdSpinConnectionTimerTimeout), + 'FcpConnectionTimerTimeout', + ) + self.fcSettingsControler.addSpinBox( + self.controlById(self.IdSpinFcpPollTimerTimeout), + 'FcpPollTimerTimeout', + ) + + def controlById(self, idControl): + return getattr(self, idControl) + + def doApply(self): + if self.fcSettingsControler is not None: + return self.fcSettingsControler.apply() + return False + + def doRestoreDefaults(self): + if self.fcSettingsControler is not None: + return self.fcSettingsControler.restoreDefaults() + return False + +#*********************************************************************** +# +#*********************************************************************** +class PrefsPageConnectionExpertSettings(dlgpreferences.Page): + + UUID = '{{98c7efcb-5636-4bf5-8192-10e7ccb09314}' + + def __init__(self): + dlgpreferences.Page.__init__(self, self.UUID) + self._widget = None + + def displayName(self): + return self.trUtf8('Connection') + + def canApply(self): return True + def canHelp(self): return False + def canRestoreDefaults(self): return True + + def doApply(self): + self._widget.doApply() + return True + + def doRestoreDefaults(self): + self._widget.doRestoreDefaults() + return True + + def setVisible(self, parent, flag): + createdNew = False + if flag and self._widget is None: + createdNew = True + self._widget = PrefsConnectionExpertSettingsWidget(parent, page=self) + self.connect(self._widget, QtCore.SIGNAL('setDirty(bool)'), self.setDirty) + self._widget.setVisible(flag) + return (createdNew, self._widget) + + + +#*********************************************************************** +# +#*********************************************************************** +if __name__ == '__main__': + from PyQt4 import QtGui + import sys + + app = QtGui.QApplication(sys.argv) + w = PrefsConnectionExpertSettingsWidget(None) + w.show() + res = app.exec_() + sys.exit(res) + Added: trunk/fclient/fclient/impl/ViewConnection/prefs/Ui_PrefsConnectionExpertSettings.py =================================================================== --- trunk/fclient/fclient/impl/ViewConnection/prefs/Ui_PrefsConnectionExpertSettings.py (rev 0) +++ trunk/fclient/fclient/impl/ViewConnection/prefs/Ui_PrefsConnectionExpertSettings.py 2008-08-16 07:54:39 UTC (rev 911) @@ -0,0 +1,155 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file '/home/me/src/fclient/trunk/fclient/fclient/impl/ViewConnection/prefs/PrefsConnectionExpertSettings.ui' +# +# Created: Sat Aug 16 09:47:48 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_PrefsConnectionExpertSettings(object): + def setupUi(self, PrefsConnectionExpertSettings): + PrefsConnectionExpertSettings.setObjectName("PrefsConnectionExpertSettings") + PrefsConnectionExpertSettings.resize(520, 502) + self.gridLayout = QtGui.QGridLayout(PrefsConnectionExpertSettings) + self.gridLayout.setObjectName("gridLayout") + self.verticalLayout_3 = QtGui.QVBoxLayout() + self.verticalLayout_3.setObjectName("verticalLayout_3") + self.fieldHeader = QtGui.QLabel(PrefsConnectionExpertSettings) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.fieldHeader.sizePolicy().hasHeightForWidth()) + self.fieldHeader.setSizePolicy(sizePolicy) + self.fieldHeader.setObjectName("fieldHeader") + self.verticalLayout_3.addWidget(self.fieldHeader) + self.label_5 = QtGui.QLabel(PrefsConnectionExpertSettings) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.label_5.sizePolicy().hasHeightForWidth()) + self.label_5.setSizePolicy(sizePolicy) + self.label_5.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) + self.label_5.setWordWrap(True) + self.label_5.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByKeyboard) + self.label_5.setObjectName("label_5") + self.verticalLayout_3.addWidget(self.label_5) + self.edFcpConnectionName = QtGui.QLineEdit(PrefsConnectionExpertSettings) + self.edFcpConnectionName.setObjectName("edFcpConnectionName") + self.verticalLayout_3.addWidget(self.edFcpConnectionName) + self.fieldHeader_2 = QtGui.QLabel(PrefsConnectionExpertSettings) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.fieldHeader_2.sizePolicy().hasHeightForWidth()) + self.fieldHeader_2.setSizePolicy(sizePolicy) + self.fieldHeader_2.setObjectName("fieldHeader_2") + self.verticalLayout_3.addWidget(self.fieldHeader_2) + self.label_6 = QtGui.QLabel(PrefsConnectionExpertSettings) + self.label_6.setWordWrap(True) + self.label_6.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByKeyboard) + self.label_6.setObjectName("label_6") + self.verticalLayout_3.addWidget(self.label_6) + self.horizontalLayout = QtGui.QHBoxLayout() + self.horizontalLayout.setObjectName("horizontalLayout") + self.verticalLayout = QtGui.QVBoxLayout() + self.verticalLayout.setObjectName("verticalLayout") + self.fieldName = QtGui.QLabel(PrefsConnectionExpertSettings) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.fieldName.sizePolicy().hasHeightForWidth()) + self.fieldName.setSizePolicy(sizePolicy) + self.fieldName.setObjectName("fieldName") + self.verticalLayout.addWidget(self.fieldName) + self.fieldName_2 = QtGui.QLabel(PrefsConnectionExpertSettings) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.fieldName_2.sizePolicy().hasHeightForWidth()) + self.fieldName_2.setSizePolicy(sizePolicy) + self.fieldName_2.setObjectName("fieldName_2") + self.verticalLayout.addWidget(self.fieldName_2) + self.horizontalLayout.addLayout(self.verticalLayout) + self.verticalLayout_2 = QtGui.QVBoxLayout() + self.verticalLayout_2.setObjectName("verticalLayout_2") + self.spinFcpConnectionTimerMaxDuration = QtGui.QSpinBox(PrefsConnectionExpertSettings) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.spinFcpConnectionTimerMaxDuration.sizePolicy().hasHeightForWidth()) + self.spinFcpConnectionTimerMaxDuration.setSizePolicy(sizePolicy) + self.spinFcpConnectionTimerMaxDuration.setMaximum(999) + self.spinFcpConnectionTimerMaxDuration.setObjectName("spinFcpConnectionTimerMaxDuration") + self.verticalLayout_2.addWidget(self.spinFcpConnectionTimerMaxDuration) + self.spinConnectionTimerTimeout = QtGui.QSpinBox(PrefsConnectionExpertSettings) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.spinConnectionTimerTimeout.sizePolicy().hasHeightForWidth()) + self.spinConnectionTimerTimeout.setSizePolicy(sizePolicy) + self.spinConnectionTimerTimeout.setMaximum(99999) + self.spinConnectionTimerTimeout.setObjectName("spinConnectionTimerTimeout") + self.verticalLayout_2.addWidget(self.spinConnectionTimerTimeout) + self.horizontalLayout.addLayout(self.verticalLayout_2) + self.verticalLayout_3.addLayout(self.horizontalLayout) + self.fieldHeader_3 = QtGui.QLabel(PrefsConnectionExpertSettings) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.fieldHeader_3.sizePolicy().hasHeightForWidth()) + self.fieldHeader_3.setSizePolicy(sizePolicy) + self.fieldHeader_3.setObjectName("fieldHeader_3") + self.verticalLayout_3.addWidget(self.fieldHeader_3) + self.label_7 = QtGui.QLabel(PrefsConnectionExpertSettings) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.label_7.sizePolicy().hasHeightForWidth()) + self.label_7.setSizePolicy(sizePolicy) + self.label_7.setWordWrap(True) + self.label_7.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByKeyboard) + self.label_7.setObjectName("label_7") + self.verticalLayout_3.addWidget(self.label_7) + self.spinFcpPollTimerTimeout = QtGui.QSpinBox(PrefsConnectionExpertSettings) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.spinFcpPollTimerTimeout.sizePolicy().hasHeightForWidth()) + self.spinFcpPollTimerTimeout.setSizePolicy(sizePolicy) + self.spinFcpPollTimerTimeout.setMaximum(99999) + self.spinFcpPollTimerTimeout.setObjectName("spinFcpPollTimerTimeout") + self.verticalLayout_3.addWidget(self.spinFcpPollTimerTimeout) + self.gridLayout.addLayout(self.verticalLayout_3, 0, 0, 1, 1) + spacerItem = QtGui.QSpacerItem(20, 87, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.gridLayout.addItem(spacerItem, 1, 0, 1, 1) + + self.retranslateUi(PrefsConnectionExpertSettings) + QtCore.QMetaObject.connectSlotsByName(PrefsConnectionExpertSettings) + + def retranslateUi(self, PrefsConnectionExpertSettings): + PrefsConnectionExpertSettings.setWindowTitle(QtGui.QApplication.translate("PrefsConnectionExpertSettings", "Form", None, QtGui.QApplication.UnicodeUTF8)) + self.fieldHeader.setText(QtGui.QApplication.translate("PrefsConnectionExpertSettings", "Connection name:", None, QtGui.QApplication.UnicodeUTF8)) + self.label_5.setText(QtGui.QApplication.translate("PrefsConnectionExpertSettings", "Adjusts the name the client uses to connect to the node. Use this for example to adjust the connection name in case the name is already in use by other clients. WARNING: changing this will loose your current qequests untill you connect under that name again", None, QtGui.QApplication.UnicodeUTF8)) + self.fieldHeader_2.setText(QtGui.QApplication.translate("PrefsConnectionExpertSettings", "Connect duration and timeout:", None, QtGui.QApplication.UnicodeUTF8)) + self.label_6.setText(QtGui.QApplication.translate("PrefsConnectionExpertSettings", "How long should the client try to connect to the node before finally giving up? How long should he wait before retrying to establish a connection? WARNING: setting timeout to low values may cause the gui to slow down", None, QtGui.QApplication.UnicodeUTF8)) + self.fieldName.setText(QtGui.QApplication.translate("PrefsConnectionExpertSettings", "Duration: ", None, QtGui.QApplication.UnicodeUTF8)) + self.fieldName_2.setText(QtGui.QApplication.translate("PrefsConnectionExpertSettings", "Timeout:", None, QtGui.QApplication.UnicodeUTF8)) + self.spinFcpConnectionTimerMaxDuration.setSuffix(QtGui.QApplication.translate("PrefsConnectionExpertSettings", " seconds", None, QtGui.QApplication.UnicodeUTF8)) + self.spinConnectionTimerTimeout.setSuffix(QtGui.QApplication.translate("PrefsConnectionExpertSettings", " miliseconds", None, QtGui.QApplication.UnicodeUTF8)) + self.fieldHeader_3.setText(QtGui.QApplication.translate("PrefsConnectionExpertSettings", "Poll frequency: ", None, QtGui.QApplication.UnicodeUTF8)) + self.label_7.setText(QtGui.QApplication.translate("PrefsConnectionExpertSettings", "How long should the client wait before polling the node for a the next message? Warning: setting this to high values will make messages come in more slowly. Setting it to low values may cause the gui to slow down.", None, QtGui.QApplication.UnicodeUTF8)) + self.spinFcpPollTimerTimeout.setSuffix(QtGui.QApplication.translate("PrefsConnectionExpertSettings", " miliseconds", None, QtGui.QApplication.UnicodeUTF8)) + + +if __name__ == "__main__": + import sys + app = QtGui.QApplication(sys.argv) + PrefsConnectionExpertSettings = QtGui.QWidget() + ui = Ui_PrefsConnectionExpertSettings() + ui.setupUi(PrefsConnectionExpertSettings) + PrefsConnectionExpertSettings.show() + sys.exit(app.exec_()) + Added: trunk/fclient/fclient/impl/ViewConnection/prefs/__init__.py =================================================================== -... [truncated message content] |