forked from openlp/openlp
alters plugin renaming
This commit is contained in:
parent
14db927af7
commit
85ab27ab0c
@ -27,6 +27,5 @@
|
|||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
"""
|
"""
|
||||||
The :mod:`alerts` module provides the Alerts plugin for producing impromptu
|
The :mod:`alerts` module provides the Alerts plugin for producing impromptu on-screen announcements during a service.
|
||||||
on-screen announcements during a service.
|
|
||||||
"""
|
"""
|
||||||
|
@ -115,13 +115,13 @@ HTML = """
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
__default_settings__ = {
|
__default_settings__ = {
|
||||||
u'alerts/font face': QtGui.QFont().family(),
|
u'alerts/font face': QtGui.QFont().family(),
|
||||||
u'alerts/font size': 40,
|
u'alerts/font size': 40,
|
||||||
u'alerts/db type': u'sqlite',
|
u'alerts/db type': u'sqlite',
|
||||||
u'alerts/location': AlertLocation.Bottom,
|
u'alerts/location': AlertLocation.Bottom,
|
||||||
u'alerts/background color': u'#660000',
|
u'alerts/background color': u'#660000',
|
||||||
u'alerts/font color': u'#ffffff',
|
u'alerts/font color': u'#ffffff',
|
||||||
u'alerts/timeout': 5
|
u'alerts/timeout': 5
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -139,12 +139,10 @@ class AlertsPlugin(Plugin):
|
|||||||
|
|
||||||
def add_tools_menu_item(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.
|
|
||||||
|
|
||||||
``tools_menu``
|
``tools_menu``
|
||||||
The actual **Tools** menu item, so that your actions can
|
The actual **Tools** menu item, so that your actions can use it as their parent.
|
||||||
use it as their parent.
|
|
||||||
"""
|
"""
|
||||||
log.info(u'add tools menu')
|
log.info(u'add tools menu')
|
||||||
self.tools_alert_item = create_action(tools_menu, u'toolsAlertItem',
|
self.tools_alert_item = create_action(tools_menu, u'toolsAlertItem',
|
||||||
|
@ -27,20 +27,16 @@
|
|||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
"""
|
"""
|
||||||
Forms in OpenLP are made up of two classes. One class holds all the graphical
|
Forms in OpenLP are made up of two classes. One class holds all the graphical elements, like buttons and lists, and the
|
||||||
elements, like buttons and lists, and the other class holds all the functional
|
other class holds all the functional code, like slots and loading and saving.
|
||||||
code, like slots and loading and saving.
|
|
||||||
|
|
||||||
The first class, commonly known as the **Dialog** class, is typically named
|
The first class, commonly known as the **Dialog** class, is typically named ``Ui_<name>Dialog``. It is a slightly
|
||||||
``Ui_<name>Dialog``. It is a slightly modified version of the class that the
|
modified version of the class that the ``pyuic4`` command produces from Qt4's .ui file. Typical modifications will be
|
||||||
``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.
|
||||||
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
|
The second class, commonly known as the **Form** class, is typically named ``<name>Form``. This class is the one which
|
||||||
``<name>Form``. This class is the one which is instantiated and used. It uses
|
is instantiated and used. It uses dual inheritance to inherit from (usually) QtGui.QDialog and the Ui class mentioned
|
||||||
dual inheritance to inherit from (usually) QtGui.QDialog and the Ui class
|
above, like so::
|
||||||
mentioned above, like so::
|
|
||||||
|
|
||||||
class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
|
class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
|
||||||
|
|
||||||
@ -48,9 +44,8 @@ mentioned above, like so::
|
|||||||
QtGui.QDialog.__init__(self, parent)
|
QtGui.QDialog.__init__(self, parent)
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
|
|
||||||
This allows OpenLP to use ``self.object`` for all the GUI elements while keeping
|
This allows OpenLP to use ``self.object`` for all the GUI elements while keeping them separate from the functionality,
|
||||||
them separate from the functionality, so that it is easier to recreate the GUI
|
so that it is easier to recreate the GUI from the .ui files later if necessary.
|
||||||
from the .ui files later if necessary.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from alertform import AlertForm
|
from alertform import AlertForm
|
||||||
|
@ -71,7 +71,7 @@ class Ui_AlertDialog(object):
|
|||||||
self.save_button.setObjectName(u'save_button')
|
self.save_button.setObjectName(u'save_button')
|
||||||
self.manage_button_layout.addWidget(self.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,
|
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.addWidget(self.delete_button)
|
||||||
self.manage_button_layout.addStretch()
|
self.manage_button_layout.addStretch()
|
||||||
self.alert_dialog_layout.addLayout(self.manage_button_layout, 1, 1)
|
self.alert_dialog_layout.addLayout(self.manage_button_layout, 1, 1)
|
||||||
|
@ -93,7 +93,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
|
|||||||
if self.trigger_alert(self.alert_text_edit.text()):
|
if self.trigger_alert(self.alert_text_edit.text()):
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
def onDeleteButtonClicked(self):
|
def on_delete_button_clicked(self):
|
||||||
"""
|
"""
|
||||||
Deletes the selected item.
|
Deletes the selected item.
|
||||||
"""
|
"""
|
||||||
@ -160,8 +160,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
|
|||||||
|
|
||||||
def on_single_click(self):
|
def on_single_click(self):
|
||||||
"""
|
"""
|
||||||
List item has been single clicked to add it to the edit field so it can
|
List item has been single clicked to add it to the edit field so it can be changed.
|
||||||
be changed.
|
|
||||||
"""
|
"""
|
||||||
item = self.alert_list_widget.selectedIndexes()[0]
|
item = self.alert_list_widget.selectedIndexes()[0]
|
||||||
bitem = self.alert_list_widget.item(item.row())
|
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', 'No Parameter Found'),
|
||||||
translate('AlertsPlugin.AlertForm', 'You have not entered a parameter to be replaced.\n'
|
translate('AlertsPlugin.AlertForm', 'You have not entered a parameter to be replaced.\n'
|
||||||
'Do you want to continue anyway?'),
|
'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()
|
self.parameter_edit.setFocus()
|
||||||
return False
|
return False
|
||||||
# The ParameterEdit field is not empty, but we have not found '<>'
|
# 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', 'No Placeholder Found'),
|
||||||
translate('AlertsPlugin.AlertForm', 'The alert text does not contain \'<>\'.\n'
|
translate('AlertsPlugin.AlertForm', 'The alert text does not contain \'<>\'.\n'
|
||||||
'Do you want to continue anyway?'),
|
'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()
|
self.parameter_edit.setFocus()
|
||||||
return False
|
return False
|
||||||
text = text.replace(u'<>', self.parameter_edit.text())
|
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):
|
def on_current_row_changed(self, row):
|
||||||
"""
|
"""
|
||||||
Called when the *alert_list_widget*'s current row has been changed. This
|
Called when the *alert_list_widget*'s current row has been changed. This enables or disables buttons which
|
||||||
enables or disables buttons which require an item to act on.
|
require an item to act on.
|
||||||
|
|
||||||
``row``
|
``row``
|
||||||
The row (int). If there is no current row, the value is -1.
|
The row (int). If there is no current row, the value is -1.
|
||||||
|
@ -27,8 +27,8 @@
|
|||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
"""
|
"""
|
||||||
The :mod:`~openlp.plugins.alerts.lib.alertsmanager` module contains the part of
|
The :mod:`~openlp.plugins.alerts.lib.alertsmanager` module contains the part of the plugin which manages storing and
|
||||||
the plugin which manages storing and displaying of alerts.
|
displaying of alerts.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
@ -56,15 +56,14 @@ class AlertsManager(QtCore.QObject):
|
|||||||
|
|
||||||
def alert_text(self, message):
|
def alert_text(self, message):
|
||||||
"""
|
"""
|
||||||
Called via a alerts_text event. Message is single element array
|
Called via a alerts_text event. Message is single element array containing text.
|
||||||
containing text
|
|
||||||
"""
|
"""
|
||||||
if message:
|
if message:
|
||||||
self.display_alert(message[0])
|
self.display_alert(message[0])
|
||||||
|
|
||||||
def display_alert(self, text=u''):
|
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``
|
``text``
|
||||||
display text
|
display text
|
||||||
@ -81,7 +80,7 @@ class AlertsManager(QtCore.QObject):
|
|||||||
|
|
||||||
def generate_alert(self):
|
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')
|
log.debug(u'Generate Alert called')
|
||||||
if not self.alert_list:
|
if not self.alert_list:
|
||||||
@ -95,8 +94,7 @@ class AlertsManager(QtCore.QObject):
|
|||||||
|
|
||||||
def timerEvent(self, event):
|
def timerEvent(self, event):
|
||||||
"""
|
"""
|
||||||
Time has finished so if our time then request the next Alert
|
Time has finished so if our time then request the next Alert if there is one and reset the timer.
|
||||||
if there is one and reset the timer.
|
|
||||||
|
|
||||||
``event``
|
``event``
|
||||||
the QT event that has been triggered.
|
the QT event that has been triggered.
|
||||||
|
@ -27,8 +27,7 @@
|
|||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
"""
|
"""
|
||||||
The :mod:`db` module provides the database and schema that is the backend for
|
The :mod:`db` module provides the database and schema that is the backend for the Alerts plugin.
|
||||||
the Alerts plugin
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from sqlalchemy import Column, Table, types
|
from sqlalchemy import Column, Table, types
|
||||||
@ -36,12 +35,14 @@ from sqlalchemy.orm import mapper
|
|||||||
|
|
||||||
from openlp.core.lib.db import BaseModel, init_db
|
from openlp.core.lib.db import BaseModel, init_db
|
||||||
|
|
||||||
|
|
||||||
class AlertItem(BaseModel):
|
class AlertItem(BaseModel):
|
||||||
"""
|
"""
|
||||||
AlertItem model
|
AlertItem model
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def init_schema(url):
|
def init_schema(url):
|
||||||
"""
|
"""
|
||||||
Setup the alerts database connection and initialise the database schema
|
Setup the alerts database connection and initialise the database schema
|
||||||
|
Loading…
Reference in New Issue
Block a user