forked from openlp/openlp
Fix plugin forms
This commit is contained in:
parent
ab3efd2b3b
commit
8f0d30c48b
@ -133,6 +133,7 @@ class Plugin(QtCore.QObject):
|
||||
self.mediadock = plugin_helpers[u'toolbox']
|
||||
self.displayManager = plugin_helpers[u'displaymanager']
|
||||
self.pluginManager = plugin_helpers[u'pluginmanager']
|
||||
self.formparent = plugin_helpers[u'formparent']
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'%s_add_service_item' % self.name),
|
||||
self.processAddServiceEvent)
|
||||
|
@ -607,6 +607,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
self.plugin_helpers[u'toolbox'] = self.mediaDockManager
|
||||
self.plugin_helpers[u'displaymanager'] = self.displayManager
|
||||
self.plugin_helpers[u'pluginmanager'] = self.plugin_manager
|
||||
self.plugin_helpers[u'formparent'] = self
|
||||
self.plugin_manager.find_plugins(pluginpath, self.plugin_helpers)
|
||||
# hook methods have to happen after find_plugins. Find plugins needs
|
||||
# the controllers hence the hooks have moved from setupUI() to here
|
||||
|
@ -45,7 +45,7 @@ class AlertsPlugin(Plugin):
|
||||
self.icon = build_icon(u':/plugins/plugin_alerts.png')
|
||||
self.alertsmanager = AlertsManager(self)
|
||||
self.manager = Manager(u'alerts', init_schema)
|
||||
self.alertForm = AlertForm(self.manager, self)
|
||||
self.alertForm = AlertForm(self.manager, self.formparent)
|
||||
|
||||
def getSettingsTab(self):
|
||||
"""
|
||||
|
@ -40,9 +40,8 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
|
||||
Initialise the alert form
|
||||
"""
|
||||
self.manager = manager
|
||||
self.parent = parent
|
||||
self.item_id = None
|
||||
QtGui.QDialog.__init__(self, None)
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
self.setupUi(self)
|
||||
QtCore.QObject.connect(self.DisplayButton, QtCore.SIGNAL(u'clicked()'),
|
||||
self.onDisplayClicked)
|
||||
@ -153,6 +152,6 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
|
||||
def triggerAlert(self, text):
|
||||
if text:
|
||||
text = text.replace(u'<>', unicode(self.ParameterEdit.text()))
|
||||
self.parent.alertsmanager.displayAlert(text)
|
||||
self.parent().alertsmanager.displayAlert(text)
|
||||
return True
|
||||
return False
|
||||
|
@ -34,7 +34,7 @@ class SongUsageDeleteForm(QtGui.QDialog, Ui_SongUsageDeleteDialog):
|
||||
"""
|
||||
Class documentation goes here.
|
||||
"""
|
||||
def __init__(self, songusagemanager, parent=None):
|
||||
def __init__(self, songusagemanager, parent):
|
||||
"""
|
||||
Constructor
|
||||
"""
|
||||
|
@ -42,12 +42,12 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
|
||||
"""
|
||||
log.info(u'SongUsage Detail Form Loaded')
|
||||
|
||||
def __init__(self, parent=None):
|
||||
def __init__(self, plugin, parent):
|
||||
"""
|
||||
Initialise the form
|
||||
"""
|
||||
QtGui.QDialog.__init__(self, None)
|
||||
self.parent = parent
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
self.plugin = plugin
|
||||
self.setupUi(self)
|
||||
|
||||
def initialise(self):
|
||||
@ -59,16 +59,16 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
|
||||
self.fromDate.setSelectedDate(fromDate)
|
||||
self.toDate.setSelectedDate(toDate)
|
||||
self.fileLineEdit.setText(
|
||||
SettingsManager.get_last_dir(self.parent.settingsSection, 1))
|
||||
SettingsManager.get_last_dir(self.plugin.settingsSection, 1))
|
||||
|
||||
def defineOutputLocation(self):
|
||||
path = QtGui.QFileDialog.getExistingDirectory(self,
|
||||
translate('SongUsagePlugin.SongUsageDetailForm',
|
||||
'Output File Location'),
|
||||
SettingsManager.get_last_dir(self.parent.settingsSection, 1))
|
||||
SettingsManager.get_last_dir(self.plugin.settingsSection, 1))
|
||||
path = unicode(path)
|
||||
if path != u'':
|
||||
SettingsManager.set_last_dir(self.parent.settingsSection, path, 1)
|
||||
SettingsManager.set_last_dir(self.plugin.settingsSection, path, 1)
|
||||
self.fileLineEdit.setText(path)
|
||||
|
||||
def accept(self):
|
||||
@ -76,7 +76,7 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
|
||||
filename = u'usage_detail_%s_%s.txt' % (
|
||||
self.fromDate.selectedDate().toString(u'ddMMyyyy'),
|
||||
self.toDate.selectedDate().toString(u'ddMMyyyy'))
|
||||
usage = self.parent.songusagemanager.get_all_objects(
|
||||
usage = self.plugin.songusagemanager.get_all_objects(
|
||||
SongUsageItem, and_(
|
||||
SongUsageItem.usagedate >= self.fromDate.selectedDate().toPyDate(),
|
||||
SongUsageItem.usagedate < self.toDate.selectedDate().toPyDate()),
|
||||
@ -95,3 +95,4 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
|
||||
finally:
|
||||
if file:
|
||||
file.close()
|
||||
self.close()
|
||||
|
@ -117,8 +117,9 @@ class SongUsagePlugin(Plugin):
|
||||
self.SongUsageStatus.setChecked(self.SongUsageActive)
|
||||
if self.songusagemanager is None:
|
||||
self.songusagemanager = Manager(u'songusage', init_schema)
|
||||
self.SongUsagedeleteform = SongUsageDeleteForm(self.songusagemanager)
|
||||
self.SongUsagedetailform = SongUsageDetailForm(self)
|
||||
self.SongUsagedeleteform = SongUsageDeleteForm(self.songusagemanager,
|
||||
self.formparent)
|
||||
self.SongUsagedetailform = SongUsageDetailForm(self, self.formparent)
|
||||
self.SongUsageMenu.menuAction().setVisible(True)
|
||||
|
||||
def finalise(self):
|
||||
|
Loading…
Reference in New Issue
Block a user