Made a better fix for fixing bug where display is unblanked on editing current live item.

This now sets a hidden setting to true while processing Live item and then changes it back to false.
Display is thus not unblanked at all during the process. (Old fix showed the edited slide for a small time)

Downside: All the new tests were based on the old method and thus they were removed.
This commit is contained in:
suutari-olli 2016-04-17 06:43:25 +03:00
parent bf3cad050c
commit 0563c6372f
4 changed files with 6 additions and 112 deletions

View File

@ -162,6 +162,7 @@ class Settings(QtCore.QSettings):
'core/display on monitor': True,
'core/override position': False,
'core/application version': '0.0',
'core/is live item edited and replaced': False,
'core/has doubleclicking preview added item to service': False,
'images/background color': '#000000',
'media/players': 'system,webkit',

View File

@ -471,7 +471,7 @@ class MainDisplay(OpenLPMixin, Display, RegistryProperties):
self.footer(service_item.foot_text)
# if was hidden keep it hidden
if self.hide_mode and self.is_live and not service_item.is_media():
if Settings().value('core/auto unblank'):
if Settings().value('core/auto unblank') and not Settings().value('core/is live item edited and replaced'):
Registry().execute('slidecontroller_live_unblank')
else:
self.hide_display(self.hide_mode)

View File

@ -798,19 +798,9 @@ class SlideController(DisplayController, RegistryProperties):
:param item: The current service item
"""
if item == self.service_item:
if not self.hide_mode():
Settings().setValue('core/is live item edited and replaced', True)
self._process_item(item, self.preview_widget.current_slide_number())
# "isChecked" method is required for checking blanks, on_xx_display(False) does not work.
elif self.hide_mode():
if self.blank_screen.isChecked():
self._process_item(item, self.preview_widget.current_slide_number())
self.on_blank_display(True)
elif self.theme_screen.isChecked():
self._process_item(item, self.preview_widget.current_slide_number())
self.on_theme_display(True)
elif self.desktop_screen.isChecked():
self._process_item(item, self.preview_widget.current_slide_number())
self.on_hide_display(True)
Settings().setValue('core/is live item edited and replaced', False)
def add_service_manager_item(self, item, slide_no):
"""
@ -1113,7 +1103,7 @@ class SlideController(DisplayController, RegistryProperties):
# With this display stays blanked when "auto unblank" setting is not enabled and new item is sent to Live.
if not Settings().value('core/auto unblank') and start:
()
else:
if not start and not Settings().value('core/is live item edited and replaced'):
Registry().execute('slidecontroller_live_unblank')
row = self.preview_widget.current_slide_number()
old_selected_row = self.selected_row
@ -1364,7 +1354,7 @@ class SlideController(DisplayController, RegistryProperties):
Triggered when a preview slide item is doubleclicked
"""
if self.service_item:
if Settings().value('advanced/double click live'):
if Settings().value('advanced/double click live') and Settings().value('core/auto unblank'):
# Live and Preview have issues if we have video or presentations
# playing in both at the same time.
if self.service_item.is_command():

View File

@ -538,103 +538,6 @@ class TestSlideController(TestCase):
mocked_preview_widget.current_slide_number.assert_called_with()
mocked_process_item.assert_called_once_with(mocked_item, 7)
def replace_service_manager_item_on_blank_display_test(self):
"""
Test that when the service item is replaced, display remains blanked if it was blanked.
"""
# GIVEN: A slide controller and a new item to add, blanked display.
mocked_item = MagicMock()
mocked_preview_widget = MagicMock()
mocked_preview_widget.current_slide_number = MagicMock()
mocked_process_item = MagicMock()
slide_controller = SlideController(None)
slide_controller.preview_widget = mocked_preview_widget
slide_controller._process_item = mocked_process_item
slide_controller.service_item = mocked_item
slide_controller.hide_menu = MagicMock()
slide_controller.hide_mode = MagicMock()
slide_controller.hide_mode.return_value = True
slide_controller.blank_screen = MagicMock()
slide_controller.blank_screen.isChecked = MagicMock()
slide_controller.blank_screen.isChecked.return_value = True
slide_controller.on_blank_display = mocked_item
slide_controller.theme_screen = MagicMock()
slide_controller.desktop_screen = MagicMock()
slide_controller.log_debug = MagicMock()
# WHEN: The service item is replaced
slide_controller.replace_service_manager_item(mocked_item)
# THEN: The display should remain blanked
slide_controller.on_blank_display.assert_called_once_with(True)
def replace_service_manager_item_on_theme_display_test(self):
"""
Test that when the service item is replaced, display remains blanked if it was blanked.
"""
# GIVEN: A slide controller and a new item to add, blanked display.
mocked_item = MagicMock()
mocked_preview_widget = MagicMock()
mocked_preview_widget.current_slide_number = MagicMock()
mocked_process_item = MagicMock()
slide_controller = SlideController(None)
slide_controller.preview_widget = mocked_preview_widget
slide_controller._process_item = mocked_process_item
slide_controller.service_item = mocked_item
slide_controller.hide_menu = MagicMock()
slide_controller.hide_mode = MagicMock()
slide_controller.hide_mode.return_value = True
slide_controller.blank_screen = MagicMock()
slide_controller.blank_screen.isChecked = MagicMock()
slide_controller.blank_screen.isChecked.return_value = False
slide_controller.theme_screen = MagicMock()
slide_controller.theme_screen.isChecked = MagicMock()
slide_controller.theme_screen.isChecked.return_value = True
slide_controller.on_theme_display = mocked_item
slide_controller.desktop_screen = MagicMock()
slide_controller.log_debug = MagicMock()
# WHEN: The service item is replaced
slide_controller.replace_service_manager_item(mocked_item)
# THEN: The display should remain blanked
slide_controller.on_theme_display.assert_called_once_with(True)
def replace_service_manager_item_on_hide_display_test(self):
"""
Test that when the service item is replaced, display remains blanked if it was blanked.
"""
# GIVEN: A slide controller and a new item to add, blanked display.
mocked_item = MagicMock()
mocked_preview_widget = MagicMock()
mocked_preview_widget.current_slide_number = MagicMock()
mocked_process_item = MagicMock()
slide_controller = SlideController(None)
slide_controller.preview_widget = mocked_preview_widget
slide_controller._process_item = mocked_process_item
slide_controller.service_item = mocked_item
slide_controller.hide_menu = MagicMock()
slide_controller.hide_mode = MagicMock()
slide_controller.hide_mode.return_value = True
slide_controller.blank_screen = MagicMock()
slide_controller.blank_screen.isChecked = MagicMock()
slide_controller.blank_screen.isChecked.return_value = False
slide_controller.theme_screen = MagicMock()
slide_controller.theme_screen.isChecked = MagicMock()
slide_controller.theme_screen.isChecked.return_value = False
slide_controller.on_theme_display = mocked_item
slide_controller.desktop_screen = MagicMock()
slide_controller.desktop_screen.isChecked = MagicMock()
slide_controller.desktop_screen.isChecked.return_value = True
slide_controller.on_hide_display = MagicMock()
slide_controller.log_debug = MagicMock()
# WHEN: The service item is replaced
slide_controller.replace_service_manager_item(mocked_item)
# THEN: The display should remain blanked
slide_controller.on_hide_display.assert_called_once_with(True)
def on_slide_blank_test(self):
"""
Test on_slide_blank