Merge lp:~alisonken1/openlp/pjlink2-u into lp:openlp
- pjlink2-u
- Merge into trunk
Proposed by
Ken Roberts
Status: | Superseded |
---|---|
Proposed branch: | lp:~alisonken1/openlp/pjlink2-u |
Merge into: | lp:openlp |
Diff against target: |
327 lines (+52/-46) 10 files modified
openlp/core/projectors/manager.py (+13/-28) openlp/core/projectors/pjlink.py (+15/-4) openlp/core/ui/icons.py (+8/-4) setup.cfg (+1/-0) tests/functional/openlp_core/lib/test_image_manager.py (+2/-2) tests/functional/openlp_plugins/media/test_mediaplugin.py (+1/-1) tests/functional/openlp_plugins/songs/test_lib.py (+1/-1) tests/functional/openlp_plugins/songusage/test_songusage.py (+2/-2) tests/openlp_core/projectors/test_projector_db.py (+4/-3) tests/openlp_core/projectors/test_projector_pjlink_commands_01.py (+5/-1) |
To merge this branch: | bzr merge lp:~alisonken1/openlp/pjlink2-u |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Phill | Needs Fixing | ||
Review via email: mp+364148@code.launchpad.net |
This proposal has been superseded by a proposal from 2019-03-08.
Commit message
PJLink2 Update U
Description of the change
- Fix projector S_ON status icon selection
- Remove unused status items (status icons changed to FA)
- Fix projector icon status update for network errors
(keep error icon until network reconnects rather than disconnect icon)
- Fix colors to projector toolbar connect/power icons
- Fix toolbar select input icon not always enabled after selecting/
- Add max-line-length option for flake8 tests in setup.cfg
- Fix projector tests
To post a comment you must log in.
Revision history for this message
Ken Roberts (alisonken1) wrote : | # |
Revision history for this message
Raoul Snyman (raoul-snyman) wrote : | # |
Linux tests passed!
Revision history for this message
Raoul Snyman (raoul-snyman) wrote : | # |
Linting passed!
Revision history for this message
Raoul Snyman (raoul-snyman) wrote : | # |
macOS tests failed, please see https:/
lp:~alisonken1/openlp/pjlink2-u
updated
- 2849. By Ken Roberts
-
PJLink2 Update U
Revision history for this message
Phill (phill-ridout) wrote : | # |
Few minor inlines.
review:
Needs Fixing
lp:~alisonken1/openlp/pjlink2-u
updated
- 2850. By Ken Roberts
-
Minor cleanups
Unmerged revisions
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'openlp/core/projectors/manager.py' |
2 | --- openlp/core/projectors/manager.py 2019-02-14 15:09:09 +0000 |
3 | +++ openlp/core/projectors/manager.py 2019-03-08 11:58:35 +0000 |
4 | @@ -46,31 +46,10 @@ |
5 | from openlp.core.ui.icons import UiIcons |
6 | from openlp.core.widgets.toolbar import OpenLPToolbar |
7 | |
8 | - |
9 | log = logging.getLogger(__name__) |
10 | log.debug('projectormanager loaded') |
11 | |
12 | |
13 | -# Dict for matching projector status to display icon |
14 | -STATUS_ICONS = { |
15 | - S_NOT_CONNECTED: ':/projector/projector_item_disconnect.png', |
16 | - S_CONNECTING: ':/projector/projector_item_connect.png', |
17 | - S_CONNECTED: ':/projector/projector_off.png', |
18 | - S_OFF: ':/projector/projector_off.png', |
19 | - S_INITIALIZE: ':/projector/projector_off.png', |
20 | - S_STANDBY: ':/projector/projector_off.png', |
21 | - S_WARMUP: ':/projector/projector_warmup.png', |
22 | - S_ON: ':/projector/projector_on.png', |
23 | - S_COOLDOWN: ':/projector/projector_cooldown.png', |
24 | - E_ERROR: ':/projector/projector_error.png', |
25 | - E_NETWORK: ':/projector/projector_not_connected_error.png', |
26 | - E_SOCKET_TIMEOUT: ':/projector/projector_not_connected_error.png', |
27 | - E_AUTHENTICATION: ':/projector/projector_not_connected_error.png', |
28 | - E_UNKNOWN_SOCKET_ERROR: ':/projector/projector_not_connected_error.png', |
29 | - E_NOT_CONNECTED: ':/projector/projector_not_connected_error.png' |
30 | -} |
31 | - |
32 | - |
33 | class UiProjectorManager(object): |
34 | """ |
35 | UI part of the Projector Manager |
36 | @@ -122,7 +101,7 @@ |
37 | self.one_toolbar.add_toolbar_action('connect_projector', |
38 | text=translate('OpenLP.ProjectorManager', |
39 | 'Connect to selected projector.'), |
40 | - icon=UiIcons().projector_connect, |
41 | + icon=UiIcons().projector_select_connect, |
42 | tooltip=translate('OpenLP.ProjectorManager', |
43 | 'Connect to selected projector.'), |
44 | triggers=self.on_connect_projector) |
45 | @@ -136,7 +115,7 @@ |
46 | self.one_toolbar.add_toolbar_action('disconnect_projector', |
47 | text=translate('OpenLP.ProjectorManager', |
48 | 'Disconnect from selected projectors'), |
49 | - icon=UiIcons().projector_disconnect, |
50 | + icon=UiIcons().projector_select_disconnect, |
51 | tooltip=translate('OpenLP.ProjectorManager', |
52 | 'Disconnect from selected projector.'), |
53 | triggers=self.on_disconnect_projector) |
54 | @@ -151,7 +130,7 @@ |
55 | self.one_toolbar.add_toolbar_action('poweron_projector', |
56 | text=translate('OpenLP.ProjectorManager', |
57 | 'Power on selected projector'), |
58 | - icon=UiIcons().projector_on, |
59 | + icon=UiIcons().projector_power_on, |
60 | tooltip=translate('OpenLP.ProjectorManager', |
61 | 'Power on selected projector.'), |
62 | triggers=self.on_poweron_projector) |
63 | @@ -164,7 +143,7 @@ |
64 | triggers=self.on_poweron_projector) |
65 | self.one_toolbar.add_toolbar_action('poweroff_projector', |
66 | text=translate('OpenLP.ProjectorManager', 'Standby selected projector'), |
67 | - icon=UiIcons().projector_off, |
68 | + icon=UiIcons().projector_power_off, |
69 | tooltip=translate('OpenLP.ProjectorManager', |
70 | 'Put selected projector in standby.'), |
71 | triggers=self.on_poweroff_projector) |
72 | @@ -309,7 +288,7 @@ |
73 | S_INITIALIZE: UiIcons().projector_on, |
74 | S_STANDBY: UiIcons().projector_off, |
75 | S_WARMUP: UiIcons().projector_warmup, |
76 | - S_ON: UiIcons().projector_off, |
77 | + S_ON: UiIcons().projector_on, |
78 | S_COOLDOWN: UiIcons().projector_cooldown, |
79 | E_ERROR: UiIcons().projector_error, |
80 | E_NETWORK: UiIcons().error, |
81 | @@ -505,7 +484,8 @@ |
82 | projector = list_item.data(QtCore.Qt.UserRole) |
83 | try: |
84 | projector.link.connect_to_host() |
85 | - except Exception: |
86 | + except Exception as e: |
87 | + print(e) |
88 | continue |
89 | |
90 | def on_delete_projector(self, opt=None): |
91 | @@ -880,6 +860,7 @@ |
92 | """ |
93 | Update the icons when the selected projectors change |
94 | """ |
95 | + log.debug('update_icons(): Checking for selected projector items in list') |
96 | count = len(self.projector_list_widget.selectedItems()) |
97 | projector = None |
98 | if count == 0: |
99 | @@ -900,6 +881,7 @@ |
100 | self.get_toolbar_item('blank_projector_multiple', hidden=True) |
101 | self.get_toolbar_item('show_projector_multiple', hidden=True) |
102 | elif count == 1: |
103 | + log.debug('update_icons(): Found one item selected') |
104 | projector = self.projector_list_widget.selectedItems()[0].data(QtCore.Qt.UserRole) |
105 | connected = QSOCKET_STATE[projector.link.state()] == S_CONNECTED |
106 | power = projector.link.power == S_ON |
107 | @@ -910,12 +892,14 @@ |
108 | self.get_toolbar_item('blank_projector_multiple', hidden=True) |
109 | self.get_toolbar_item('show_projector_multiple', hidden=True) |
110 | if connected: |
111 | + log.debug('update_icons(): Updating icons for connected state') |
112 | self.get_toolbar_item('view_projector', enabled=True) |
113 | self.get_toolbar_item('source_view_projector', |
114 | - enabled=connected and power and projector.link.source_available is not None) |
115 | + enabled=projector.link.source_available is not None and connected and power) |
116 | self.get_toolbar_item('edit_projector', hidden=True) |
117 | self.get_toolbar_item('delete_projector', hidden=True) |
118 | else: |
119 | + log.debug('update_icons(): Updating for not connected state') |
120 | self.get_toolbar_item('view_projector', hidden=True) |
121 | self.get_toolbar_item('source_view_projector', hidden=True) |
122 | self.get_toolbar_item('edit_projector', enabled=True) |
123 | @@ -931,6 +915,7 @@ |
124 | self.get_toolbar_item('blank_projector', enabled=False) |
125 | self.get_toolbar_item('show_projector', enabled=False) |
126 | else: |
127 | + log.debug('update_icons(): Updating for multiple items selected') |
128 | self.get_toolbar_item('edit_projector', enabled=False) |
129 | self.get_toolbar_item('delete_projector', enabled=False) |
130 | self.get_toolbar_item('view_projector', hidden=True) |
131 | |
132 | === modified file 'openlp/core/projectors/pjlink.py' |
133 | --- openlp/core/projectors/pjlink.py 2019-02-14 15:09:09 +0000 |
134 | +++ openlp/core/projectors/pjlink.py 2019-03-08 11:58:35 +0000 |
135 | @@ -528,8 +528,9 @@ |
136 | sources.append(source) |
137 | sources.sort() |
138 | self.source_available = sources |
139 | - log.debug('({ip}) Setting projector sources_available to "{data}"'.format(ip=self.entry.name, |
140 | - data=self.source_available)) |
141 | + log.debug('({ip}) Setting projector source_available to "{data}"'.format(ip=self.entry.name, |
142 | + data=self.source_available)) |
143 | + self.projectorUpdateIcons.emit() |
144 | return |
145 | |
146 | def process_lamp(self, data): |
147 | @@ -886,6 +887,9 @@ |
148 | elif status >= S_NOT_CONNECTED and status in QSOCKET_STATE: |
149 | # Socket connection status update |
150 | self.status_connect = status |
151 | + # Check if we need to update error state as well |
152 | + if self.error_status != S_OK and status != S_NOT_CONNECTED: |
153 | + self.error_status = S_OK |
154 | elif status >= S_NOT_CONNECTED and status in PROJECTOR_STATE: |
155 | # Only affects the projector status |
156 | self.projector_status = status |
157 | @@ -905,7 +909,14 @@ |
158 | message=status_message if msg is None else msg)) |
159 | |
160 | # Now that we logged extra information for debugging, broadcast the original change/message |
161 | - (code, message) = self._get_status(status) |
162 | + # Check for connection errors first |
163 | + if self.error_status != S_OK: |
164 | + log.debug('({ip}) Signalling error code'.format(ip=self.entry.name)) |
165 | + (code, message) = self._get_status(self.error_status) |
166 | + status = self.error_status |
167 | + else: |
168 | + log.debug('({ip}) Signalling status code'.format(ip=self.entry.name)) |
169 | + (code, message) = self._get_status(status) |
170 | if msg is not None: |
171 | message = msg |
172 | elif message is None: |
173 | @@ -953,7 +964,7 @@ |
174 | log.error('({ip}) Invalid initial packet received - closing socket'.format(ip=self.entry.name)) |
175 | return self.disconnect_from_host() |
176 | # Convert the initial login prompt with the expected PJLink normal command format for processing |
177 | - log.debug('({ip}) check_login(): Formatting initial connection prompt' |
178 | + log.debug('({ip}) check_login(): Formatting initial connection prompt ' |
179 | 'to PJLink packet'.format(ip=self.entry.name)) |
180 | return self.get_data('{start}{clss}{data}'.format(start=PJLINK_PREFIX, |
181 | clss='1', |
182 | |
183 | === modified file 'openlp/core/ui/icons.py' |
184 | --- openlp/core/ui/icons.py 2019-02-15 22:34:53 +0000 |
185 | +++ openlp/core/ui/icons.py 2019-03-08 11:58:35 +0000 |
186 | @@ -117,13 +117,17 @@ |
187 | 'presentation': {'icon': 'fa.bar-chart'}, |
188 | 'preview': {'icon': 'fa.laptop'}, |
189 | 'projector': {'icon': 'op.video'}, |
190 | - 'projector_connect': {'icon': 'fa.plug'}, |
191 | + 'projector_connect': {'icon': 'fa.plug'}, # Projector connect |
192 | 'projector_cooldown': {'icon': 'fa.video-camera', 'attr': 'blue'}, |
193 | - 'projector_disconnect': {'icon': 'fa.plug', 'attr': 'lightGray'}, |
194 | + 'projector_disconnect': {'icon': 'fa.plug', 'attr': 'lightGray'}, # Projector disconnect |
195 | 'projector_error': {'icon': 'fa.video-camera', 'attr': 'red'}, |
196 | 'projector_hdmi': {'icon': 'op.hdmi'}, |
197 | - 'projector_off': {'icon': 'fa.video-camera', 'attr': 'black'}, |
198 | - 'projector_on': {'icon': 'fa.video-camera', 'attr': 'green'}, |
199 | + 'projector_power_off': {'icon': 'fa.video-camera', 'attr': 'red'}, # Toolbar power off |
200 | + 'projector_power_on': {'icon': 'fa.video-camera', 'attr': 'green'}, # Toolbar power on |
201 | + 'projector_off': {'icon': 'fa.video-camera', 'attr': 'black'}, # Projector off |
202 | + 'projector_on': {'icon': 'fa.video-camera', 'attr': 'green'}, # Projector on |
203 | + 'projector_select_connect': {'icon': 'fa.plug', 'attr': 'green'}, # Toolbar connect |
204 | + 'projector_select_disconnect': {'icon': 'fa.plug', 'attr': 'red'}, # Toolbar disconnect |
205 | 'projector_warmup': {'icon': 'fa.video-camera', 'attr': 'yellow'}, |
206 | 'picture': {'icon': 'fa.picture-o'}, |
207 | 'print': {'icon': 'fa.print'}, |
208 | |
209 | === modified file 'setup.cfg' |
210 | --- setup.cfg 2018-10-30 19:46:55 +0000 |
211 | +++ setup.cfg 2019-03-08 11:58:35 +0000 |
212 | @@ -9,6 +9,7 @@ |
213 | |
214 | [flake8] |
215 | exclude=resources.py,vlc.py |
216 | +max-line-length = 120 |
217 | ignore = E402,W503,W504,D |
218 | |
219 | [pycodestyle] |
220 | |
221 | === modified file 'tests/functional/openlp_core/lib/test_image_manager.py' |
222 | --- tests/functional/openlp_core/lib/test_image_manager.py 2019-02-14 15:09:09 +0000 |
223 | +++ tests/functional/openlp_core/lib/test_image_manager.py 2019-03-08 11:58:35 +0000 |
224 | @@ -178,7 +178,7 @@ |
225 | # THEN a KeyError is thrown |
226 | with self.assertRaises(KeyError) as context: |
227 | self.image_manager.get_image(TEST_PATH, 'church1.jpg') |
228 | - assert context.exception is not '', 'KeyError exception should have been thrown for missing image' |
229 | + assert context.exception != '', 'KeyError exception should have been thrown for missing image' |
230 | |
231 | @patch('openlp.core.lib.imagemanager.run_thread') |
232 | def test_different_dimension_image(self, mocked_run_thread): |
233 | @@ -211,7 +211,7 @@ |
234 | # WHEN: calling with correct image, but wrong dimensions |
235 | with self.assertRaises(KeyError) as context: |
236 | self.image_manager.get_image(full_path, 'church.jpg', 120, 120) |
237 | - assert context.exception is not '', 'KeyError exception should have been thrown for missing dimension' |
238 | + assert context.exception != '', 'KeyError exception should have been thrown for missing dimension' |
239 | |
240 | @patch('openlp.core.lib.imagemanager.resize_image') |
241 | @patch('openlp.core.lib.imagemanager.image_to_byte') |
242 | |
243 | === modified file 'tests/functional/openlp_plugins/media/test_mediaplugin.py' |
244 | --- tests/functional/openlp_plugins/media/test_mediaplugin.py 2019-02-14 15:09:09 +0000 |
245 | +++ tests/functional/openlp_plugins/media/test_mediaplugin.py 2019-03-08 11:58:35 +0000 |
246 | @@ -57,4 +57,4 @@ |
247 | # THEN: about() should return a string object |
248 | assert isinstance(MediaPlugin.about(), str) |
249 | # THEN: about() should return a non-empty string |
250 | - assert len(MediaPlugin.about()) is not 0 |
251 | + assert len(MediaPlugin.about()) != 0 |
252 | |
253 | === modified file 'tests/functional/openlp_plugins/songs/test_lib.py' |
254 | --- tests/functional/openlp_plugins/songs/test_lib.py 2019-02-14 15:09:09 +0000 |
255 | +++ tests/functional/openlp_plugins/songs/test_lib.py 2019-03-08 11:58:35 +0000 |
256 | @@ -199,7 +199,7 @@ |
257 | result = _remove_typos(diff) |
258 | |
259 | # THEN: There should be no typos in the middle anymore. The remaining equals should have been merged. |
260 | - assert len(result) is 1, 'The result should contain only one element.' |
261 | + assert len(result) == 1, 'The result should contain only one element.' |
262 | assert result[0][0] == 'equal', 'The result should contain an equal element.' |
263 | assert result[0][1] == 0, 'The start indices should be kept.' |
264 | assert result[0][2] == 22, 'The stop indices should be kept.' |
265 | |
266 | === modified file 'tests/functional/openlp_plugins/songusage/test_songusage.py' |
267 | --- tests/functional/openlp_plugins/songusage/test_songusage.py 2019-02-14 15:09:09 +0000 |
268 | +++ tests/functional/openlp_plugins/songusage/test_songusage.py 2019-03-08 11:58:35 +0000 |
269 | @@ -45,8 +45,8 @@ |
270 | # THEN: about() should return a string object |
271 | assert isinstance(SongUsagePlugin.about(), str) |
272 | # THEN: about() should return a non-empty string |
273 | - assert len(SongUsagePlugin.about()) is not 0 |
274 | - assert len(SongUsagePlugin.about()) is not 0 |
275 | + assert len(SongUsagePlugin.about()) != 0 |
276 | + assert len(SongUsagePlugin.about()) != 0 |
277 | |
278 | @patch('openlp.plugins.songusage.songusageplugin.Manager') |
279 | def test_song_usage_init(self, MockedManager): |
280 | |
281 | === modified file 'tests/openlp_core/projectors/test_projector_db.py' |
282 | --- tests/openlp_core/projectors/test_projector_db.py 2019-02-14 15:09:09 +0000 |
283 | +++ tests/openlp_core/projectors/test_projector_db.py 2019-03-08 11:58:35 +0000 |
284 | @@ -134,6 +134,7 @@ |
285 | """ |
286 | Set up anything necessary for all tests |
287 | """ |
288 | + self.tmp_folder = mkdtemp(prefix='openlp_') |
289 | # Create a test app to keep from segfaulting |
290 | Registry.create() |
291 | self.registry = Registry() |
292 | @@ -153,11 +154,11 @@ |
293 | patch('openlp.core.ui.mainwindow.ThemeManager'), \ |
294 | patch('openlp.core.ui.mainwindow.ProjectorManager'), \ |
295 | patch('openlp.core.ui.mainwindow.websockets.WebSocketServer'), \ |
296 | - patch('openlp.core.ui.mainwindow.server.HttpServer'): |
297 | + patch('openlp.core.ui.mainwindow.server.HttpServer'), \ |
298 | + patch('openlp.core.state.State.list_plugins') as mock_plugins: |
299 | + mock_plugins.return_value = [] |
300 | self.main_window = MainWindow() |
301 | |
302 | - # Create a temporary database directory and database |
303 | - self.tmp_folder = mkdtemp(prefix='openlp_') |
304 | tmpdb_url = 'sqlite:///{db}'.format(db=os.path.join(self.tmp_folder, TEST_DB)) |
305 | mocked_init_url.return_value = tmpdb_url |
306 | self.projector = ProjectorDB() |
307 | |
308 | === modified file 'tests/openlp_core/projectors/test_projector_pjlink_commands_01.py' |
309 | --- tests/openlp_core/projectors/test_projector_pjlink_commands_01.py 2019-02-14 15:09:09 +0000 |
310 | +++ tests/openlp_core/projectors/test_projector_pjlink_commands_01.py 2019-03-08 11:58:35 +0000 |
311 | @@ -452,12 +452,16 @@ |
312 | """ |
313 | Test saving video source available information |
314 | """ |
315 | + |
316 | # GIVEN: Test object |
317 | with patch.object(openlp.core.projectors.pjlink, 'log') as mock_log: |
318 | pjlink = PJLink(Projector(**TEST1_DATA), no_poll=True) |
319 | pjlink.source_available = [] |
320 | - log_debug_calls = [call('({ip}) Setting projector sources_available to ' |
321 | + log_debug_calls = [call('({ip}) reset_information() connect status is ' |
322 | + 'S_NOT_CONNECTED'.format(ip=pjlink.name)), |
323 | + call('({ip}) Setting projector source_available to ' |
324 | '"[\'11\', \'12\', \'21\', \'22\', \'31\', \'32\']"'.format(ip=pjlink.name))] |
325 | + |
326 | chk_data = '21 12 11 22 32 31' # Although they should already be sorted, use unsorted to verify method |
327 | chk_test = ['11', '12', '21', '22', '31', '32'] |
328 |
------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- --- /ci.openlp. io/job/ Branch- 01-Pull/ 2696/ [SUCCESS] /ci.openlp. io/job/ Branch- 02a-Linux- Tests/2590/ [SUCCESS] /ci.openlp. io/job/ Branch- 02b-macOS- Tests/360/ [FAILURE] /ci.openlp. io/job/ Branch- 03a-Build- Source/ 190/ [SUCCESS] /ci.openlp. io/job/ Branch- 03b-Build- macOS/169/ [FAILURE] /ci.openlp. io/job/ Branch- 04a-Code- Lint/1652/ [SUCCESS] /ci.openlp. io/job/ Branch- 04b-Test- Coverage/ 1465/ [SUCCESS] /ci.openlp. io/job/ Branch- 05-AppVeyor- Tests/352/ [FAILURE]
lp:~alisonken1/openlp/pjlink2-u (revision 2849)
https:/
https:/
https:/
https:/
https:/
https:/
https:/
https:/