openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #29828
[Merge] lp:~alisonken1/openlp/bug-1588369-2.4-projectorNetwork-signal into lp:openlp/2.4
Ken Roberts has proposed merging lp:~alisonken1/openlp/bug-1588369-2.4-projectorNetwork-signal into lp:openlp/2.4.
Commit message:
Bugfix 1588369 - projectorNetwork signal/slot signature mismatch
Requested reviews:
OpenLP Core (openlp-core)
Related bugs:
Bug #1588369 in OpenLP: "Projector Won't Connect in OpenLP"
https://bugs.launchpad.net/openlp/+bug/1588369
For more details, see:
https://code.launchpad.net/~alisonken1/openlp/bug-1588369-2.4-projectorNetwork-signal/+merge/296398
Bugfix 1588369 - projectorNetwork signal/slot signature mismatch
- Fix projectorNetwork signal signature
- Fix projector manager projectorNetwork signature and method call
- Updated pjlink1 test
--------------------------------
lp:~alisonken1/openlp/bug-1588369-2.4-projectorNetwork-signal (revision 2638)
[SUCCESS] https://ci.openlp.io/job/Branch-01-Pull/1587/
[SUCCESS] https://ci.openlp.io/job/Branch-02-Functional-Tests/1498/
[SUCCESS] https://ci.openlp.io/job/Branch-03-Interface-Tests/1436/
[SUCCESS] https://ci.openlp.io/job/Branch-04a-Windows_Functional_Tests/1215/
[SUCCESS] https://ci.openlp.io/job/Branch-04b-Windows_Interface_Tests/805/
[SUCCESS] https://ci.openlp.io/job/Branch-05a-Code_Analysis/873/
[SUCCESS] https://ci.openlp.io/job/Branch-05b-Test_Coverage/741/
--
Your team OpenLP Core is requested to review the proposed merge of lp:~alisonken1/openlp/bug-1588369-2.4-projectorNetwork-signal into lp:openlp/2.4.
=== modified file 'openlp/core/lib/projector/pjlink1.py'
--- openlp/core/lib/projector/pjlink1.py 2016-03-03 17:15:58 +0000
+++ openlp/core/lib/projector/pjlink1.py 2016-06-03 06:42:48 +0000
@@ -68,7 +68,7 @@
"""
# Signals sent by this module
changeStatus = pyqtSignal(str, int, str)
- projectorNetwork = pyqtSignal(int) # Projector network activity
+ projectorNetwork = pyqtSignal(str, int) # Projector network activity
projectorStatus = pyqtSignal(int) # Status update
projectorAuthentication = pyqtSignal(str) # Authentication error
projectorNoAuthentication = pyqtSignal(str) # PIN set and no authentication needed
@@ -377,7 +377,7 @@
self.projectorReceivedData.emit()
return
self.socket_timer.stop()
- self.projectorNetwork.emit(S_NETWORK_RECEIVED)
+ self.projectorNetwork.emit(self.ip, S_NETWORK_RECEIVED)
data_in = decode(read, 'ascii')
data = data_in.strip()
if len(data) < 7:
@@ -456,7 +456,7 @@
log.warn('(%s) send_command(): Not connected - returning' % self.ip)
self.send_queue = []
return
- self.projectorNetwork.emit(S_NETWORK_SENDING)
+ self.projectorNetwork.emit(self.ip, S_NETWORK_SENDING)
log.debug('(%s) send_command(): Building cmd="%s" opts="%s" %s' % (self.ip,
cmd,
opts,
@@ -514,7 +514,7 @@
log.debug('(%s) _send_string(): Queue = %s' % (self.ip, self.send_queue))
self.socket_timer.start()
try:
- self.projectorNetwork.emit(S_NETWORK_SENDING)
+ self.projectorNetwork.emit(self.ip, S_NETWORK_SENDING)
sent = self.write(out.encode('ascii'))
self.waitForBytesWritten(2000) # 2 seconds should be enough
if sent == -1:
=== modified file 'openlp/core/ui/projector/manager.py'
--- openlp/core/ui/projector/manager.py 2015-12-31 22:46:06 +0000
+++ openlp/core/ui/projector/manager.py 2016-06-03 06:42:48 +0000
@@ -61,6 +61,9 @@
E_NOT_CONNECTED: ':/projector/projector_not_connected_error.png'
}
+STATUS_NETWORK_BUSY = [S_CONNECTING, S_NETWORK_SENDING]
+STATUS_NETWORK_FREE = [E_NETWORK, E_UNKNOWN_SOCKET_ERROR, E_NOT_CONNECTED, S_NETWORK_RECEIVED]
+
class Ui_ProjectorManager(object):
"""
@@ -288,6 +291,8 @@
self.projectordb = projectordb
self.projector_list = []
self.source_select_form = None
+ self.network_list = {} # Currently active network communications keyed on IP
+ self.network_busy = False
def bootstrap_initialise(self):
"""
@@ -482,7 +487,7 @@
if ans == msg.Cancel:
return
try:
- projector.link.projectorNetwork.disconnect(self.update_status)
+ projector.link.projectorNetwork.disconnect(self.update_network_status)
except (AttributeError, TypeError):
pass
try:
@@ -720,7 +725,7 @@
thread.started.connect(item.link.thread_started)
thread.finished.connect(item.link.thread_stopped)
thread.finished.connect(thread.deleteLater)
- item.link.projectorNetwork.connect(self.update_status)
+ item.link.projectorNetwork.connect(self.update_network_status)
item.link.changeStatus.connect(self.update_status)
item.link.projectorAuthentication.connect(self.authentication_error)
item.link.projectorNoAuthentication.connect(self.no_authentication_error)
@@ -790,6 +795,39 @@
"""
return self.projector_list
+ @pyqtSlot(str, int)
+ def update_network_status(self, ip, status):
+ """
+ Update network busy icon
+
+ NOTE: Placeholder for bugfix 1588369. Permanent fix will be in trunk for 2.6.
+
+ :param ip: IP of destination
+ :param status: Status code
+ """
+ log.debug('update_network_status(ip="%s" status=%d)' % (ip, status))
+ # Keep track of what connections are currently being chatty
+ if status in STATUS_NETWORK_BUSY:
+ if ip not in self.network_list:
+ log.debug('Adding %s to network list' % ip)
+ self.network_list[ip] = status
+ elif status in STATUS_NETWORK_FREE:
+ if ip in self.network_list:
+ log.debug('Removing %s from network list' % ip)
+ self.network_list.pop(ip)
+ else:
+ log.warn('"%s" not in network list - something got dropped in setting?')
+ else:
+ log.warn('Unknown network status update: ip="%s" stutus: %s' % (ip, status))
+ # Check for turnin on/off network busy icon
+ if self.network_list:
+ log.debug('network list: %s' % self.network_list)
+ log.debug('Turning on network busy icon')
+ self.network_busy = True
+ else:
+ log.debug('No network chatter - turning off network busy icon')
+ self.network_busy = False
+
@pyqtSlot(str, int, str)
def update_status(self, ip, status=None, msg=None):
"""
=== modified file 'tests/functional/openlp_core_lib/test_projector_pjlink1.py'
--- tests/functional/openlp_core_lib/test_projector_pjlink1.py 2016-03-03 17:15:58 +0000
+++ tests/functional/openlp_core_lib/test_projector_pjlink1.py 2016-06-03 06:42:48 +0000
@@ -74,3 +74,17 @@
# THEN: Projector class should be set with proper value
self.assertEquals(pjlink.pjlink_class, '1',
'Non-standard class reply should have set proper class')
+
+ def projector_class_test(self):
+ """
+ Test class version from projector
+ """
+ # GIVEN: Test object
+ pjlink = pjlink_test
+
+ # WHEN: Process class response
+ pjlink.process_clss('1')
+
+ # THEN: Projector class should be set to 1
+ self.assertEquals(pjlink.pjlink_class, '1',
+ 'Projector should have returned class=1')
Follow ups