alters plugin renaming

This commit is contained in:
Andreas Preikschat 2013-04-18 19:17:00 +02:00
parent 14db927af7
commit 85ab27ab0c
7 changed files with 36 additions and 46 deletions

View File

@ -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.
"""

View File

@ -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',

View File

@ -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_<name>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_<name>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
``<name>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 ``<name>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

View File

@ -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)

View File

@ -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.

View File

@ -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.

View File

@ -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