Merge lp:~thelinuxguy/openlp/editable-remote-port into lp:openlp

Proposed by Simon Hanna
Status: Needs review
Proposed branch: lp:~thelinuxguy/openlp/editable-remote-port
Merge into: lp:openlp
Diff against target: 67 lines (+31/-3)
2 files modified
openlp/core/api/tab.py (+7/-3)
tests/functional/openlp_core/api/test_tab.py (+24/-0)
To merge this branch: bzr merge lp:~thelinuxguy/openlp/editable-remote-port
Reviewer Review Type Date Requested Status
Raoul Snyman Approve
Tim Bentley Disapprove
Review via email: mp+353586@code.launchpad.net

Description of the change

Somehow the port was changed to be static, this reintroduces customizable ports

To post a comment you must log in.
Revision history for this message
Raoul Snyman (raoul-snyman) wrote :
Download full text (12.6 KiB)

============================= test session starts ==============================
platform linux -- Python 3.6.5, pytest-3.6.2, py-1.5.3, pluggy-0.6.0
rootdir: /var/lib/jenkins/jobs/MP-02-Linux_Tests/workspace/OpenLP-2.5-bzr2830, inifile:
plugins: mock-1.7.1, cov-2.5.1
collected 1211 items / 14 errors

==================================== ERRORS ====================================
 ERROR collecting tests/functional/openlp_plugins/bibles/test_wordprojectimport.py
tests/functional/openlp_plugins/bibles/test_wordprojectimport.py:33: in <module>
    INDEX_PAGE = (TEST_PATH / 'wordproject_index.htm').read_bytes().decode()
/usr/lib/python3.6/pathlib.py:1187: in read_bytes
    with self.open(mode='rb') as f:
/usr/lib/python3.6/pathlib.py:1181: in open
    opener=self._opener)
/usr/lib/python3.6/pathlib.py:1035: in _opener
    return self._accessor.open(self, flags, mode)
/usr/lib/python3.6/pathlib.py:387: in wrapped
    return strfunc(str(pathobj), *args)
E FileNotFoundError: [Errno 2] No such file or directory: '/var/lib/jenkins/jobs/MP-02-Linux_Tests/workspace/OpenLP-2.5-bzr2830/tests/resources/bibles/wordproject_index.htm'
___ ERROR collecting tests/functional/openlp_plugins/media/test_mediaitem.py ___
tests/functional/openlp_plugins/media/test_mediaitem.py:32: in <module>
    from openlp.plugins.media.lib.mediaitem import MediaMediaItem
openlp/plugins/media/lib/__init__.py:23: in <module>
    from .mediaitem import MediaMediaItem
openlp/plugins/media/lib/mediaitem.py:49: in <module>
    CLAPPERBOARD = UiIcons().clapperboard
openlp/core/ui/icons.py:48: in __new__
    cls.load(cls)
openlp/core/ui/icons.py:57: in load
    qta.load_font('op', font_path, charmap_path)
/usr/lib/python3/dist-packages/qtawesome/__init__.py:153: in load_font
    return _instance().load_font(prefix, ttf_filename, charmap_filename, directory)
/usr/lib/python3/dist-packages/qtawesome/iconic_font.py:223: in load_font
    os.path.join(directory, ttf_filename)))
E qtawesome.iconic_font.FontError: Font at '/var/lib/jenkins/jobs/MP-02-Linux_Tests/workspace/OpenLP-2.5-bzr2830/openlp/core/ui/fonts/OpenLP.ttf' appears to be empty. If you are on Windows 10, please read https://support.microsoft.com/en-us/kb/3053676 to know how to prevent Windows from blocking the fonts that come with QtAwesome.
__ ERROR collecting tests/functional/openlp_plugins/media/test_mediaplugin.py __
tests/functional/openlp_plugins/media/test_mediaplugin.py:29: in <module>
    from openlp.plugins.media.mediaplugin import MediaPlugin, process_check_binary
openlp/plugins/media/mediaplugin.py:38: in <module>
    from openlp.plugins.media.lib import MediaMediaItem, MediaTab
openlp/plugins/media/lib/__init__.py:23: in <module>
    from .mediaitem import MediaMediaItem
openlp/plugins/media/lib/mediaitem.py:49: in <module>
    CLAPPERBOARD = UiIcons().clapperboard
E AttributeError: 'UiIcons' object has no attribute 'clapperboard'
______ ERROR collecting tests/openlp_core/projectors/test_projector_db.py ______
ImportError while importing test module '/var/lib/jenkins/jobs/MP-02-Linux_Tests/workspace/OpenLP-2.5-bzr2830/tests/openlp_core/projectors/test_projector_db.py'.
Hint: make sure your test modules/package...

Revision history for this message
Tim Bentley (trb143) wrote :

This introduces issues with firewalls and the remotes and causes problems with the android and ios clients. It was removed as this is a complication and an issue for support.

review: Disapprove
Revision history for this message
Raoul Snyman (raoul-snyman) :
Revision history for this message
Raoul Snyman (raoul-snyman) :
Revision history for this message
Raoul Snyman (raoul-snyman) wrote :
Download full text (134.3 KiB)

============================= test session starts ==============================
platform darwin -- Python 3.5.6, pytest-3.3.0, py-1.5.2, pluggy-0.6.0
rootdir: /Users/raoul/Jenkins/workspace/MP-03-macOS-Tests/OpenLP-2.5-bzr2830, inifile:
collected 250 items / 119 errors

==================================== ERRORS ====================================
__________ ERROR collecting tests/functional/openlp_core/test_app.py ___________
ImportError while importing test module '/Users/raoul/Jenkins/workspace/MP-03-macOS-Tests/OpenLP-2.5-bzr2830/tests/functional/openlp_core/test_app.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/functional/openlp_core/test_app.py:28: in <module>
    from openlp.core.app import OpenLP, parse_options
openlp/core/app.py:46: in <module>
    from openlp.core.ui import SplashScreen
openlp/core/ui/__init__.py:96: in <module>
    from .firsttimeform import FirstTimeForm
openlp/core/ui/firsttimeform.py:43: in <module>
    from openlp.core.lib import PluginStatus, build_icon
openlp/core/lib/__init__.py:619: in <module>
    from .serviceitem import ServiceItem, ServiceItemType, ItemCapabilities
openlp/core/lib/serviceitem.py:38: in <module>
    from openlp.core.ui.icons import UiIcons
openlp/core/ui/icons.py:26: in <module>
    import qtawesome as qta
E ImportError: No module named 'qtawesome'
_______ ERROR collecting tests/functional/openlp_core/api/test_deploy.py _______
ImportError while importing test module '/Users/raoul/Jenkins/workspace/MP-03-macOS-Tests/OpenLP-2.5-bzr2830/tests/functional/openlp_core/api/test_deploy.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/functional/openlp_core/api/test_deploy.py:26: in <module>
    from openlp.core.api.deploy import deploy_zipfile, download_sha256, download_and_check
openlp/core/api/__init__.py:26: in <module>
    from openlp.core.api.tab import ApiTab
openlp/core/api/tab.py:31: in <module>
    from openlp.core.lib import SettingsTab
openlp/core/lib/__init__.py:619: in <module>
    from .serviceitem import ServiceItem, ServiceItemType, ItemCapabilities
openlp/core/lib/serviceitem.py:38: in <module>
    from openlp.core.ui.icons import UiIcons
openlp/core/ui/__init__.py:96: in <module>
    from .firsttimeform import FirstTimeForm
openlp/core/ui/firsttimeform.py:44: in <module>
    from openlp.core.lib.ui import critical_error_message_box
openlp/core/lib/ui.py:34: in <module>
    from openlp.core.ui.icons import UiIcons
openlp/core/ui/icons.py:26: in <module>
    import qtawesome as qta
E ImportError: No module named 'qtawesome'
________ ERROR collecting tests/functional/openlp_core/api/test_tab.py _________
ImportError while importing test module '/Users/raoul/Jenkins/workspace/MP-03-macOS-Tests/OpenLP-2.5-bzr2830/tests/functional/openlp_core/api/test_tab.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/functional/openlp_core/api/test_tab.py:31: in <module>
    from openlp.core.api.tab import ApiTab
openlp/core/api/__init__.py:26: in <module>
    from openlp.core.api.tab import ApiTab
openlp/core/api/tab.py:31: in <module>
    from openlp.core.lib impo...

Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

Simon and I were discussing this in IRC after a chap who was having issues with his set up.

I think we *should* make both the IP and the port editable, BUT ... we should hide them by default under a collapsable "Advanced settings" section. We're going to have folks who want to do some weird set up and hook all sorts of things together, and I don't want to prevent that, but I do want to make life easier for the Joe Soaps who can't tell an IP address from a VB GUI ;-)

Revision history for this message
Raoul Snyman (raoul-snyman) :
review: Approve

Unmerged revisions

2830. By Simon Hanna

Make Remote Port editable again

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp/core/api/tab.py'
2--- openlp/core/api/tab.py 2018-08-04 20:58:13 +0000
3+++ openlp/core/api/tab.py 2018-08-22 16:43:25 +0000
4@@ -71,7 +71,9 @@
5 self.http_setting_layout.setObjectName('http_setting_layout')
6 self.port_label = QtWidgets.QLabel(self.http_settings_group_box)
7 self.port_label.setObjectName('port_label')
8- self.port_spin_box = QtWidgets.QLabel(self.http_settings_group_box)
9+ self.port_spin_box = QtWidgets.QSpinBox(self.http_settings_group_box)
10+ self.port_spin_box.setMinimum(1024)
11+ self.port_spin_box.setMaximum(65535)
12 self.port_spin_box.setObjectName('port_spin_box')
13 self.http_setting_layout.addRow(self.port_label, self.port_spin_box)
14 self.remote_url_label = QtWidgets.QLabel(self.http_settings_group_box)
15@@ -213,7 +215,7 @@
16 """
17 Load the configuration and update the server configuration if necessary
18 """
19- self.port_spin_box.setText(str(Settings().value(self.settings_section + '/port')))
20+ self.port_spin_box.setValue(Settings().value(self.settings_section + '/port'))
21 self.address_edit.setText(Settings().value(self.settings_section + '/ip address'))
22 self.twelve_hour = Settings().value(self.settings_section + '/twelve hour')
23 self.twelve_hour_check_box.setChecked(self.twelve_hour)
24@@ -232,8 +234,10 @@
25 """
26 Save the configuration and update the server configuration if necessary
27 """
28- if Settings().value(self.settings_section + '/ip address') != self.address_edit.text():
29+ if Settings().value(self.settings_section + '/ip address') != self.address_edit.text() or \
30+ Settings().value(self.settings_section + '/port') != self.port_spin_box.value():
31 self.settings_form.register_post_process('remotes_config_updated')
32+ Settings().setValue(self.settings_section + '/port', self.port_spin_box.value())
33 Settings().setValue(self.settings_section + '/ip address', self.address_edit.text())
34 Settings().setValue(self.settings_section + '/twelve hour', self.twelve_hour)
35 Settings().setValue(self.settings_section + '/thumbnails', self.thumbnails)
36
37=== modified file 'tests/functional/openlp_core/api/test_tab.py'
38--- tests/functional/openlp_core/api/test_tab.py 2018-08-04 20:58:13 +0000
39+++ tests/functional/openlp_core/api/test_tab.py 2018-08-22 16:43:25 +0000
40@@ -119,3 +119,27 @@
41 assert self.form.live_url.text() == \
42 "<a href=\"http://192.168.1.1:4316/main\">http://192.168.1.1:4316/main</a>", \
43 'The return value should be a fully formed main link'
44+
45+ def test_port_spin_box_is_available(self):
46+ """
47+ Test that the port can be set using a SpinBox
48+ """
49+ # GIVEN: The Remote Settings tab
50+ # THEN: The port input is a spin box
51+ assert isinstance(self.form.port_spin_box, QtWidgets.QSpinBox)
52+
53+ def test_port_spin_box_maximum_value(self):
54+ """
55+ Test that the maximum allowed value is 65535
56+ """
57+ # GIVEN: The Remote Settings tab
58+ # THEN: The maximum allowed value is 65535
59+ assert self.form.port_spin_box.maximum() == 65535
60+
61+ def test_port_spin_box_minimum_value(self):
62+ """
63+ Test that the minimum allowed value is 1024
64+ """
65+ # GIVEN: The Remote Settings tab
66+ # THEN: The minimum allowed value is 1024
67+ assert self.form.port_spin_box.minimum() == 1024