SF.net SVN: fclient:[687] trunk/fclient/src/fclient/Ui_ViewConnection.py
Status: Pre-Alpha
Brought to you by:
jurner
|
From: <jU...@us...> - 2008-07-19 12:53:03
|
Revision: 687
http://fclient.svn.sourceforge.net/fclient/?rev=687&view=rev
Author: jUrner
Date: 2008-07-19 12:53:07 +0000 (Sat, 19 Jul 2008)
Log Message:
-----------
ups, rename error
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 12:52:44 UTC (rev 686)
+++ trunk/fclient/src/fclient/Ui_ViewConnection.py 2008-07-19 12:53:07 UTC (rev 687)
@@ -30,33 +30,33 @@
class GlobalFeedback(config.GlobalFeedbackBase):
"""wrapper for global statusbar widgets, menus"""
- def __init__(idGlobalFeedback, parent, idFeedbackParent):
- config.GlobalFeedbackBase.__init__(idGlobalFeedback, parent, idFeedbackParent)
+ def __init__(self, parent,idGlobalFeedback):
+ config.GlobalFeedbackBase.__init__(self, parent,idGlobalFeedback)
# menus
- idGlobalFeedback.menus = []
- if idGlobalFeedback.menuBar is not None and hasattr(parent, 'fcViewObject'):
- menu = QtGui.QMenu(parent.fcViewObject.displayName, idGlobalFeedback.menuBar)
+ self.menus = []
+ if self.menuBar is not None and hasattr(parent, 'fcViewObject'):
+ menu = QtGui.QMenu(parent.fcViewObject.displayName, self.menuBar)
parent.populateMenu(menu)
- idGlobalFeedback.menus.append(menu)
- idGlobalFeedback.menuBar.addViewMenu(menu)
+ self.menus.append(menu)
+ self.menuBar.addViewMenu(menu)
# status bar widgets
- idGlobalFeedback.label1 = None
- #if idGlobalFeedback.statusBar is not None:
- # idGlobalFeedback.label1 = QtGui.QLabel('foo here', idGlobalFeedback.statusBar)
+ self.label1 = None
+ #if self.statusBar is not None:
+ # self.label1 = QtGui.QLabel('foo here', self.statusBar)
- def setVisible(idGlobalFeedback, flag):
- for menu in idGlobalFeedback.menus:
+ def setVisible(self, flag):
+ for menu in self.menus:
menu.children()[0].setVisible(flag)
- if idGlobalFeedback.label1 is not None:
- idGlobalFeedback.label1.setVisible(flag)
+ if self.label1 is not None:
+ self.label1.setVisible(flag)
class Settings(config.SettingsBase):
_key_ = config.IdViewConnectionWidget
_settings_ = (
- ('ConnectionTimerTimeout', 'UInt', 800, config.SettingScopeExpert),
+ ('ConnectionTimerTimeout', 'UInt', 500, config.SettingScopeExpert),
('ConnectionTimerMaxDuration', 'UInt', 20, config.SettingScopeExpert),
('PollTimerTimeout', 'UInt', 200, config.SettingScopeExpert),
@@ -68,12 +68,12 @@
class ConnectionViewObject(config.ViewObject):
- def __init__(idGlobalFeedback, parent):
- config.ViewObject. __init__(idGlobalFeedback, parent)
+ def __init__(self, parent):
+ config.ViewObject. __init__(self, parent)
- idGlobalFeedback.name=parent.objectName()
- idGlobalFeedback.displayName=idGlobalFeedback.trUtf8('Connection')
- idGlobalFeedback.icon=QtGui.QIcon()
+ self.name=parent.objectName()
+ self.displayName=self.trUtf8('Connection')
+ self.icon=QtGui.QIcon()
#**********************************************************************************
@@ -81,27 +81,27 @@
#**********************************************************************************
class ConnectionTimer(QtCore.QTimer):
- def __init__(idGlobalFeedback,parent):
- QtCore.QTimer.__init__(idGlobalFeedback, parent)
- idGlobalFeedback.fcpIterConnect = None
- idGlobalFeedback.connect(idGlobalFeedback, QtCore.SIGNAL('timeout()'), idGlobalFeedback.onNext)
+ def __init__(self,parent):
+ QtCore.QTimer.__init__(self, parent)
+ self.fcpIterConnect = None
+ self.connect(self, QtCore.SIGNAL('timeout()'), self.onNext)
- def start(idGlobalFeedback, settings):
- idGlobalFeedback.fcpIterConnect = config.fcpClient.iterConnect(
+ def start(self, settings):
+ self.fcpIterConnect = config.fcpClient.iterConnect(
duration=settings.value('ConnectionTimerMaxDuration'),
timeout=0
)
- if not idGlobalFeedback.onNext():
- QtCore.QTimer.start(idGlobalFeedback, settings.value('ConnectionTimerTimeout'))
+ if not self.onNext():
+ QtCore.QTimer.start(self, settings.value('ConnectionTimerTimeout'))
- def onNext(idGlobalFeedback):
+ def onNext(self):
try:
- result = idGlobalFeedback.fcpIterConnect.next()
+ result = self.fcpIterConnect.next()
except StopIteration:
- idGlobalFeedback.stop()
+ self.stop()
else:
if result is not None:
- idGlobalFeedback.stop()
+ self.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
@@ -112,14 +112,14 @@
class PollTimer(QtCore.QTimer):
- def __init__(idGlobalFeedback,parent):
- QtCore.QTimer.__init__(idGlobalFeedback, parent)
- idGlobalFeedback.connect(idGlobalFeedback, QtCore.SIGNAL('timeout()'), idGlobalFeedback.onNext)
+ def __init__(self,parent):
+ QtCore.QTimer.__init__(self, parent)
+ self.connect(self, QtCore.SIGNAL('timeout()'), self.onNext)
- def start(idGlobalFeedback, settings):
- QtCore.QTimer.start(idGlobalFeedback, settings.value('PollTimerTimeout'))
+ def start(self, settings):
+ QtCore.QTimer.start(self, settings.value('PollTimerTimeout'))
- def onNext(idGlobalFeedback):
+ def onNext(self):
if config.fcpClient.isConnected():
result = config.fcpClient.next()
@@ -133,119 +133,119 @@
IdEdConnectionHost = 'edConnectionHost' #TODO: combobox? validate input.
IdSpinConnectionPort = 'spinConnectionPort'
- def __init__(idGlobalFeedback, parent, idFeedbackParent=config.IdMainWindow):
- QtGui.QWidget.__init__(idGlobalFeedback, parent)
+ def __init__(self, parent,idGlobalFeedback=config.IdMainWindow):
+ QtGui.QWidget.__init__(self, parent)
- 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),
+ 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),
)
- config.fcpClient.events += idGlobalFeedback._fcpEventonrs
- idGlobalFeedback._mainWindowMenus = ()
+ config.fcpClient.events += self._fcpEventonrs
+ self._mainWindowMenus = ()
- idGlobalFeedback.setupUi(idGlobalFeedback)
- config.ObjectRegistry.register(idGlobalFeedback)
- idGlobalFeedback.fcSettings = Settings().restore()
- idGlobalFeedback.fcActions = Actions(idGlobalFeedback)
- idGlobalFeedback.fcViewObject = ConnectionViewObject(idGlobalFeedback)
- idGlobalFeedback.fcGlobalFeedback = GlobalFeedback(idGlobalFeedback, idFeedbackParent)
+ self.setupUi(self)
+ config.ObjectRegistry.register(self)
+ self.fcSettings = Settings().restore()
+ self.fcActions = Actions(self)
+ self.fcViewObject = ConnectionViewObject(self)
+ self.fcGlobalFeedback = GlobalFeedback(self,idGlobalFeedback)
#########################################
## methods
#########################################
- def controlById(idGlobalFeedback, idControl):
- return getattr(idGlobalFeedback, idControl)
+ def controlById(self, idControl):
+ return getattr(self, idControl)
- def populateMenu(idGlobalFeedback, menu):
+ def populateMenu(self, menu):
return menu
#########################################
## view methods
#########################################
- def viewClose(idGlobalFeedback):
- config.fcpClient.events -= idGlobalFeedback._fcpEventonrs
+ def viewClose(self):
+ config.fcpClient.events -= self._fcpEventonrs
#########################################
## overwritten events
#########################################
- def closeEvent(idGlobalFeedback, event):
- idGlobalFeedback.viewClose()
+ def closeEvent(self, event):
+ self.viewClose()
- def hideEvent(idGlobalFeedback, event):
- idGlobalFeedback.fcGlobalFeedback.setVisible(False)
+ def hideEvent(self, event):
+ self.fcGlobalFeedback.setVisible(False)
- def showEvent(idGlobalFeedback, event):
- idGlobalFeedback.fcGlobalFeedback.setVisible(True)
- if idGlobalFeedback._isCreated:
+ def showEvent(self, event):
+ self.fcGlobalFeedback.setVisible(True)
+ if self._isCreated:
return
- idGlobalFeedback._isCreated = True
+ self._isCreated = True
# setup host / port boxes
- edHost = idGlobalFeedback.controlById(idGlobalFeedback.IdEdConnectionHost)
- edHost.setText(idGlobalFeedback.fcSettings.value('ConnectionHost'))
+ edHost = self.controlById(self.IdEdConnectionHost)
+ edHost.setText(self.fcSettings.value('ConnectionHost'))
- spinPort = idGlobalFeedback.controlById(idGlobalFeedback.IdSpinConnectionPort)
+ spinPort = self.controlById(self.IdSpinConnectionPort)
spinPort.setRange(0, 0xFFFF) #TODO: no idea if port range (0, 0xFFFF) this is reasonable
- spinPort.setValue(idGlobalFeedback.fcSettings.value('ConnectionPort'))
+ spinPort.setValue(self.fcSettings.value('ConnectionPort'))
# setup Connect button and AutoConnect checkbox
- doAutoConnect = idGlobalFeedback.fcSettings.value('AutoConnect')
- ck = idGlobalFeedback.controlById(idGlobalFeedback.IdckAutoConnect)
+ doAutoConnect = self.fcSettings.value('AutoConnect')
+ ck = self.controlById(self.IdckAutoConnect)
ck.setChecked(doAutoConnect)
- idGlobalFeedback.connect(ck, QtCore.SIGNAL('stateChanged(int)'), idGlobalFeedback.onCkAutoConnectStateChanged)
+ self.connect(ck, QtCore.SIGNAL('stateChanged(int)'), self.onCkAutoConnectStateChanged)
- bt = idGlobalFeedback.controlById(idGlobalFeedback.IdBtConnect)
- idGlobalFeedback.connect(bt, QtCore.SIGNAL('clicked(bool)'), idGlobalFeedback.onBtConnectClicked)
+ bt = self.controlById(self.IdBtConnect)
+ self.connect(bt, QtCore.SIGNAL('clicked(bool)'), self.onBtConnectClicked)
if doAutoConnect:
- idGlobalFeedback.controlById(idGlobalFeedback.IdBtConnect).click()
+ self.controlById(self.IdBtConnect).click()
########################################
## overwritten methods
#########################################
- 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'))
+ 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'))
#########################################
## event onrs
#########################################
- def onBtConnectClicked(idGlobalFeedback, isChecked):
- bt = idGlobalFeedback.controlById(idGlobalFeedback.IdBtConnect)
- bt.setText(idGlobalFeedback.trUtf8('Disconnect') if isChecked else idGlobalFeedback.trUtf8('Connect'))
+ 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()
- idGlobalFeedback._connectionTimer.start(idGlobalFeedback.fcSettings)
+ self._connectionTimer.start(self.fcSettings)
else:
- idGlobalFeedback._connectionTimer.stop()
+ self._connectionTimer.stop()
if config.fcpClient.isConnected():
- idGlobalFeedback._pollTimer.stop()
+ self._pollTimer.stop()
config.fcpClient.close()
- def onCkAutoConnectStateChanged(idGlobalFeedback, state):
- idGlobalFeedback.fcSettings.setValues(AutoConnect=state == QtCore.Qt.Checked)
+ def onCkAutoConnectStateChanged(self, state):
+ self.fcSettings.setValues(AutoConnect=state == QtCore.Qt.Checked)
#########################################
## fcp event onrs
#########################################
- def onFcpClientDisconected(idGlobalFeedback, event, msg):
- bt = idGlobalFeedback.controlById(idGlobalFeedback.IdBtConnect)
+ def onFcpClientDisconected(self, event, msg):
+ bt = self.controlById(self.IdBtConnect)
if bt.isChecked():
bt.click()
- def onFcpClientConected(idGlobalFeedback, event, msg):
- idGlobalFeedback._pollTimer.start(idGlobalFeedback.fcSettings)
+ def onFcpClientConected(self, event, msg):
+ self._pollTimer.start(self.fcSettings)
#**********************************************************************************
#
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|