SF.net SVN: fclient:[673] trunk/fclient/src/fclient/Ui_ViewConnection.py
Status: Pre-Alpha
Brought to you by:
jurner
|
From: <jU...@us...> - 2008-07-19 06:36:50
|
Revision: 673
http://fclient.svn.sourceforge.net/fclient/?rev=673&view=rev
Author: jUrner
Date: 2008-07-19 06:36:58 +0000 (Sat, 19 Jul 2008)
Log Message:
-----------
naming
Modified Paths:
--------------
trunk/fclient/src/fclient/Ui_ViewConnection.py
Modified: trunk/fclient/src/fclient/Ui_ViewConnection.py
===================================================================
--- trunk/fclient/src/fclient/Ui_ViewConnection.py 2008-07-19 06:36:49 UTC (rev 672)
+++ trunk/fclient/src/fclient/Ui_ViewConnection.py 2008-07-19 06:36:58 UTC (rev 673)
@@ -19,28 +19,27 @@
class GlobalFeedback(config.GlobalFeedbackBase):
"""wrapper for global statusbar widgets, menus"""
- def __init__(self, parent, idFeedbackParent):
- config.GlobalFeedbackBase.__init__(self, parent, idFeedbackParent)
+ def __init__(idGlobalFeedback, parent, idFeedbackParent):
+ config.GlobalFeedbackBase.__init__(idGlobalFeedback, parent, idFeedbackParent)
-
# menus
- self.menus = []
- if self.menuBar is not None:
- menu = QtGui.QMenu(parent.fcViewObject.displayName, self.menuBar)
+ idGlobalFeedback.menus = []
+ if idGlobalFeedback.menuBar is not None and hasattr(parent, 'fcViewObject'):
+ menu = QtGui.QMenu(parent.fcViewObject.displayName, idGlobalFeedback.menuBar)
parent.populateMenu(menu)
- self.menus.append(menu)
- self.menuBar.addViewMenu(menu)
+ idGlobalFeedback.menus.append(menu)
+ idGlobalFeedback.menuBar.addViewMenu(menu)
# status bar widgets
- self.label1 = None
- #if self.statusBar is not None:
- # self.label1 = QtGui.QLabel('foo here', self.statusBar)
+ idGlobalFeedback.label1 = None
+ #if idGlobalFeedback.statusBar is not None:
+ # idGlobalFeedback.label1 = QtGui.QLabel('foo here', idGlobalFeedback.statusBar)
- def setVisible(self, flag):
- for menu in self.menus:
+ def setVisible(idGlobalFeedback, flag):
+ for menu in idGlobalFeedback.menus:
menu.children()[0].setVisible(flag)
- if self.label1 is not None:
- self.label1.setVisible(flag)
+ if idGlobalFeedback.label1 is not None:
+ idGlobalFeedback.label1.setVisible(flag)
class Settings(config.SettingsBase):
@@ -58,12 +57,12 @@
class ConnectionViewObject(config.ViewObject):
- def __init__(self, parent):
- config.ViewObject. __init__(self, parent)
+ def __init__(idGlobalFeedback, parent):
+ config.ViewObject. __init__(idGlobalFeedback, parent)
- self.name=parent.objectName()
- self.displayName=self.trUtf8('Connection')
- self.icon=QtGui.QIcon()
+ idGlobalFeedback.name=parent.objectName()
+ idGlobalFeedback.displayName=idGlobalFeedback.trUtf8('Connection')
+ idGlobalFeedback.icon=QtGui.QIcon()
#**********************************************************************************
@@ -71,27 +70,27 @@
#**********************************************************************************
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 __init__(idGlobalFeedback,parent):
+ QtCore.QTimer.__init__(idGlobalFeedback, parent)
+ idGlobalFeedback.fcpIterConnect = None
+ idGlobalFeedback.connect(idGlobalFeedback, QtCore.SIGNAL('timeout()'), idGlobalFeedback.onNext)
- def start(self, settings):
- self.fcpIterConnect = config.fcpClient.iterConnect(
+ def start(idGlobalFeedback, settings):
+ idGlobalFeedback.fcpIterConnect = config.fcpClient.iterConnect(
duration=settings.value('ConnectionTimerMaxDuration'),
timeout=0
)
- if not self.onNext():
- QtCore.QTimer.start(self, settings.value('ConnectionTimerTimeout'))
+ if not idGlobalFeedback.onNext():
+ QtCore.QTimer.start(idGlobalFeedback, settings.value('ConnectionTimerTimeout'))
- def onNext(self):
+ def onNext(idGlobalFeedback):
try:
- result = self.fcpIterConnect.next()
+ result = idGlobalFeedback.fcpIterConnect.next()
except StopIteration:
- self.stop()
+ idGlobalFeedback.stop()
else:
if result is not None:
- self.stop()
+ idGlobalFeedback.stop()
# 1st thing todo after connect is to query the config from the node so all
# listeners right away so not everyone has to query it so. needs more details
# or joins the gui later.. feel free to query again
@@ -102,14 +101,14 @@
class PollTimer(QtCore.QTimer):
- def __init__(self,parent):
- QtCore.QTimer.__init__(self, parent)
- self.connect(self, QtCore.SIGNAL('timeout()'), self.onNext)
+ def __init__(idGlobalFeedback,parent):
+ QtCore.QTimer.__init__(idGlobalFeedback, parent)
+ idGlobalFeedback.connect(idGlobalFeedback, QtCore.SIGNAL('timeout()'), idGlobalFeedback.onNext)
- def start(self, settings):
- QtCore.QTimer.start(self, settings.value('PollTimerTimeout'))
+ def start(idGlobalFeedback, settings):
+ QtCore.QTimer.start(idGlobalFeedback, settings.value('PollTimerTimeout'))
- def onNext(self):
+ def onNext(idGlobalFeedback):
if config.fcpClient.isConnected():
result = config.fcpClient.next()
@@ -123,119 +122,119 @@
IdEdConnectionHost = 'edConnectionHost' #TODO: combobox? validate input.
IdSpinConnectionPort = 'spinConnectionPort'
- def __init__(self, parent, idFeedbackParent=config.IdMainWindow):
- QtGui.QWidget.__init__(self, parent)
+ def __init__(idGlobalFeedback, parent, idFeedbackParent=config.IdMainWindow):
+ QtGui.QWidget.__init__(idGlobalFeedback, parent)
- self._isCreated = False
- self._connectionTimer = ConnectionTimer(self)
- self._pollTimer = PollTimer(self)
- self._fcpEventonrs = (
- (config.fcpClient.events.ClientConnected, self.onFcpClientConected),
- (config.fcpClient.events.ClientDisconnected, self.onFcpClientDisconected),
+ idGlobalFeedback._isCreated = False
+ idGlobalFeedback._connectionTimer = ConnectionTimer(idGlobalFeedback)
+ idGlobalFeedback._pollTimer = PollTimer(idGlobalFeedback)
+ idGlobalFeedback._fcpEventonrs = (
+ (config.fcpClient.events.ClientConnected, idGlobalFeedback.onFcpClientConected),
+ (config.fcpClient.events.ClientDisconnected, idGlobalFeedback.onFcpClientDisconected),
)
- config.fcpClient.events += self._fcpEventonrs
- self._mainWindowMenus = ()
+ config.fcpClient.events += idGlobalFeedback._fcpEventonrs
+ idGlobalFeedback._mainWindowMenus = ()
- self.setupUi(self)
- config.ObjectRegistry.register(self)
- self.fcSettings = Settings().restore()
- self.fcActions = Actions(self)
- self.fcViewObject = ConnectionViewObject(self)
- self.fcGlobalFeedback = GlobalFeedback(self, idFeedbackParent)
+ idGlobalFeedback.setupUi(idGlobalFeedback)
+ config.ObjectRegistry.register(idGlobalFeedback)
+ idGlobalFeedback.fcSettings = Settings().restore()
+ idGlobalFeedback.fcActions = Actions(idGlobalFeedback)
+ idGlobalFeedback.fcViewObject = ConnectionViewObject(idGlobalFeedback)
+ idGlobalFeedback.fcGlobalFeedback = GlobalFeedback(idGlobalFeedback, idFeedbackParent)
#########################################
## methods
#########################################
- def controlById(self, idControl):
- return getattr(self, idControl)
+ def controlById(idGlobalFeedback, idControl):
+ return getattr(idGlobalFeedback, idControl)
- def populateMenu(self, menu):
+ def populateMenu(idGlobalFeedback, menu):
return menu
#########################################
## view methods
#########################################
- def viewClose(self):
- config.fcpClient.events -= self._fcpEventonrs
+ def viewClose(idGlobalFeedback):
+ config.fcpClient.events -= idGlobalFeedback._fcpEventonrs
#########################################
## overwritten events
#########################################
- def closeEvent(self, event):
- self.viewClose()
+ def closeEvent(idGlobalFeedback, event):
+ idGlobalFeedback.viewClose()
- def hideEvent(self, event):
- self.fcGlobalFeedback.setVisible(False)
+ def hideEvent(idGlobalFeedback, event):
+ idGlobalFeedback.fcGlobalFeedback.setVisible(False)
- def showEvent(self, event):
- self.fcGlobalFeedback.setVisible(True)
- if self._isCreated:
+ def showEvent(idGlobalFeedback, event):
+ idGlobalFeedback.fcGlobalFeedback.setVisible(True)
+ if idGlobalFeedback._isCreated:
return
- self._isCreated = True
+ idGlobalFeedback._isCreated = True
# setup host / port boxes
- edHost = self.controlById(self.IdEdConnectionHost)
- edHost.setText(self.fcSettings.value('ConnectionHost'))
+ edHost = idGlobalFeedback.controlById(idGlobalFeedback.IdEdConnectionHost)
+ edHost.setText(idGlobalFeedback.fcSettings.value('ConnectionHost'))
- spinPort = self.controlById(self.IdSpinConnectionPort)
+ spinPort = idGlobalFeedback.controlById(idGlobalFeedback.IdSpinConnectionPort)
spinPort.setRange(0, 0xFFFF) #TODO: no idea if port range (0, 0xFFFF) this is reasonable
- spinPort.setValue(self.fcSettings.value('ConnectionPort'))
+ spinPort.setValue(idGlobalFeedback.fcSettings.value('ConnectionPort'))
# setup Connect button and AutoConnect checkbox
- doAutoConnect = self.fcSettings.value('AutoConnect')
- ck = self.controlById(self.IdckAutoConnect)
+ doAutoConnect = idGlobalFeedback.fcSettings.value('AutoConnect')
+ ck = idGlobalFeedback.controlById(idGlobalFeedback.IdckAutoConnect)
ck.setChecked(doAutoConnect)
- self.connect(ck, QtCore.SIGNAL('stateChanged(int)'), self.onCkAutoConnectStateChanged)
+ idGlobalFeedback.connect(ck, QtCore.SIGNAL('stateChanged(int)'), idGlobalFeedback.onCkAutoConnectStateChanged)
- bt = self.controlById(self.IdBtConnect)
- self.connect(bt, QtCore.SIGNAL('clicked(bool)'), self.onBtConnectClicked)
+ bt = idGlobalFeedback.controlById(idGlobalFeedback.IdBtConnect)
+ idGlobalFeedback.connect(bt, QtCore.SIGNAL('clicked(bool)'), idGlobalFeedback.onBtConnectClicked)
if doAutoConnect:
- self.controlById(self.IdBtConnect).click()
+ idGlobalFeedback.controlById(idGlobalFeedback.IdBtConnect).click()
########################################
## overwritten methods
#########################################
- def retranslateUi(self, w):
- Ui_ViewConnectionWidget.retranslateUi(self, w)
- bt = self.controlById(self.IdBtConnect)
- bt.setText(self.trUtf8('Disconnect') if bt.isChecked() else self.trUtf8('Connect'))
+ def retranslateUi(idGlobalFeedback, w):
+ Ui_ViewConnectionWidget.retranslateUi(idGlobalFeedback, w)
+ bt = idGlobalFeedback.controlById(idGlobalFeedback.IdBtConnect)
+ bt.setText(idGlobalFeedback.trUtf8('Disconnect') if bt.isChecked() else idGlobalFeedback.trUtf8('Connect'))
#########################################
## event onrs
#########################################
- def onBtConnectClicked(self, isChecked):
- bt = self.controlById(self.IdBtConnect)
- bt.setText(self.trUtf8('Disconnect') if isChecked else self.trUtf8('Connect'))
+ def onBtConnectClicked(idGlobalFeedback, isChecked):
+ bt = idGlobalFeedback.controlById(idGlobalFeedback.IdBtConnect)
+ bt.setText(idGlobalFeedback.trUtf8('Disconnect') if isChecked else idGlobalFeedback.trUtf8('Connect'))
if isChecked:
if config.fcpClient.isConnected():
config.fcpClient.close()
- self._connectionTimer.start(self.fcSettings)
+ idGlobalFeedback._connectionTimer.start(idGlobalFeedback.fcSettings)
else:
- self._connectionTimer.stop()
+ idGlobalFeedback._connectionTimer.stop()
if config.fcpClient.isConnected():
- self._pollTimer.stop()
+ idGlobalFeedback._pollTimer.stop()
config.fcpClient.close()
- def onCkAutoConnectStateChanged(self, state):
- self.fcSettings.setValues(AutoConnect=state == QtCore.Qt.Checked)
+ def onCkAutoConnectStateChanged(idGlobalFeedback, state):
+ idGlobalFeedback.fcSettings.setValues(AutoConnect=state == QtCore.Qt.Checked)
#########################################
## fcp event onrs
#########################################
- def onFcpClientDisconected(self, event, msg):
- bt = self.controlById(self.IdBtConnect)
+ def onFcpClientDisconected(idGlobalFeedback, event, msg):
+ bt = idGlobalFeedback.controlById(idGlobalFeedback.IdBtConnect)
if bt.isChecked():
bt.click()
- def onFcpClientConected(self, event, msg):
- self._pollTimer.start(self.fcSettings)
+ def onFcpClientConected(idGlobalFeedback, event, msg):
+ idGlobalFeedback._pollTimer.start(idGlobalFeedback.fcSettings)
#**********************************************************************************
#
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|