← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~alisonken1/openlp/projector-qt5 into lp:openlp

 

Ken Roberts has proposed merging lp:~alisonken1/openlp/projector-qt5 into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~alisonken1/openlp/projector-qt5/+merge/290791

- Fix str.decode() exception when using -d option
- Fix projector try...except block issues with Qt5
- Added test for projector receiving command INST data

[SUCCESS] https://ci.openlp.io/job/Branch-01-Pull/1371/
[SUCCESS] https://ci.openlp.io/job/Branch-02-Functional-Tests/1290/
[SUCCESS] https://ci.openlp.io/job/Branch-03-Interface-Tests/1229/
[SUCCESS] https://ci.openlp.io/job/Branch-04a-Windows_Functional_Tests/1061/
[SUCCESS] https://ci.openlp.io/job/Branch-04b-Windows_Interface_Tests/652/
[SUCCESS] https://ci.openlp.io/job/Branch-05a-Code_Analysis/719/
[SUCCESS] https://ci.openlp.io/job/Branch-05b-Test_Coverage/587/

-- 
Your team OpenLP Core is requested to review the proposed merge of lp:~alisonken1/openlp/projector-qt5 into lp:openlp.
=== modified file 'openlp/core/lib/projector/pjlink1.py'
--- openlp/core/lib/projector/pjlink1.py	2016-02-28 12:35:15 +0000
+++ openlp/core/lib/projector/pjlink1.py	2016-04-02 03:52:13 +0000
@@ -513,17 +513,13 @@
         log.debug('(%s) _send_string(): Sending "%s"' % (self.ip, out.strip()))
         log.debug('(%s) _send_string(): Queue = %s' % (self.ip, self.send_queue))
         self.socket_timer.start()
-        try:
-            self.projectorNetwork.emit(S_NETWORK_SENDING)
-            sent = self.write(out.encode('ascii'))
-            self.waitForBytesWritten(2000)  # 2 seconds should be enough
-            if sent == -1:
-                # Network error?
-                self.change_status(E_NETWORK,
-                                   translate('OpenLP.PJLink1', 'Error while sending data to projector'))
-        except SocketError as e:
-            self.disconnect_from_host(abort=True)
-            self.changeStatus(E_NETWORK, '%s : %s' % (e.error(), e.errorString()))
+        self.projectorNetwork.emit(S_NETWORK_SENDING)
+        sent = self.write(out.encode('ascii'))
+        self.waitForBytesWritten(2000)  # 2 seconds should be enough
+        if sent == -1:
+            # Network error?
+            self.change_status(E_NETWORK,
+                               translate('OpenLP.PJLink1', 'Error while sending data to projector'))
 
     def process_command(self, cmd, data):
         """

=== modified file 'openlp/core/utils/__init__.py'
--- openlp/core/utils/__init__.py	2016-03-31 16:42:42 +0000
+++ openlp/core/utils/__init__.py	2016-04-02 03:52:13 +0000
@@ -186,9 +186,9 @@
         # If they are equal, then this tree is tarball with the source for the release. We do not want the revision
         # number in the full version.
         if tree_revision == tag_revision:
-            full_version = tag_version.decode('utf-8')
+            full_version = tag_version.strip()
         else:
-            full_version = '%s-bzr%s' % (tag_version.decode('utf-8'), tree_revision.decode('utf-8'))
+            full_version = '%s-bzr%s' % (tag_version.strip(), tree_revision.strip())
     else:
         # We're not running the development version, let's use the file.
         file_path = AppLocation.get_directory(AppLocation.VersionDir)

=== modified file 'tests/functional/openlp_core_lib/test_projector_pjlink1.py'
--- tests/functional/openlp_core_lib/test_projector_pjlink1.py	2016-03-03 18:19:42 +0000
+++ tests/functional/openlp_core_lib/test_projector_pjlink1.py	2016-04-02 03:52:13 +0000
@@ -92,3 +92,18 @@
         mock_change_status.called_with(E_PARAMETER,
                                        'change_status should have been called with "{}"'.format(
                                            ERROR_STRING[E_PARAMETER]))
+
+    @patch.object(pjlink_test, 'process_inpt')
+    def projector_return_ok_test(self, mock_process_inpt):
+        """
+        Test projector calls process_inpt command when process_command is called with INPT option
+        """
+        # GIVEN: Test object
+        pjlink = pjlink_test
+
+        # WHEN: process_command is called with INST command and 31 input:
+        pjlink.process_command('INPT', '31')
+
+        # THEN: process_inpt method should have been called with 31
+        mock_process_inpt.called_with('31',
+                                      "process_inpt should have been called with 31")


Follow ups