From 85ab27ab0c3bbc6484c8862f74cbc9a3c779f698 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 18 Apr 2013 19:17:00 +0200 Subject: [PATCH] alters plugin renaming --- openlp/plugins/alerts/__init__.py | 3 +-- openlp/plugins/alerts/alertsplugin.py | 20 ++++++++--------- openlp/plugins/alerts/forms/__init__.py | 25 +++++++++------------- openlp/plugins/alerts/forms/alertdialog.py | 2 +- openlp/plugins/alerts/forms/alertform.py | 13 ++++++----- openlp/plugins/alerts/lib/alertsmanager.py | 14 ++++++------ openlp/plugins/alerts/lib/db.py | 5 +++-- 7 files changed, 36 insertions(+), 46 deletions(-) diff --git a/openlp/plugins/alerts/__init__.py b/openlp/plugins/alerts/__init__.py index 3e4a63444..bb4c2835d 100644 --- a/openlp/plugins/alerts/__init__.py +++ b/openlp/plugins/alerts/__init__.py @@ -27,6 +27,5 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### """ -The :mod:`alerts` module provides the Alerts plugin for producing impromptu -on-screen announcements during a service. +The :mod:`alerts` module provides the Alerts plugin for producing impromptu on-screen announcements during a service. """ diff --git a/openlp/plugins/alerts/alertsplugin.py b/openlp/plugins/alerts/alertsplugin.py index 8d8530918..a2d77c42b 100644 --- a/openlp/plugins/alerts/alertsplugin.py +++ b/openlp/plugins/alerts/alertsplugin.py @@ -115,13 +115,13 @@ HTML = """ """ __default_settings__ = { - u'alerts/font face': QtGui.QFont().family(), - u'alerts/font size': 40, - u'alerts/db type': u'sqlite', - u'alerts/location': AlertLocation.Bottom, - u'alerts/background color': u'#660000', - u'alerts/font color': u'#ffffff', - u'alerts/timeout': 5 + u'alerts/font face': QtGui.QFont().family(), + u'alerts/font size': 40, + u'alerts/db type': u'sqlite', + u'alerts/location': AlertLocation.Bottom, + u'alerts/background color': u'#660000', + u'alerts/font color': u'#ffffff', + u'alerts/timeout': 5 } @@ -139,12 +139,10 @@ class AlertsPlugin(Plugin): def add_tools_menu_item(self, tools_menu): """ - Give the alerts plugin the opportunity to add items to the - **Tools** menu. + Give the alerts plugin the opportunity to add items to the **Tools** menu. ``tools_menu`` - The actual **Tools** menu item, so that your actions can - use it as their parent. + The actual **Tools** menu item, so that your actions can use it as their parent. """ log.info(u'add tools menu') self.tools_alert_item = create_action(tools_menu, u'toolsAlertItem', diff --git a/openlp/plugins/alerts/forms/__init__.py b/openlp/plugins/alerts/forms/__init__.py index e97fdfed3..2a3037f97 100644 --- a/openlp/plugins/alerts/forms/__init__.py +++ b/openlp/plugins/alerts/forms/__init__.py @@ -27,20 +27,16 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### """ -Forms in OpenLP are made up of two classes. One class holds all the graphical -elements, like buttons and lists, and the other class holds all the functional -code, like slots and loading and saving. +Forms in OpenLP are made up of two classes. One class holds all the graphical elements, like buttons and lists, and the +other class holds all the functional code, like slots and loading and saving. -The first class, commonly known as the **Dialog** class, is typically named -``Ui_Dialog``. It is a slightly modified version of the class that the -``pyuic4`` command produces from Qt4's .ui file. Typical modifications will be -converting most strings from "" to u'' and using OpenLP's ``translate()`` -function for translating strings. +The first class, commonly known as the **Dialog** class, is typically named ``Ui_Dialog``. It is a slightly +modified version of the class that the ``pyuic4`` command produces from Qt4's .ui file. Typical modifications will be +converting most strings from "" to u'' and using OpenLP's ``translate()`` function for translating strings. -The second class, commonly known as the **Form** class, is typically named -``Form``. This class is the one which is instantiated and used. It uses -dual inheritance to inherit from (usually) QtGui.QDialog and the Ui class -mentioned above, like so:: +The second class, commonly known as the **Form** class, is typically named ``Form``. This class is the one which +is instantiated and used. It uses dual inheritance to inherit from (usually) QtGui.QDialog and the Ui class mentioned +above, like so:: class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog): @@ -48,9 +44,8 @@ mentioned above, like so:: QtGui.QDialog.__init__(self, parent) self.setupUi(self) -This allows OpenLP to use ``self.object`` for all the GUI elements while keeping -them separate from the functionality, so that it is easier to recreate the GUI -from the .ui files later if necessary. +This allows OpenLP to use ``self.object`` for all the GUI elements while keeping them separate from the functionality, +so that it is easier to recreate the GUI from the .ui files later if necessary. """ from alertform import AlertForm diff --git a/openlp/plugins/alerts/forms/alertdialog.py b/openlp/plugins/alerts/forms/alertdialog.py index 1985fdcd1..e8a50d183 100644 --- a/openlp/plugins/alerts/forms/alertdialog.py +++ b/openlp/plugins/alerts/forms/alertdialog.py @@ -71,7 +71,7 @@ class Ui_AlertDialog(object): self.save_button.setObjectName(u'save_button') self.manage_button_layout.addWidget(self.save_button) self.delete_button = create_button(alert_dialog, u'delete_button', role=u'delete', enabled=False, - click=alert_dialog.onDeleteButtonClicked) + click=alert_dialog.on_delete_button_clicked) self.manage_button_layout.addWidget(self.delete_button) self.manage_button_layout.addStretch() self.alert_dialog_layout.addLayout(self.manage_button_layout, 1, 1) diff --git a/openlp/plugins/alerts/forms/alertform.py b/openlp/plugins/alerts/forms/alertform.py index 64aca1e26..d1f5361d0 100644 --- a/openlp/plugins/alerts/forms/alertform.py +++ b/openlp/plugins/alerts/forms/alertform.py @@ -93,7 +93,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog): if self.trigger_alert(self.alert_text_edit.text()): self.close() - def onDeleteButtonClicked(self): + def on_delete_button_clicked(self): """ Deletes the selected item. """ @@ -160,8 +160,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog): def on_single_click(self): """ - List item has been single clicked to add it to the edit field so it can - be changed. + List item has been single clicked to add it to the edit field so it can be changed. """ item = self.alert_list_widget.selectedIndexes()[0] bitem = self.alert_list_widget.item(item.row()) @@ -186,7 +185,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog): translate('AlertsPlugin.AlertForm', 'No Parameter Found'), translate('AlertsPlugin.AlertForm', 'You have not entered a parameter to be replaced.\n' 'Do you want to continue anyway?'), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No: + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No: self.parameter_edit.setFocus() return False # The ParameterEdit field is not empty, but we have not found '<>' @@ -195,7 +194,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog): translate('AlertsPlugin.AlertForm', 'No Placeholder Found'), translate('AlertsPlugin.AlertForm', 'The alert text does not contain \'<>\'.\n' 'Do you want to continue anyway?'), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No: + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No: self.parameter_edit.setFocus() return False text = text.replace(u'<>', self.parameter_edit.text()) @@ -204,8 +203,8 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog): def on_current_row_changed(self, row): """ - Called when the *alert_list_widget*'s current row has been changed. This - enables or disables buttons which require an item to act on. + Called when the *alert_list_widget*'s current row has been changed. This enables or disables buttons which + require an item to act on. ``row`` The row (int). If there is no current row, the value is -1. diff --git a/openlp/plugins/alerts/lib/alertsmanager.py b/openlp/plugins/alerts/lib/alertsmanager.py index 042999a11..607706a13 100644 --- a/openlp/plugins/alerts/lib/alertsmanager.py +++ b/openlp/plugins/alerts/lib/alertsmanager.py @@ -27,8 +27,8 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### """ -The :mod:`~openlp.plugins.alerts.lib.alertsmanager` module contains the part of -the plugin which manages storing and displaying of alerts. +The :mod:`~openlp.plugins.alerts.lib.alertsmanager` module contains the part of the plugin which manages storing and +displaying of alerts. """ import logging @@ -56,15 +56,14 @@ class AlertsManager(QtCore.QObject): def alert_text(self, message): """ - Called via a alerts_text event. Message is single element array - containing text + Called via a alerts_text event. Message is single element array containing text. """ if message: self.display_alert(message[0]) def display_alert(self, text=u''): """ - Called from the Alert Tab to display an alert + Called from the Alert Tab to display an alert. ``text`` display text @@ -81,7 +80,7 @@ class AlertsManager(QtCore.QObject): def generate_alert(self): """ - Format and request the Alert and start the timer + Format and request the Alert and start the timer. """ log.debug(u'Generate Alert called') if not self.alert_list: @@ -95,8 +94,7 @@ class AlertsManager(QtCore.QObject): def timerEvent(self, event): """ - Time has finished so if our time then request the next Alert - if there is one and reset the timer. + Time has finished so if our time then request the next Alert if there is one and reset the timer. ``event`` the QT event that has been triggered. diff --git a/openlp/plugins/alerts/lib/db.py b/openlp/plugins/alerts/lib/db.py index 58ee47076..499e63906 100644 --- a/openlp/plugins/alerts/lib/db.py +++ b/openlp/plugins/alerts/lib/db.py @@ -27,8 +27,7 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### """ -The :mod:`db` module provides the database and schema that is the backend for -the Alerts plugin +The :mod:`db` module provides the database and schema that is the backend for the Alerts plugin. """ from sqlalchemy import Column, Table, types @@ -36,12 +35,14 @@ from sqlalchemy.orm import mapper from openlp.core.lib.db import BaseModel, init_db + class AlertItem(BaseModel): """ AlertItem model """ pass + def init_schema(url): """ Setup the alerts database connection and initialise the database schema