- Turned the two new hidden settings into registry flags

This commit is contained in:
suutari-olli 2016-06-27 02:14:24 +03:00
parent c249eb1f20
commit 68b4d62502
5 changed files with 17 additions and 18 deletions

View File

@ -164,8 +164,6 @@ 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',
'media/override player': QtCore.Qt.Unchecked,

View File

@ -488,9 +488,8 @@ class MediaManagerItem(QtWidgets.QWidget, RegistryProperties):
'You must select one or more items to preview.'))
else:
log.debug('%s Preview requested' % self.plugin.name)
# If ('advanced/double click live') is not enabled, double clicking preview adds the item to Service.
# This setting prevents it from being sent to Service multiple times, in here it is reset to False.
Settings().setValue('core/has doubleclicking preview added item to service', False)
# Reset the flag for: "has doubleclick added item to service" to False.
Registry().set_flag('has doubleclick added item to service', False)
service_item = self.build_service_item()
if service_item:
service_item.from_plugin = True

View File

@ -475,7 +475,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') and not Settings().value('core/is live item edited and replaced'):
if Settings().value('core/auto unblank'):
Registry().execute('slidecontroller_live_unblank')
else:
self.hide_display(self.hide_mode)

View File

@ -658,7 +658,6 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, RegistryProperties):
"""
# This setting is set to false, in case def replace_service_manager_item in slidecontroller would crash the
# program and make blank to modes unavailable.
Settings().setValue('core/is live item edited and replaced', False)
self.application.process_events()
for plugin in self.plugin_manager.plugins:
if plugin.is_active():

View File

@ -139,6 +139,7 @@ class SlideController(DisplayController, RegistryProperties):
Set up the Slide Controller.
"""
super(SlideController, self).__init__(parent)
Registry().set_flag('replace service manager item', False)
def post_set_up(self):
"""
@ -797,18 +798,18 @@ class SlideController(DisplayController, RegistryProperties):
def replace_service_manager_item(self, item):
"""
Replacement item following a remote edit
Replacement item following a remote edit.
This action also takes place when a song that is sent to live from Service Manager is edited.
If display is blanked, it will get unblanked if automatic unblanking is enabled. We prevent this from happening
by setting a hidden setting to "True" and then to "False" after the processing is done.
The setting is also set to "False" on every start up, should the program ever crash during this process.
by setting a flag to "True" and then to "False" after the processing is done.
The flag is also set to "False" on startup so display may be unblanked properly.
:param item: The current service item
"""
if item == self.service_item:
Settings().setValue('core/is live item edited and replaced', True)
Registry().set_flag('replace service manager item', True)
self._process_item(item, self.preview_widget.current_slide_number())
Settings().setValue('core/is live item edited and replaced', False)
Registry().set_flag('replace service manager item', False)
def add_service_manager_item(self, item, slide_no):
"""
@ -977,9 +978,12 @@ class SlideController(DisplayController, RegistryProperties):
def on_slide_unblank(self):
"""
Handle the slidecontroller unblank event
Handle the slidecontroller unblank event.
If we are re-processing service item, don't unblank the display
(Found in def replace_service_manager_item)
"""
self.on_blank_display(False)
if not Registry().get_flag('replace service manager item') == True:
self.on_blank_display(False)
def on_blank_display(self, checked=None):
"""
@ -1111,13 +1115,12 @@ class SlideController(DisplayController, RegistryProperties):
% timeout)
return
# If "click live slide to unblank" is enabled, unblank the display. And start = Item is sent to Live.
# 'core/is live item edited and replaced' is only True when replacing Live item with the same item from Service.
# Note: If this if statement is placed at the bottom of this function instead of top slide transitions are lost.
if self.is_live and Settings().value('core/click live slide to unblank'):
# 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:
()
if not start and not Settings().value('core/is live item edited and replaced'):
if not start:
Registry().execute('slidecontroller_live_unblank')
row = self.preview_widget.current_slide_number()
old_selected_row = self.selected_row
@ -1395,9 +1398,9 @@ class SlideController(DisplayController, RegistryProperties):
# Prevent same item in preview from being sent to Service multiple times. Changing preview slide resets
# this setting. Sending to preview from Service does not reset this setting, this is a design choise.
# Do note that this still allows to add item to Service multiple times if icon is clicked.
elif not Settings().value('core/has doubleclicking preview added item to service'):
elif not Registry().get_flag('has doubleclick added item to service') == True:
self.on_preview_add_to_service()
Settings().setValue('core/has doubleclicking preview added item to service', True)
Registry().set_flag('has doubleclick added item to service', True)
def on_go_live(self, field=None):
"""