From 0efcf157529a28f6cf6850c911ffea4a42badf4d Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Mon, 7 Sep 2009 21:39:17 +0100 Subject: [PATCH 1/2] Move network code to initialise(). Add weight to plugin attibutes documentation --- openlp/core/lib/plugin.py | 3 +++ openlp/plugins/remotes/remoteplugin.py | 10 ++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index a338175a8..3cf555136 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -45,6 +45,9 @@ class Plugin(object): ``log`` A log object used to log debugging messages. This is pre-instantiated. + ``weight`` + A numerical value used to order the plugins. + **Hook Functions** ``check_pre_conditions()`` diff --git a/openlp/plugins/remotes/remoteplugin.py b/openlp/plugins/remotes/remoteplugin.py index eadcb05ca..6d6717685 100644 --- a/openlp/plugins/remotes/remoteplugin.py +++ b/openlp/plugins/remotes/remoteplugin.py @@ -35,10 +35,6 @@ class RemotesPlugin(Plugin): # Call the parent constructor Plugin.__init__(self, u'Remotes', u'1.9.0', plugin_helpers) 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): """ @@ -51,6 +47,12 @@ class RemotesPlugin(Plugin): else: 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()'), seld.readData) + def get_settings_tab(self): """ Create the settings Tab From 38ff2f92acfe68826a8af0caa647972eeb0c0108 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Tue, 8 Sep 2009 18:51:34 +0100 Subject: [PATCH 2/2] Fix typo in previous commit --- openlp/plugins/remotes/remoteplugin.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/remotes/remoteplugin.py b/openlp/plugins/remotes/remoteplugin.py index 6d6717685..6852e08d2 100644 --- a/openlp/plugins/remotes/remoteplugin.py +++ b/openlp/plugins/remotes/remoteplugin.py @@ -51,7 +51,7 @@ class RemotesPlugin(Plugin): 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()'), seld.readData) + QtCore.SIGNAL(u'readyRead()'), self.readData) def get_settings_tab(self): """ @@ -62,7 +62,8 @@ class RemotesPlugin(Plugin): def readData(self): log.info(u'Remoted data has arrived') 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) def handle_datagram(self, datagram):