forked from openlp/openlp
Alerts editing now work - history and pre determined
This commit is contained in:
parent
acc97f3c79
commit
2fefcef09d
@ -30,7 +30,7 @@ from PyQt4 import QtCore, QtGui
|
|||||||
|
|
||||||
from openlp.core.lib import Plugin, Receiver, str_to_bool, build_icon, PluginStatus
|
from openlp.core.lib import Plugin, Receiver, str_to_bool, build_icon, PluginStatus
|
||||||
from openlp.plugins.alerts.lib import AlertsManager, DBManager
|
from openlp.plugins.alerts.lib import AlertsManager, DBManager
|
||||||
from openlp.plugins.alerts.forms import AlertsTab, AlertForm
|
from openlp.plugins.alerts.forms import AlertsTab, AlertForm, AlertEditForm
|
||||||
|
|
||||||
class alertsPlugin(Plugin):
|
class alertsPlugin(Plugin):
|
||||||
global log
|
global log
|
||||||
@ -44,10 +44,11 @@ class alertsPlugin(Plugin):
|
|||||||
self.alertsmanager = AlertsManager(self)
|
self.alertsmanager = AlertsManager(self)
|
||||||
self.manager = DBManager(self.config)
|
self.manager = DBManager(self.config)
|
||||||
self.alertForm = AlertForm(self.manager, self)
|
self.alertForm = AlertForm(self.manager, self)
|
||||||
|
self.alertEditForm = AlertEditForm(self.manager, self)
|
||||||
self.status = PluginStatus.Active
|
self.status = PluginStatus.Active
|
||||||
|
|
||||||
def get_settings_tab(self):
|
def get_settings_tab(self):
|
||||||
self.alertsTab = AlertsTab(self.name)
|
self.alertsTab = AlertsTab(self)
|
||||||
return self.alertsTab
|
return self.alertsTab
|
||||||
|
|
||||||
def add_tools_menu_item(self, tools_menu):
|
def add_tools_menu_item(self, tools_menu):
|
||||||
@ -90,9 +91,9 @@ class alertsPlugin(Plugin):
|
|||||||
self.alertForm.loadList()
|
self.alertForm.loadList()
|
||||||
self.alertForm.exec_()
|
self.alertForm.exec_()
|
||||||
|
|
||||||
def onalertsReport(self):
|
def onAlertsEdit(self):
|
||||||
self.alertsdetailform.initialise()
|
self.alertEditForm.loadList()
|
||||||
self.alertsdetailform.exec_()
|
self.alertEditForm.exec_()
|
||||||
|
|
||||||
def about(self):
|
def about(self):
|
||||||
about_text = self.trUtf8('<b>Alerts Plugin</b><br>This plugin '
|
about_text = self.trUtf8('<b>Alerts Plugin</b><br>This plugin '
|
||||||
|
@ -25,3 +25,4 @@
|
|||||||
|
|
||||||
from alertstab import AlertsTab
|
from alertstab import AlertsTab
|
||||||
from alertform import AlertForm
|
from alertform import AlertForm
|
||||||
|
from alerteditform import AlertEditForm
|
||||||
|
@ -43,6 +43,7 @@ class Ui_AlertDialog(object):
|
|||||||
self.AlertEntryEditItem.setObjectName("AlertEntryEditItem")
|
self.AlertEntryEditItem.setObjectName("AlertEntryEditItem")
|
||||||
self.verticalLayout.addWidget(self.AlertEntryEditItem)
|
self.verticalLayout.addWidget(self.AlertEntryEditItem)
|
||||||
self.AlertListWidget = QtGui.QListWidget(self.AlertEntryWidget)
|
self.AlertListWidget = QtGui.QListWidget(self.AlertEntryWidget)
|
||||||
|
self.AlertListWidget.setAlternatingRowColors(True)
|
||||||
self.AlertListWidget.setObjectName("AlertListWidget")
|
self.AlertListWidget.setObjectName("AlertListWidget")
|
||||||
self.verticalLayout.addWidget(self.AlertListWidget)
|
self.verticalLayout.addWidget(self.AlertListWidget)
|
||||||
self.verticalLayout_2.addLayout(self.verticalLayout)
|
self.verticalLayout_2.addLayout(self.verticalLayout)
|
||||||
@ -60,7 +61,7 @@ class Ui_AlertDialog(object):
|
|||||||
self.AlertFormLayout.addWidget(self.AlertEntryWidget)
|
self.AlertFormLayout.addWidget(self.AlertEntryWidget)
|
||||||
|
|
||||||
self.retranslateUi(AlertForm)
|
self.retranslateUi(AlertForm)
|
||||||
QtCore.QObject.connect(self.CancelButton, QtCore.SIGNAL("clicked()"), AlertForm.close)
|
QtCore.QObject.connect(self.CancelButton, QtCore.SIGNAL("clicked()"), self.close)
|
||||||
QtCore.QMetaObject.connectSlotsByName(AlertForm)
|
QtCore.QMetaObject.connectSlotsByName(AlertForm)
|
||||||
|
|
||||||
def retranslateUi(self, AlertForm):
|
def retranslateUi(self, AlertForm):
|
||||||
|
@ -2,62 +2,66 @@
|
|||||||
|
|
||||||
# Form implementation generated from reading ui file 'alerteditdialog.ui'
|
# Form implementation generated from reading ui file 'alerteditdialog.ui'
|
||||||
#
|
#
|
||||||
# Created: Sat Feb 13 08:20:09 2010
|
# Created: Sun Feb 14 16:45:10 2010
|
||||||
# by: PyQt4 UI code generator 4.6.2
|
# by: PyQt4 UI code generator 4.6.2
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
class Ui_AlertList(object):
|
class Ui_AlertEditDialog(object):
|
||||||
def setupUi(self, AlertList):
|
def setupUi(self, AlertEditDialog):
|
||||||
AlertList.setObjectName("AlertList")
|
AlertEditDialog.setObjectName("AlertEditDialog")
|
||||||
AlertList.resize(400, 300)
|
AlertEditDialog.resize(400, 300)
|
||||||
self.buttonBox = QtGui.QDialogButtonBox(AlertList)
|
self.buttonBox = QtGui.QDialogButtonBox(AlertEditDialog)
|
||||||
self.buttonBox.setGeometry(QtCore.QRect(220, 270, 173, 27))
|
self.buttonBox.setGeometry(QtCore.QRect(220, 270, 173, 27))
|
||||||
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel)
|
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel)
|
||||||
self.buttonBox.setObjectName("buttonBox")
|
self.buttonBox.setObjectName("buttonBox")
|
||||||
self.widget = QtGui.QWidget(AlertList)
|
self.layoutWidget = QtGui.QWidget(AlertEditDialog)
|
||||||
self.widget.setGeometry(QtCore.QRect(20, 10, 361, 251))
|
self.layoutWidget.setGeometry(QtCore.QRect(20, 10, 361, 251))
|
||||||
self.widget.setObjectName("widget")
|
self.layoutWidget.setObjectName("layoutWidget")
|
||||||
self.verticalLayout_2 = QtGui.QVBoxLayout(self.widget)
|
self.verticalLayout_2 = QtGui.QVBoxLayout(self.layoutWidget)
|
||||||
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||||
self.horizontalLayout_2 = QtGui.QHBoxLayout()
|
self.horizontalLayout_2 = QtGui.QHBoxLayout()
|
||||||
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||||
self.lineEdit = QtGui.QLineEdit(self.widget)
|
self.AlertLineEdit = QtGui.QLineEdit(self.layoutWidget)
|
||||||
self.lineEdit.setObjectName("lineEdit")
|
self.AlertLineEdit.setObjectName("AlertLineEdit")
|
||||||
self.horizontalLayout_2.addWidget(self.lineEdit)
|
self.horizontalLayout_2.addWidget(self.AlertLineEdit)
|
||||||
self.SaveButton = QtGui.QPushButton(self.widget)
|
|
||||||
self.SaveButton.setObjectName("SaveButton")
|
|
||||||
self.horizontalLayout_2.addWidget(self.SaveButton)
|
|
||||||
self.verticalLayout_2.addLayout(self.horizontalLayout_2)
|
self.verticalLayout_2.addLayout(self.horizontalLayout_2)
|
||||||
self.horizontalLayout = QtGui.QHBoxLayout()
|
self.horizontalLayout = QtGui.QHBoxLayout()
|
||||||
self.horizontalLayout.setObjectName("horizontalLayout")
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
self.listWidget = QtGui.QListWidget(self.widget)
|
self.AlertListWidget = QtGui.QListWidget(self.layoutWidget)
|
||||||
self.listWidget.setAlternatingRowColors(True)
|
self.AlertListWidget.setAlternatingRowColors(True)
|
||||||
self.listWidget.setObjectName("listWidget")
|
self.AlertListWidget.setObjectName("AlertListWidget")
|
||||||
self.horizontalLayout.addWidget(self.listWidget)
|
self.horizontalLayout.addWidget(self.AlertListWidget)
|
||||||
self.verticalLayout = QtGui.QVBoxLayout()
|
self.verticalLayout = QtGui.QVBoxLayout()
|
||||||
self.verticalLayout.setObjectName("verticalLayout")
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
self.AddButton = QtGui.QPushButton(self.widget)
|
self.SaveButton = QtGui.QPushButton(self.layoutWidget)
|
||||||
|
self.SaveButton.setObjectName("SaveButton")
|
||||||
|
self.verticalLayout.addWidget(self.SaveButton)
|
||||||
|
self.ClearButton = QtGui.QPushButton(self.layoutWidget)
|
||||||
|
self.ClearButton.setObjectName("ClearButton")
|
||||||
|
self.verticalLayout.addWidget(self.ClearButton)
|
||||||
|
self.AddButton = QtGui.QPushButton(self.layoutWidget)
|
||||||
self.AddButton.setObjectName("AddButton")
|
self.AddButton.setObjectName("AddButton")
|
||||||
self.verticalLayout.addWidget(self.AddButton)
|
self.verticalLayout.addWidget(self.AddButton)
|
||||||
self.EdirButton = QtGui.QPushButton(self.widget)
|
self.EditButton = QtGui.QPushButton(self.layoutWidget)
|
||||||
self.EdirButton.setObjectName("EdirButton")
|
self.EditButton.setObjectName("EditButton")
|
||||||
self.verticalLayout.addWidget(self.EdirButton)
|
self.verticalLayout.addWidget(self.EditButton)
|
||||||
self.DeleteButton = QtGui.QPushButton(self.widget)
|
self.DeleteButton = QtGui.QPushButton(self.layoutWidget)
|
||||||
self.DeleteButton.setObjectName("DeleteButton")
|
self.DeleteButton.setObjectName("DeleteButton")
|
||||||
self.verticalLayout.addWidget(self.DeleteButton)
|
self.verticalLayout.addWidget(self.DeleteButton)
|
||||||
self.horizontalLayout.addLayout(self.verticalLayout)
|
self.horizontalLayout.addLayout(self.verticalLayout)
|
||||||
self.verticalLayout_2.addLayout(self.horizontalLayout)
|
self.verticalLayout_2.addLayout(self.horizontalLayout)
|
||||||
|
|
||||||
self.retranslateUi(AlertList)
|
self.retranslateUi(AlertEditDialog)
|
||||||
QtCore.QMetaObject.connectSlotsByName(AlertList)
|
QtCore.QMetaObject.connectSlotsByName(AlertEditDialog)
|
||||||
|
|
||||||
def retranslateUi(self, AlertList):
|
def retranslateUi(self, AlertEditDialog):
|
||||||
AlertList.setWindowTitle(QtGui.QApplication.translate("AlertList", "Form", None, QtGui.QApplication.UnicodeUTF8))
|
AlertEditDialog.setWindowTitle(QtGui.QApplication.translate("AlertEditDialog", "Maintain Alerts", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.SaveButton.setText(QtGui.QApplication.translate("AlertList", "Save", None, QtGui.QApplication.UnicodeUTF8))
|
self.SaveButton.setText(QtGui.QApplication.translate("AlertEditDialog", "Save", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.AddButton.setText(QtGui.QApplication.translate("AlertList", "Add", None, QtGui.QApplication.UnicodeUTF8))
|
self.ClearButton.setText(QtGui.QApplication.translate("AlertEditDialog", "Clear", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.EdirButton.setText(QtGui.QApplication.translate("AlertList", "Edit", None, QtGui.QApplication.UnicodeUTF8))
|
self.AddButton.setText(QtGui.QApplication.translate("AlertEditDialog", "Add", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.DeleteButton.setText(QtGui.QApplication.translate("AlertList", "Delete", None, QtGui.QApplication.UnicodeUTF8))
|
self.EditButton.setText(QtGui.QApplication.translate("AlertEditDialog", "Edit", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
self.DeleteButton.setText(QtGui.QApplication.translate("AlertEditDialog", "Delete", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
|
||||||
|
168
openlp/plugins/alerts/forms/alerteditform.py
Normal file
168
openlp/plugins/alerts/forms/alerteditform.py
Normal file
@ -0,0 +1,168 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
|
# --------------------------------------------------------------------------- #
|
||||||
|
# Copyright (c) 2008-2010 Raoul Snyman #
|
||||||
|
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
|
||||||
|
# Gorven, Scott Guerrieri, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
|
||||||
|
# Carsten Tinggaard #
|
||||||
|
# --------------------------------------------------------------------------- #
|
||||||
|
# This program is free software; you can redistribute it and/or modify it #
|
||||||
|
# under the terms of the GNU General Public License as published by the Free #
|
||||||
|
# Software Foundation; version 2 of the License. #
|
||||||
|
# #
|
||||||
|
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
||||||
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
||||||
|
# more details. #
|
||||||
|
# #
|
||||||
|
# You should have received a copy of the GNU General Public License along #
|
||||||
|
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||||
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
from datetime import date
|
||||||
|
|
||||||
|
from PyQt4 import QtGui, QtCore
|
||||||
|
from openlp.plugins.alerts.lib.models import AlertItem
|
||||||
|
|
||||||
|
from alerteditdialog import Ui_AlertEditDialog
|
||||||
|
|
||||||
|
class AlertEditForm(QtGui.QDialog, Ui_AlertEditDialog):
|
||||||
|
"""
|
||||||
|
Class documentation goes here.
|
||||||
|
"""
|
||||||
|
def __init__(self, manager, parent):
|
||||||
|
"""
|
||||||
|
Constructor
|
||||||
|
"""
|
||||||
|
self.manager = manager
|
||||||
|
self.parent = parent
|
||||||
|
QtGui.QDialog.__init__(self, None)
|
||||||
|
self.setupUi(self)
|
||||||
|
QtCore.QObject.connect(self.DeleteButton,
|
||||||
|
QtCore.SIGNAL(u'clicked()'),
|
||||||
|
self.onDeleteClick)
|
||||||
|
QtCore.QObject.connect(self.ClearButton,
|
||||||
|
QtCore.SIGNAL(u'clicked()'),
|
||||||
|
self.onClearClick)
|
||||||
|
QtCore.QObject.connect(self.EditButton,
|
||||||
|
QtCore.SIGNAL(u'clicked()'),
|
||||||
|
self.onEditClick)
|
||||||
|
QtCore.QObject.connect(self.AddButton,
|
||||||
|
QtCore.SIGNAL(u'clicked()'),
|
||||||
|
self.onAddClick)
|
||||||
|
QtCore.QObject.connect(self.SaveButton,
|
||||||
|
QtCore.SIGNAL(u'clicked()'),
|
||||||
|
self.onSaveClick)
|
||||||
|
QtCore.QObject.connect(self.buttonBox,
|
||||||
|
QtCore.SIGNAL(u'rejected()'), self.close)
|
||||||
|
QtCore.QObject.connect(self.AlertLineEdit,
|
||||||
|
QtCore.SIGNAL(u'textChanged(const QString&)'),
|
||||||
|
self.onTextChanged)
|
||||||
|
QtCore.QObject.connect(self.AlertListWidget,
|
||||||
|
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
|
||||||
|
self.onItemSelected)
|
||||||
|
QtCore.QObject.connect(self.AlertListWidget,
|
||||||
|
QtCore.SIGNAL(u'clicked(QModelIndex)'),
|
||||||
|
self.onItemSelected)
|
||||||
|
|
||||||
|
def loadList(self):
|
||||||
|
self.AlertListWidget.clear()
|
||||||
|
alerts = self.manager.get_all_alerts()
|
||||||
|
for alert in alerts:
|
||||||
|
item_name = QtGui.QListWidgetItem(alert.text)
|
||||||
|
item_name.setData(
|
||||||
|
QtCore.Qt.UserRole, QtCore.QVariant(alert.id))
|
||||||
|
self.AlertListWidget.addItem(item_name)
|
||||||
|
self.AddButton.setEnabled(True)
|
||||||
|
self.ClearButton.setEnabled(False)
|
||||||
|
self.SaveButton.setEnabled(False)
|
||||||
|
self.EditButton.setEnabled(False)
|
||||||
|
self.DeleteButton.setEnabled(False)
|
||||||
|
|
||||||
|
def onItemSelected(self):
|
||||||
|
if len(self.AlertLineEdit.text()) > 0:
|
||||||
|
QtGui.QMessageBox.information(self,
|
||||||
|
self.trUtf8('Item selected to Edit'),
|
||||||
|
self.trUtf8('Please Save or Clear seletced item'))
|
||||||
|
else:
|
||||||
|
self.EditButton.setEnabled(True)
|
||||||
|
self.DeleteButton.setEnabled(True)
|
||||||
|
|
||||||
|
def onDeleteClick(self):
|
||||||
|
item = self.AlertListWidget.currentItem()
|
||||||
|
if item:
|
||||||
|
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||||
|
self.parent.manager.delete_alert(item_id)
|
||||||
|
row = self.AlertListWidget.row(item)
|
||||||
|
self.AlertListWidget.takeItem(row)
|
||||||
|
self.AddButton.setEnabled(True)
|
||||||
|
self.SaveButton.setEnabled(False)
|
||||||
|
self.DeleteButton.setEnabled(False)
|
||||||
|
self.EditButton.setEnabled(False)
|
||||||
|
|
||||||
|
def onEditClick(self):
|
||||||
|
item = self.AlertListWidget.currentItem()
|
||||||
|
if item:
|
||||||
|
self.item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||||
|
self.AlertLineEdit.setText(unicode(item.text()))
|
||||||
|
self.AddButton.setEnabled(True)
|
||||||
|
self.ClearButton.setEnabled(True)
|
||||||
|
self.SaveButton.setEnabled(True)
|
||||||
|
self.DeleteButton.setEnabled(True)
|
||||||
|
self.EditButton.setEnabled(False)
|
||||||
|
|
||||||
|
def onClearClick(self):
|
||||||
|
self.AlertLineEdit.setText(u'')
|
||||||
|
self.AddButton.setEnabled(False)
|
||||||
|
self.ClearButton.setEnabled(True)
|
||||||
|
self.SaveButton.setEnabled(False)
|
||||||
|
self.DeleteButton.setEnabled(False)
|
||||||
|
self.EditButton.setEnabled(False)
|
||||||
|
|
||||||
|
def onAddClick(self):
|
||||||
|
if len(self.AlertLineEdit.text()) == 0:
|
||||||
|
QtGui.QMessageBox.information(self,
|
||||||
|
self.trUtf8('Item selected to Add'),
|
||||||
|
self.trUtf8('Missing data'))
|
||||||
|
else:
|
||||||
|
alert = AlertItem()
|
||||||
|
alert.text = unicode(self.AlertLineEdit.text())
|
||||||
|
self.manager.save_alert(alert)
|
||||||
|
self.onClearClick()
|
||||||
|
self.loadList()
|
||||||
|
|
||||||
|
def onSaveClick(self):
|
||||||
|
alert = self.manager.get_alert(self.item_id)
|
||||||
|
alert.text = unicode(self.AlertLineEdit.text())
|
||||||
|
self.manager.save_alert(alert)
|
||||||
|
self.onClearClick()
|
||||||
|
self.loadList()
|
||||||
|
|
||||||
|
def onTextChanged(self):
|
||||||
|
self.AddButton.setEnabled(True)
|
||||||
|
|
||||||
|
def onDoubleClick(self):
|
||||||
|
"""
|
||||||
|
List item has been double clicked to display it
|
||||||
|
"""
|
||||||
|
items = self.AlertListWidget.selectedIndexes()
|
||||||
|
for item in items:
|
||||||
|
bitem = self.AlertListWidget.item(item.row())
|
||||||
|
self.triggerAlert(bitem.text())
|
||||||
|
|
||||||
|
def onSingleClick(self):
|
||||||
|
"""
|
||||||
|
List item has been single clicked to add it to
|
||||||
|
the edit field so it can be changed.
|
||||||
|
"""
|
||||||
|
items = self.AlertListWidget.selectedIndexes()
|
||||||
|
for item in items:
|
||||||
|
bitem = self.AlertListWidget.item(item.row())
|
||||||
|
self.AlertEntryEditItem.setText(bitem.text())
|
||||||
|
|
||||||
|
def triggerAlert(self, text):
|
||||||
|
self.parent.alertsmanager.displayAlert(text)
|
@ -43,9 +43,6 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
|
|||||||
self.history_required = True
|
self.history_required = True
|
||||||
QtGui.QDialog.__init__(self, None)
|
QtGui.QDialog.__init__(self, None)
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
QtCore.QObject.connect(self.CancelButton,
|
|
||||||
QtCore.SIGNAL(u'clicked()'),
|
|
||||||
AlertForm.close)
|
|
||||||
QtCore.QObject.connect(self.DisplayButton,
|
QtCore.QObject.connect(self.DisplayButton,
|
||||||
QtCore.SIGNAL(u'clicked()'),
|
QtCore.SIGNAL(u'clicked()'),
|
||||||
self.onDisplayClicked)
|
self.onDisplayClicked)
|
||||||
|
@ -31,8 +31,9 @@ class AlertsTab(SettingsTab):
|
|||||||
"""
|
"""
|
||||||
AlertsTab is the alerts settings tab in the settings dialog.
|
AlertsTab is the alerts settings tab in the settings dialog.
|
||||||
"""
|
"""
|
||||||
def __init__(self, title, section=None):
|
def __init__(self, parent, section=None):
|
||||||
SettingsTab.__init__(self, title, section)
|
self.parent = parent
|
||||||
|
SettingsTab.__init__(self, parent.name, section)
|
||||||
|
|
||||||
def setupUi(self):
|
def setupUi(self):
|
||||||
self.setObjectName(u'AlertsTab')
|
self.setObjectName(u'AlertsTab')
|
||||||
@ -209,6 +210,8 @@ class AlertsTab(SettingsTab):
|
|||||||
QtCore.SIGNAL(u'pressed()'), self.onBackgroundColorButtonClicked)
|
QtCore.SIGNAL(u'pressed()'), self.onBackgroundColorButtonClicked)
|
||||||
QtCore.QObject.connect(self.FontColorButton,
|
QtCore.QObject.connect(self.FontColorButton,
|
||||||
QtCore.SIGNAL(u'pressed()'), self.onFontColorButtonClicked)
|
QtCore.SIGNAL(u'pressed()'), self.onFontColorButtonClicked)
|
||||||
|
QtCore.QObject.connect(self.HistoryEditPushButton,
|
||||||
|
QtCore.SIGNAL(u'pressed()'), self.onHistoryEditButtonClicked)
|
||||||
QtCore.QObject.connect(self.FontComboBox,
|
QtCore.QObject.connect(self.FontComboBox,
|
||||||
QtCore.SIGNAL(u'activated(int)'), self.onFontComboBoxClicked)
|
QtCore.SIGNAL(u'activated(int)'), self.onFontComboBoxClicked)
|
||||||
QtCore.QObject.connect(self.LocationComboBox,
|
QtCore.QObject.connect(self.LocationComboBox,
|
||||||
@ -268,6 +271,9 @@ class AlertsTab(SettingsTab):
|
|||||||
self.font_size = self.FontSizeSpinBox.value()
|
self.font_size = self.FontSizeSpinBox.value()
|
||||||
self.updateDisplay()
|
self.updateDisplay()
|
||||||
|
|
||||||
|
def onHistoryEditButtonClicked(self):
|
||||||
|
self.parent.onAlertsEdit()
|
||||||
|
|
||||||
def load(self):
|
def load(self):
|
||||||
self.timeout = int(self.config.get_config(u'timeout', 5))
|
self.timeout = int(self.config.get_config(u'timeout', 5))
|
||||||
self.font_color = unicode(
|
self.font_color = unicode(
|
||||||
|
@ -78,10 +78,10 @@ class DBManager():
|
|||||||
return True
|
return True
|
||||||
except:
|
except:
|
||||||
self.session.rollback()
|
self.session.rollback()
|
||||||
log.excertion(u'Alert save failed')
|
log.exception(u'Alert save failed')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def get_alerts(self, id=None):
|
def get_alert(self, id=None):
|
||||||
"""
|
"""
|
||||||
Returns the details of a Alert
|
Returns the details of a Alert
|
||||||
"""
|
"""
|
||||||
@ -95,14 +95,14 @@ class DBManager():
|
|||||||
Delete a Alert show
|
Delete a Alert show
|
||||||
"""
|
"""
|
||||||
if id != 0:
|
if id != 0:
|
||||||
Alerts = self.get_Alert(id)
|
AlertItem = self.get_alert(id)
|
||||||
try:
|
try:
|
||||||
self.session.delete(AlertItem)
|
self.session.delete(AlertItem)
|
||||||
self.session.commit()
|
self.session.commit()
|
||||||
return True
|
return True
|
||||||
except:
|
except:
|
||||||
self.session.rollback()
|
self.session.rollback()
|
||||||
log.excertion(u'Alert deleton failed')
|
log.exception(u'Alert deleton failed')
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
|
@ -78,7 +78,7 @@ class CustomManager():
|
|||||||
return True
|
return True
|
||||||
except:
|
except:
|
||||||
self.session.rollback()
|
self.session.rollback()
|
||||||
log.excertion(u'Custom Slide save failed')
|
log.exceptiontion(u'Custom Slide save failed')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def get_custom(self, id=None):
|
def get_custom(self, id=None):
|
||||||
@ -102,7 +102,7 @@ class CustomManager():
|
|||||||
return True
|
return True
|
||||||
except:
|
except:
|
||||||
self.session.rollback()
|
self.session.rollback()
|
||||||
log.excertion(u'Custom Slide deleton failed')
|
log.exception(u'Custom Slide deleton failed')
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
return True
|
return True
|
@ -52,7 +52,11 @@
|
|||||||
<widget class="QLineEdit" name="AlertEntryEditItem"/>
|
<widget class="QLineEdit" name="AlertEntryEditItem"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QListWidget" name="AlertListWidget"/>
|
<widget class="QListWidget" name="AlertListWidget">
|
||||||
|
<property name="alternatingRowColors">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>AlertList</class>
|
<class>AlertEditDialog</class>
|
||||||
<widget class="QWidget" name="AlertList">
|
<widget class="QWidget" name="AlertEditDialog">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
@ -11,7 +11,7 @@
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Maintain Alerts</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
@ -26,7 +26,7 @@
|
|||||||
<set>QDialogButtonBox::Cancel</set>
|
<set>QDialogButtonBox::Cancel</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="">
|
<widget class="QWidget" name="layoutWidget">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>20</x>
|
<x>20</x>
|
||||||
@ -39,21 +39,14 @@
|
|||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="lineEdit"/>
|
<widget class="QLineEdit" name="AlertLineEdit"/>
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="SaveButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>Save</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QListWidget" name="listWidget">
|
<widget class="QListWidget" name="AlertListWidget">
|
||||||
<property name="alternatingRowColors">
|
<property name="alternatingRowColors">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
@ -61,6 +54,20 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="SaveButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Save</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="ClearButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Clear</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="AddButton">
|
<widget class="QPushButton" name="AddButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
Loading…
Reference in New Issue
Block a user