forked from openlp/openlp
config_update removed
This commit is contained in:
parent
bdad091ff0
commit
af76c3f6b9
|
@ -191,7 +191,7 @@ class ImageManager(QtCore.QObject):
|
|||
self.image_thread = ImageThread(self)
|
||||
self._conversion_queue = PriorityQueue()
|
||||
self.stop_manager = False
|
||||
Registry().register_function(u'config_updated', self.process_updates)
|
||||
Registry().register_function(u'images_regenerate', self.process_updates)
|
||||
|
||||
def update_display(self):
|
||||
"""
|
||||
|
|
|
@ -36,7 +36,7 @@ import re
|
|||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import OpenLPToolbar, ServiceItem, StringContent, ListWidgetWithDnD, \
|
||||
ServiceItemContext, Settings, Registry, UiStrings, build_icon, translate
|
||||
ServiceItemContext, Settings, Registry, UiStrings, translate
|
||||
from openlp.core.lib.searchedit import SearchEdit
|
||||
from openlp.core.lib.ui import create_widget_action, critical_error_message_box
|
||||
|
||||
|
|
|
@ -403,9 +403,11 @@ class Plugin(QtCore.QObject):
|
|||
|
||||
def config_update(self):
|
||||
"""
|
||||
The plugin's config has changed
|
||||
Called when Config is changed to restart values dependent on configuration.
|
||||
"""
|
||||
pass
|
||||
log.info(u'config update processed')
|
||||
if self.mediaItem:
|
||||
self.mediaItem.config_update()
|
||||
|
||||
def new_service_created(self):
|
||||
"""
|
||||
|
|
|
@ -114,7 +114,7 @@ class Registry(object):
|
|||
Register an event and associated function to be called
|
||||
|
||||
``event``
|
||||
The function description like "config_updated" or "live_display_hide" where a number of places in the code
|
||||
The function description like "live_display_hide" where a number of places in the code
|
||||
will/may need to respond to a single action and the caller does not need to understand or know about the
|
||||
recipients.
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ class SettingsTab(QtGui.QWidget):
|
|||
self.tab_title = title
|
||||
self.tab_title_visible = visible_title
|
||||
self.settings_section = self.tab_title.lower()
|
||||
self.tab_visited = False
|
||||
if icon_path:
|
||||
self.icon_path = icon_path
|
||||
self.setupUi()
|
||||
|
@ -137,7 +138,7 @@ class SettingsTab(QtGui.QWidget):
|
|||
"""
|
||||
Tab has just been made visible to the user
|
||||
"""
|
||||
pass
|
||||
self.tab_visited = True
|
||||
|
||||
def _get_service_manager(self):
|
||||
"""
|
||||
|
|
|
@ -309,8 +309,7 @@ class GeneralTab(SettingsTab):
|
|||
|
||||
def post_set_up(self, postUpdate=False):
|
||||
"""
|
||||
Apply settings after settings tab has loaded and most of the
|
||||
system so must be delayed
|
||||
Apply settings after settings tab has loaded and most of the system so must be delayed
|
||||
"""
|
||||
self.settings_form.register_post_process(u'slidecontroller_live_spin_delay')
|
||||
# Do not continue on start up.
|
||||
|
|
|
@ -89,8 +89,7 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
|
|||
item_name.setIcon(icon)
|
||||
self.setting_list_widget.insertItem(location, item_name)
|
||||
else:
|
||||
# then remove tab to stop the UI displaying it even if
|
||||
# it is not required.
|
||||
# then remove tab to stop the UI displaying it even if it is not required.
|
||||
self.stacked_layout.takeAt(pos)
|
||||
|
||||
def accept(self):
|
||||
|
@ -99,10 +98,13 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
|
|||
"""
|
||||
for tabIndex in range(self.stacked_layout.count()):
|
||||
self.stacked_layout.widget(tabIndex).save()
|
||||
# Must go after all settings are save
|
||||
# if the display of image background are changing we need to regenerate the image cache
|
||||
if u'images_config_updated' in self.processes or u'config_screen_changed' in self.processes:
|
||||
print "found"
|
||||
self.register_post_process(u'images_regenerate')
|
||||
# Now lets process all the post save handlers
|
||||
while self.processes:
|
||||
Registry().execute(self.processes.pop(0))
|
||||
Registry().execute(u'config_updated')
|
||||
return QtGui.QDialog.accept(self)
|
||||
|
||||
def reject(self):
|
||||
|
|
|
@ -404,7 +404,6 @@ class ThemeManager(QtGui.QWidget):
|
|||
theme.theme_name = UiStrings().Default
|
||||
self._write_theme(theme, None, None)
|
||||
Settings().setValue(self.settingsSection + u'/global theme', theme.theme_name)
|
||||
self.config_updated()
|
||||
self.application.set_normal_cursor()
|
||||
self.load_themes()
|
||||
|
||||
|
|
|
@ -150,7 +150,9 @@ class ThemesTab(SettingsTab):
|
|||
settings.setValue(u'global theme', self.global_theme)
|
||||
settings.endGroup()
|
||||
self.renderer.set_theme_level(self.theme_level)
|
||||
self.settings_form.register_post_process(u'theme_update_global')
|
||||
if self.tab_visited:
|
||||
self.settings_form.register_post_process(u'theme_update_global')
|
||||
self.tab_visited = False
|
||||
|
||||
def post_set_up(self):
|
||||
"""
|
||||
|
|
|
@ -378,6 +378,7 @@ class BiblesTab(SettingsTab):
|
|||
self.settings_form.register_post_process(u'bibles_load_list',
|
||||
translate('OpenLP.BibleTab', 'Bibles Lists updating.'))
|
||||
settings.endGroup()
|
||||
self.settings_form.register_post_process(u'bibles_config_updated')
|
||||
|
||||
def update_theme_list(self, theme_list):
|
||||
"""
|
||||
|
|
|
@ -71,7 +71,6 @@ class BibleMediaItem(MediaManagerItem):
|
|||
self.second_search_results = {}
|
||||
self.checkSearchResult()
|
||||
Registry().register_function(u'bibles_load_list', self.reload_bibles)
|
||||
Registry().register_function(u'config_updated', self.config_update)
|
||||
|
||||
def __checkSecondBible(self, bible, second_bible):
|
||||
"""
|
||||
|
|
|
@ -46,7 +46,7 @@ __default_settings__ = {
|
|||
u'custom/last search type': CustomSearch.Titles,
|
||||
u'custom/display footer': True,
|
||||
u'custom/add custom from service': True
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class CustomPlugin(Plugin):
|
||||
|
|
|
@ -35,6 +35,7 @@ from PyQt4 import QtCore, QtGui
|
|||
|
||||
from openlp.core.lib import SettingsTab, Settings, translate
|
||||
|
||||
|
||||
class CustomTab(SettingsTab):
|
||||
"""
|
||||
CustomTab is the Custom settings tab in the settings dialog.
|
||||
|
@ -94,3 +95,6 @@ class CustomTab(SettingsTab):
|
|||
settings.setValue(u'display footer', self.display_footer)
|
||||
settings.setValue(u'add custom from service', self.update_load)
|
||||
settings.endGroup()
|
||||
if self.tab_visited:
|
||||
self.settings_form.register_post_process(u'custom_config_updated')
|
||||
self.tab_visited = False
|
|
@ -75,10 +75,13 @@ class CustomMediaItem(MediaManagerItem):
|
|||
self.onSearchTextButtonClicked)
|
||||
Registry().register_function(u'custom_load_list', self.loadList)
|
||||
Registry().register_function(u'custom_preview', self.onPreviewClick)
|
||||
Registry().register_function(u'config_updated', self.config_updated)
|
||||
Registry().register_function(u'custom_create_from_service', self.create_from_service_item)
|
||||
|
||||
def config_updated(self):
|
||||
def config_update(self):
|
||||
"""
|
||||
Config has been updated so reload values
|
||||
"""
|
||||
log.debug(u'Config loaded')
|
||||
self.add_custom_from_service = Settings().value(self.settingsSection + u'/add custom from service')
|
||||
|
||||
def retranslateUi(self):
|
||||
|
@ -92,9 +95,9 @@ class CustomMediaItem(MediaManagerItem):
|
|||
translate('SongsPlugin.MediaItem', 'Search Titles...')),
|
||||
(CustomSearch.Themes, u':/slides/slide_theme.png', UiStrings().Themes, UiStrings().SearchThemes)
|
||||
])
|
||||
self.searchTextEdit.set_current_search_type(Settings().value(u'%s/last search type' % self.settingsSection))
|
||||
self.loadList(self.manager.get_all_objects(CustomSlide, order_by_ref=CustomSlide.title))
|
||||
self.searchTextEdit.set_current_search_type(Settings().value( u'%s/last search type' % self.settingsSection))
|
||||
self.config_updated()
|
||||
self.config_update()
|
||||
|
||||
def loadList(self, custom_slides):
|
||||
# Sort out what custom we want to select after loading the list.
|
||||
|
|
|
@ -49,7 +49,6 @@ class ImagePlugin(Plugin):
|
|||
self.weight = -7
|
||||
self.iconPath = u':/plugins/plugin_images.png'
|
||||
self.icon = build_icon(self.iconPath)
|
||||
Registry().execute(u'image_updated', self.image_updated)
|
||||
|
||||
def about(self):
|
||||
about_text = translate('ImagePlugin', '<strong>Image Plugin</strong>'
|
||||
|
@ -90,12 +89,12 @@ class ImagePlugin(Plugin):
|
|||
}
|
||||
self.setPluginUiTextStrings(tooltips)
|
||||
|
||||
def image_updated(self):
|
||||
def config_update(self):
|
||||
"""
|
||||
Triggered by saving and changing the image border. Sets the images in
|
||||
image manager to require updates. Actual update is triggered by the
|
||||
last part of saving the config.
|
||||
Triggered by saving and changing the image border. Sets the images in image manager to require updates.
|
||||
Actual update is triggered by the last part of saving the config.
|
||||
"""
|
||||
log.info(u'Images config_update')
|
||||
background = QtGui.QColor(Settings().value(self.settingsSection + u'/background color'))
|
||||
self.image_manager.update_images_border(ImageSource.ImagePlugin, background)
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from openlp.core.lib import SettingsTab, Settings, UiStrings, translate
|
||||
from openlp.core.lib import Registry, SettingsTab, Settings, UiStrings, translate
|
||||
|
||||
|
||||
class ImageTab(SettingsTab):
|
||||
|
@ -87,8 +87,8 @@ class ImageTab(SettingsTab):
|
|||
|
||||
def save(self):
|
||||
settings = Settings()
|
||||
settings.beginGroup(self.setting_sSection)
|
||||
settings.beginGroup(self.settings_section)
|
||||
settings.setValue(u'background color', self.background_color)
|
||||
settings.endGroup()
|
||||
if self.initial_color != self.background_color:
|
||||
self.settings_form.register_post_process(u'image_updated')
|
||||
self.settings_form.register_post_process(u'images_config_updated')
|
||||
|
|
|
@ -81,6 +81,6 @@ class MediaTab(SettingsTab):
|
|||
self.settings_form.register_post_process(u'mediaitem_suffix_reset')
|
||||
self.settings_form.register_post_process(u'mediaitem_media_rebuild')
|
||||
self.settings_form.register_post_process(u'mediaitem_suffixes')
|
||||
setting_key = self.settingsSection + u'/media auto start'
|
||||
setting_key = self.settings_section + u'/media auto start'
|
||||
if Settings().value(setting_key) != self.auto_start_check_box.checkState():
|
||||
Settings().setValue(setting_key, self.auto_start_check_box.checkState())
|
||||
|
|
|
@ -97,8 +97,7 @@ class RemotesPlugin(Plugin):
|
|||
|
||||
def config_update(self):
|
||||
"""
|
||||
Called when Config is changed to restart the server on new address or
|
||||
port
|
||||
Called when Config is changed to restart the server on new address or port
|
||||
"""
|
||||
self.finalise()
|
||||
self.initialise()
|
||||
|
|
|
@ -104,7 +104,6 @@ class SongMediaItem(MediaManagerItem):
|
|||
self.addSearchToToolBar()
|
||||
# Signals and slots
|
||||
Registry().register_function(u'songs_load_list', self.on_song_list_load)
|
||||
Registry().register_function(u'config_updated', self.config_update)
|
||||
Registry().register_function(u'songs_preview', self.onPreviewClick)
|
||||
QtCore.QObject.connect(self.searchTextEdit, QtCore.SIGNAL(u'cleared()'), self.onClearTextButtonClick)
|
||||
QtCore.QObject.connect(self.searchTextEdit, QtCore.SIGNAL(u'searchTypeChanged(int)'),
|
||||
|
@ -120,6 +119,10 @@ class SongMediaItem(MediaManagerItem):
|
|||
self.searchTextEdit.setFocus()
|
||||
|
||||
def config_update(self):
|
||||
"""
|
||||
IS triggered when the songs config is updated
|
||||
"""
|
||||
log.debug(u'config_updated')
|
||||
self.searchAsYouType = Settings().value(self.settingsSection + u'/search as type')
|
||||
self.updateServiceOnEdit = Settings().value(self.settingsSection + u'/update service on edit')
|
||||
self.addSongFromService = Settings().value(self.settingsSection + u'/add song from service',)
|
||||
|
|
|
@ -108,3 +108,6 @@ class SongsTab(SettingsTab):
|
|||
settings.setValue(u'update service on edit', self.update_edit)
|
||||
settings.setValue(u'add song from service', self.update_load)
|
||||
settings.endGroup()
|
||||
if self.tab_visited:
|
||||
self.settings_form.register_post_process(u'songs_config_updated')
|
||||
self.tab_visited = False
|
||||
|
|
Loading…
Reference in New Issue