forked from openlp/openlp
fix a couple of small issues
lp:~trb143/openlp/refactorfixes (revision 2787) https://ci.openlp.io/job/Branch-01-Pull/2278/ [SUCCESS] https://ci.openlp.io/job/Branch-02-Functional-Tests/2180/ [SUCCESS] https://ci.openlp.io/job/Branch-03-Interface-Tests/2061/ [SUCCESS] https://ci.openlp.io/job/Branch-04a-Code_Analysis/1391/ [SUCCESS] https://ci.openlp.io/job/Branch-04b-Test_Coverage/1216/ [SUCCESS] https://ci.ope... bzr-revno: 2785
This commit is contained in:
commit
5ae5d8c07e
@ -27,7 +27,7 @@ from openlp.core.api.endpoint.core import TRANSLATED_STRINGS
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
remote_endpoint = Endpoint('remote', template_dir='remotes', static_dir='remotes')
|
||||
remote_endpoint = Endpoint('remote', template_dir='remotes')
|
||||
|
||||
|
||||
@remote_endpoint.route('{view}')
|
||||
|
@ -151,8 +151,9 @@ class Registry(object):
|
||||
trace_error_handler(log)
|
||||
log.exception('Exception for function {function}'.format(function=function))
|
||||
else:
|
||||
trace_error_handler(log)
|
||||
log.exception('Event {event} called but not registered'.format(event=event))
|
||||
if log.getEffectiveLevel() == logging.DEBUG:
|
||||
trace_error_handler(log)
|
||||
log.exception('Event {event} called but not registered'.format(event=event))
|
||||
return results
|
||||
|
||||
def get_flag(self, key):
|
||||
|
@ -236,6 +236,9 @@ class SlideController(DisplayController, LogMixin, RegistryProperties):
|
||||
self.hide_menu.setPopupMode(QtWidgets.QToolButton.MenuButtonPopup)
|
||||
self.hide_menu.setMenu(QtWidgets.QMenu(translate('OpenLP.SlideController', 'Hide'), self.toolbar))
|
||||
self.toolbar.add_toolbar_widget(self.hide_menu)
|
||||
self.toolbar.add_toolbar_action('goPreview', icon=':/general/general_live.png',
|
||||
tooltip=translate('OpenLP.SlideController', 'Move to preview.'),
|
||||
triggers=self.on_go_preview)
|
||||
# The order of the blank to modes in Shortcuts list comes from here.
|
||||
self.desktop_screen_enable = create_action(self, 'desktopScreenEnable',
|
||||
text=translate('OpenLP.SlideController', 'Show Desktop'),
|
||||
@ -1420,6 +1423,15 @@ class SlideController(DisplayController, LogMixin, RegistryProperties):
|
||||
self.live_controller.add_service_manager_item(self.service_item, row)
|
||||
self.live_controller.preview_widget.setFocus()
|
||||
|
||||
def on_go_preview(self, field=None):
|
||||
"""
|
||||
If live copy slide item to preview controller from live Controller
|
||||
"""
|
||||
row = self.preview_widget.current_slide_number()
|
||||
if -1 < row < self.preview_widget.slide_count():
|
||||
self.preview_controller.add_service_manager_item(self.service_item, row)
|
||||
self.preview_controller.preview_widget.setFocus()
|
||||
|
||||
def on_media_start(self, item):
|
||||
"""
|
||||
Respond to the arrival of a media service item
|
||||
|
@ -208,6 +208,33 @@ class TestSlideController(TestCase):
|
||||
mocked_on_theme_display.assert_called_once_with(False)
|
||||
mocked_on_hide_display.assert_called_once_with(False)
|
||||
|
||||
def test_on_go_live_preview_controller(self):
|
||||
"""
|
||||
Test that when the on_go_preview() method is called the message is sent to the preview controller and focus is
|
||||
set correctly.
|
||||
"""
|
||||
# GIVEN: A new SlideController instance and plugin preview then pressing go live should respond
|
||||
mocked_display = MagicMock()
|
||||
mocked_preview_controller = MagicMock()
|
||||
mocked_preview_widget = MagicMock()
|
||||
mocked_service_item = MagicMock()
|
||||
mocked_service_item.from_service = False
|
||||
mocked_preview_widget.current_slide_number.return_value = 1
|
||||
mocked_preview_widget.slide_count = MagicMock(return_value=2)
|
||||
mocked_preview_controller.preview_widget = MagicMock()
|
||||
Registry.create()
|
||||
Registry().register('preview_controller', mocked_preview_controller)
|
||||
slide_controller = SlideController(None)
|
||||
slide_controller.service_item = mocked_service_item
|
||||
slide_controller.preview_widget = mocked_preview_widget
|
||||
slide_controller.display = mocked_display
|
||||
|
||||
# WHEN: on_go_live() is called
|
||||
slide_controller.on_go_preview()
|
||||
|
||||
# THEN: the preview controller should have the service item and the focus set to live
|
||||
mocked_preview_controller.preview_widget.setFocus.assert_called_once_with()
|
||||
|
||||
def test_on_go_live_live_controller(self):
|
||||
"""
|
||||
Test that when the on_go_live() method is called the message is sent to the live controller and focus is
|
||||
|
Loading…
Reference in New Issue
Block a user