fix missing state code

This commit is contained in:
Tim Bentley 2019-07-31 22:01:22 +01:00
parent 8ce94115c9
commit df2ace541e
3 changed files with 7 additions and 4 deletions

View File

@ -34,6 +34,7 @@ from tempfile import NamedTemporaryFile
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
from openlp.core.state import State
from openlp.core.common import ThemeLevel, delete_file from openlp.core.common import ThemeLevel, delete_file
from openlp.core.common.actions import ActionList, CategoryOrder from openlp.core.common.actions import ActionList, CategoryOrder
from openlp.core.common.applocation import AppLocation from openlp.core.common.applocation import AppLocation
@ -828,7 +829,7 @@ class ServiceManager(QtWidgets.QWidget, RegistryBase, Ui_ServiceManager, LogMixi
self.auto_start_action.setIcon(UiIcons().inactive) self.auto_start_action.setIcon(UiIcons().inactive)
self.auto_start_action.setText(translate('OpenLP.ServiceManager', '&Auto Start - inactive')) self.auto_start_action.setText(translate('OpenLP.ServiceManager', '&Auto Start - inactive'))
if service_item['service_item'].is_text(): if service_item['service_item'].is_text():
for plugin in self.plugin_manager.plugins: for plugin in State().list_plugins():
if plugin.name == 'custom' and plugin.status == PluginStatus.Active: if plugin.name == 'custom' and plugin.status == PluginStatus.Active:
self.create_custom_action.setVisible(True) self.create_custom_action.setVisible(True)
break break

View File

@ -30,6 +30,7 @@ from xml.etree.ElementTree import XML, ElementTree
from PyQt5 import QtCore, QtWidgets from PyQt5 import QtCore, QtWidgets
from openlp.core.state import State
from openlp.core.common import delete_file from openlp.core.common import delete_file
from openlp.core.common.applocation import AppLocation from openlp.core.common.applocation import AppLocation
from openlp.core.common.i18n import UiStrings, get_locale_key, translate from openlp.core.common.i18n import UiStrings, get_locale_key, translate
@ -293,7 +294,7 @@ class ThemeManager(QtWidgets.QWidget, RegistryBase, Ui_ThemeManager, LogMixin, R
old_theme_data = self.get_theme_data(old_theme_name) old_theme_data = self.get_theme_data(old_theme_name)
self.clone_theme_data(old_theme_data, new_theme_name) self.clone_theme_data(old_theme_data, new_theme_name)
self.delete_theme(old_theme_name) self.delete_theme(old_theme_name)
for plugin in self.plugin_manager.plugins: for plugin in State().list_plugins():
if plugin.uses_theme(old_theme_name): if plugin.uses_theme(old_theme_name):
plugin.rename_theme(old_theme_name, new_theme_name) plugin.rename_theme(old_theme_name, new_theme_name)
self.renderer.set_theme(self.get_theme_data(new_theme_name)) self.renderer.set_theme(self.get_theme_data(new_theme_name))
@ -771,7 +772,7 @@ class ThemeManager(QtWidgets.QWidget, RegistryBase, Ui_ThemeManager, LogMixin, R
# check for use in the system else where. # check for use in the system else where.
if test_plugin: if test_plugin:
plugin_usage = "" plugin_usage = ""
for plugin in self.plugin_manager.plugins: for plugin in State().list_plugins():
used_count = plugin.uses_theme(theme) used_count = plugin.uses_theme(theme)
if used_count: if used_count:
plugin_usage = "{plug}{text}".format(plug=plugin_usage, plugin_usage = "{plug}{text}".format(plug=plugin_usage,

View File

@ -29,6 +29,7 @@ from shutil import copyfile
from PyQt5 import QtCore, QtWidgets from PyQt5 import QtCore, QtWidgets
from openlp.core.state import State
from openlp.core.common.applocation import AppLocation from openlp.core.common.applocation import AppLocation
from openlp.core.common.i18n import UiStrings, get_natural_key, translate from openlp.core.common.i18n import UiStrings, get_natural_key, translate
from openlp.core.common.mixins import RegistryProperties from openlp.core.common.mixins import RegistryProperties
@ -416,7 +417,7 @@ class EditSongForm(QtWidgets.QDialog, Ui_EditSongDialog, RegistryProperties):
Load the media files into a combobox. Load the media files into a combobox.
""" """
self.from_media_button.setVisible(False) self.from_media_button.setVisible(False)
for plugin in self.plugin_manager.plugins: for plugin in State().list_plugins():
if plugin.name == 'media' and plugin.status == PluginStatus.Active: if plugin.name == 'media' and plugin.status == PluginStatus.Active:
self.from_media_button.setVisible(True) self.from_media_button.setVisible(True)
self.media_form.populate_files(plugin.media_item.get_list(MediaType.Audio)) self.media_form.populate_files(plugin.media_item.get_list(MediaType.Audio))