- Renamed some code

This commit is contained in:
Olli Suutari 2016-09-02 18:52:44 +03:00
parent 2c4dbda42f
commit 2fcd292969
2 changed files with 12 additions and 8 deletions

View File

@ -239,7 +239,7 @@ class SlideController(DisplayController, RegistryProperties):
text=translate('OpenLP.SlideController', 'Show Desktop'),
can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut,
category=self.category,
triggers=self.live_escape)
triggers=self.on_hide_display_enable)
self.desktop_screen = create_action(self, 'desktopScreen',
text=translate('OpenLP.SlideController', 'Show or hide Desktop'),
icon=':/slides/slide_desktop.png',
@ -955,7 +955,7 @@ class SlideController(DisplayController, RegistryProperties):
else:
Registry().execute('live_display_show')
else:
self.live_escape()
self.on_hide_display_enable()
def on_slide_blank(self):
"""
@ -1015,6 +1015,7 @@ class SlideController(DisplayController, RegistryProperties):
def on_hide_display(self, checked=None):
"""
Handle the Hide screen button
This toggles the desktop screen.
:param checked: the new state of the of the widget
"""
@ -1033,9 +1034,12 @@ class SlideController(DisplayController, RegistryProperties):
self.update_preview()
self.on_toggle_loop()
def live_escape(self, checked=None):
def on_hide_display_enable(self, checked=None):
"""
If you press ESC on the live screen it should close the display temporarily.
Handle the on_hide_display_enable
This only enables the desktop screen.
:param checked: the new state of the of the widget
"""
self.blank_screen.setChecked(False)
self.theme_screen.setChecked(False)

View File

@ -208,9 +208,9 @@ class TestSlideController(TestCase):
mocked_on_theme_display.assert_called_once_with(False)
mocked_on_hide_display.assert_called_once_with(False)
def test_live_escape(self):
def test_on_hide_display_enable(self):
"""
Test that when the live_escape() method is called, the display is set to invisible and any media is stopped
Test that when the on_hide_display_enable() method is called, the display is set to invisible and any media is stopped
"""
# GIVEN: A new SlideController instance and mocked out display and media_controller
mocked_display = MagicMock()
@ -224,8 +224,8 @@ class TestSlideController(TestCase):
slide_controller.play_slides_loop = play_slides
slide_controller.play_slides_once = play_slides
# WHEN: live_escape() is called
slide_controller.live_escape()
# WHEN: on_hide_display_enable() is called
slide_controller.on_hide_display_enable()
# THEN: the display should be set to invisible and the media controller stopped
mocked_display.setVisible.assert_called_once_with(False)