forked from openlp/openlp
Merge branch 'master' of gitlab.com:openlp/openlp into master
This commit is contained in:
commit
68d39fdc25
@ -223,10 +223,10 @@ def set_theme():
|
||||
abort(400)
|
||||
if theme_level == ThemeLevel.Global:
|
||||
Registry().get('settings').setValue('themes/global theme', theme)
|
||||
Registry().execute('theme_update_global')
|
||||
Registry().get('theme_manager').theme_update_global.emit()
|
||||
elif theme_level == ThemeLevel.Service:
|
||||
Registry().get('settings').setValue('servicemanager/service theme', theme)
|
||||
Registry().execute('theme_update_service')
|
||||
Registry().get('service_manager').theme_update_service.emit()
|
||||
elif theme_level == ThemeLevel.Song:
|
||||
log.error('Unimplemented method')
|
||||
return '', 501
|
||||
|
@ -302,7 +302,6 @@ class Ui_ServiceManager(object):
|
||||
Registry().register_function('theme_update_list', self.update_theme_list)
|
||||
Registry().register_function('config_screen_changed', self.regenerate_service_items)
|
||||
Registry().register_function('theme_update_global', self.theme_change)
|
||||
Registry().register_function('theme_update_service', self.service_theme_change)
|
||||
Registry().register_function('mediaitem_suffix_reset', self.reset_supported_suffixes)
|
||||
|
||||
|
||||
@ -317,6 +316,7 @@ class ServiceManager(QtWidgets.QWidget, RegistryBase, Ui_ServiceManager, LogMixi
|
||||
servicemanager_next_item = QtCore.pyqtSignal()
|
||||
servicemanager_previous_item = QtCore.pyqtSignal()
|
||||
servicemanager_new_file = QtCore.pyqtSignal()
|
||||
theme_update_service = QtCore.pyqtSignal()
|
||||
|
||||
def __init__(self, parent=None):
|
||||
"""
|
||||
@ -346,6 +346,7 @@ class ServiceManager(QtWidgets.QWidget, RegistryBase, Ui_ServiceManager, LogMixi
|
||||
self.servicemanager_next_item.connect(self.next_item)
|
||||
self.servicemanager_previous_item.connect(self.previous_item)
|
||||
self.servicemanager_new_file.connect(self.new_file)
|
||||
self.theme_update_service.connect(self.service_theme_change)
|
||||
|
||||
def bootstrap_post_set_up(self):
|
||||
"""
|
||||
@ -1355,7 +1356,7 @@ class ServiceManager(QtWidgets.QWidget, RegistryBase, Ui_ServiceManager, LogMixi
|
||||
"""
|
||||
self.service_theme = self.theme_combo_box.currentText()
|
||||
self.settings.setValue('servicemanager/service theme', self.service_theme)
|
||||
Registry().execute('theme_update_service')
|
||||
self.service_theme_change()
|
||||
|
||||
def theme_change(self):
|
||||
"""
|
||||
|
@ -136,6 +136,8 @@ class ThemeManager(QtWidgets.QWidget, RegistryBase, Ui_ThemeManager, LogMixin, R
|
||||
"""
|
||||
Manages the orders of Theme.
|
||||
"""
|
||||
theme_update_global = QtCore.pyqtSignal()
|
||||
|
||||
def __init__(self, parent=None):
|
||||
"""
|
||||
Constructor
|
||||
@ -167,6 +169,7 @@ class ThemeManager(QtWidgets.QWidget, RegistryBase, Ui_ThemeManager, LogMixin, R
|
||||
self.setup_ui(self)
|
||||
self.global_theme = self.settings.value('themes/global theme')
|
||||
self.build_theme_path()
|
||||
self.theme_update_global.connect(self.change_global_from_tab)
|
||||
|
||||
def bootstrap_post_set_up(self):
|
||||
"""
|
||||
|
@ -229,12 +229,16 @@ def test_controller_set_theme_aborts_if_no_theme(flask_client, settings):
|
||||
|
||||
|
||||
def test_controller_set_theme_sets_global_theme(flask_client, settings):
|
||||
fake_theme_manager = MagicMock()
|
||||
Registry().register('theme_manager', fake_theme_manager)
|
||||
settings.setValue('themes/theme level', 1)
|
||||
res = flask_client.post('/api/v2/controller/theme', json=dict(theme='test'))
|
||||
assert res.status_code == 204
|
||||
|
||||
|
||||
def test_controller_set_theme_sets_service_theme(flask_client, settings):
|
||||
fake_service_manager = MagicMock()
|
||||
Registry().register('service_manager', fake_service_manager)
|
||||
settings.setValue('themes/theme level', 2)
|
||||
res = flask_client.post('/api/v2/controller/theme', json=dict(theme='test'))
|
||||
assert res.status_code == 204
|
||||
|
Loading…
Reference in New Issue
Block a user