Plugins 2 - setttingsSection gone

This commit is contained in:
Tim Bentley 2013-03-19 19:43:22 +00:00
parent 611dbdf044
commit fb6d292be0
35 changed files with 350 additions and 349 deletions

View File

@ -240,9 +240,9 @@ def build_html(item, screen, is_live, background, image=None, plugins=None):
html_additions = u'' html_additions = u''
if plugins: if plugins:
for plugin in plugins: for plugin in plugins:
css_additions += plugin.getDisplayCss() css_additions += plugin.get_display_css()
js_additions += plugin.getDisplayJavaScript() js_additions += plugin.get_display_javascript()
html_additions += plugin.getDisplayHtml() html_additions += plugin.get_display_html()
html = HTMLSRC % ( html = HTMLSRC % (
build_background_css(item, width), build_background_css(item, width),
css_additions, css_additions,

View File

@ -86,10 +86,10 @@ class MediaManagerItem(QtGui.QWidget):
self.hide() self.hide()
self.whitespace = re.compile(r'[\W_]+', re.UNICODE) self.whitespace = re.compile(r'[\W_]+', re.UNICODE)
self.plugin = plugin self.plugin = plugin
visible_title = self.plugin.getString(StringContent.VisibleName) visible_title = self.plugin.get_string(StringContent.VisibleName)
self.title = unicode(visible_title[u'title']) self.title = unicode(visible_title[u'title'])
Registry().register(self.plugin.name, self) Registry().register(self.plugin.name, self)
self.settingsSection = self.plugin.name self.settings_section = self.plugin.name
self.toolbar = None self.toolbar = None
self.remoteTriggered = None self.remoteTriggered = None
self.singleServiceItem = True self.singleServiceItem = True
@ -180,8 +180,8 @@ class MediaManagerItem(QtGui.QWidget):
if action[0] == StringContent.Preview: if action[0] == StringContent.Preview:
self.toolbar.addSeparator() self.toolbar.addSeparator()
self.toolbar.add_toolbar_action(u'%s%sAction' % (self.plugin.name, action[0]), self.toolbar.add_toolbar_action(u'%s%sAction' % (self.plugin.name, action[0]),
text=self.plugin.getString(action[1])[u'title'], icon=action[2], text=self.plugin.get_string(action[1])[u'title'], icon=action[2],
tooltip=self.plugin.getString(action[1])[u'tooltip'], tooltip=self.plugin.get_string(action[1])[u'tooltip'],
triggers=action[3]) triggers=action[3])
def addListViewToToolBar(self): def addListViewToToolBar(self):
@ -200,33 +200,33 @@ class MediaManagerItem(QtGui.QWidget):
self.listView.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.listView.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
if self.hasEditIcon: if self.hasEditIcon:
create_widget_action(self.listView, create_widget_action(self.listView,
text=self.plugin.getString(StringContent.Edit)[u'title'], text=self.plugin.get_string(StringContent.Edit)[u'title'],
icon=u':/general/general_edit.png', icon=u':/general/general_edit.png',
triggers=self.onEditClick) triggers=self.onEditClick)
create_widget_action(self.listView, separator=True) create_widget_action(self.listView, separator=True)
if self.hasDeleteIcon: if self.hasDeleteIcon:
create_widget_action(self.listView, create_widget_action(self.listView,
u'listView%s%sItem' % (self.plugin.name.title(), StringContent.Delete.title()), u'listView%s%sItem' % (self.plugin.name.title(), StringContent.Delete.title()),
text=self.plugin.getString(StringContent.Delete)[u'title'], text=self.plugin.get_string(StringContent.Delete)[u'title'],
icon=u':/general/general_delete.png', icon=u':/general/general_delete.png',
can_shortcuts=True, triggers=self.onDeleteClick) can_shortcuts=True, triggers=self.onDeleteClick)
create_widget_action(self.listView, separator=True) create_widget_action(self.listView, separator=True)
create_widget_action(self.listView, create_widget_action(self.listView,
u'listView%s%sItem' % (self.plugin.name.title(), StringContent.Preview.title()), u'listView%s%sItem' % (self.plugin.name.title(), StringContent.Preview.title()),
text=self.plugin.getString(StringContent.Preview)[u'title'], text=self.plugin.get_string(StringContent.Preview)[u'title'],
icon=u':/general/general_preview.png', icon=u':/general/general_preview.png',
can_shortcuts=True, can_shortcuts=True,
triggers=self.onPreviewClick) triggers=self.onPreviewClick)
create_widget_action(self.listView, create_widget_action(self.listView,
u'listView%s%sItem' % (self.plugin.name.title(), StringContent.Live.title()), u'listView%s%sItem' % (self.plugin.name.title(), StringContent.Live.title()),
text=self.plugin.getString(StringContent.Live)[u'title'], text=self.plugin.get_string(StringContent.Live)[u'title'],
icon=u':/general/general_live.png', icon=u':/general/general_live.png',
can_shortcuts=True, can_shortcuts=True,
triggers=self.onLiveClick) triggers=self.onLiveClick)
create_widget_action(self.listView, create_widget_action(self.listView,
u'listView%s%sItem' % (self.plugin.name.title(), StringContent.Service.title()), u'listView%s%sItem' % (self.plugin.name.title(), StringContent.Service.title()),
can_shortcuts=True, can_shortcuts=True,
text=self.plugin.getString(StringContent.Service)[u'title'], text=self.plugin.get_string(StringContent.Service)[u'title'],
icon=u':/general/general_add.png', icon=u':/general/general_add.png',
triggers=self.onAddClick) triggers=self.onAddClick)
if self.addToServiceItem: if self.addToServiceItem:
@ -304,7 +304,7 @@ class MediaManagerItem(QtGui.QWidget):
Add a file to the list widget to make it available for showing Add a file to the list widget to make it available for showing
""" """
files = QtGui.QFileDialog.getOpenFileNames(self, self.onNewPrompt, files = QtGui.QFileDialog.getOpenFileNames(self, self.onNewPrompt,
Settings().value(self.settingsSection + u'/last directory'), self.onNewFileMasks) Settings().value(self.settings_section + u'/last directory'), self.onNewFileMasks)
log.info(u'New files(s) %s', files) log.info(u'New files(s) %s', files)
if files: if files:
self.application.set_busy_cursor() self.application.set_busy_cursor()
@ -371,8 +371,8 @@ class MediaManagerItem(QtGui.QWidget):
self.listView.clear() self.listView.clear()
self.loadList(full_list, target_group) self.loadList(full_list, target_group)
last_dir = os.path.split(unicode(files[0]))[0] last_dir = os.path.split(unicode(files[0]))[0]
Settings().setValue(self.settingsSection + u'/last directory', last_dir) Settings().setValue(self.settings_section + u'/last directory', last_dir)
Settings().setValue(u'%s/%s files' % (self.settingsSection, self.settingsSection), self.getFileList()) Settings().setValue(u'%s/%s files' % (self.settings_section, self.settings_section), self.getFileList())
if duplicates_found: if duplicates_found:
critical_error_message_box(UiStrings().Duplicate, critical_error_message_box(UiStrings().Duplicate,
translate('OpenLP.MediaManagerItem', 'Duplicate files were found on import and were ignored.')) translate('OpenLP.MediaManagerItem', 'Duplicate files were found on import and were ignored.'))

View File

@ -76,7 +76,7 @@ class Plugin(QtCore.QObject):
``version`` ``version``
The version number of this iteration of the plugin. The version number of this iteration of the plugin.
``settingsSection`` ``settings_section``
The namespace to store settings for the plugin. The namespace to store settings for the plugin.
``icon`` ``icon``
@ -97,17 +97,17 @@ class Plugin(QtCore.QObject):
Creates a new instance of MediaManagerItem to be used in the Media Creates a new instance of MediaManagerItem to be used in the Media
Manager. Manager.
``addImportMenuItem(import_menu)`` ``add_import_menu_item(import_menu)``
Add an item to the Import menu. Add an item to the Import menu.
``addExportMenuItem(export_menu)`` ``add_export_menu_Item(export_menu)``
Add an item to the Export menu. Add an item to the Export menu.
``createSettingsTab()`` ``create_settings_Tab()``
Creates a new instance of SettingsTabItem to be used in the Settings Creates a new instance of SettingsTabItem to be used in the Settings
dialog. dialog.
``addToMenu(menubar)`` ``add_to_menu(menubar)``
A method to add a menu item to anywhere in the menu, given the menu bar. A method to add a menu item to anywhere in the menu, given the menu bar.
``handle_event(event)`` ``handle_event(event)``
@ -147,19 +147,19 @@ class Plugin(QtCore.QObject):
log.debug(u'Plugin %s initialised' % name) log.debug(u'Plugin %s initialised' % name)
QtCore.QObject.__init__(self) QtCore.QObject.__init__(self)
self.name = name self.name = name
self.textStrings = {} self.text_strings = {}
self.set_plugin_text_strings() self.set_plugin_text_strings()
self.nameStrings = self.textStrings[StringContent.Name] self.name_strings = self.text_strings[StringContent.Name]
if version: if version:
self.version = version self.version = version
else: else:
self.version = get_application_version()[u'version'] self.version = get_application_version()[u'version']
self.settingsSection = self.name self.settings_section = self.name
self.icon = None self.icon = None
self.mediaItemClass = media_item_class self.media_item_class = media_item_class
self.settingsTabClass = settings_tab_class self.settings_tab_class = settings_tab_class
self.settingsTab = None self.settings_tab = None
self.mediaItem = None self.media_item = None
self.weight = 0 self.weight = 0
self.status = PluginStatus.Inactive self.status = PluginStatus.Inactive
# Add the default status to the default settings. # Add the default status to the default settings.
@ -171,7 +171,7 @@ class Plugin(QtCore.QObject):
default_settings[u'%s/%s files' % (name, name)] = [] default_settings[u'%s/%s files' % (name, name)] = []
# Add settings to the dict of all settings. # Add settings to the dict of all settings.
Settings.extend_default_settings(default_settings) Settings.extend_default_settings(default_settings)
Registry().register_function(u'%s_add_service_item' % self.name, self.processAddServiceEvent) Registry().register_function(u'%s_add_service_item' % self.name, self.process_add_service_event)
Registry().register_function(u'%s_config_updated' % self.name, self.config_update) Registry().register_function(u'%s_config_updated' % self.name, self.config_update)
def check_pre_conditions(self): def check_pre_conditions(self):
@ -187,14 +187,14 @@ class Plugin(QtCore.QObject):
""" """
Sets the status of the plugin Sets the status of the plugin
""" """
self.status = Settings().value(self.settingsSection + u'/status') self.status = Settings().value(self.settings_section + u'/status')
def toggle_status(self, new_status): def toggle_status(self, new_status):
""" """
Changes the status of the plugin and remembers it Changes the status of the plugin and remembers it
""" """
self.status = new_status self.status = new_status
Settings().setValue(self.settingsSection + u'/status', self.status) Settings().setValue(self.settings_section + u'/status', self.status)
if new_status == PluginStatus.Active: if new_status == PluginStatus.Active:
self.initialise() self.initialise()
elif new_status == PluginStatus.Inactive: elif new_status == PluginStatus.Inactive:
@ -213,8 +213,8 @@ class Plugin(QtCore.QObject):
Construct a MediaManagerItem object with all the buttons and things Construct a MediaManagerItem object with all the buttons and things
you need, and return it for integration into OpenLP. you need, and return it for integration into OpenLP.
""" """
if self.mediaItemClass: if self.media_item_class:
self.mediaItem = self.mediaItemClass(self.main_window.media_dock_manager.media_dock, self) self.media_item = self.media_item_class(self.main_window.media_dock_manager.media_dock, self)
def upgrade_settings(self, settings): def upgrade_settings(self, settings):
""" """
@ -225,7 +225,7 @@ class Plugin(QtCore.QObject):
""" """
pass pass
def addImportMenuItem(self, importMenu): def add_import_menu_item(self, importMenu):
""" """
Create a menu item and add it to the "Import" menu. Create a menu item and add it to the "Import" menu.
@ -234,7 +234,7 @@ class Plugin(QtCore.QObject):
""" """
pass pass
def addExportMenuItem(self, exportMenu): def add_export_menu_Item(self, exportMenu):
""" """
Create a menu item and add it to the "Export" menu. Create a menu item and add it to the "Export" menu.
@ -243,7 +243,7 @@ class Plugin(QtCore.QObject):
""" """
pass pass
def addToolsMenuItem(self, toolsMenu): def add_tools_menu_item(self, toolsMenu):
""" """
Create a menu item and add it to the "Tools" menu. Create a menu item and add it to the "Tools" menu.
@ -252,16 +252,16 @@ class Plugin(QtCore.QObject):
""" """
pass pass
def createSettingsTab(self, parent): def create_settings_Tab(self, parent):
""" """
Create a tab for the settings window to display the configurable options Create a tab for the settings window to display the configurable options
for this plugin to the user. for this plugin to the user.
""" """
if self.settingsTabClass: if self.settings_tab_class:
self.settingsTab = self.settingsTabClass(parent, self.name, self.settings_tab = self.settings_tab_class(parent, self.name,
self.getString(StringContent.VisibleName)[u'title'], self.iconPath) self.get_string(StringContent.VisibleName)[u'title'], self.icon_path)
def addToMenu(self, menubar): def add_to_menu(self, menubar):
""" """
Add menu items to the menu, given the menubar. Add menu items to the menu, given the menubar.
@ -270,15 +270,15 @@ class Plugin(QtCore.QObject):
""" """
pass pass
def processAddServiceEvent(self, replace=False): def process_add_service_event(self, replace=False):
""" """
Generic Drag and drop handler triggered from service_manager. Generic Drag and drop handler triggered from service_manager.
""" """
log.debug(u'processAddServiceEvent event called for plugin %s' % self.name) log.debug(u'process_add_service_event event called for plugin %s' % self.name)
if replace: if replace:
self.mediaItem.onAddEditClick() self.media_item.onAddEditClick()
else: else:
self.mediaItem.onAddClick() self.media_item.onAddClick()
def about(self): def about(self):
""" """
@ -291,16 +291,16 @@ class Plugin(QtCore.QObject):
""" """
Called by the plugin Manager to initialise anything it needs. Called by the plugin Manager to initialise anything it needs.
""" """
if self.mediaItem: if self.media_item:
self.mediaItem.initialise() self.media_item.initialise()
self.main_window.media_dock_manager.insert_dock(self.mediaItem, self.icon, self.weight) self.main_window.media_dock_manager.insert_dock(self.media_item, self.icon, self.weight)
def finalise(self): def finalise(self):
""" """
Called by the plugin Manager to cleanup things. Called by the plugin Manager to cleanup things.
""" """
if self.mediaItem: if self.media_item:
self.main_window.media_dock_manager.remove_dock(self.mediaItem) self.main_window.media_dock_manager.remove_dock(self.media_item)
def app_startup(self): def app_startup(self):
""" """
@ -309,10 +309,10 @@ class Plugin(QtCore.QObject):
# FIXME: Remove after 2.2 release. # FIXME: Remove after 2.2 release.
# This is needed to load the list of images/media/presentation from the config saved # This is needed to load the list of images/media/presentation from the config saved
# before the settings rewrite. # before the settings rewrite.
if self.mediaItemClass is not None and self.name != u'images': if self.media_item_class is not None and self.name != u'images':
loaded_list = Settings().get_files_from_config(self) loaded_list = Settings().get_files_from_config(self)
# Now save the list to the config using our Settings class. # Now save the list to the config using our Settings class.
Settings().setValue(u'%s/%s files' % (self.settingsSection, self.name), loaded_list) Settings().setValue(u'%s/%s files' % (self.settings_section, self.name), loaded_list)
def uses_theme(self, theme): def uses_theme(self, theme):
""" """
@ -334,54 +334,54 @@ class Plugin(QtCore.QObject):
""" """
pass pass
def getString(self, name): def get_string(self, name):
""" """
encapsulate access of plugins translated text strings Encapsulate access of plugins translated text strings
""" """
return self.textStrings[name] return self.text_strings[name]
def setPluginUiTextStrings(self, tooltips): def set_plugin_ui_text_strings(self, tooltips):
""" """
Called to define all translatable texts of the plugin Called to define all translatable texts of the plugin
""" """
## Load Action ## ## Load Action ##
self.__setNameTextString(StringContent.Load, UiStrings().Load, tooltips[u'load']) self.__set_name_text_string(StringContent.Load, UiStrings().Load, tooltips[u'load'])
## Import Action ## ## Import Action ##
self.__setNameTextString(StringContent.Import, UiStrings().Import, tooltips[u'import']) self.__set_name_text_string(StringContent.Import, UiStrings().Import, tooltips[u'import'])
## New Action ## ## New Action ##
self.__setNameTextString(StringContent.New, UiStrings().Add, tooltips[u'new']) self.__set_name_text_string(StringContent.New, UiStrings().Add, tooltips[u'new'])
## Edit Action ## ## Edit Action ##
self.__setNameTextString(StringContent.Edit, UiStrings().Edit, tooltips[u'edit']) self.__set_name_text_string(StringContent.Edit, UiStrings().Edit, tooltips[u'edit'])
## Delete Action ## ## Delete Action ##
self.__setNameTextString(StringContent.Delete, UiStrings().Delete, tooltips[u'delete']) self.__set_name_text_string(StringContent.Delete, UiStrings().Delete, tooltips[u'delete'])
## Preview Action ## ## Preview Action ##
self.__setNameTextString(StringContent.Preview, UiStrings().Preview, tooltips[u'preview']) self.__set_name_text_string(StringContent.Preview, UiStrings().Preview, tooltips[u'preview'])
## Send Live Action ## ## Send Live Action ##
self.__setNameTextString(StringContent.Live, UiStrings().Live, tooltips[u'live']) self.__set_name_text_string(StringContent.Live, UiStrings().Live, tooltips[u'live'])
## Add to Service Action ## ## Add to Service Action ##
self.__setNameTextString(StringContent.Service, UiStrings().Service, tooltips[u'service']) self.__set_name_text_string(StringContent.Service, UiStrings().Service, tooltips[u'service'])
def __setNameTextString(self, name, title, tooltip): def __set_name_text_string(self, name, title, tooltip):
""" """
Utility method for creating a plugin's textStrings. This method makes Utility method for creating a plugin's text_strings. This method makes
use of the singular name of the plugin object so must only be called use of the singular name of the plugin object so must only be called
after this has been set. after this has been set.
""" """
self.textStrings[name] = {u'title': title, u'tooltip': tooltip} self.text_strings[name] = {u'title': title, u'tooltip': tooltip}
def getDisplayCss(self): def get_display_css(self):
""" """
Add css style sheets to htmlbuilder. Add css style sheets to htmlbuilder.
""" """
return u'' return u''
def getDisplayJavaScript(self): def get_display_javascript(self):
""" """
Add javascript functions to htmlbuilder. Add javascript functions to htmlbuilder.
""" """
return u'' return u''
def refreshCss(self, frame): def refresh_css(self, frame):
""" """
Allow plugins to refresh javascript on displayed screen. Allow plugins to refresh javascript on displayed screen.
@ -390,7 +390,7 @@ class Plugin(QtCore.QObject):
""" """
return u'' return u''
def getDisplayHtml(self): def get_display_html(self):
""" """
Add html code to htmlbuilder. Add html code to htmlbuilder.
""" """
@ -401,8 +401,8 @@ class Plugin(QtCore.QObject):
Called when Config is changed to restart values dependent on configuration. Called when Config is changed to restart values dependent on configuration.
""" """
log.info(u'config update processed') log.info(u'config update processed')
if self.mediaItem: if self.media_item:
self.mediaItem.config_update() self.media_item.config_update()
def new_service_created(self): def new_service_created(self):
""" """

View File

@ -129,7 +129,7 @@ class PluginManager(object):
log.exception(u'Failed to load plugin %s', unicode(p)) log.exception(u'Failed to load plugin %s', unicode(p))
plugins_list = sorted(plugin_objects, key=lambda plugin: plugin.weight) plugins_list = sorted(plugin_objects, key=lambda plugin: plugin.weight)
for plugin in plugins_list: for plugin in plugins_list:
if plugin.checkPreConditions(): if plugin.check_pre_conditions():
log.debug(u'Plugin %s active', unicode(plugin.name)) log.debug(u'Plugin %s active', unicode(plugin.name))
plugin.set_status() plugin.set_status()
else: else:
@ -153,7 +153,7 @@ class PluginManager(object):
""" """
for plugin in self.plugins: for plugin in self.plugins:
if plugin.status is not PluginStatus.Disabled: if plugin.status is not PluginStatus.Disabled:
plugin.createSettingsTab(self.settings_form) plugin.create_settings_Tab(self.settings_form)
def hook_import_menu(self): def hook_import_menu(self):
""" """
@ -163,7 +163,7 @@ class PluginManager(object):
""" """
for plugin in self.plugins: for plugin in self.plugins:
if plugin.status is not PluginStatus.Disabled: if plugin.status is not PluginStatus.Disabled:
plugin.addImportMenuItem(self.main_window.file_import_menu) plugin.add_import_menu_item(self.main_window.file_import_menu)
def hook_export_menu(self): def hook_export_menu(self):
""" """
@ -172,7 +172,7 @@ class PluginManager(object):
""" """
for plugin in self.plugins: for plugin in self.plugins:
if plugin.status is not PluginStatus.Disabled: if plugin.status is not PluginStatus.Disabled:
plugin.addExportMenuItem(self.main_window.file_export_menu) plugin.add_export_menu_Item(self.main_window.file_export_menu)
def hook_tools_menu(self): def hook_tools_menu(self):
""" """
@ -181,7 +181,7 @@ class PluginManager(object):
""" """
for plugin in self.plugins: for plugin in self.plugins:
if plugin.status is not PluginStatus.Disabled: if plugin.status is not PluginStatus.Disabled:
plugin.addToolsMenuItem(self.main_window.tools_menu) plugin.add_tools_menu_item(self.main_window.tools_menu)
def hook_upgrade_plugin_settings(self, settings): def hook_upgrade_plugin_settings(self, settings):
""" """

View File

@ -419,8 +419,8 @@ class ServiceItem(object):
for slide in serviceitem[u'serviceitem'][u'data']: for slide in serviceitem[u'serviceitem'][u'data']:
self._raw_frames.append(slide) self._raw_frames.append(slide)
elif self.service_item_type == ServiceItemType.Image: elif self.service_item_type == ServiceItemType.Image:
settingsSection = serviceitem[u'serviceitem'][u'header'][u'name'] settings_section = serviceitem[u'serviceitem'][u'header'][u'name']
background = QtGui.QColor(Settings().value(settingsSection + u'/background color')) background = QtGui.QColor(Settings().value(settings_section + u'/background color'))
if path: if path:
self.has_original_files = False self.has_original_files = False
for text_image in serviceitem[u'serviceitem'][u'data']: for text_image in serviceitem[u'serviceitem'][u'data']:

View File

@ -454,7 +454,7 @@ class Settings(QtCore.QSettings):
# We need QSettings instead of Settings here to bypass our central settings dict. # We need QSettings instead of Settings here to bypass our central settings dict.
# Do NOT do this anywhere else! # Do NOT do this anywhere else!
settings = QtCore.QSettings(self.fileName(), Settings.IniFormat) settings = QtCore.QSettings(self.fileName(), Settings.IniFormat)
settings.beginGroup(plugin.settingsSection) settings.beginGroup(plugin.settings_section)
if settings.contains(u'%s count' % plugin.name): if settings.contains(u'%s count' % plugin.name):
# Get the count. # Get the count.
list_count = int(settings.value(u'%s count' % plugin.name, 0)) list_count = int(settings.value(u'%s count' % plugin.name, 0))

View File

@ -56,7 +56,7 @@ class MediaDockManager(object):
``icon`` ``icon``
An icon for this dock item An icon for this dock item
""" """
visible_title = media_item.plugin.getString(StringContent.VisibleName) visible_title = media_item.plugin.get_string(StringContent.VisibleName)
log.info(u'Adding %s dock' % visible_title) log.info(u'Adding %s dock' % visible_title)
self.media_dock.addItem(media_item, icon, visible_title[u'title']) self.media_dock.addItem(media_item, icon, visible_title[u'title'])
@ -66,11 +66,11 @@ class MediaDockManager(object):
This does not work as it gives a Segmentation error. This does not work as it gives a Segmentation error.
For now add at end of stack if not present For now add at end of stack if not present
""" """
visible_title = media_item.plugin.getString(StringContent.VisibleName) visible_title = media_item.plugin.get_string(StringContent.VisibleName)
log.debug(u'Inserting %s dock' % visible_title[u'title']) log.debug(u'Inserting %s dock' % visible_title[u'title'])
match = False match = False
for dock_index in range(self.media_dock.count()): for dock_index in range(self.media_dock.count()):
if self.media_dock.widget(dock_index).settingsSection == media_item.plugin.name: if self.media_dock.widget(dock_index).settings_section == media_item.plugin.name:
match = True match = True
break break
if not match: if not match:
@ -83,10 +83,10 @@ class MediaDockManager(object):
``media_item`` ``media_item``
The item to add to the dock The item to add to the dock
""" """
visible_title = media_item.plugin.getString(StringContent.VisibleName) visible_title = media_item.plugin.get_string(StringContent.VisibleName)
log.debug(u'remove %s dock' % visible_title[u'title']) log.debug(u'remove %s dock' % visible_title[u'title'])
for dock_index in range(self.media_dock.count()): for dock_index in range(self.media_dock.count()):
if self.media_dock.widget(dock_index): if self.media_dock.widget(dock_index):
if self.media_dock.widget(dock_index).settingsSection == media_item.plugin.name: if self.media_dock.widget(dock_index).settings_section == media_item.plugin.name:
self.media_dock.widget(dock_index).setVisible(False) self.media_dock.widget(dock_index).setVisible(False)
self.media_dock.removeItem(dock_index) self.media_dock.removeItem(dock_index)

View File

@ -896,7 +896,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
item = self.find_service_item()[0] item = self.find_service_item()[0]
service_item = self.service_items[item][u'service_item'] service_item = self.service_items[item][u'service_item']
if service_item.timed_slide_interval == 0: if service_item.timed_slide_interval == 0:
timed_slide_interval = Settings().value(self.mainwindow.generalSettingsSection + u'/loop delay') timed_slide_interval = Settings().value(self.main_window.general_settings_section + u'/loop delay')
else: else:
timed_slide_interval = service_item.timed_slide_interval timed_slide_interval = service_item.timed_slide_interval
timed_slide_interval, ok = QtGui.QInputDialog.getInteger(self, translate('OpenLP.ServiceManager', timed_slide_interval, ok = QtGui.QInputDialog.getInteger(self, translate('OpenLP.ServiceManager',

View File

@ -70,8 +70,8 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
self.insert_tab(self.player_tab, 3, PluginStatus.Active) self.insert_tab(self.player_tab, 3, PluginStatus.Active)
count = 4 count = 4
for plugin in self.plugin_manager.plugins: for plugin in self.plugin_manager.plugins:
if plugin.settingsTab: if plugin.settings_tab:
self.insert_tab(plugin.settingsTab, count, plugin.status) self.insert_tab(plugin.settings_tab, count, plugin.status)
count += 1 count += 1
self.setting_list_widget.setCurrentRow(0) self.setting_list_widget.setCurrentRow(0)
return QtGui.QDialog.exec_(self) return QtGui.QDialog.exec_(self)
@ -132,8 +132,8 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
self.advanced_tab.post_set_up() self.advanced_tab.post_set_up()
self.player_tab.post_set_up() self.player_tab.post_set_up()
for plugin in self.plugin_manager.plugins: for plugin in self.plugin_manager.plugins:
if plugin.settingsTab: if plugin.settings_tab:
plugin.settingsTab.post_set_up() plugin.settings_tab.post_set_up()
def tab_changed(self, tabIndex): def tab_changed(self, tabIndex):
""" """

View File

@ -912,9 +912,9 @@ class SlideController(DisplayController):
self.theme_screen.setChecked(False) self.theme_screen.setChecked(False)
self.desktop_screen.setChecked(False) self.desktop_screen.setChecked(False)
if checked: if checked:
Settings().setValue(self.main_window.generalSettingsSection + u'/screen blank', u'blanked') Settings().setValue(self.main_window.general_settings_section + u'/screen blank', u'blanked')
else: else:
Settings().remove(self.main_window.generalSettingsSection + u'/screen blank') Settings().remove(self.main_window.general_settings_section + u'/screen blank')
self.blankPlugin() self.blankPlugin()
self.updatePreview() self.updatePreview()
self.onToggleLoop() self.onToggleLoop()
@ -931,9 +931,9 @@ class SlideController(DisplayController):
self.theme_screen.setChecked(checked) self.theme_screen.setChecked(checked)
self.desktop_screen.setChecked(False) self.desktop_screen.setChecked(False)
if checked: if checked:
Settings().setValue(self.main_window.generalSettingsSection + u'/screen blank', u'themed') Settings().setValue(self.main_window.general_settings_section + u'/screen blank', u'themed')
else: else:
Settings().remove(self.main_window.generalSettingsSection + u'/screen blank') Settings().remove(self.main_window.general_settings_section + u'/screen blank')
self.blankPlugin() self.blankPlugin()
self.updatePreview() self.updatePreview()
self.onToggleLoop() self.onToggleLoop()
@ -950,9 +950,9 @@ class SlideController(DisplayController):
self.theme_screen.setChecked(False) self.theme_screen.setChecked(False)
self.desktop_screen.setChecked(checked) self.desktop_screen.setChecked(checked)
if checked: if checked:
Settings().setValue(self.main_window.generalSettingsSection + u'/screen blank', u'hidden') Settings().setValue(self.main_window.general_settings_section + u'/screen blank', u'hidden')
else: else:
Settings().remove(self.main_window.generalSettingsSection + u'/screen blank') Settings().remove(self.main_window.general_settings_section + u'/screen blank')
self.hidePlugin(checked) self.hidePlugin(checked)
self.updatePreview() self.updatePreview()
self.onToggleLoop() self.onToggleLoop()

View File

@ -61,7 +61,7 @@ class ThemeManager(QtGui.QWidget):
Registry().register(u'theme_manager', self) Registry().register(u'theme_manager', self)
Registry().register_function(u'bootstrap_initialise', self.load_first_time_themes) Registry().register_function(u'bootstrap_initialise', self.load_first_time_themes)
Registry().register_function(u'bootstrap_post_set_up', self._push_themes) Registry().register_function(u'bootstrap_post_set_up', self._push_themes)
self.settingsSection = u'themes' self.settings_section = u'themes'
self.theme_form = ThemeForm(self) self.theme_form = ThemeForm(self)
self.file_rename_form = FileRenameForm() self.file_rename_form = FileRenameForm()
# start with the layout # start with the layout
@ -135,7 +135,7 @@ class ThemeManager(QtGui.QWidget):
Registry().register_function(u'theme_update_global', self.change_global_from_tab) Registry().register_function(u'theme_update_global', self.change_global_from_tab)
# Variables # Variables
self.theme_list = [] self.theme_list = []
self.path = AppLocation.get_section_data_path(self.settingsSection) self.path = AppLocation.get_section_data_path(self.settings_section)
check_directory_exists(self.path) check_directory_exists(self.path)
self.thumb_path = os.path.join(self.path, u'thumbnails') self.thumb_path = os.path.join(self.path, u'thumbnails')
check_directory_exists(self.thumb_path) check_directory_exists(self.thumb_path)
@ -143,7 +143,7 @@ class ThemeManager(QtGui.QWidget):
self.old_background_image = None self.old_background_image = None
self.bad_v1_name_chars = re.compile(r'[%+\[\]]') self.bad_v1_name_chars = re.compile(r'[%+\[\]]')
# Last little bits of setting up # Last little bits of setting up
self.global_theme = Settings().value(self.settingsSection + u'/global theme') self.global_theme = Settings().value(self.settings_section + u'/global theme')
def check_list_state(self, item): def check_list_state(self, item):
""" """
@ -179,7 +179,7 @@ class ThemeManager(QtGui.QWidget):
""" """
Change the global theme when it is changed through the Themes settings tab Change the global theme when it is changed through the Themes settings tab
""" """
self.global_theme = Settings().value(self.settingsSection + u'/global theme') self.global_theme = Settings().value(self.settings_section + u'/global theme')
log.debug(u'change_global_from_tab %s', self.global_theme) log.debug(u'change_global_from_tab %s', self.global_theme)
for count in range(0, self.theme_list_widget.count()): for count in range(0, self.theme_list_widget.count()):
# reset the old name # reset the old name
@ -212,7 +212,7 @@ class ThemeManager(QtGui.QWidget):
self.global_theme = self.theme_list_widget.item(count).text() self.global_theme = self.theme_list_widget.item(count).text()
name = translate('OpenLP.ThemeManager', '%s (default)') % self.global_theme name = translate('OpenLP.ThemeManager', '%s (default)') % self.global_theme
self.theme_list_widget.item(count).setText(name) self.theme_list_widget.item(count).setText(name)
Settings().setValue(self.settingsSection + u'/global theme', self.global_theme) Settings().setValue(self.settings_section + u'/global theme', self.global_theme)
Registry().execute(u'theme_update_global') Registry().execute(u'theme_update_global')
self._push_themes() self._push_themes()
@ -342,10 +342,10 @@ class ThemeManager(QtGui.QWidget):
theme = item.data(QtCore.Qt.UserRole) theme = item.data(QtCore.Qt.UserRole)
path = QtGui.QFileDialog.getExistingDirectory(self, path = QtGui.QFileDialog.getExistingDirectory(self,
translate('OpenLP.ThemeManager', 'Save Theme - (%s)') % theme, translate('OpenLP.ThemeManager', 'Save Theme - (%s)') % theme,
Settings().value(self.settingsSection + u'/last directory export')) Settings().value(self.settings_section + u'/last directory export'))
self.application.set_busy_cursor() self.application.set_busy_cursor()
if path: if path:
Settings().setValue(self.settingsSection + u'/last directory export', path) Settings().setValue(self.settings_section + u'/last directory export', path)
theme_path = os.path.join(path, theme + u'.otz') theme_path = os.path.join(path, theme + u'.otz')
theme_zip = None theme_zip = None
try: try:
@ -375,14 +375,14 @@ class ThemeManager(QtGui.QWidget):
""" """
files = QtGui.QFileDialog.getOpenFileNames(self, files = QtGui.QFileDialog.getOpenFileNames(self,
translate('OpenLP.ThemeManager', 'Select Theme Import File'), translate('OpenLP.ThemeManager', 'Select Theme Import File'),
Settings().value(self.settingsSection + u'/last directory import'), Settings().value(self.settings_section + u'/last directory import'),
translate('OpenLP.ThemeManager', 'OpenLP Themes (*.theme *.otz)')) translate('OpenLP.ThemeManager', 'OpenLP Themes (*.theme *.otz)'))
log.info(u'New Themes %s', unicode(files)) log.info(u'New Themes %s', unicode(files))
if not files: if not files:
return return
self.application.set_busy_cursor() self.application.set_busy_cursor()
for file_name in files: for file_name in files:
Settings().setValue(self.settingsSection + u'/last directory import', unicode(file_name)) Settings().setValue(self.settings_section + u'/last directory import', unicode(file_name))
self.unzip_theme(file_name, self.path) self.unzip_theme(file_name, self.path)
self.load_themes() self.load_themes()
self.application.set_normal_cursor() self.application.set_normal_cursor()
@ -392,18 +392,18 @@ class ThemeManager(QtGui.QWidget):
Imports any themes on start up and makes sure there is at least one theme Imports any themes on start up and makes sure there is at least one theme
""" """
self.application.set_busy_cursor() self.application.set_busy_cursor()
files = AppLocation.get_files(self.settingsSection, u'.otz') files = AppLocation.get_files(self.settings_section, u'.otz')
for theme_file in files: for theme_file in files:
theme_file = os.path.join(self.path, theme_file) theme_file = os.path.join(self.path, theme_file)
self.unzip_theme(theme_file, self.path) self.unzip_theme(theme_file, self.path)
delete_file(theme_file) delete_file(theme_file)
files = AppLocation.get_files(self.settingsSection, u'.png') files = AppLocation.get_files(self.settings_section, u'.png')
# No themes have been found so create one # No themes have been found so create one
if not files: if not files:
theme = ThemeXML() theme = ThemeXML()
theme.theme_name = UiStrings().Default theme.theme_name = UiStrings().Default
self._write_theme(theme, None, None) self._write_theme(theme, None, None)
Settings().setValue(self.settingsSection + u'/global theme', theme.theme_name) Settings().setValue(self.settings_section + u'/global theme', theme.theme_name)
self.application.set_normal_cursor() self.application.set_normal_cursor()
self.load_themes() self.load_themes()
@ -416,7 +416,7 @@ class ThemeManager(QtGui.QWidget):
log.debug(u'Load themes from dir') log.debug(u'Load themes from dir')
self.theme_list = [] self.theme_list = []
self.theme_list_widget.clear() self.theme_list_widget.clear()
files = AppLocation.get_files(self.settingsSection, u'.png') files = AppLocation.get_files(self.settings_section, u'.png')
# Sort the themes by its name considering language specific # Sort the themes by its name considering language specific
files.sort(key=lambda file_name: unicode(file_name), cmp=locale_compare) files.sort(key=lambda file_name: unicode(file_name), cmp=locale_compare)
# now process the file list of png files # now process the file list of png files
@ -718,7 +718,7 @@ class ThemeManager(QtGui.QWidget):
Check to see if theme has been selected and the destructive action Check to see if theme has been selected and the destructive action
is allowed. is allowed.
""" """
self.global_theme = Settings().value(self.settingsSection + u'/global theme') self.global_theme = Settings().value(self.settings_section + u'/global theme')
if check_item_selected(self.theme_list_widget, select_text): if check_item_selected(self.theme_list_widget, select_text):
item = self.theme_list_widget.currentItem() item = self.theme_list_widget.currentItem()
theme = item.text() theme = item.text()

View File

@ -277,10 +277,10 @@ class OpenLPWizard(QtGui.QWizard):
filters += u';;' filters += u';;'
filters += u'%s (*)' % UiStrings().AllFiles filters += u'%s (*)' % UiStrings().AllFiles
filename = QtGui.QFileDialog.getOpenFileName(self, title, filename = QtGui.QFileDialog.getOpenFileName(self, title,
os.path.dirname(Settings().value(self.plugin.settingsSection + u'/' + setting_name)), filters) os.path.dirname(Settings().value(self.plugin.settings_section + u'/' + setting_name)), filters)
if filename: if filename:
editbox.setText(filename) editbox.setText(filename)
Settings().setValue(self.plugin.settingsSection + u'/' + setting_name, filename) Settings().setValue(self.plugin.settings_section + u'/' + setting_name, filename)
def get_folder(self, title, editbox, setting_name): def get_folder(self, title, editbox, setting_name):
""" """
@ -296,10 +296,10 @@ class OpenLPWizard(QtGui.QWizard):
The place where to save the last opened directory. The place where to save the last opened directory.
""" """
folder = QtGui.QFileDialog.getExistingDirectory(self, title, folder = QtGui.QFileDialog.getExistingDirectory(self, title,
Settings().value(self.plugin.settingsSection + u'/' + setting_name), QtGui.QFileDialog.ShowDirsOnly) Settings().value(self.plugin.settings_section + u'/' + setting_name), QtGui.QFileDialog.ShowDirsOnly)
if folder: if folder:
editbox.setText(folder) editbox.setText(folder)
Settings().setValue(self.plugin.settingsSection + u'/' + setting_name, folder) Settings().setValue(self.plugin.settings_section + u'/' + setting_name, folder)
def _get_application(self): def _get_application(self):
""" """

View File

@ -131,13 +131,13 @@ class AlertsPlugin(Plugin):
def __init__(self): def __init__(self):
Plugin.__init__(self, u'alerts', __default_settings__, settings_tab_class=AlertsTab) Plugin.__init__(self, u'alerts', __default_settings__, settings_tab_class=AlertsTab)
self.weight = -3 self.weight = -3
self.iconPath = u':/plugins/plugin_alerts.png' self.icon_path = u':/plugins/plugin_alerts.png'
self.icon = build_icon(self.iconPath) self.icon = build_icon(self.icon_path)
self.alerts_manager = AlertsManager(self) self.alerts_manager = AlertsManager(self)
self.manager = Manager(u'alerts', init_schema) self.manager = Manager(u'alerts', init_schema)
self.alertForm = AlertForm(self) self.alert_form = AlertForm(self)
def addToolsMenuItem(self, tools_menu): def add_tools_menu_item(self, tools_menu):
""" """
Give the alerts plugin the opportunity to add items to the Give the alerts plugin the opportunity to add items to the
**Tools** menu. **Tools** menu.
@ -147,18 +147,18 @@ class AlertsPlugin(Plugin):
use it as their parent. use it as their parent.
""" """
log.info(u'add tools menu') log.info(u'add tools menu')
self.toolsAlertItem = create_action(tools_menu, u'toolsAlertItem', self.tools_alert_item = create_action(tools_menu, u'toolsAlertItem',
text=translate('AlertsPlugin', '&Alert'), icon=u':/plugins/plugin_alerts.png', text=translate('AlertsPlugin', '&Alert'), icon=u':/plugins/plugin_alerts.png',
statustip=translate('AlertsPlugin', 'Show an alert message.'), statustip=translate('AlertsPlugin', 'Show an alert message.'),
visible=False, can_shortcuts=True, triggers=self.onAlertsTrigger) visible=False, can_shortcuts=True, triggers=self.on_alerts_trigger)
self.main_window.tools_menu.addAction(self.toolsAlertItem) self.main_window.tools_menu.addAction(self.tools_alert_item)
def initialise(self): def initialise(self):
log.info(u'Alerts Initialising') log.info(u'Alerts Initialising')
Plugin.initialise(self) Plugin.initialise(self)
self.toolsAlertItem.setVisible(True) self.tools_alert_item.setVisible(True)
action_list = ActionList.get_instance() action_list = ActionList.get_instance()
action_list.add_action(self.toolsAlertItem, UiStrings().Tools) action_list.add_action(self.tools_alert_item, UiStrings().Tools)
def finalise(self): def finalise(self):
""" """
@ -167,17 +167,17 @@ class AlertsPlugin(Plugin):
log.info(u'Alerts Finalising') log.info(u'Alerts Finalising')
self.manager.finalise() self.manager.finalise()
Plugin.finalise(self) Plugin.finalise(self)
self.toolsAlertItem.setVisible(False) self.tools_alert_item.setVisible(False)
action_list = ActionList.get_instance() action_list = ActionList.get_instance()
action_list.remove_action(self.toolsAlertItem, u'Tools') action_list.remove_action(self.tools_alert_item, u'Tools')
def toggleAlertsState(self): def toggle_alerts_state(self):
self.alertsActive = not self.alertsActive self.alerts_active = not self.alerts_active
Settings().setValue(self.settingsSection + u'/active', self.alertsActive) Settings().setValue(self.settings_section + u'/active', self.alerts_active)
def onAlertsTrigger(self): def on_alerts_trigger(self):
self.alertForm.load_list() self.alert_form.load_list()
self.alertForm.exec_() self.alert_form.exec_()
def about(self): def about(self):
about_text = translate('AlertsPlugin', '<strong>Alerts Plugin</strong>' about_text = translate('AlertsPlugin', '<strong>Alerts Plugin</strong>'
@ -189,36 +189,36 @@ class AlertsPlugin(Plugin):
Called to define all translatable texts of the plugin Called to define all translatable texts of the plugin
""" """
## Name PluginList ## ## Name PluginList ##
self.textStrings[StringContent.Name] = { self.text_strings[StringContent.Name] = {
u'singular': translate('AlertsPlugin', 'Alert', 'name singular'), u'singular': translate('AlertsPlugin', 'Alert', 'name singular'),
u'plural': translate('AlertsPlugin', 'Alerts', 'name plural') u'plural': translate('AlertsPlugin', 'Alerts', 'name plural')
} }
## Name for MediaDockManager, SettingsManager ## ## Name for MediaDockManager, SettingsManager ##
self.textStrings[StringContent.VisibleName] = { self.text_strings[StringContent.VisibleName] = {
u'title': translate('AlertsPlugin', 'Alerts', 'container title') u'title': translate('AlertsPlugin', 'Alerts', 'container title')
} }
def getDisplayJavaScript(self): def get_display_javascript(self):
""" """
Add Javascript to the main display. Add Javascript to the main display.
""" """
return JAVASCRIPT return JAVASCRIPT
def getDisplayCss(self): def get_display_css(self):
""" """
Add CSS to the main display. Add CSS to the main display.
""" """
align = VerticalType.Names[self.settingsTab.location] align = VerticalType.Names[self.settings_tab.location]
return CSS % (align, self.settingsTab.font_face, self.settingsTab.font_size, self.settingsTab.font_color, return CSS % (align, self.settings_tab.font_face, self.settings_tab.font_size, self.settings_tab.font_color,
self.settingsTab.background_color) self.settings_tab.background_color)
def getDisplayHtml(self): def get_display_html(self):
""" """
Add HTML to the main display. Add HTML to the main display.
""" """
return HTML return HTML
def refreshCss(self, frame): def refresh_css(self, frame):
""" """
Trigger an update of the CSS in the maindisplay. Trigger an update of the CSS in the maindisplay.

View File

@ -62,7 +62,7 @@ __default_settings__ = {
u'bibles/list separator': u'', u'bibles/list separator': u'',
u'bibles/end separator': u'', u'bibles/end separator': u'',
u'bibles/last directory import': u'' u'bibles/last directory import': u''
} }
class BiblePlugin(Plugin): class BiblePlugin(Plugin):
@ -71,8 +71,8 @@ class BiblePlugin(Plugin):
def __init__(self): def __init__(self):
Plugin.__init__(self, u'bibles', __default_settings__, BibleMediaItem, BiblesTab) Plugin.__init__(self, u'bibles', __default_settings__, BibleMediaItem, BiblesTab)
self.weight = -9 self.weight = -9
self.iconPath = u':/plugins/plugin_bibles.png' self.icon_path = u':/plugins/plugin_bibles.png'
self.icon = build_icon(self.iconPath) self.icon = build_icon(self.icon_path)
self.manager = None self.manager = None
def initialise(self): def initialise(self):
@ -80,14 +80,14 @@ class BiblePlugin(Plugin):
if self.manager is None: if self.manager is None:
self.manager = BibleManager(self) self.manager = BibleManager(self)
Plugin.initialise(self) Plugin.initialise(self)
self.importBibleItem.setVisible(True) self.import_bible_item.setVisible(True)
action_list = ActionList.get_instance() action_list = ActionList.get_instance()
action_list.add_action(self.importBibleItem, UiStrings().Import) action_list.add_action(self.import_bible_item, UiStrings().Import)
# Do not add the action to the list yet. # Do not add the action to the list yet.
#action_list.add_action(self.exportBibleItem, UiStrings().Export) #action_list.add_action(self.export_bible_item, UiStrings().Export)
# Set to invisible until we can export bibles # Set to invisible until we can export bibles
self.exportBibleItem.setVisible(False) self.export_bible_item.setVisible(False)
self.toolsUpgradeItem.setVisible(bool(self.manager.old_bible_databases)) self.tools_upgrade_item.setVisible(bool(self.manager.old_bible_databases))
def finalise(self): def finalise(self):
""" """
@ -97,10 +97,10 @@ class BiblePlugin(Plugin):
self.manager.finalise() self.manager.finalise()
Plugin.finalise(self) Plugin.finalise(self)
action_list = ActionList.get_instance() action_list = ActionList.get_instance()
action_list.remove_action(self.importBibleItem, UiStrings().Import) action_list.remove_action(self.import_bible_item, UiStrings().Import)
self.importBibleItem.setVisible(False) self.import_bible_item.setVisible(False)
#action_list.remove_action(self.exportBibleItem, UiStrings().Export) #action_list.remove_action(self.export_bible_item, UiStrings().Export)
self.exportBibleItem.setVisible(False) self.export_bible_item.setVisible(False)
def app_startup(self): def app_startup(self):
""" """
@ -114,21 +114,21 @@ class BiblePlugin(Plugin):
'Should OpenLP upgrade now?'), 'Should OpenLP upgrade now?'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)) == \ QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)) == \
QtGui.QMessageBox.Yes: QtGui.QMessageBox.Yes:
self.onToolsUpgradeItemTriggered() self.on_tools_upgrade_Item_triggered()
def addImportMenuItem(self, import_menu): def add_import_menu_item(self, import_menu):
self.importBibleItem = create_action(import_menu, u'importBibleItem', self.import_bible_item = create_action(import_menu, u'importBibleItem',
text=translate('BiblesPlugin', '&Bible'), visible=False, text=translate('BiblesPlugin', '&Bible'), visible=False,
triggers=self.onBibleImportClick) triggers=self.on_bible_import_click)
import_menu.addAction(self.importBibleItem) import_menu.addAction(self.import_bible_item)
def addExportMenuItem(self, export_menu): def add_export_menu_Item(self, export_menu):
self.exportBibleItem = create_action(export_menu, u'exportBibleItem', self.export_bible_item = create_action(export_menu, u'exportBibleItem',
text=translate('BiblesPlugin', '&Bible'), text=translate('BiblesPlugin', '&Bible'),
visible=False) visible=False)
export_menu.addAction(self.exportBibleItem) export_menu.addAction(self.export_bible_item)
def addToolsMenuItem(self, tools_menu): def add_tools_menu_item(self, tools_menu):
""" """
Give the bible plugin the opportunity to add items to the Give the bible plugin the opportunity to add items to the
**Tools** menu. **Tools** menu.
@ -138,13 +138,13 @@ class BiblePlugin(Plugin):
use it as their parent. use it as their parent.
""" """
log.debug(u'add tools menu') log.debug(u'add tools menu')
self.toolsUpgradeItem = create_action(tools_menu, u'toolsUpgradeItem', self.tools_upgrade_item = create_action(tools_menu, u'toolsUpgradeItem',
text=translate('BiblesPlugin', '&Upgrade older Bibles'), text=translate('BiblesPlugin', '&Upgrade older Bibles'),
statustip=translate('BiblesPlugin', 'Upgrade the Bible databases to the latest format.'), statustip=translate('BiblesPlugin', 'Upgrade the Bible databases to the latest format.'),
visible=False, triggers=self.onToolsUpgradeItemTriggered) visible=False, triggers=self.on_tools_upgrade_Item_triggered)
tools_menu.addAction(self.toolsUpgradeItem) tools_menu.addAction(self.tools_upgrade_item)
def onToolsUpgradeItemTriggered(self): def on_tools_upgrade_Item_triggered(self):
""" """
Upgrade older bible databases. Upgrade older bible databases.
""" """
@ -152,11 +152,11 @@ class BiblePlugin(Plugin):
self.upgrade_wizard = BibleUpgradeForm(self.main_window, self.manager, self) self.upgrade_wizard = BibleUpgradeForm(self.main_window, self.manager, self)
# If the import was not cancelled then reload. # If the import was not cancelled then reload.
if self.upgrade_wizard.exec_(): if self.upgrade_wizard.exec_():
self.mediaItem.reloadBibles() self.media_item.reloadBibles()
def onBibleImportClick(self): def on_bible_import_click(self):
if self.mediaItem: if self.media_item:
self.mediaItem.onImportClick() self.media_item.onImportClick()
def about(self): def about(self):
about_text = translate('BiblesPlugin', '<strong>Bible Plugin</strong>' about_text = translate('BiblesPlugin', '<strong>Bible Plugin</strong>'
@ -170,7 +170,7 @@ class BiblePlugin(Plugin):
Returns ``True`` if the theme is being used, otherwise returns Returns ``True`` if the theme is being used, otherwise returns
``False``. ``False``.
""" """
return unicode(self.settingsTab.bible_theme) == theme return unicode(self.settings_tab.bible_theme) == theme
def rename_theme(self, oldTheme, newTheme): def rename_theme(self, oldTheme, newTheme):
""" """
@ -184,20 +184,20 @@ class BiblePlugin(Plugin):
``newTheme`` ``newTheme``
The new name the plugin should now use. The new name the plugin should now use.
""" """
self.settingsTab.bible_theme = newTheme self.settings_tab.bible_theme = newTheme
self.settingsTab.save() self.settings_tab.save()
def set_plugin_text_strings(self): def set_plugin_text_strings(self):
""" """
Called to define all translatable texts of the plugin Called to define all translatable texts of the plugin
""" """
## Name PluginList ## ## Name PluginList ##
self.textStrings[StringContent.Name] = { self.text_strings[StringContent.Name] = {
u'singular': translate('BiblesPlugin', 'Bible', 'name singular'), u'singular': translate('BiblesPlugin', 'Bible', 'name singular'),
u'plural': translate('BiblesPlugin', 'Bibles', 'name plural') u'plural': translate('BiblesPlugin', 'Bibles', 'name plural')
} }
## Name for MediaDockManager, SettingsManager ## ## Name for MediaDockManager, SettingsManager ##
self.textStrings[StringContent.VisibleName] = { self.text_strings[StringContent.VisibleName] = {
u'title': translate('BiblesPlugin', 'Bibles', 'container title') u'title': translate('BiblesPlugin', 'Bibles', 'container title')
} }
# Middle Header Bar # Middle Header Bar
@ -212,4 +212,4 @@ class BiblePlugin(Plugin):
u'live': translate('BiblesPlugin', 'Send the selected Bible live.'), u'live': translate('BiblesPlugin', 'Send the selected Bible live.'),
u'service': translate('BiblesPlugin', 'Add the selected Bible to the service.') u'service': translate('BiblesPlugin', 'Add the selected Bible to the service.')
} }
self.setPluginUiTextStrings(tooltips) self.set_plugin_ui_text_strings(tooltips)

View File

@ -515,7 +515,7 @@ class BibleImportForm(OpenLPWizard):
Set default values for the wizard pages. Set default values for the wizard pages.
""" """
settings = Settings() settings = Settings()
settings.beginGroup(self.plugin.settingsSection) settings.beginGroup(self.plugin.settings_section)
self.restart() self.restart()
self.finish_button.setVisible(False) self.finish_button.setVisible(False)
self.cancel_button.setVisible(True) self.cancel_button.setVisible(True)
@ -634,4 +634,4 @@ class BibleImportForm(OpenLPWizard):
else: else:
self.progress_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Your Bible import failed.')) self.progress_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Your Bible import failed.'))
del self.manager.db_cache[importer.name] del self.manager.db_cache[importer.name]
delete_database(self.plugin.settingsSection, importer.file) delete_database(self.plugin.settings_section, importer.file)

View File

@ -69,8 +69,8 @@ class BibleUpgradeForm(OpenLPWizard):
self.manager = manager self.manager = manager
self.mediaItem = bibleplugin.mediaItem self.mediaItem = bibleplugin.mediaItem
self.suffix = u'.sqlite' self.suffix = u'.sqlite'
self.settingsSection = u'bibles' self.settings_section = u'bibles'
self.path = AppLocation.get_section_data_path(self.settingsSection) self.path = AppLocation.get_section_data_path(self.settings_section)
self.temp_dir = os.path.join(unicode(gettempdir(), get_filesystem_encoding()), u'openlp') self.temp_dir = os.path.join(unicode(gettempdir(), get_filesystem_encoding()), u'openlp')
self.files = self.manager.old_bible_databases self.files = self.manager.old_bible_databases
self.success = {} self.success = {}
@ -313,7 +313,7 @@ class BibleUpgradeForm(OpenLPWizard):
""" """
log.debug(u'BibleUpgrade setDefaults') log.debug(u'BibleUpgrade setDefaults')
settings = Settings() settings = Settings()
settings.beginGroup(self.plugin.settingsSection) settings.beginGroup(self.plugin.settings_section)
self.stop_import_flag = False self.stop_import_flag = False
self.success.clear() self.success.clear()
self.newbibles.clear() self.newbibles.clear()

View File

@ -120,11 +120,11 @@ class BibleManager(object):
""" """
log.debug(u'Bible Initialising') log.debug(u'Bible Initialising')
self.parent = parent self.parent = parent
self.settingsSection = u'bibles' self.settings_section = u'bibles'
self.web = u'Web' self.web = u'Web'
self.db_cache = None self.db_cache = None
self.path = AppLocation.get_section_data_path(self.settingsSection) self.path = AppLocation.get_section_data_path(self.settings_section)
self.proxy_name = Settings().value(self.settingsSection + u'/proxy name') self.proxy_name = Settings().value(self.settings_section + u'/proxy name')
self.suffix = u'.sqlite' self.suffix = u'.sqlite'
self.import_wizard = None self.import_wizard = None
self.reload_bibles() self.reload_bibles()
@ -137,7 +137,7 @@ class BibleManager(object):
BibleDB class. BibleDB class.
""" """
log.debug(u'Reload bibles') log.debug(u'Reload bibles')
files = AppLocation.get_files(self.settingsSection, self.suffix) files = AppLocation.get_files(self.settings_section, self.suffix)
if u'alternative_book_names.sqlite' in files: if u'alternative_book_names.sqlite' in files:
files.remove(u'alternative_book_names.sqlite') files.remove(u'alternative_book_names.sqlite')
log.debug(u'Bible Files %s', files) log.debug(u'Bible Files %s', files)
@ -352,7 +352,7 @@ class BibleManager(object):
if not language_selection or language_selection.value == "None" or language_selection.value == "-1": if not language_selection or language_selection.value == "None" or language_selection.value == "-1":
# If None is returned, it's not the singleton object but a # If None is returned, it's not the singleton object but a
# BibleMeta object with the value "None" # BibleMeta object with the value "None"
language_selection = Settings().value(self.settingsSection + u'/book name language') language_selection = Settings().value(self.settings_section + u'/book name language')
else: else:
language_selection = language_selection.value language_selection = language_selection.value
try: try:

View File

@ -65,7 +65,7 @@ class BibleMediaItem(MediaManagerItem):
self.unlockIcon = build_icon(u':/bibles/bibles_search_unlock.png') self.unlockIcon = build_icon(u':/bibles/bibles_search_unlock.png')
MediaManagerItem.__init__(self, parent, plugin) MediaManagerItem.__init__(self, parent, plugin)
# Place to store the search results for both bibles. # Place to store the search results for both bibles.
self.settings = self.plugin.settingsTab self.settings = self.plugin.settings_tab
self.quickPreviewAllowed = True self.quickPreviewAllowed = True
self.hasSearch = True self.hasSearch = True
self.search_results = {} self.search_results = {}
@ -255,7 +255,7 @@ class BibleMediaItem(MediaManagerItem):
def config_update(self): def config_update(self):
log.debug(u'config_update') log.debug(u'config_update')
if Settings().value(self.settingsSection + u'/second bibles'): if Settings().value(self.settings_section + u'/second bibles'):
self.advancedSecondLabel.setVisible(True) self.advancedSecondLabel.setVisible(True)
self.advancedSecondComboBox.setVisible(True) self.advancedSecondComboBox.setVisible(True)
self.quickSecondLabel.setVisible(True) self.quickSecondLabel.setVisible(True)
@ -307,7 +307,7 @@ class BibleMediaItem(MediaManagerItem):
translate('BiblesPlugin.MediaItem', 'Text Search'), translate('BiblesPlugin.MediaItem', 'Text Search'),
translate('BiblesPlugin.MediaItem', 'Search Text...')) translate('BiblesPlugin.MediaItem', 'Search Text...'))
]) ])
self.quickSearchEdit.set_current_search_type(Settings().value(u'%s/last search type' % self.settingsSection)) self.quickSearchEdit.set_current_search_type(Settings().value(u'%s/last search type' % self.settings_section))
self.config_update() self.config_update()
log.debug(u'bible manager initialise complete') log.debug(u'bible manager initialise complete')
@ -329,13 +329,13 @@ class BibleMediaItem(MediaManagerItem):
self.advancedVersionComboBox.addItems(bibles) self.advancedVersionComboBox.addItems(bibles)
self.advancedSecondComboBox.addItems(bibles) self.advancedSecondComboBox.addItems(bibles)
# set the default value # set the default value
bible = Settings().value(self.settingsSection + u'/advanced bible') bible = Settings().value(self.settings_section + u'/advanced bible')
if bible in bibles: if bible in bibles:
find_and_set_in_combo_box(self.advancedVersionComboBox, bible) find_and_set_in_combo_box(self.advancedVersionComboBox, bible)
self.initialiseAdvancedBible(unicode(bible)) self.initialiseAdvancedBible(unicode(bible))
elif bibles: elif bibles:
self.initialiseAdvancedBible(bibles[0]) self.initialiseAdvancedBible(bibles[0])
bible = Settings().value(self.settingsSection + u'/quick bible') bible = Settings().value(self.settings_section + u'/quick bible')
find_and_set_in_combo_box(self.quickVersionComboBox, bible) find_and_set_in_combo_box(self.quickVersionComboBox, bible)
def reload_bibles(self, process=False): def reload_bibles(self, process=False):
@ -427,9 +427,9 @@ class BibleMediaItem(MediaManagerItem):
""" """
log.debug(u'updateAutoCompleter') log.debug(u'updateAutoCompleter')
# Save the current search type to the configuration. # Save the current search type to the configuration.
Settings().setValue(u'%s/last search type' % self.settingsSection, self.quickSearchEdit.current_search_type()) Settings().setValue(u'%s/last search type' % self.settings_section, self.quickSearchEdit.current_search_type())
# Save the current bible to the configuration. # Save the current bible to the configuration.
Settings().setValue(self.settingsSection + u'/quick bible', self.quickVersionComboBox.currentText()) Settings().setValue(self.settings_section + u'/quick bible', self.quickVersionComboBox.currentText())
books = [] books = []
# We have to do a 'Reference Search'. # We have to do a 'Reference Search'.
if self.quickSearchEdit.current_search_type() == BibleSearch.Reference: if self.quickSearchEdit.current_search_type() == BibleSearch.Reference:
@ -514,16 +514,16 @@ class BibleMediaItem(MediaManagerItem):
self.settings.layout_style = self.quickStyleComboBox.currentIndex() self.settings.layout_style = self.quickStyleComboBox.currentIndex()
self.advancedStyleComboBox.setCurrentIndex(self.settings.layout_style) self.advancedStyleComboBox.setCurrentIndex(self.settings.layout_style)
self.settings.layoutStyleComboBox.setCurrentIndex(self.settings.layout_style) self.settings.layoutStyleComboBox.setCurrentIndex(self.settings.layout_style)
Settings().setValue(self.settingsSection + u'/verse layout style', self.settings.layout_style) Settings().setValue(self.settings_section + u'/verse layout style', self.settings.layout_style)
def onAdvancedStyleComboBoxChanged(self): def onAdvancedStyleComboBoxChanged(self):
self.settings.layout_style = self.advancedStyleComboBox.currentIndex() self.settings.layout_style = self.advancedStyleComboBox.currentIndex()
self.quickStyleComboBox.setCurrentIndex(self.settings.layout_style) self.quickStyleComboBox.setCurrentIndex(self.settings.layout_style)
self.settings.layoutStyleComboBox.setCurrentIndex(self.settings.layout_style) self.settings.layoutStyleComboBox.setCurrentIndex(self.settings.layout_style)
Settings().setValue(self.settingsSection + u'/verse layout style', self.settings.layout_style) Settings().setValue(self.settings_section + u'/verse layout style', self.settings.layout_style)
def onAdvancedVersionComboBox(self): def onAdvancedVersionComboBox(self):
Settings().setValue(self.settingsSection + u'/advanced bible', self.advancedVersionComboBox.currentText()) Settings().setValue(self.settings_section + u'/advanced bible', self.advancedVersionComboBox.currentText())
self.initialiseAdvancedBible(self.advancedVersionComboBox.currentText(), self.initialiseAdvancedBible(self.advancedVersionComboBox.currentText(),
self.advancedBookComboBox.itemData(int(self.advancedBookComboBox.currentIndex()))) self.advancedBookComboBox.itemData(int(self.advancedBookComboBox.currentIndex())))

View File

@ -64,8 +64,8 @@ class CustomPlugin(Plugin):
Plugin.__init__(self, u'custom', __default_settings__, CustomMediaItem, CustomTab) Plugin.__init__(self, u'custom', __default_settings__, CustomMediaItem, CustomTab)
self.weight = -5 self.weight = -5
self.manager = Manager(u'custom', init_schema) self.manager = Manager(u'custom', init_schema)
self.iconPath = u':/plugins/plugin_custom.png' self.icon_path = u':/plugins/plugin_custom.png'
self.icon = build_icon(self.iconPath) self.icon = build_icon(self.icon_path)
def about(self): def about(self):
about_text = translate('CustomPlugin', '<strong>Custom Slide Plugin </strong><br />The custom slide plugin ' about_text = translate('CustomPlugin', '<strong>Custom Slide Plugin </strong><br />The custom slide plugin '
@ -104,12 +104,12 @@ class CustomPlugin(Plugin):
Called to define all translatable texts of the plugin Called to define all translatable texts of the plugin
""" """
## Name PluginList ## ## Name PluginList ##
self.textStrings[StringContent.Name] = { self.text_strings[StringContent.Name] = {
u'singular': translate('CustomPlugin', 'Custom Slide', 'name singular'), u'singular': translate('CustomPlugin', 'Custom Slide', 'name singular'),
u'plural': translate('CustomPlugin', 'Custom Slides', 'name plural') u'plural': translate('CustomPlugin', 'Custom Slides', 'name plural')
} }
## Name for MediaDockManager, SettingsManager ## ## Name for MediaDockManager, SettingsManager ##
self.textStrings[StringContent.VisibleName] = { self.text_strings[StringContent.VisibleName] = {
u'title': translate('CustomPlugin', 'Custom Slides', 'container title') u'title': translate('CustomPlugin', 'Custom Slides', 'container title')
} }
# Middle Header Bar # Middle Header Bar
@ -123,7 +123,7 @@ class CustomPlugin(Plugin):
u'live': translate('CustomPlugin', 'Send the selected custom slide live.'), u'live': translate('CustomPlugin', 'Send the selected custom slide live.'),
u'service': translate('CustomPlugin', 'Add the selected custom slide to the service.') u'service': translate('CustomPlugin', 'Add the selected custom slide to the service.')
} }
self.setPluginUiTextStrings(tooltips) self.set_plugin_ui_text_strings(tooltips)
def finalise(self): def finalise(self):
""" """

View File

@ -82,7 +82,7 @@ class CustomMediaItem(MediaManagerItem):
Config has been updated so reload values Config has been updated so reload values
""" """
log.debug(u'Config loaded') log.debug(u'Config loaded')
self.add_custom_from_service = Settings().value(self.settingsSection + u'/add custom from service') self.add_custom_from_service = Settings().value(self.settings_section + u'/add custom from service')
def retranslateUi(self): def retranslateUi(self):
self.searchTextLabel.setText(u'%s:' % UiStrings().Search) self.searchTextLabel.setText(u'%s:' % UiStrings().Search)
@ -95,7 +95,7 @@ class CustomMediaItem(MediaManagerItem):
translate('SongsPlugin.MediaItem', 'Search Titles...')), translate('SongsPlugin.MediaItem', 'Search Titles...')),
(CustomSearch.Themes, u':/slides/slide_theme.png', UiStrings().Themes, UiStrings().SearchThemes) (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.searchTextEdit.set_current_search_type(Settings().value(u'%s/last search type' % self.settings_section))
self.loadList(self.manager.get_all_objects(CustomSlide, order_by_ref=CustomSlide.title)) self.loadList(self.manager.get_all_objects(CustomSlide, order_by_ref=CustomSlide.title))
self.config_update() self.config_update()
@ -202,7 +202,7 @@ class CustomMediaItem(MediaManagerItem):
service_item.title = title service_item.title = title
for slide in raw_slides: for slide in raw_slides:
service_item.add_from_text(slide) service_item.add_from_text(slide)
if Settings().value(self.settingsSection + u'/display footer') or credit: if Settings().value(self.settings_section + u'/display footer') or credit:
service_item.raw_footer.append(u' '.join([title, credit])) service_item.raw_footer.append(u' '.join([title, credit]))
else: else:
service_item.raw_footer.append(u'') service_item.raw_footer.append(u'')
@ -210,7 +210,7 @@ class CustomMediaItem(MediaManagerItem):
def onSearchTextButtonClicked(self): def onSearchTextButtonClicked(self):
# Save the current search type to the configuration. # Save the current search type to the configuration.
Settings().setValue(u'%s/last search type' % self.settingsSection, self.searchTextEdit.current_search_type()) Settings().setValue(u'%s/last search type' % self.settings_section, self.searchTextEdit.current_search_type())
# Reload the list considering the new search type. # Reload the list considering the new search type.
search_keywords = self.searchTextEdit.displayText() search_keywords = self.searchTextEdit.displayText()
search_results = [] search_results = []

View File

@ -51,8 +51,8 @@ class ImagePlugin(Plugin):
Plugin.__init__(self, u'images', __default_settings__, ImageMediaItem, ImageTab) Plugin.__init__(self, u'images', __default_settings__, ImageMediaItem, ImageTab)
self.manager = Manager(u'images', init_schema) self.manager = Manager(u'images', init_schema)
self.weight = -7 self.weight = -7
self.iconPath = u':/plugins/plugin_images.png' self.icon_path = u':/plugins/plugin_images.png'
self.icon = build_icon(self.iconPath) self.icon = build_icon(self.icon_path)
def about(self): def about(self):
about_text = translate('ImagePlugin', '<strong>Image Plugin</strong>' about_text = translate('ImagePlugin', '<strong>Image Plugin</strong>'
@ -77,7 +77,7 @@ class ImagePlugin(Plugin):
files_from_config = Settings().get_files_from_config(self) files_from_config = Settings().get_files_from_config(self)
if files_from_config: if files_from_config:
log.debug(u'Importing images list from old config: %s' % files_from_config) log.debug(u'Importing images list from old config: %s' % files_from_config)
self.mediaItem.save_new_images_list(files_from_config) self.media_item.save_new_images_list(files_from_config)
def upgrade_settings(self, settings): def upgrade_settings(self, settings):
""" """
@ -89,19 +89,19 @@ class ImagePlugin(Plugin):
files_from_config = settings.get_files_from_config(self) files_from_config = settings.get_files_from_config(self)
if files_from_config: if files_from_config:
log.debug(u'Importing images list from old config: %s' % files_from_config) log.debug(u'Importing images list from old config: %s' % files_from_config)
self.mediaItem.save_new_images_list(files_from_config) self.media_item.save_new_images_list(files_from_config)
def set_plugin_text_strings(self): def set_plugin_text_strings(self):
""" """
Called to define all translatable texts of the plugin Called to define all translatable texts of the plugin
""" """
## Name PluginList ## ## Name PluginList ##
self.textStrings[StringContent.Name] = { self.text_strings[StringContent.Name] = {
u'singular': translate('ImagePlugin', 'Image', 'name singular'), u'singular': translate('ImagePlugin', 'Image', 'name singular'),
u'plural': translate('ImagePlugin', 'Images', 'name plural') u'plural': translate('ImagePlugin', 'Images', 'name plural')
} }
## Name for MediaDockManager, SettingsManager ## ## Name for MediaDockManager, SettingsManager ##
self.textStrings[StringContent.VisibleName] = {u'title': translate('ImagePlugin', 'Images', 'container title')} self.text_strings[StringContent.VisibleName] = {u'title': translate('ImagePlugin', 'Images', 'container title')}
# Middle Header Bar # Middle Header Bar
tooltips = { tooltips = {
u'load': translate('ImagePlugin', 'Load a new image.'), u'load': translate('ImagePlugin', 'Load a new image.'),
@ -113,7 +113,7 @@ class ImagePlugin(Plugin):
u'live': translate('ImagePlugin', 'Send the selected image live.'), u'live': translate('ImagePlugin', 'Send the selected image live.'),
u'service': translate('ImagePlugin', 'Add the selected image to the service.') u'service': translate('ImagePlugin', 'Add the selected image to the service.')
} }
self.setPluginUiTextStrings(tooltips) self.set_plugin_ui_text_strings(tooltips)
def config_update(self): def config_update(self):
""" """
@ -121,7 +121,7 @@ class ImagePlugin(Plugin):
Actual update is triggered by the last part of saving the config. Actual update is triggered by the last part of saving the config.
""" """
log.info(u'Images config_update') log.info(u'Images config_update')
background = QtGui.QColor(Settings().value(self.settingsSection + u'/background color')) background = QtGui.QColor(Settings().value(self.settings_section + u'/background color'))
self.image_manager.update_images_border(ImageSource.ImagePlugin, background) self.image_manager.update_images_border(ImageSource.ImagePlugin, background)
def _get_image_manager(self): def _get_image_manager(self):

View File

@ -88,7 +88,7 @@ class ImageMediaItem(MediaManagerItem):
self.listView.setIconSize(QtCore.QSize(88, 50)) self.listView.setIconSize(QtCore.QSize(88, 50))
self.listView.setIndentation(self.listView.defaultIndentation) self.listView.setIndentation(self.listView.defaultIndentation)
self.listView.allow_internal_dnd = True self.listView.allow_internal_dnd = True
self.servicePath = os.path.join(AppLocation.get_section_data_path(self.settingsSection), u'thumbnails') self.servicePath = os.path.join(AppLocation.get_section_data_path(self.settings_section), u'thumbnails')
check_directory_exists(self.servicePath) check_directory_exists(self.servicePath)
# Load images from the database # Load images from the database
self.loadFullList( self.loadFullList(
@ -110,29 +110,29 @@ class ImageMediaItem(MediaManagerItem):
self.listView.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.listView.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
if self.hasEditIcon: if self.hasEditIcon:
create_widget_action(self.listView, create_widget_action(self.listView,
text=self.plugin.getString(StringContent.Edit)[u'title'], text=self.plugin.get_string(StringContent.Edit)[u'title'],
icon=u':/general/general_edit.png', icon=u':/general/general_edit.png',
triggers=self.onEditClick) triggers=self.onEditClick)
create_widget_action(self.listView, separator=True) create_widget_action(self.listView, separator=True)
if self.hasDeleteIcon: if self.hasDeleteIcon:
create_widget_action(self.listView, create_widget_action(self.listView,
text=self.plugin.getString(StringContent.Delete)[u'title'], text=self.plugin.get_string(StringContent.Delete)[u'title'],
icon=u':/general/general_delete.png', icon=u':/general/general_delete.png',
shortcuts=[QtCore.Qt.Key_Delete], triggers=self.onDeleteClick) shortcuts=[QtCore.Qt.Key_Delete], triggers=self.onDeleteClick)
create_widget_action(self.listView, separator=True) create_widget_action(self.listView, separator=True)
create_widget_action(self.listView, create_widget_action(self.listView,
text=self.plugin.getString(StringContent.Preview)[u'title'], text=self.plugin.get_string(StringContent.Preview)[u'title'],
icon=u':/general/general_preview.png', icon=u':/general/general_preview.png',
shortcuts=[QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return], shortcuts=[QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return],
triggers=self.onPreviewClick) triggers=self.onPreviewClick)
create_widget_action(self.listView, create_widget_action(self.listView,
text=self.plugin.getString(StringContent.Live)[u'title'], text=self.plugin.get_string(StringContent.Live)[u'title'],
icon=u':/general/general_live.png', icon=u':/general/general_live.png',
shortcuts=[QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Enter, shortcuts=[QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Enter,
QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Return], QtCore.Qt.ShiftModifier | QtCore.Qt.Key_Return],
triggers=self.onLiveClick) triggers=self.onLiveClick)
create_widget_action(self.listView, create_widget_action(self.listView,
text=self.plugin.getString(StringContent.Service)[u'title'], text=self.plugin.get_string(StringContent.Service)[u'title'],
icon=u':/general/general_add.png', icon=u':/general/general_add.png',
shortcuts=[QtCore.Qt.Key_Plus, QtCore.Qt.Key_Equal], shortcuts=[QtCore.Qt.Key_Plus, QtCore.Qt.Key_Equal],
triggers=self.onAddClick) triggers=self.onAddClick)
@ -161,7 +161,7 @@ class ImageMediaItem(MediaManagerItem):
icon=u':/images/image_new_group.png', icon=u':/images/image_new_group.png',
triggers=self.onAddGroupClick) triggers=self.onAddGroupClick)
create_widget_action(self.listView, create_widget_action(self.listView,
text=self.plugin.getString(StringContent.Load)[u'tooltip'], text=self.plugin.get_string(StringContent.Load)[u'tooltip'],
icon=u':/general/general_open.png', icon=u':/general/general_open.png',
triggers=self.onFileClick) triggers=self.onFileClick)
@ -373,7 +373,7 @@ class ImageMediaItem(MediaManagerItem):
self.application.set_normal_cursor() self.application.set_normal_cursor()
self.loadList(files, target_group) self.loadList(files, target_group)
last_dir = os.path.split(unicode(files[0]))[0] last_dir = os.path.split(unicode(files[0]))[0]
Settings().setValue(self.settingsSection + u'/last directory', last_dir) Settings().setValue(self.settings_section + u'/last directory', last_dir)
def loadList(self, images, target_group=None, initial_load=False): def loadList(self, images, target_group=None, initial_load=False):
""" """
@ -526,7 +526,7 @@ class ImageMediaItem(MediaManagerItem):
def generateSlideData(self, service_item, item=None, xmlVersion=False, def generateSlideData(self, service_item, item=None, xmlVersion=False,
remote=False, context=ServiceItemContext.Service): remote=False, context=ServiceItemContext.Service):
background = QtGui.QColor(Settings().value(self.settingsSection + u'/background color')) background = QtGui.QColor(Settings().value(self.settings_section + u'/background color'))
if item: if item:
items = [item] items = [item]
else: else:
@ -651,7 +651,7 @@ class ImageMediaItem(MediaManagerItem):
""" """
if check_item_selected(self.listView, if check_item_selected(self.listView,
translate('ImagePlugin.MediaItem', 'You must select an image to replace the background with.')): translate('ImagePlugin.MediaItem', 'You must select an image to replace the background with.')):
background = QtGui.QColor(Settings().value(self.settingsSection + u'/background color')) background = QtGui.QColor(Settings().value(self.settings_section + u'/background color'))
bitem = self.listView.selectedItems()[0] bitem = self.listView.selectedItems()[0]
if not isinstance(bitem.data(0, QtCore.Qt.UserRole), ImageFilenames): if not isinstance(bitem.data(0, QtCore.Qt.UserRole), ImageFilenames):
# Only continue when an image is selected # Only continue when an image is selected

View File

@ -187,7 +187,7 @@ class MediaMediaItem(MediaManagerItem):
service_item.add_capability(ItemCapabilities.CanAutoStartForLive) service_item.add_capability(ItemCapabilities.CanAutoStartForLive)
service_item.add_capability(ItemCapabilities.RequiresMedia) service_item.add_capability(ItemCapabilities.RequiresMedia)
service_item.add_capability(ItemCapabilities.HasDetailedTitleDisplay) service_item.add_capability(ItemCapabilities.HasDetailedTitleDisplay)
if Settings().value(self.settingsSection + u'/media auto start') == QtCore.Qt.Checked: if Settings().value(self.settings_section + u'/media auto start') == QtCore.Qt.Checked:
service_item.will_auto_start = True service_item.will_auto_start = True
# force a non-existent theme # force a non-existent theme
service_item.theme = -1 service_item.theme = -1
@ -196,9 +196,9 @@ class MediaMediaItem(MediaManagerItem):
def initialise(self): def initialise(self):
self.listView.clear() self.listView.clear()
self.listView.setIconSize(QtCore.QSize(88, 50)) self.listView.setIconSize(QtCore.QSize(88, 50))
self.servicePath = os.path.join(AppLocation.get_section_data_path(self.settingsSection), u'thumbnails') self.servicePath = os.path.join(AppLocation.get_section_data_path(self.settings_section), u'thumbnails')
check_directory_exists(self.servicePath) check_directory_exists(self.servicePath)
self.loadList(Settings().value(self.settingsSection + u'/media files')) self.loadList(Settings().value(self.settings_section + u'/media files'))
self.populateDisplayTypes() self.populateDisplayTypes()
def rebuild_players(self): def rebuild_players(self):
@ -250,7 +250,7 @@ class MediaMediaItem(MediaManagerItem):
row_list.sort(reverse=True) row_list.sort(reverse=True)
for row in row_list: for row in row_list:
self.listView.takeItem(row) self.listView.takeItem(row)
Settings().setValue(self.settingsSection + u'/media files', self.getFileList()) Settings().setValue(self.settings_section + u'/media files', self.getFileList())
def loadList(self, media, target_group=None): def loadList(self, media, target_group=None):
# Sort the media by its filename considering language specific # Sort the media by its filename considering language specific
@ -280,7 +280,7 @@ class MediaMediaItem(MediaManagerItem):
self.listView.addItem(item_name) self.listView.addItem(item_name)
def getList(self, type=MediaType.Audio): def getList(self, type=MediaType.Audio):
media = Settings().value(self.settingsSection + u'/media files') media = Settings().value(self.settings_section + u'/media files')
media.sort(cmp=locale_compare, key=lambda filename: os.path.split(unicode(filename))[1]) media.sort(cmp=locale_compare, key=lambda filename: os.path.split(unicode(filename))[1])
ext = [] ext = []
if type == MediaType.Audio: if type == MediaType.Audio:
@ -292,7 +292,7 @@ class MediaMediaItem(MediaManagerItem):
return media return media
def search(self, string, showError): def search(self, string, showError):
files = Settings().value(self.settingsSection + u'/media files') files = Settings().value(self.settings_section + u'/media files')
results = [] results = []
string = string.lower() string = string.lower()
for file in files: for file in files:

View File

@ -40,7 +40,7 @@ log = logging.getLogger(__name__)
__default_settings__ = { __default_settings__ = {
u'media/media auto start': QtCore.Qt.Unchecked, u'media/media auto start': QtCore.Qt.Unchecked,
u'media/media files': [] u'media/media files': []
} }
class MediaPlugin(Plugin): class MediaPlugin(Plugin):
@ -54,12 +54,12 @@ class MediaPlugin(Plugin):
# passed with drag and drop messages # passed with drag and drop messages
self.dnd_id = u'Media' self.dnd_id = u'Media'
def createSettingsTab(self, parent): def create_settings_Tab(self, parent):
""" """
Create the settings Tab Create the settings Tab
""" """
visible_name = self.getString(StringContent.VisibleName) visible_name = self.get_string(StringContent.VisibleName)
self.settingsTab = MediaTab(parent, self.name, visible_name[u'title'], self.iconPath) self.settings_tab = MediaTab(parent, self.name, visible_name[u'title'], self.iconPath)
def about(self): def about(self):
about_text = translate('MediaPlugin', '<strong>Media Plugin</strong>' about_text = translate('MediaPlugin', '<strong>Media Plugin</strong>'
@ -71,12 +71,12 @@ class MediaPlugin(Plugin):
Called to define all translatable texts of the plugin Called to define all translatable texts of the plugin
""" """
## Name PluginList ## ## Name PluginList ##
self.textStrings[StringContent.Name] = { self.text_strings[StringContent.Name] = {
u'singular': translate('MediaPlugin', 'Media', 'name singular'), u'singular': translate('MediaPlugin', 'Media', 'name singular'),
u'plural': translate('MediaPlugin', 'Media', 'name plural') u'plural': translate('MediaPlugin', 'Media', 'name plural')
} }
## Name for MediaDockManager, SettingsManager ## ## Name for MediaDockManager, SettingsManager ##
self.textStrings[StringContent.VisibleName] = { self.text_strings[StringContent.VisibleName] = {
u'title': translate('MediaPlugin', 'Media', 'container title') u'title': translate('MediaPlugin', 'Media', 'container title')
} }
# Middle Header Bar # Middle Header Bar
@ -90,7 +90,7 @@ class MediaPlugin(Plugin):
u'live': translate('MediaPlugin', 'Send the selected media live.'), u'live': translate('MediaPlugin', 'Send the selected media live.'),
u'service': translate('MediaPlugin', 'Add the selected media to the service.') u'service': translate('MediaPlugin', 'Add the selected media to the service.')
} }
self.setPluginUiTextStrings(tooltips) self.set_plugin_ui_text_strings(tooltips)
def finalise(self): def finalise(self):
""" """
@ -100,19 +100,19 @@ class MediaPlugin(Plugin):
self.media_controller.finalise() self.media_controller.finalise()
Plugin.finalise(self) Plugin.finalise(self)
def getDisplayCss(self): def get_display_css(self):
""" """
Add css style sheets to htmlbuilder Add css style sheets to htmlbuilder
""" """
return self.media_controller.get_media_display_css() return self.media_controller.get_media_display_css()
def getDisplayJavaScript(self): def get_display_javascript(self):
""" """
Add javascript functions to htmlbuilder Add javascript functions to htmlbuilder
""" """
return self.media_controller.get_media_display_javascript() return self.media_controller.get_media_display_javascript()
def getDisplayHtml(self): def get_display_html(self):
""" """
Add html code to htmlbuilder Add html code to htmlbuilder
""" """
@ -126,7 +126,7 @@ class MediaPlugin(Plugin):
""" """
Plugin.app_startup(self) Plugin.app_startup(self)
settings = Settings() settings = Settings()
settings.beginGroup(self.settingsSection) settings.beginGroup(self.settings_section)
if settings.contains(u'use phonon'): if settings.contains(u'use phonon'):
log.info(u'Found old Phonon setting') log.info(u'Found old Phonon setting')
players = self.media_controller.mediaPlayers.keys() players = self.media_controller.mediaPlayers.keys()

View File

@ -119,7 +119,7 @@ class PresentationMediaItem(MediaManagerItem):
Populate the media manager tab Populate the media manager tab
""" """
self.listView.setIconSize(QtCore.QSize(88, 50)) self.listView.setIconSize(QtCore.QSize(88, 50))
files = Settings().value(self.settingsSection + u'/presentations files') files = Settings().value(self.settings_section + u'/presentations files')
self.loadList(files, initialLoad=True) self.loadList(files, initialLoad=True)
self.populate_display_types() self.populate_display_types()
@ -136,7 +136,7 @@ class PresentationMediaItem(MediaManagerItem):
if self.displayTypeComboBox.count() > 1: if self.displayTypeComboBox.count() > 1:
self.displayTypeComboBox.insertItem(0, self.Automatic) self.displayTypeComboBox.insertItem(0, self.Automatic)
self.displayTypeComboBox.setCurrentIndex(0) self.displayTypeComboBox.setCurrentIndex(0)
if Settings().value(self.settingsSection + u'/override app') == QtCore.Qt.Checked: if Settings().value(self.settings_section + u'/override app') == QtCore.Qt.Checked:
self.presentationWidget.show() self.presentationWidget.show()
else: else:
self.presentationWidget.hide() self.presentationWidget.hide()
@ -229,7 +229,7 @@ class PresentationMediaItem(MediaManagerItem):
self.application.set_busy_cursor() self.application.set_busy_cursor()
for row in row_list: for row in row_list:
self.listView.takeItem(row) self.listView.takeItem(row)
Settings().setValue(self.settingsSection + u'/presentations files', self.getFileList()) Settings().setValue(self.settings_section + u'/presentations files', self.getFileList())
def generateSlideData(self, service_item, item=None, xmlVersion=False, def generateSlideData(self, service_item, item=None, xmlVersion=False,
remote=False, context=ServiceItemContext.Service): remote=False, context=ServiceItemContext.Service):
@ -308,7 +308,7 @@ class PresentationMediaItem(MediaManagerItem):
return None return None
def search(self, string, showError): def search(self, string, showError):
files = Settings().value(self.settingsSection + u'/presentations files') files = Settings().value(self.settings_section + u'/presentations files')
results = [] results = []
string = string.lower() string = string.lower()
for file in files: for file in files:

View File

@ -375,7 +375,7 @@ class PresentationController(object):
self.plugin = plugin self.plugin = plugin
self.name = name self.name = name
self.document_class = document_class self.document_class = document_class
self.settings_section = self.plugin.settingsSection self.settings_section = self.plugin.settings_section
self.available = None self.available = None
self.temp_folder = os.path.join(AppLocation.get_section_data_path(self.settings_section), name) self.temp_folder = os.path.join(AppLocation.get_section_data_path(self.settings_section), name)
self.thumbnail_folder = os.path.join(AppLocation.get_section_data_path(self.settings_section), u'thumbnails') self.thumbnail_folder = os.path.join(AppLocation.get_section_data_path(self.settings_section), u'thumbnails')

View File

@ -66,15 +66,16 @@ class PresentationPlugin(Plugin):
self.controllers = {} self.controllers = {}
Plugin.__init__(self, u'presentations', __default_settings__, __default_settings__) Plugin.__init__(self, u'presentations', __default_settings__, __default_settings__)
self.weight = -8 self.weight = -8
self.iconPath = u':/plugins/plugin_presentations.png' self.icon_path = u':/plugins/plugin_presentations.png'
self.icon = build_icon(self.iconPath) self.icon = build_icon(self.icon_path)
def createSettingsTab(self, parent): def create_settings_Tab(self, parent):
""" """
Create the settings Tab Create the settings Tab
""" """
visible_name = self.getString(StringContent.VisibleName) visible_name = self.get_string(StringContent.VisibleName)
self.settingsTab = PresentationTab(parent, self.name, visible_name[u'title'], self.controllers, self.iconPath) self.settings_tab = PresentationTab(parent, self.name, visible_name[u'title'], self.controllers,
self.icon_path)
def initialise(self): def initialise(self):
""" """
@ -90,7 +91,7 @@ class PresentationPlugin(Plugin):
except Exception: except Exception:
log.warn(u'Failed to start controller process') log.warn(u'Failed to start controller process')
self.controllers[controller].available = False self.controllers[controller].available = False
self.mediaItem.build_file_mask_string() self.media_item.build_file_mask_string()
def finalise(self): def finalise(self):
""" """
@ -109,10 +110,10 @@ class PresentationPlugin(Plugin):
""" """
Create the Media Manager List Create the Media Manager List
""" """
self.mediaItem = PresentationMediaItem( self.media_item = PresentationMediaItem(
self.main_window.media_dock_manager.media_dock, self, self.icon, self.controllers) self.main_window.media_dock_manager.media_dock, self, self.icon, self.controllers)
def registerControllers(self, controller): def register_controllers(self, controller):
""" """
Register each presentation controller (Impress, PPT etc) and store for later use Register each presentation controller (Impress, PPT etc) and store for later use
""" """
@ -140,7 +141,7 @@ class PresentationPlugin(Plugin):
controller_classes = PresentationController.__subclasses__() controller_classes = PresentationController.__subclasses__()
for controller_class in controller_classes: for controller_class in controller_classes:
controller = controller_class(self) controller = controller_class(self)
self.registerControllers(controller) self.register_controllers(controller)
return bool(self.controllers) return bool(self.controllers)
def about(self): def about(self):
@ -159,12 +160,12 @@ class PresentationPlugin(Plugin):
Called to define all translatable texts of the plugin Called to define all translatable texts of the plugin
""" """
## Name PluginList ## ## Name PluginList ##
self.textStrings[StringContent.Name] = { self.text_strings[StringContent.Name] = {
u'singular': translate('PresentationPlugin', 'Presentation', 'name singular'), u'singular': translate('PresentationPlugin', 'Presentation', 'name singular'),
u'plural': translate('PresentationPlugin', 'Presentations', 'name plural') u'plural': translate('PresentationPlugin', 'Presentations', 'name plural')
} }
## Name for MediaDockManager, SettingsManager ## ## Name for MediaDockManager, SettingsManager ##
self.textStrings[StringContent.VisibleName] = { self.text_strings[StringContent.VisibleName] = {
u'title': translate('PresentationPlugin', 'Presentations', 'container title') u'title': translate('PresentationPlugin', 'Presentations', 'container title')
} }
# Middle Header Bar # Middle Header Bar
@ -178,4 +179,4 @@ class PresentationPlugin(Plugin):
u'live': translate('PresentationPlugin', 'Send the selected presentation live.'), u'live': translate('PresentationPlugin', 'Send the selected presentation live.'),
u'service': translate('PresentationPlugin', 'Add the selected presentation to the service.') u'service': translate('PresentationPlugin', 'Add the selected presentation to the service.')
} }
self.setPluginUiTextStrings(tooltips) self.set_plugin_ui_text_strings(tooltips)

View File

@ -171,8 +171,8 @@ class HttpServer(object):
clients. Listen out for socket connections. clients. Listen out for socket connections.
""" """
log.debug(u'Start TCP server') log.debug(u'Start TCP server')
port = Settings().value(self.plugin.settingsSection + u'/port') port = Settings().value(self.plugin.settings_section + u'/port')
address = Settings().value(self.plugin.settingsSection + u'/ip address') address = Settings().value(self.plugin.settings_section + u'/ip address')
self.server = QtNetwork.QTcpServer() self.server = QtNetwork.QTcpServer()
self.server.listen(QtNetwork.QHostAddress(address), port) self.server.listen(QtNetwork.QHostAddress(address), port)
self.server.newConnection.connect(self.new_connection) self.server.newConnection.connect(self.new_connection)

View File

@ -49,8 +49,8 @@ class RemotesPlugin(Plugin):
remotes constructor remotes constructor
""" """
Plugin.__init__(self, u'remotes', __default_settings__, settings_tab_class=RemoteTab) Plugin.__init__(self, u'remotes', __default_settings__, settings_tab_class=RemoteTab)
self.iconPath = u':/plugins/plugin_remote.png' self.icon_path = u':/plugins/plugin_remote.png'
self.icon = build_icon(self.iconPath) self.icon = build_icon(self.icon_path)
self.weight = -1 self.weight = -1
self.server = None self.server = None
@ -86,12 +86,12 @@ class RemotesPlugin(Plugin):
Called to define all translatable texts of the plugin Called to define all translatable texts of the plugin
""" """
## Name PluginList ## ## Name PluginList ##
self.textStrings[StringContent.Name] = { self.text_strings[StringContent.Name] = {
u'singular': translate('RemotePlugin', 'Remote', 'name singular'), u'singular': translate('RemotePlugin', 'Remote', 'name singular'),
u'plural': translate('RemotePlugin', 'Remotes', 'name plural') u'plural': translate('RemotePlugin', 'Remotes', 'name plural')
} }
## Name for MediaDockManager, SettingsManager ## ## Name for MediaDockManager, SettingsManager ##
self.textStrings[StringContent.VisibleName] = { self.text_strings[StringContent.VisibleName] = {
u'title': translate('RemotePlugin', 'Remote', 'container title') u'title': translate('RemotePlugin', 'Remote', 'container title')
} }

View File

@ -245,10 +245,10 @@ class SongImportForm(OpenLPWizard):
filters += u';;' filters += u';;'
filters += u'%s (*)' % UiStrings().AllFiles filters += u'%s (*)' % UiStrings().AllFiles
filenames = QtGui.QFileDialog.getOpenFileNames(self, title, filenames = QtGui.QFileDialog.getOpenFileNames(self, title,
Settings().value(self.plugin.settingsSection + u'/last directory import'), filters) Settings().value(self.plugin.settings_section + u'/last directory import'), filters)
if filenames: if filenames:
listbox.addItems(filenames) listbox.addItems(filenames)
Settings().setValue(self.plugin.settingsSection + u'/last directory import', Settings().setValue(self.plugin.settings_section + u'/last directory import',
os.path.split(unicode(filenames[0]))[0]) os.path.split(unicode(filenames[0]))[0])
def get_list_of_files(self, listbox): def get_list_of_files(self, listbox):
@ -364,7 +364,7 @@ class SongImportForm(OpenLPWizard):
Save the error report to a file. Save the error report to a file.
""" """
filename = QtGui.QFileDialog.getSaveFileName(self, filename = QtGui.QFileDialog.getSaveFileName(self,
Settings().value(self.plugin.settingsSection + u'/last directory import')) Settings().value(self.plugin.settings_section + u'/last directory import'))
if not filename: if not filename:
return return
report_file = codecs.open(filename, u'w', u'utf-8') report_file = codecs.open(filename, u'w', u'utf-8')

View File

@ -123,9 +123,9 @@ class SongMediaItem(MediaManagerItem):
IS triggered when the songs config is updated IS triggered when the songs config is updated
""" """
log.debug(u'config_updated') log.debug(u'config_updated')
self.searchAsYouType = Settings().value(self.settingsSection + u'/search as type') self.searchAsYouType = Settings().value(self.settings_section + u'/search as type')
self.updateServiceOnEdit = Settings().value(self.settingsSection + u'/update service on edit') self.updateServiceOnEdit = Settings().value(self.settings_section + u'/update service on edit')
self.addSongFromService = Settings().value(self.settingsSection + u'/add song from service',) self.addSongFromService = Settings().value(self.settings_section + u'/add song from service',)
def retranslateUi(self): def retranslateUi(self):
self.searchTextLabel.setText(u'%s:' % UiStrings().Search) self.searchTextLabel.setText(u'%s:' % UiStrings().Search)
@ -152,12 +152,12 @@ class SongMediaItem(MediaManagerItem):
(SongSearch.Themes, u':/slides/slide_theme.png', (SongSearch.Themes, u':/slides/slide_theme.png',
UiStrings().Themes, UiStrings().SearchThemes) UiStrings().Themes, UiStrings().SearchThemes)
]) ])
self.searchTextEdit.set_current_search_type(Settings().value(u'%s/last search type' % self.settingsSection)) self.searchTextEdit.set_current_search_type(Settings().value(u'%s/last search type' % self.settings_section))
self.config_update() self.config_update()
def onSearchTextButtonClicked(self): def onSearchTextButtonClicked(self):
# Save the current search type to the configuration. # Save the current search type to the configuration.
Settings().setValue(u'%s/last search type' % self.settingsSection, self.searchTextEdit.current_search_type()) Settings().setValue(u'%s/last search type' % self.settings_section, self.searchTextEdit.current_search_type())
# Reload the list considering the new search type. # Reload the list considering the new search type.
search_keywords = unicode(self.searchTextEdit.displayText()) search_keywords = unicode(self.searchTextEdit.displayText())
search_results = [] search_results = []

View File

@ -82,8 +82,8 @@ class SongsPlugin(Plugin):
Plugin.__init__(self, u'songs', __default_settings__, SongMediaItem, SongsTab) Plugin.__init__(self, u'songs', __default_settings__, SongMediaItem, SongsTab)
self.manager = Manager(u'songs', init_schema, upgrade_mod=upgrade) self.manager = Manager(u'songs', init_schema, upgrade_mod=upgrade)
self.weight = -10 self.weight = -10
self.iconPath = u':/plugins/plugin_songs.png' self.icon_path = u':/plugins/plugin_songs.png'
self.icon = build_icon(self.iconPath) self.icon = build_icon(self.icon_path)
def check_pre_conditions(self): def check_pre_conditions(self):
""" """
@ -94,15 +94,15 @@ class SongsPlugin(Plugin):
def initialise(self): def initialise(self):
log.info(u'Songs Initialising') log.info(u'Songs Initialising')
Plugin.initialise(self) Plugin.initialise(self)
self.songImportItem.setVisible(True) self.song_import_item.setVisible(True)
self.songExportItem.setVisible(True) self.song_export_item.setVisible(True)
self.toolsReindexItem.setVisible(True) self.tools_reindex_item.setVisible(True)
action_list = ActionList.get_instance() action_list = ActionList.get_instance()
action_list.add_action(self.songImportItem, UiStrings().Import) action_list.add_action(self.song_import_item, UiStrings().Import)
action_list.add_action(self.songExportItem, UiStrings().Export) action_list.add_action(self.song_export_item, UiStrings().Export)
action_list.add_action(self.toolsReindexItem, UiStrings().Tools) action_list.add_action(self.tools_reindex_item, UiStrings().Tools)
def addImportMenuItem(self, import_menu): def add_import_menu_item(self, import_menu):
""" """
Give the Songs plugin the opportunity to add items to the Give the Songs plugin the opportunity to add items to the
**Import** menu. **Import** menu.
@ -112,13 +112,13 @@ class SongsPlugin(Plugin):
use it as their parent. use it as their parent.
""" """
# Main song import menu item - will eventually be the only one # Main song import menu item - will eventually be the only one
self.songImportItem = create_action(import_menu, u'songImportItem', self.song_import_item = create_action(import_menu, u'songImportItem',
text=translate('SongsPlugin', '&Song'), text=translate('SongsPlugin', '&Song'),
tooltip=translate('SongsPlugin', 'Import songs using the import wizard.'), tooltip=translate('SongsPlugin', 'Import songs using the import wizard.'),
triggers=self.onSongImportItemClicked) triggers=self.on_song_import_item_clicked)
import_menu.addAction(self.songImportItem) import_menu.addAction(self.song_import_item)
def addExportMenuItem(self, export_menu): def add_export_menu_Item(self, export_menu):
""" """
Give the Songs plugin the opportunity to add items to the Give the Songs plugin the opportunity to add items to the
**Export** menu. **Export** menu.
@ -128,13 +128,13 @@ class SongsPlugin(Plugin):
use it as their parent. use it as their parent.
""" """
# Main song import menu item - will eventually be the only one # Main song import menu item - will eventually be the only one
self.songExportItem = create_action(export_menu, u'songExportItem', self.song_export_item = create_action(export_menu, u'songExportItem',
text=translate('SongsPlugin', '&Song'), text=translate('SongsPlugin', '&Song'),
tooltip=translate('SongsPlugin', 'Exports songs using the export wizard.'), tooltip=translate('SongsPlugin', 'Exports songs using the export wizard.'),
triggers=self.onSongExportItemClicked) triggers=self.on_song_export_item_clicked)
export_menu.addAction(self.songExportItem) export_menu.addAction(self.song_export_item)
def addToolsMenuItem(self, tools_menu): def add_tools_menu_item(self, tools_menu):
""" """
Give the alerts plugin the opportunity to add items to the Give the alerts plugin the opportunity to add items to the
**Tools** menu. **Tools** menu.
@ -144,38 +144,38 @@ class SongsPlugin(Plugin):
use it as their parent. use it as their parent.
""" """
log.info(u'add tools menu') log.info(u'add tools menu')
self.toolsReindexItem = create_action(tools_menu, u'toolsReindexItem', self.tools_reindex_item = create_action(tools_menu, u'toolsReindexItem',
text=translate('SongsPlugin', '&Re-index Songs'), text=translate('SongsPlugin', '&Re-index Songs'),
icon=u':/plugins/plugin_songs.png', icon=u':/plugins/plugin_songs.png',
statustip=translate('SongsPlugin', 'Re-index the songs database to improve searching and ordering.'), statustip=translate('SongsPlugin', 'Re-index the songs database to improve searching and ordering.'),
visible=False, triggers=self.onToolsReindexItemTriggered) visible=False, triggers=self.on_tools_reindex_item_triggered)
tools_menu.addAction(self.toolsReindexItem) tools_menu.addAction(self.tools_reindex_item)
def onToolsReindexItemTriggered(self): def on_tools_reindex_item_triggered(self):
""" """
Rebuild each song. Rebuild each song.
""" """
maxSongs = self.manager.get_object_count(Song) maxSongs = self.manager.get_object_count(Song)
if maxSongs == 0: if maxSongs == 0:
return return
progressDialog = QtGui.QProgressDialog(translate('SongsPlugin', 'Reindexing songs...'), UiStrings().Cancel, progress_dialog = QtGui.QProgressDialog(translate('SongsPlugin', 'Reindexing songs...'), UiStrings().Cancel,
0, maxSongs, self.main_window) 0, maxSongs, self.main_window)
progressDialog.setWindowTitle(translate('SongsPlugin', 'Reindexing songs')) progress_dialog.setWindowTitle(translate('SongsPlugin', 'Reindexing songs'))
progressDialog.setWindowModality(QtCore.Qt.WindowModal) progress_dialog.setWindowModality(QtCore.Qt.WindowModal)
songs = self.manager.get_all_objects(Song) songs = self.manager.get_all_objects(Song)
for number, song in enumerate(songs): for number, song in enumerate(songs):
clean_song(self.manager, song) clean_song(self.manager, song)
progressDialog.setValue(number + 1) progress_dialog.setValue(number + 1)
self.manager.save_objects(songs) self.manager.save_objects(songs)
self.mediaItem.onSearchTextButtonClicked() self.media_item.onSearchTextButtonClicked()
def onSongImportItemClicked(self): def on_song_import_item_clicked(self):
if self.mediaItem: if self.media_item:
self.mediaItem.onImportClick() self.media_item.on_import_click()
def onSongExportItemClicked(self): def on_song_export_item_clicked(self):
if self.mediaItem: if self.media_item:
self.mediaItem.onExportClick() self.media_item.on_export_click()
def about(self): def about(self):
return translate('SongsPlugin', '<strong>Songs Plugin</strong>' return translate('SongsPlugin', '<strong>Songs Plugin</strong>'
@ -218,12 +218,12 @@ class SongsPlugin(Plugin):
Called to define all translatable texts of the plugin Called to define all translatable texts of the plugin
""" """
## Name PluginList ## ## Name PluginList ##
self.textStrings[StringContent.Name] = { self.text_strings[StringContent.Name] = {
u'singular': translate('SongsPlugin', 'Song', 'name singular'), u'singular': translate('SongsPlugin', 'Song', 'name singular'),
u'plural': translate('SongsPlugin', 'Songs', 'name plural') u'plural': translate('SongsPlugin', 'Songs', 'name plural')
} }
## Name for MediaDockManager, SettingsManager ## ## Name for MediaDockManager, SettingsManager ##
self.textStrings[StringContent.VisibleName] = { self.text_strings[StringContent.VisibleName] = {
u'title': translate('SongsPlugin', 'Songs', 'container title') u'title': translate('SongsPlugin', 'Songs', 'container title')
} }
# Middle Header Bar # Middle Header Bar
@ -238,7 +238,7 @@ class SongsPlugin(Plugin):
u'service': translate('SongsPlugin', u'service': translate('SongsPlugin',
'Add the selected song to the service.') 'Add the selected song to the service.')
} }
self.setPluginUiTextStrings(tooltips) self.set_plugin_ui_text_strings(tooltips)
def first_time(self): def first_time(self):
""" """
@ -246,7 +246,7 @@ class SongsPlugin(Plugin):
new songs into the database. new songs into the database.
""" """
self.application.process_events() self.application.process_events()
self.onToolsReindexItemTriggered() self.on_tools_reindex_item_triggered()
self.application.process_events() self.application.process_events()
db_dir = unicode(os.path.join(unicode(gettempdir(), get_filesystem_encoding()), u'openlp')) db_dir = unicode(os.path.join(unicode(gettempdir(), get_filesystem_encoding()), u'openlp'))
if not os.path.exists(db_dir): if not os.path.exists(db_dir):
@ -285,13 +285,13 @@ class SongsPlugin(Plugin):
self.new_service_created() self.new_service_created()
# Clean up files and connections # Clean up files and connections
self.manager.finalise() self.manager.finalise()
self.songImportItem.setVisible(False) self.song_import_item.setVisible(False)
self.songExportItem.setVisible(False) self.song_export_item.setVisible(False)
self.toolsReindexItem.setVisible(False) self.tools_reindex_item.setVisible(False)
action_list = ActionList.get_instance() action_list = ActionList.get_instance()
action_list.remove_action(self.songImportItem, UiStrings().Import) action_list.remove_action(self.song_import_item, UiStrings().Import)
action_list.remove_action(self.songExportItem, UiStrings().Export) action_list.remove_action(self.song_export_item, UiStrings().Export)
action_list.remove_action(self.toolsReindexItem, UiStrings().Tools) action_list.remove_action(self.tools_reindex_item, UiStrings().Tools)
Plugin.finalise(self) Plugin.finalise(self)
def new_service_created(self): def new_service_created(self):

View File

@ -58,9 +58,9 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
""" """
We need to set up the screen We need to set up the screen
""" """
self.from_date_calendar.setSelectedDate(Settings().value(self.plugin.settingsSection + u'/from date')) self.from_date_calendar.setSelectedDate(Settings().value(self.plugin.settings_section + u'/from date'))
self.to_date_calendar.setSelectedDate(Settings().value(self.plugin.settingsSection + u'/to date')) self.to_date_calendar.setSelectedDate(Settings().value(self.plugin.settings_section + u'/to date'))
self.file_line_edit.setText(Settings().value(self.plugin.settingsSection + u'/last directory export')) self.file_line_edit.setText(Settings().value(self.plugin.settings_section + u'/last directory export'))
def define_output_location(self): def define_output_location(self):
""" """
@ -68,9 +68,9 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
""" """
path = QtGui.QFileDialog.getExistingDirectory(self, path = QtGui.QFileDialog.getExistingDirectory(self,
translate('SongUsagePlugin.SongUsageDetailForm', 'Output File Location'), translate('SongUsagePlugin.SongUsageDetailForm', 'Output File Location'),
Settings().value(self.plugin.settingsSection + u'/last directory export')) Settings().value(self.plugin.settings_section + u'/last directory export'))
if path: if path:
Settings().setValue(self.plugin.settingsSection + u'/last directory export', path) Settings().setValue(self.plugin.settings_section + u'/last directory export', path)
self.file_line_edit.setText(path) self.file_line_edit.setText(path)
def accept(self): def accept(self):
@ -90,8 +90,8 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
file_name = translate('SongUsagePlugin.SongUsageDetailForm', 'usage_detail_%s_%s.txt') % ( file_name = translate('SongUsagePlugin.SongUsageDetailForm', 'usage_detail_%s_%s.txt') % (
self.from_date_calendar.selectedDate().toString(u'ddMMyyyy'), self.from_date_calendar.selectedDate().toString(u'ddMMyyyy'),
self.to_date_calendar.selectedDate().toString(u'ddMMyyyy')) self.to_date_calendar.selectedDate().toString(u'ddMMyyyy'))
Settings().setValue(self.plugin.settingsSection + u'/from date', self.from_date_calendar.selectedDate()) Settings().setValue(self.plugin.settings_section + u'/from date', self.from_date_calendar.selectedDate())
Settings().setValue(self.plugin.settingsSection + u'/to date', self.to_date_calendar.selectedDate()) Settings().setValue(self.plugin.settings_section + u'/to date', self.to_date_calendar.selectedDate())
usage = self.plugin.manager.get_all_objects( usage = self.plugin.manager.get_all_objects(
SongUsageItem, and_( SongUsageItem, and_(
SongUsageItem.usagedate >= self.from_date_calendar.selectedDate().toPyDate(), SongUsageItem.usagedate >= self.from_date_calendar.selectedDate().toPyDate(),

View File

@ -64,8 +64,8 @@ class SongUsagePlugin(Plugin):
self.manager = Manager(u'songusage', init_schema, upgrade_mod=upgrade) self.manager = Manager(u'songusage', init_schema, upgrade_mod=upgrade)
self.weight = -4 self.weight = -4
self.icon = build_icon(u':/plugins/plugin_songusage.png') self.icon = build_icon(u':/plugins/plugin_songusage.png')
self.activeIcon = build_icon(u':/songusage/song_usage_active.png') self.active_icon = build_icon(u':/songusage/song_usage_active.png')
self.inactiveIcon = build_icon(u':/songusage/song_usage_inactive.png') self.inactive_icon = build_icon(u':/songusage/song_usage_inactive.png')
self.song_usage_active = False self.song_usage_active = False
def check_pre_conditions(self): def check_pre_conditions(self):
@ -74,7 +74,7 @@ class SongUsagePlugin(Plugin):
""" """
return self.manager.session is not None return self.manager.session is not None
def addToolsMenuItem(self, tools_menu): def add_tools_menu_item(self, tools_menu):
""" """
Give the SongUsage plugin the opportunity to add items to the Give the SongUsage plugin the opportunity to add items to the
**Tools** menu. **Tools** menu.
@ -127,7 +127,7 @@ class SongUsagePlugin(Plugin):
Plugin.initialise(self) Plugin.initialise(self)
Registry().register_function(u'slidecontroller_live_started', self.display_song_usage) Registry().register_function(u'slidecontroller_live_started', self.display_song_usage)
Registry().register_function(u'print_service_started', self.print_song_usage) Registry().register_function(u'print_service_started', self.print_song_usage)
self.song_usage_active = Settings().value(self.settingsSection + u'/active') self.song_usage_active = Settings().value(self.settings_section + u'/active')
# Set the button and checkbox state # Set the button and checkbox state
self.set_button_state() self.set_button_state()
action_list = ActionList.get_instance() action_list = ActionList.get_instance()
@ -161,7 +161,7 @@ class SongUsagePlugin(Plugin):
the UI when necessary, the UI when necessary,
""" """
self.song_usage_active = not self.song_usage_active self.song_usage_active = not self.song_usage_active
Settings().setValue(self.settingsSection + u'/active', self.song_usage_active) Settings().setValue(self.settings_section + u'/active', self.song_usage_active)
self.set_button_state() self.set_button_state()
def set_button_state(self): def set_button_state(self):
@ -172,12 +172,12 @@ class SongUsagePlugin(Plugin):
self.song_usage_active_button.blockSignals(True) self.song_usage_active_button.blockSignals(True)
self.song_usage_status.blockSignals(True) self.song_usage_status.blockSignals(True)
if self.song_usage_active: if self.song_usage_active:
self.song_usage_active_button.setIcon(self.activeIcon) self.song_usage_active_button.setIcon(self.active_icon)
self.song_usage_status.setChecked(True) self.song_usage_status.setChecked(True)
self.song_usage_active_button.setChecked(True) self.song_usage_active_button.setChecked(True)
self.song_usage_active_button.setToolTip(translate('SongUsagePlugin', 'Song usage tracking is active.')) self.song_usage_active_button.setToolTip(translate('SongUsagePlugin', 'Song usage tracking is active.'))
else: else:
self.song_usage_active_button.setIcon(self.inactiveIcon) self.song_usage_active_button.setIcon(self.inactive_icon)
self.song_usage_status.setChecked(False) self.song_usage_status.setChecked(False)
self.song_usage_active_button.setChecked(False) self.song_usage_active_button.setChecked(False)
self.song_usage_active_button.setToolTip(translate('SongUsagePlugin', 'Song usage tracking is inactive.')) self.song_usage_active_button.setToolTip(translate('SongUsagePlugin', 'Song usage tracking is inactive.'))
@ -227,11 +227,11 @@ class SongUsagePlugin(Plugin):
Called to define all translatable texts of the plugin Called to define all translatable texts of the plugin
""" """
## Name PluginList ## ## Name PluginList ##
self.textStrings[StringContent.Name] = { self.text_strings[StringContent.Name] = {
u'singular': translate('SongUsagePlugin', 'SongUsage', 'name singular'), u'singular': translate('SongUsagePlugin', 'SongUsage', 'name singular'),
u'plural': translate('SongUsagePlugin', 'SongUsage', 'name plural') u'plural': translate('SongUsagePlugin', 'SongUsage', 'name plural')
} }
## Name for MediaDockManager, SettingsManager ## ## Name for MediaDockManager, SettingsManager ##
self.textStrings[StringContent.VisibleName] = { self.text_strings[StringContent.VisibleName] = {
u'title': translate('SongUsagePlugin', 'SongUsage', 'container title') u'title': translate('SongUsagePlugin', 'SongUsage', 'container title')
} }

View File

@ -74,7 +74,7 @@ class TestPluginManager(TestCase):
# WHEN: We run hook_settings_tabs() # WHEN: We run hook_settings_tabs()
plugin_manager.hook_settings_tabs() plugin_manager.hook_settings_tabs()
# THEN: The createSettingsTab() method should have been called # THEN: The create_settings_Tab() method should have been called
assert mocked_plugin.create_media_manager_item.call_count == 0, \ assert mocked_plugin.create_media_manager_item.call_count == 0, \
u'The create_media_manager_item() method should not have been called.' u'The create_media_manager_item() method should not have been called.'
@ -94,8 +94,8 @@ class TestPluginManager(TestCase):
# WHEN: We run hook_settings_tabs() # WHEN: We run hook_settings_tabs()
plugin_manager.hook_settings_tabs() plugin_manager.hook_settings_tabs()
# THEN: The createSettingsTab() method should not have been called, but the plugins lists should be the same # THEN: The create_settings_Tab() method should not have been called, but the plugins lists should be the same
assert mocked_plugin.createSettingsTab.call_count == 0, \ assert mocked_plugin.create_settings_Tab.call_count == 0, \
u'The create_media_manager_item() method should not have been called.' u'The create_media_manager_item() method should not have been called.'
self.assertEqual(mocked_settings_form.plugin_manager.plugins, plugin_manager.plugins, self.assertEqual(mocked_settings_form.plugin_manager.plugins, plugin_manager.plugins,
u'The plugins on the settings form should be the same as the plugins in the plugin manager') u'The plugins on the settings form should be the same as the plugins in the plugin manager')
@ -117,7 +117,7 @@ class TestPluginManager(TestCase):
plugin_manager.hook_settings_tabs() plugin_manager.hook_settings_tabs()
# THEN: The create_media_manager_item() method should have been called with the mocked settings form # THEN: The create_media_manager_item() method should have been called with the mocked settings form
assert mocked_plugin.createSettingsTab.call_count == 1, \ assert mocked_plugin.create_settings_Tab.call_count == 1, \
u'The create_media_manager_item() method should have been called once.' u'The create_media_manager_item() method should have been called once.'
self.assertEqual(mocked_settings_form.plugin_manager.plugins, plugin_manager.plugins, self.assertEqual(mocked_settings_form.plugin_manager.plugins, plugin_manager.plugins,
u'The plugins on the settings form should be the same as the plugins in the plugin manager') u'The plugins on the settings form should be the same as the plugins in the plugin manager')
@ -135,8 +135,8 @@ class TestPluginManager(TestCase):
# WHEN: We run hook_settings_tabs() # WHEN: We run hook_settings_tabs()
plugin_manager.hook_settings_tabs() plugin_manager.hook_settings_tabs()
# THEN: The createSettingsTab() method should have been called # THEN: The create_settings_Tab() method should have been called
mocked_plugin.createSettingsTab.assert_called_with(self.mocked_settings_form) mocked_plugin.create_settings_Tab.assert_called_with(self.mocked_settings_form)
def hook_import_menu_with_disabled_plugin_test(self): def hook_import_menu_with_disabled_plugin_test(self):
""" """
@ -152,8 +152,8 @@ class TestPluginManager(TestCase):
plugin_manager.hook_import_menu() plugin_manager.hook_import_menu()
# THEN: The create_media_manager_item() method should have been called # THEN: The create_media_manager_item() method should have been called
assert mocked_plugin.addImportMenuItem.call_count == 0, \ assert mocked_plugin.add_import_menu_item.call_count == 0, \
u'The addImportMenuItem() method should not have been called.' u'The add_import_menu_item() method should not have been called.'
def hook_import_menu_with_active_plugin_test(self): def hook_import_menu_with_active_plugin_test(self):
""" """
@ -168,8 +168,8 @@ class TestPluginManager(TestCase):
# WHEN: We run hook_import_menu() # WHEN: We run hook_import_menu()
plugin_manager.hook_import_menu() plugin_manager.hook_import_menu()
# THEN: The addImportMenuItem() method should have been called # THEN: The add_import_menu_item() method should have been called
mocked_plugin.addImportMenuItem.assert_called_with(self.mocked_main_window.file_import_menu) mocked_plugin.add_import_menu_item.assert_called_with(self.mocked_main_window.file_import_menu)
def hook_export_menu_with_disabled_plugin_test(self): def hook_export_menu_with_disabled_plugin_test(self):
""" """
@ -184,9 +184,9 @@ class TestPluginManager(TestCase):
# WHEN: We run hook_export_menu() # WHEN: We run hook_export_menu()
plugin_manager.hook_export_menu() plugin_manager.hook_export_menu()
# THEN: The addExportMenuItem() method should not have been called # THEN: The add_export_menu_Item() method should not have been called
assert mocked_plugin.addExportMenuItem.call_count == 0, \ assert mocked_plugin.add_export_menu_Item.call_count == 0, \
u'The addExportMenuItem() method should not have been called.' u'The add_export_menu_Item() method should not have been called.'
def hook_export_menu_with_active_plugin_test(self): def hook_export_menu_with_active_plugin_test(self):
""" """
@ -201,8 +201,8 @@ class TestPluginManager(TestCase):
# WHEN: We run hook_export_menu() # WHEN: We run hook_export_menu()
plugin_manager.hook_export_menu() plugin_manager.hook_export_menu()
# THEN: The addExportMenuItem() method should have been called # THEN: The add_export_menu_Item() method should have been called
mocked_plugin.addExportMenuItem.assert_called_with(self.mocked_main_window.file_export_menu) mocked_plugin.add_export_menu_Item.assert_called_with(self.mocked_main_window.file_export_menu)
def hook_upgrade_plugin_settings_with_disabled_plugin_test(self): def hook_upgrade_plugin_settings_with_disabled_plugin_test(self):
""" """
@ -236,7 +236,7 @@ class TestPluginManager(TestCase):
# WHEN: We run hook_upgrade_plugin_settings() # WHEN: We run hook_upgrade_plugin_settings()
plugin_manager.hook_upgrade_plugin_settings(settings) plugin_manager.hook_upgrade_plugin_settings(settings)
# THEN: The addExportMenuItem() method should have been called # THEN: The add_export_menu_Item() method should have been called
mocked_plugin.upgrade_settings.assert_called_with(settings) mocked_plugin.upgrade_settings.assert_called_with(settings)
def hook_tools_menu_with_disabled_plugin_test(self): def hook_tools_menu_with_disabled_plugin_test(self):
@ -252,9 +252,9 @@ class TestPluginManager(TestCase):
# WHEN: We run hook_tools_menu() # WHEN: We run hook_tools_menu()
plugin_manager.hook_tools_menu() plugin_manager.hook_tools_menu()
# THEN: The addToolsMenuItem() method should have been called # THEN: The add_tools_menu_item() method should have been called
assert mocked_plugin.addToolsMenuItem.call_count == 0, \ assert mocked_plugin.add_tools_menu_item.call_count == 0, \
u'The addToolsMenuItem() method should not have been called.' u'The add_tools_menu_item() method should not have been called.'
def hook_tools_menu_with_active_plugin_test(self): def hook_tools_menu_with_active_plugin_test(self):
""" """
@ -269,8 +269,8 @@ class TestPluginManager(TestCase):
# WHEN: We run hook_tools_menu() # WHEN: We run hook_tools_menu()
plugin_manager.hook_tools_menu() plugin_manager.hook_tools_menu()
# THEN: The addToolsMenuItem() method should have been called # THEN: The add_tools_menu_item() method should have been called
mocked_plugin.addToolsMenuItem.assert_called_with(self.mocked_main_window.tools_menu) mocked_plugin.add_tools_menu_item.assert_called_with(self.mocked_main_window.tools_menu)
def initialise_plugins_with_disabled_plugin_test(self): def initialise_plugins_with_disabled_plugin_test(self):
""" """