bzr-revno: 527
This commit is contained in:
Jon Tibble 2009-09-08 19:00:16 +01:00 committed by Tim Bentley
commit 7e5b8ce70f
2 changed files with 11 additions and 5 deletions

View File

@ -45,6 +45,9 @@ class Plugin(object):
``log`` ``log``
A log object used to log debugging messages. This is pre-instantiated. A log object used to log debugging messages. This is pre-instantiated.
``weight``
A numerical value used to order the plugins.
**Hook Functions** **Hook Functions**
``check_pre_conditions()`` ``check_pre_conditions()``

View File

@ -35,10 +35,6 @@ class RemotesPlugin(Plugin):
# Call the parent constructor # Call the parent constructor
Plugin.__init__(self, u'Remotes', u'1.9.0', plugin_helpers) Plugin.__init__(self, u'Remotes', u'1.9.0', plugin_helpers)
self.weight = -1 self.weight = -1
self.server = QtNetwork.QUdpSocket()
self.server.bind(int(self.config.get_config(u'remote port', 4316)))
QtCore.QObject.connect(self.server,
QtCore.SIGNAL(u'readyRead()'), self.readData)
def check_pre_conditions(self): def check_pre_conditions(self):
""" """
@ -51,6 +47,12 @@ class RemotesPlugin(Plugin):
else: else:
return False return False
def initialise(self):
self.server = QtNetwork.QUdpSocket()
self.server.bind(int(self.config.get_config(u'remote port', 4316)))
QtCore.QObject.connect(self.server,
QtCore.SIGNAL(u'readyRead()'), self.readData)
def get_settings_tab(self): def get_settings_tab(self):
""" """
Create the settings Tab Create the settings Tab
@ -60,7 +62,8 @@ class RemotesPlugin(Plugin):
def readData(self): def readData(self):
log.info(u'Remoted data has arrived') log.info(u'Remoted data has arrived')
while self.server.hasPendingDatagrams(): while self.server.hasPendingDatagrams():
datagram, host, port = self.server.readDatagram(self.server.pendingDatagramSize()) datagram, host, port = self.server.readDatagram(
self.server.pendingDatagramSize())
self.handle_datagram(datagram) self.handle_datagram(datagram)
def handle_datagram(self, datagram): def handle_datagram(self, datagram):