← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~trb143/openlp/alpha3 into lp:openlp

 

Tim Bentley has proposed merging lp:~trb143/openlp/alpha3 into lp:openlp.

Requested reviews:
  Jon Tibble (meths)


Finish method cleanup
-- 
https://code.launchpad.net/~trb143/openlp/alpha3/+merge/29222
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/plugin.py'
--- openlp/core/lib/plugin.py	2010-07-02 22:18:54 +0000
+++ openlp/core/lib/plugin.py	2010-07-05 16:38:25 +0000
@@ -67,23 +67,23 @@
 
     **Hook Functions**
 
-    ``check_pre_conditions()``
+    ``checkPreConditions()``
         Provides the Plugin with a handle to check if it can be loaded.
 
-    ``get_media_manager_item()``
+    ``getMediaManagerItem()``
         Returns an instance of MediaManagerItem to be used in the Media Manager.
 
-    ``add_import_menu_item(import_menu)``
+    ``addImportMenuItem(import_menu)``
         Add an item to the Import menu.
 
-    ``add_export_menu_item(export_menu)``
+    ``addExportMenuItem(export_menu)``
         Add an item to the Export menu.
 
-    ``get_settings_tab()``
+    ``getSettingsTab()``
         Returns an instance of SettingsTabItem to be used in the Settings
         dialog.
 
-    ``add_to_menu(menubar)``
+    ``addToMenu(menubar)``
         A method to add a menu item to anywhere in the menu, given the menu bar.
 
     ``handle_event(event)``
@@ -134,9 +134,9 @@
         self.pluginManager = plugin_helpers[u'pluginmanager']
         QtCore.QObject.connect(Receiver.get_receiver(),
             QtCore.SIGNAL(u'%s_add_service_item' % self.name),
-            self.process_add_service_event)
+            self.processAddServiceEvent)
 
-    def check_pre_conditions(self):
+    def checkPreConditions(self):
         """
         Provides the Plugin with a handle to check if it can be loaded.
         Failing Preconditions does not stop a settings Tab being created
@@ -145,7 +145,7 @@
         """
         return True
 
-    def set_status(self):
+    def setStatus(self):
         """
         Sets the status of the plugin
         """
@@ -153,7 +153,7 @@
             self.settingsSection + u'/status',
             QtCore.QVariant(PluginStatus.Inactive)).toInt()[0]
 
-    def toggle_status(self, new_status):
+    def toggleStatus(self, new_status):
         """
         Changes the status of the plugin and remembers it
         """
@@ -161,7 +161,7 @@
         QtCore.QSettings().setValue(
             self.settingsSection + u'/status', QtCore.QVariant(self.status))
 
-    def is_active(self):
+    def isActive(self):
         """
         Indicates if the plugin is active
 
@@ -169,14 +169,14 @@
         """
         return self.status == PluginStatus.Active
 
-    def get_media_manager_item(self):
+    def getMediaManagerItem(self):
         """
         Construct a MediaManagerItem object with all the buttons and things
         you need, and return it for integration into openlp.org.
         """
         pass
 
-    def add_import_menu_item(self, importMenu):
+    def addImportMenuItem(self, importMenu):
         """
         Create a menu item and add it to the "Import" menu.
 
@@ -185,7 +185,7 @@
         """
         pass
 
-    def add_export_menu_item(self, exportMenu):
+    def addExportMenuItem(self, exportMenu):
         """
         Create a menu item and add it to the "Export" menu.
 
@@ -194,7 +194,7 @@
         """
         pass
 
-    def add_tools_menu_item(self, toolsMenu):
+    def addToolsMenuItem(self, toolsMenu):
         """
         Create a menu item and add it to the "Tools" menu.
 
@@ -203,13 +203,13 @@
         """
         pass
 
-    def get_settings_tab(self):
+    def getSettingsTab(self):
         """
         Create a tab for the settings window.
         """
         pass
 
-    def add_to_menu(self, menubar):
+    def addToMenu(self, menubar):
         """
         Add menu items to the menu, given the menubar.
 
@@ -218,11 +218,11 @@
         """
         pass
 
-    def process_add_service_event(self, replace=False):
+    def processAddServiceEvent(self, replace=False):
         """
         Generic Drag and drop handler triggered from service_manager.
         """
-        log.debug(u'process_add_service_event event called for plugin %s' %
+        log.debug(u'processAddServiceEvent event called for plugin %s' %
             self.name)
         if replace:
             self.mediaItem.onAddEditClick()
@@ -243,15 +243,15 @@
         """
         if self.mediaItem:
             self.mediaItem.initialise()
-        self.insert_toolbox_item()
+        self.insertToolboxItem()
 
     def finalise(self):
         """
         Called by the plugin Manager to cleanup things.
         """
-        self.remove_toolbox_item()
+        self.removeToolboxItem()
 
-    def remove_toolbox_item(self):
+    def removeToolboxItem(self):
         """
         Called by the plugin to remove toolbar
         """
@@ -260,7 +260,7 @@
         if self.settings_tab:
             self.settingsForm.removeTab(self.name)
 
-    def insert_toolbox_item(self):
+    def insertToolboxItem(self):
         """
         Called by plugin to replace toolbar
         """
@@ -269,8 +269,8 @@
         if self.settings_tab:
             self.settingsForm.insertTab(self.settings_tab, self.weight)
 
-    def can_delete_theme(self, theme):
+    def canDeleteTheme(self, theme):
         """
         Called to ask the plugin if a theme can be deleted
         """
-        return True
+        return True
\ No newline at end of file

=== modified file 'openlp/core/lib/pluginmanager.py'
--- openlp/core/lib/pluginmanager.py	2010-07-02 18:21:45 +0000
+++ openlp/core/lib/pluginmanager.py	2010-07-05 16:38:25 +0000
@@ -109,9 +109,9 @@
                 log.exception(u'loaded plugin %s has no helpers', unicode(p))
         plugins_list = sorted(plugin_objects, self.order_by_weight)
         for plugin in plugins_list:
-            if plugin.check_pre_conditions():
+            if plugin.checkPreConditions():
                 log.debug(u'Plugin %s active', unicode(plugin.name))
-                plugin.set_status()
+                plugin.setStatus()
             else:
                 plugin.status = PluginStatus.Disabled
             self.plugins.append(plugin)
@@ -138,7 +138,7 @@
         """
         for plugin in self.plugins:
             if plugin.status is not PluginStatus.Disabled:
-                plugin.mediaItem = plugin.get_media_manager_item()
+                plugin.mediaItem = plugin.getMediaManagerItem()
 
     def hook_settings_tabs(self, settingsform=None):
         """
@@ -151,7 +151,7 @@
         """
         for plugin in self.plugins:
             if plugin.status is not PluginStatus.Disabled:
-                plugin.settings_tab = plugin.get_settings_tab()
+                plugin.settings_tab = plugin.getSettingsTab()
                 if plugin.settings_tab:
                     log.debug(u'Inserting settings tab item from %s' %
                         plugin.name)
@@ -169,7 +169,7 @@
         """
         for plugin in self.plugins:
             if plugin.status is not PluginStatus.Disabled:
-                plugin.add_import_menu_item(import_menu)
+                plugin.addImportMenuItem(import_menu)
 
     def hook_export_menu(self, export_menu):
         """
@@ -181,7 +181,7 @@
         """
         for plugin in self.plugins:
             if plugin.status is not PluginStatus.Disabled:
-                plugin.add_export_menu_item(export_menu)
+                plugin.addExportMenuItem(export_menu)
 
     def hook_tools_menu(self, tools_menu):
         """
@@ -193,7 +193,7 @@
         """
         for plugin in self.plugins:
             if plugin.status is not PluginStatus.Disabled:
-                plugin.add_tools_menu_item(tools_menu)
+                plugin.addToolsMenuItem(tools_menu)
 
     def initialise_plugins(self):
         """
@@ -202,12 +202,12 @@
         """
         for plugin in self.plugins:
             log.info(u'initialising plugins %s in a %s state'
-                % (plugin.name, plugin.is_active()))
-            if plugin.is_active():
+                % (plugin.name, plugin.isActive()))
+            if plugin.isActive():
                 plugin.initialise()
                 log.info(u'Initialisation Complete for %s ' % plugin.name)
-            if not plugin.is_active():
-                plugin.remove_toolbox_item()
+            if not plugin.isActive():
+                plugin.removeToolboxItem()
 
     def finalise_plugins(self):
         """
@@ -216,7 +216,6 @@
         """
         log.info(u'finalising plugins')
         for plugin in self.plugins:
-            if plugin.is_active():
+            if plugin.isActive():
                 plugin.finalise()
-                log.info(u'Finalisation Complete for %s ' % plugin.name)
-
+                log.info(u'Finalisation Complete for %s ' % plugin.name)
\ No newline at end of file

=== modified file 'openlp/core/ui/pluginform.py'
--- openlp/core/ui/pluginform.py	2010-06-19 04:05:39 +0000
+++ openlp/core/ui/pluginform.py	2010-07-05 16:38:25 +0000
@@ -115,10 +115,10 @@
         if self.programaticChange:
             return
         if status == 0:
-            self.activePlugin.toggle_status(PluginStatus.Active)
+            self.activePlugin.toggleStatus(PluginStatus.Active)
             self.activePlugin.initialise()
         else:
-            self.activePlugin.toggle_status(PluginStatus.Inactive)
+            self.activePlugin.toggleStatus(PluginStatus.Inactive)
             self.activePlugin.finalise()
         status_text = 'Inactive'
         if self.activePlugin.status == PluginStatus.Active:
@@ -128,4 +128,4 @@
         elif self.activePlugin.status == PluginStatus.Disabled:
             status_text = 'Disabled'
         self.PluginListWidget.currentItem().setText(
-            u'%s (%s)' % (self.activePlugin.name, status_text))
+            u'%s (%s)' % (self.activePlugin.name, status_text))
\ No newline at end of file

=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py	2010-06-24 15:50:40 +0000
+++ openlp/core/ui/thememanager.py	2010-07-05 16:38:25 +0000
@@ -212,7 +212,7 @@
                     QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
             else:
                 for plugin in self.parent.plugin_manager.plugins:
-                    if not plugin.can_delete_theme(theme):
+                    if not plugin.canDeleteTheme(theme):
                         QtGui.QMessageBox.critical(self,
                             translate('ThemeManager', 'Error'),
                             unicode(translate('ThemeManager',
@@ -682,4 +682,3 @@
         #theme.theme_mode
         theme.theme_name = theme.theme_name.strip()
         #theme.theme_version
-

=== modified file 'openlp/plugins/alerts/alertsplugin.py'
--- openlp/plugins/alerts/alertsplugin.py	2010-07-02 18:21:45 +0000
+++ openlp/plugins/alerts/alertsplugin.py	2010-07-05 16:38:25 +0000
@@ -47,14 +47,14 @@
         self.alertForm = AlertForm(self.manager, self)
         self.status = PluginStatus.Active
 
-    def get_settings_tab(self):
+    def getSettingsTab(self):
         """
         Return the settings tab for the Alerts plugin
         """
         self.alertsTab = AlertsTab(self)
         return self.alertsTab
 
-    def add_tools_menu_item(self, tools_menu):
+    def addToolsMenuItem(self, tools_menu):
         """
         Give the alerts plugin the opportunity to add items to the
         **Tools** menu.
@@ -102,4 +102,4 @@
         about_text = translate('AlertsPlugin',
             '<b>Alerts Plugin</b><br>This plugin '
             'controls the displaying of alerts on the presentations screen')
-        return about_text
+        return about_text
\ No newline at end of file

=== modified file 'openlp/plugins/bibles/bibleplugin.py'
--- openlp/plugins/bibles/bibleplugin.py	2010-07-02 12:13:46 +0000
+++ openlp/plugins/bibles/bibleplugin.py	2010-07-05 16:38:25 +0000
@@ -57,14 +57,14 @@
         self.ImportBibleItem.setVisible(False)
         self.ExportBibleItem.setVisible(False)
 
-    def get_settings_tab(self):
+    def getSettingsTab(self):
         return BiblesTab(self.name)
 
-    def get_media_manager_item(self):
+    def getMediaManagerItem(self):
         # Create the BibleManagerItem object
         return BibleMediaItem(self, self.icon, self.name)
 
-    def add_import_menu_item(self, import_menu):
+    def addImportMenuItem(self, import_menu):
         self.ImportBibleItem = QtGui.QAction(import_menu)
         self.ImportBibleItem.setObjectName(u'ImportBibleItem')
         import_menu.addAction(self.ImportBibleItem)
@@ -75,7 +75,7 @@
             QtCore.SIGNAL(u'triggered()'), self.onBibleImportClick)
         self.ImportBibleItem.setVisible(False)
 
-    def add_export_menu_item(self, export_menu):
+    def addExportMenuItem(self, export_menu):
         self.ExportBibleItem = QtGui.QAction(export_menu)
         self.ExportBibleItem.setObjectName(u'ExportBibleItem')
         export_menu.addAction(self.ExportBibleItem)
@@ -94,7 +94,7 @@
             'displayed on the screen during the service.')
         return about_text
 
-    def can_delete_theme(self, theme):
+    def canDeleteTheme(self, theme):
         if self.settings_tab.bible_theme == theme:
             return False
-        return True
+        return True
\ No newline at end of file

=== modified file 'openlp/plugins/custom/customplugin.py'
--- openlp/plugins/custom/customplugin.py	2010-07-02 12:13:46 +0000
+++ openlp/plugins/custom/customplugin.py	2010-07-05 16:38:25 +0000
@@ -53,10 +53,10 @@
         self.icon = build_icon(u':/plugins/plugin_custom.png')
         self.status = PluginStatus.Active
 
-    def get_settings_tab(self):
+    def getSettingsTab(self):
         return CustomTab(self.name)
 
-    def get_media_manager_item(self):
+    def getMediaManagerItem(self):
         # Create the CustomManagerItem object
         return CustomMediaItem(self, self.icon, self.name)
 
@@ -68,8 +68,8 @@
             'songs plugin.<br>')
         return about_text
 
-    def can_delete_theme(self, theme):
+    def canDeleteTheme(self, theme):
         if not self.custommanager.get_all_objects_filtered(CustomSlide,
             CustomSlide.theme_name == theme):
             return True
-        return False
+        return False
\ No newline at end of file

=== modified file 'openlp/plugins/images/imageplugin.py'
--- openlp/plugins/images/imageplugin.py	2010-07-02 12:13:46 +0000
+++ openlp/plugins/images/imageplugin.py	2010-07-05 16:38:25 +0000
@@ -39,10 +39,10 @@
         self.icon = build_icon(u':/plugins/plugin_images.png')
         self.status = PluginStatus.Active
 
-    def get_settings_tab(self):
+    def getSettingsTab(self):
         return ImageTab(self.name)
 
-    def get_media_manager_item(self):
+    def getMediaManagerItem(self):
         # Create the MediaManagerItem object
         return ImageMediaItem(self, self.icon, self.name)
 
@@ -55,4 +55,4 @@
             'an image is selected any songs which are rendered will use the '
             'selected image from the background instead of the one provied by '
             'the theme.<br>')
-        return about_text
+        return about_text
\ No newline at end of file

=== modified file 'openlp/plugins/media/mediaplugin.py'
--- openlp/plugins/media/mediaplugin.py	2010-07-02 18:21:45 +0000
+++ openlp/plugins/media/mediaplugin.py	2010-07-05 16:38:25 +0000
@@ -47,19 +47,19 @@
         for mimetype in Phonon.BackendCapabilities.availableMimeTypes():
             mimetype = unicode(mimetype)
             type = mimetype.split(u'audio/x-')
-            self.audio_list, mimetype = self._add_to_list(self.audio_list,
+            self.audio_list, mimetype = self._addToList(self.audio_list,
                 type, mimetype)
             type = mimetype.split(u'audio/')
-            self.audio_list, mimetype = self._add_to_list(self.audio_list,
+            self.audio_list, mimetype = self._addToList(self.audio_list,
                 type, mimetype)
             type = mimetype.split(u'video/x-')
-            self.video_list, mimetype = self._add_to_list(self.video_list,
+            self.video_list, mimetype = self._addToList(self.video_list,
                 type, mimetype)
             type = mimetype.split(u'video/')
-            self.video_list, mimetype = self._add_to_list(self.video_list,
+            self.video_list, mimetype = self._addToList(self.video_list,
                 type, mimetype)
 
-    def _add_to_list(self, list, value, type):
+    def _addToList(self, list, value, type):
         if len(value) == 2:
             if list.find(value[1]) == -1:
                 list += u'*.%s ' % value[1]
@@ -67,7 +67,7 @@
             type = u''
         return list, type
 
-    def get_media_manager_item(self):
+    def getMediaManagerItem(self):
         # Create the MediaManagerItem object
         return MediaMediaItem(self, self.icon, self.name)
 

=== modified file 'openlp/plugins/presentations/lib/powerpointcontroller.py'
--- openlp/plugins/presentations/lib/powerpointcontroller.py	2010-06-24 19:58:45 +0000
+++ openlp/plugins/presentations/lib/powerpointcontroller.py	2010-07-05 16:38:25 +0000
@@ -173,7 +173,7 @@
         return True
 
 
-    def is_active(self):
+    def isActive(self):
         """
         Returns true if a presentation is currently active
         """
@@ -206,7 +206,7 @@
         """
         Returns true if screen is blank
         """
-        if self.is_active():
+        if self.isActive():
             return self.presentation.SlideShowWindow.View.State == 3
         else:
             return False
@@ -298,4 +298,4 @@
             shape = shapes(idx + 1)
             if shape.HasTextFrame:
                 text += shape.TextFrame.TextRange.Text + '\n'
-        return text
+        return text
\ No newline at end of file

=== modified file 'openlp/plugins/presentations/presentationplugin.py'
--- openlp/plugins/presentations/presentationplugin.py	2010-07-02 12:13:46 +0000
+++ openlp/plugins/presentations/presentationplugin.py	2010-07-05 16:38:25 +0000
@@ -43,7 +43,7 @@
         self.icon = build_icon(u':/plugins/plugin_presentations.png')
         self.status = PluginStatus.Active
 
-    def get_settings_tab(self):
+    def getSettingsTab(self):
         """
         Create the settings Tab
         """
@@ -52,7 +52,7 @@
     def initialise(self):
         log.info(u'Presentations Initialising')
         Plugin.initialise(self)
-        self.insert_toolbox_item()
+        self.insertToolboxItem()
         for controller in self.controllers:
             if self.controllers[controller].enabled:
                 self.controllers[controller].start_process()
@@ -66,7 +66,7 @@
                 controller.kill()
         Plugin.finalise(self)
 
-    def get_media_manager_item(self):
+    def getMediaManagerItem(self):
         """
         Create the Media Manager List
         """
@@ -76,12 +76,12 @@
     def registerControllers(self, controller):
         self.controllers[controller.name] = controller
 
-    def check_pre_conditions(self):
+    def checkPreConditions(self):
         """
         Check to see if we have any presentation software available
         If Not do not install the plugin.
         """
-        log.debug(u'check_pre_conditions')
+        log.debug(u'checkPreConditions')
         controller_dir = os.path.join(
             AppLocation.get_directory(AppLocation.PluginsDir),
             u'presentations', u'lib')
@@ -113,4 +113,4 @@
             'the ability to show presentations using a number of different '
             'programs. The choice of available presentation programs is '
             'available to the user in a drop down box.')
-        return about_text
+        return about_text
\ No newline at end of file

=== modified file 'openlp/plugins/remotes/remoteplugin.py'
--- openlp/plugins/remotes/remoteplugin.py	2010-07-02 12:13:46 +0000
+++ openlp/plugins/remotes/remoteplugin.py	2010-07-05 16:38:25 +0000
@@ -48,7 +48,7 @@
         """
         log.debug(u'initialise')
         Plugin.initialise(self)
-        self.insert_toolbox_item()
+        self.insertToolboxItem()
         self.server = HttpServer(self)
 
     def finalise(self):
@@ -60,7 +60,7 @@
         if self.server:
             self.server.close()
 
-    def get_settings_tab(self):
+    def getSettingsTab(self):
         """
         Create the settings Tab
         """
@@ -75,4 +75,4 @@
             'provides the ability to send messages to a running version of '
             'openlp on a different computer via a web browser or other app<br>'
             'The Primary use for this would be to send alerts from a creche')
-        return about_text
+        return about_text
\ No newline at end of file

=== modified file 'openlp/plugins/songs/songsplugin.py'
--- openlp/plugins/songs/songsplugin.py	2010-07-02 18:21:45 +0000
+++ openlp/plugins/songs/songsplugin.py	2010-07-05 16:38:25 +0000
@@ -61,7 +61,7 @@
         self.icon = build_icon(u':/plugins/plugin_songs.png')
         self.status = PluginStatus.Active
 
-    def get_settings_tab(self):
+    def getSettingsTab(self):
         return SongsTab(self.name)
 
     def initialise(self):
@@ -70,14 +70,14 @@
         self.mediaItem.displayResultsSong(
             self.manager.get_all_objects(Song, Song.title))
 
-    def get_media_manager_item(self):
+    def getMediaManagerItem(self):
         """
         Create the MediaManagerItem object, which is displaed in the
         Media Manager.
         """
         return SongMediaItem(self, self.icon, self.name)
 
-    def add_import_menu_item(self, import_menu):
+    def addImportMenuItem(self, import_menu):
         """
         Give the Songs plugin the opportunity to add items to the
         **Import** menu.
@@ -137,7 +137,7 @@
             QtCore.QObject.connect(self.ImportOooItem,
                 QtCore.SIGNAL(u'triggered()'), self.onImportOooItemClick)
 
-    def add_export_menu_item(self, export_menu):
+    def addExportMenuItem(self, export_menu):
         """
         Give the Songs plugin the opportunity to add items to the
         **Export** menu.
@@ -191,8 +191,8 @@
             'This plugin allows songs to be managed and displayed.')
         return about_text
 
-    def can_delete_theme(self, theme):
+    def canDeleteTheme(self, theme):
         if not self.manager.get_all_objects_filtered(Song,
             Song.theme_name == theme):
             return True
-        return False
+        return False
\ No newline at end of file

=== modified file 'openlp/plugins/songusage/songusageplugin.py'
--- openlp/plugins/songusage/songusageplugin.py	2010-06-29 21:23:56 +0000
+++ openlp/plugins/songusage/songusageplugin.py	2010-07-05 16:38:25 +0000
@@ -46,7 +46,7 @@
         self.songusagemanager = None
         self.songusageActive = False
 
-    def add_tools_menu_item(self, tools_menu):
+    def addToolsMenuItem(self, tools_menu):
         """
         Give the SongUsage plugin the opportunity to add items to the
         **Tools** menu.
@@ -162,4 +162,4 @@
             '<b>SongUsage Plugin</b><br>This plugin '
             'records the use of songs and when they have been used during '
             'a live service')
-        return about_text
+        return about_text
\ No newline at end of file


Follow ups