forked from openlp/openlp
Plugin List Combo boxhandling finished
This commit is contained in:
parent
0408a0a320
commit
37a9b5fb4e
@ -11,6 +11,20 @@ import logging
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from openlp.core.lib import translate, PluginStatus, buildIcon
|
||||
|
||||
class PluginCombo(QtGui.QComboBox):
|
||||
"""
|
||||
Customised version of QTableWidget which can respond to keyboard
|
||||
events.
|
||||
"""
|
||||
def __init__(self, parent=None, plugin=None):
|
||||
QtGui.QComboBox.__init__(self, parent)
|
||||
self.parent = parent
|
||||
self.plugin = plugin
|
||||
|
||||
def enterEvent(self, event):
|
||||
self.parent.activePlugin = self.plugin
|
||||
event.ignore()
|
||||
|
||||
class PluginForm(QtGui.QDialog):
|
||||
global log
|
||||
log = logging.getLogger(u'PluginForm')
|
||||
@ -18,6 +32,7 @@ class PluginForm(QtGui.QDialog):
|
||||
def __init__(self, parent=None):
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
self.parent = parent
|
||||
self.activePlugin = None
|
||||
self.setupUi(self)
|
||||
log.debug(u'Defined')
|
||||
|
||||
@ -57,7 +72,6 @@ class PluginForm(QtGui.QDialog):
|
||||
self.AboutTextLabel.setWordWrap(True)
|
||||
self.AboutTextLabel.setObjectName("AboutTextLabel")
|
||||
|
||||
|
||||
self.retranslateUi(PluginForm)
|
||||
QtCore.QObject.connect(self.ButtonBox,
|
||||
QtCore.SIGNAL(u'accepted()'), PluginForm.close)
|
||||
@ -92,13 +106,13 @@ class PluginForm(QtGui.QDialog):
|
||||
self.PluginViewList.setItem(row, 0, item1)
|
||||
self.PluginViewList.setItem(row, 1, item2)
|
||||
if plugin.can_be_disabled():
|
||||
combo = QtGui.QComboBox()
|
||||
combo = PluginCombo(self, plugin)
|
||||
self.PluginViewList.setCellWidget(row, 2, combo)
|
||||
combo.addItem(translate(u'PluginForm', u'Active'))
|
||||
combo.addItem(translate(u'PluginForm', u'Inactive'))
|
||||
QtCore.QObject.connect(combo,
|
||||
QtCore.SIGNAL(u'activated(int)'), self.statusComboChanged)
|
||||
combo.setCurrentIndex(int(plugin.status))
|
||||
QtCore.QObject.connect(combo,
|
||||
QtCore.SIGNAL(u'currentIndexChanged(int)'), self.statusComboChanged)
|
||||
self.PluginViewList.setRowHeight(row, 25)
|
||||
else:
|
||||
item3 = QtGui.QTableWidgetItem(
|
||||
@ -117,10 +131,9 @@ class PluginForm(QtGui.QDialog):
|
||||
self.AboutTextLabel.setText(translate(u'PluginList', text))
|
||||
|
||||
def statusComboChanged(self, status):
|
||||
row = self.PluginViewList.currentRow()
|
||||
log.debug(u'Combo status changed %s for row %s' %(status, row))
|
||||
self.parent.plugin_manager.plugins[row].toggle_status(status)
|
||||
log.debug(u'Combo status changed %s for plugin %s' %(status, self.activePlugin.name))
|
||||
self.activePlugin.toggle_status(status)
|
||||
if status == PluginStatus.Active:
|
||||
self.parent.plugin_manager.plugins[row].initialise()
|
||||
self.activePlugin.initialise()
|
||||
else:
|
||||
self.parent.plugin_manager.plugins[row].finalise()
|
||||
self.activePlugin.finalise()
|
||||
|
@ -43,7 +43,7 @@ class AuditPlugin(Plugin):
|
||||
self.weight = -4
|
||||
# Create the plugin icon
|
||||
self.icon = buildIcon(u':/media/media_image.png')
|
||||
self.auditfile = None
|
||||
self.auditmanager = None
|
||||
|
||||
def can_be_disabled(self):
|
||||
return True
|
||||
@ -115,9 +115,9 @@ class AuditPlugin(Plugin):
|
||||
QtCore.QObject.connect(self.AuditReport,
|
||||
QtCore.SIGNAL(u'triggered()'), self.onAuditReport)
|
||||
|
||||
def get_settings_tab(self):
|
||||
self.AuditTab = AuditTab()
|
||||
return self.AuditTab
|
||||
# def get_settings_tab(self):
|
||||
# self.AuditTab = AuditTab()
|
||||
# return self.AuditTab
|
||||
|
||||
def initialise(self):
|
||||
log.info(u'Plugin Initialising')
|
||||
@ -128,9 +128,15 @@ class AuditPlugin(Plugin):
|
||||
self.auditActive = str_to_bool(
|
||||
self.config.get_config(u'audit active', False))
|
||||
self.AuditStatus.setChecked(self.auditActive)
|
||||
self.auditmanager = AuditManager(self.config)
|
||||
if self.auditmanager is None:
|
||||
self.auditmanager = AuditManager(self.config)
|
||||
self.auditdeleteform = AuditDeleteForm(self.auditmanager)
|
||||
self.auditdetailform = AuditDetailForm(self.auditmanager)
|
||||
self.AuditMenu.setVisible(True)
|
||||
|
||||
def finalise(self):
|
||||
log.info(u'Plugin Finalise')
|
||||
self.AuditMenu.setVisible(True)
|
||||
|
||||
def toggleAuditState(self):
|
||||
self.auditActive = not self.auditActive
|
||||
|
@ -44,30 +44,17 @@ class RemoteTab(SettingsTab):
|
||||
self.RemotePortSpinBox.setObjectName(u'RemotePortSpinBox')
|
||||
self.RemotePortSpinBox.setMaximum(32767)
|
||||
self.RemoteModeLayout.addWidget(self.RemotePortSpinBox)
|
||||
self.RemoteActive = QtGui.QCheckBox(self.RemoteModeGroupBox)
|
||||
self.RemoteActive.setObjectName(u'RemotePortSpinBox')
|
||||
self.RemoteModeLayout.addWidget(self.RemoteActive)
|
||||
self.WarningLabel = QtGui.QLabel(self.RemoteModeGroupBox)
|
||||
self.WarningLabel.setObjectName(u'WarningLabel')
|
||||
self.RemoteModeLayout.addWidget(self.WarningLabel)
|
||||
self.RemoteLayout.setWidget(
|
||||
0, QtGui.QFormLayout.LabelRole, self.RemoteModeGroupBox)
|
||||
|
||||
def retranslateUi(self):
|
||||
self.RemoteModeGroupBox.setTitle(
|
||||
translate(u'RemoteTab', u'Remotes Receiver Port'))
|
||||
self.RemoteActive.setText(translate(u'RemoteTab', 'Remote available:'))
|
||||
self.WarningLabel.setText(translate(u'RemoteTab',
|
||||
u'A restart is needed for this change to become effective'))
|
||||
|
||||
def load(self):
|
||||
self.RemotePortSpinBox.setValue(
|
||||
int(self.config.get_config(u'remote port', 4316)))
|
||||
self.RemoteActive.setChecked(
|
||||
int(self.config.get_config(u'startup', 0)))
|
||||
|
||||
def save(self):
|
||||
self.config.set_config(
|
||||
u'remote port', unicode(self.RemotePortSpinBox.value()))
|
||||
self.config.set_config(
|
||||
u'startup', unicode(self.RemoteActive.checkState()))
|
||||
|
@ -34,6 +34,7 @@ class RemotesPlugin(Plugin):
|
||||
# Call the parent constructor
|
||||
Plugin.__init__(self, u'Remotes', u'1.9.0', plugin_helpers)
|
||||
self.weight = -1
|
||||
self.server = None
|
||||
|
||||
def can_be_disabled(self):
|
||||
return True
|
||||
@ -47,7 +48,8 @@ class RemotesPlugin(Plugin):
|
||||
|
||||
def finalise(self):
|
||||
log.debug(u'finalise')
|
||||
self.server.close()
|
||||
if self.server is not None:
|
||||
self.server.close()
|
||||
|
||||
def about(self):
|
||||
return u'<b>Remote Plugin</b> <br>This plugin provides the ability to send messages to a running version of openlp on a different computer.<br> The Primary use for this would be to send alerts from a creche'
|
||||
|
Loading…
Reference in New Issue
Block a user