Plugin Screen added

Presentation Plugin started 
Remotes now configurable

bzr-revno: 509
This commit is contained in:
Tim Bentley 2009-08-15 06:22:52 +01:00
commit a655aae142
11 changed files with 244 additions and 280 deletions

View File

@ -86,18 +86,22 @@ class PluginManager(object):
__import__(modulename, globals(), locals(), []) __import__(modulename, globals(), locals(), [])
except ImportError, e: except ImportError, e:
log.error(u'Failed to import module %s on path %s for reason %s', modulename, path, e.args[0]) log.error(u'Failed to import module %s on path %s for reason %s', modulename, path, e.args[0])
self.plugin_classes = Plugin.__subclasses__() plugin_classes = Plugin.__subclasses__()
self.plugins = [] self.plugins = []
self.plugin_list=[]
plugin_objects = [] plugin_objects = []
for p in self.plugin_classes: for p in plugin_classes:
try: try:
plugin = p(self.plugin_helpers) plugin = p(self.plugin_helpers)
log.debug(u'loaded plugin %s with helpers', unicode(p)) log.debug(u'loaded plugin %s with helpers', unicode(p))
log.debug(u'Plugin: %s', unicode(p)) log.debug(u'Plugin: %s', unicode(p))
pList = {u'name': plugin.name, u'version':plugin.version, u'status': u'Inactive'}
if plugin.check_pre_conditions(): if plugin.check_pre_conditions():
log.debug(u'Appending %s ', unicode(p)) log.debug(u'Appending %s ', unicode(p))
plugin_objects.append(plugin) plugin_objects.append(plugin)
eventmanager.register(plugin) eventmanager.register(plugin)
pList[u'status'] = u'Active'
self.plugin_list.append(pList)
except TypeError: except TypeError:
log.error(u'loaded plugin %s has no helpers', unicode(p)) log.error(u'loaded plugin %s has no helpers', unicode(p))
self.plugins = sorted(plugin_objects, self.order_by_weight) self.plugins = sorted(plugin_objects, self.order_by_weight)

View File

@ -27,6 +27,7 @@ from generaltab import GeneralTab
from themestab import ThemesTab from themestab import ThemesTab
from about import AboutForm from about import AboutForm
from alertform import AlertForm from alertform import AlertForm
from plugindialoglistform import PluginForm
from settingsform import SettingsForm from settingsform import SettingsForm
from servicemanager import ServiceManager from servicemanager import ServiceManager
from thememanager import ThemeManager from thememanager import ThemeManager

View File

@ -23,7 +23,8 @@ import logging
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.ui import AboutForm, SettingsForm, AlertForm, \ from openlp.core.ui import AboutForm, SettingsForm, AlertForm, \
ServiceManager, ThemeManager, MainDisplay, SlideController ServiceManager, ThemeManager, MainDisplay, SlideController, \
PluginForm
from openlp.core.lib import translate, Plugin, MediaManagerItem, \ from openlp.core.lib import translate, Plugin, MediaManagerItem, \
SettingsTab, EventManager, RenderManager, PluginConfig, \ SettingsTab, EventManager, RenderManager, PluginConfig, \
SettingsManager, PluginManager, EventType SettingsManager, PluginManager, EventType
@ -203,6 +204,12 @@ class Ui_MainWindow(object):
QtGui.QIcon.Normal, QtGui.QIcon.Off) QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.ToolsAlertItem.setIcon(AlertIcon) self.ToolsAlertItem.setIcon(AlertIcon)
self.ToolsAlertItem.setObjectName(u'ToolsAlertItem') self.ToolsAlertItem.setObjectName(u'ToolsAlertItem')
self.PluginItem = QtGui.QAction(MainWindow)
PluginIcon = QtGui.QIcon()
PluginIcon.addPixmap(QtGui.QPixmap(u':/tools/tools_alert.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.PluginItem.setIcon(AlertIcon)
self.PluginItem.setObjectName(u'PluginItem')
self.HelpDocumentationItem = QtGui.QAction(MainWindow) self.HelpDocumentationItem = QtGui.QAction(MainWindow)
ContentsIcon = QtGui.QIcon() ContentsIcon = QtGui.QIcon()
ContentsIcon.addPixmap(QtGui.QPixmap(u':/system/system_help_contents.png'), ContentsIcon.addPixmap(QtGui.QPixmap(u':/system/system_help_contents.png'),
@ -264,6 +271,7 @@ class Ui_MainWindow(object):
self.OptionsMenu.addSeparator() self.OptionsMenu.addSeparator()
self.OptionsMenu.addAction(self.OptionsSettingsItem) self.OptionsMenu.addAction(self.OptionsSettingsItem)
self.ToolsMenu.addAction(self.ToolsAlertItem) self.ToolsMenu.addAction(self.ToolsAlertItem)
self.ToolsMenu.addAction(self.PluginItem)
self.ToolsMenu.addSeparator() self.ToolsMenu.addSeparator()
self.ToolsMenu.addAction(self.ToolsAddToolItem) self.ToolsMenu.addAction(self.ToolsAddToolItem)
self.HelpMenu.addAction(self.HelpDocumentationItem) self.HelpMenu.addAction(self.HelpDocumentationItem)
@ -362,6 +370,10 @@ class Ui_MainWindow(object):
self.ToolsAlertItem.setStatusTip( self.ToolsAlertItem.setStatusTip(
translate(u'mainWindow', u'Show an alert message')) translate(u'mainWindow', u'Show an alert message'))
self.ToolsAlertItem.setShortcut(translate(u'mainWindow', u'F7')) self.ToolsAlertItem.setShortcut(translate(u'mainWindow', u'F7'))
self.PluginItem.setText(translate(u'mainWindow', u'&Plugin'))
self.PluginItem.setStatusTip(
translate(u'mainWindow', u'List the Plugins'))
self.PluginItem.setShortcut(translate(u'mainWindow', u'Alt+F7'))
self.HelpDocumentationItem.setText( self.HelpDocumentationItem.setText(
translate(u'mainWindow', u'&User Guide')) translate(u'mainWindow', u'&User Guide'))
self.HelpAboutItem.setText(translate(u'mainWindow', u'&About')) self.HelpAboutItem.setText(translate(u'mainWindow', u'&About'))
@ -408,6 +420,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.mainDisplay = MainDisplay(self, screens) self.mainDisplay = MainDisplay(self, screens)
self.generalConfig = PluginConfig(u'General') self.generalConfig = PluginConfig(u'General')
self.alertForm = AlertForm(self) self.alertForm = AlertForm(self)
self.pluginForm = PluginForm(self)
self.aboutForm = AboutForm() self.aboutForm = AboutForm()
self.settingsForm = SettingsForm(self.screenList, self) self.settingsForm = SettingsForm(self.screenList, self)
# Set up the path with plugins # Set up the path with plugins
@ -441,6 +454,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtCore.SIGNAL(u'triggered()'), self.onHelpAboutItemClicked) QtCore.SIGNAL(u'triggered()'), self.onHelpAboutItemClicked)
QtCore.QObject.connect(self.ToolsAlertItem, QtCore.QObject.connect(self.ToolsAlertItem,
QtCore.SIGNAL(u'triggered()'), self.onToolsAlertItemClicked) QtCore.SIGNAL(u'triggered()'), self.onToolsAlertItemClicked)
QtCore.QObject.connect(self.PluginItem,
QtCore.SIGNAL(u'triggered()'), self.onPluginItemClicked)
QtCore.QObject.connect(self.OptionsSettingsItem, QtCore.QObject.connect(self.OptionsSettingsItem,
QtCore.SIGNAL(u'triggered()'), self.onOptionsSettingsItemClicked) QtCore.SIGNAL(u'triggered()'), self.onOptionsSettingsItemClicked)
#warning cyclic dependency #warning cyclic dependency
@ -514,6 +529,13 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
""" """
self.alertForm.exec_() self.alertForm.exec_()
def onPluginItemClicked(self):
"""
Show the Plugin form
"""
self.pluginForm.load()
self.pluginForm.exec_()
def onOptionsSettingsItemClicked(self): def onOptionsSettingsItemClicked(self):
""" """
Show the Settings dialog Show the Settings dialog

View File

@ -0,0 +1,76 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'plugindialoglistform.ui'
#
# Created: Thu Aug 13 05:52:06 2009
# by: PyQt4 UI code generator 4.5.4
#
# WARNING! All changes made in this file will be lost!
import logging
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
class PluginForm(QtGui.QDialog):
global log
log = logging.getLogger(u'PluginForm')
def __init__(self, parent=None):
QtGui.QDialog.__init__(self, None)
self.parent = parent
self.setupUi(self)
log.debug(u'Defined')
def setupUi(self, PluginForm):
PluginForm.setObjectName(u'PluginForm')
PluginForm.resize(400, 393)
self.PluginViewList = QtGui.QTableWidget(PluginForm)
self.PluginViewList.setGeometry(QtCore.QRect(20, 10, 371, 331))
self.PluginViewList.setObjectName(u'PluginViewList')
self.PluginViewList.setShowGrid(False)
self.PluginViewList.setGridStyle(QtCore.Qt.SolidLine)
self.PluginViewList.setSortingEnabled(False)
self.PluginViewList.setColumnCount(3)
item = QtGui.QTableWidgetItem()
self.PluginViewList.setHorizontalHeaderItem(0, item)
item = QtGui.QTableWidgetItem()
self.PluginViewList.setHorizontalHeaderItem(1, item)
item = QtGui.QTableWidgetItem()
self.PluginViewList.setHorizontalHeaderItem(2, item)
self.PluginViewList.horizontalHeader().setVisible(True)
self.PluginViewList.verticalHeader().setVisible(False)
self.ButtonBox = QtGui.QDialogButtonBox(PluginForm)
self.ButtonBox.setGeometry(QtCore.QRect(220, 350, 170, 25))
self.ButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok)
self.ButtonBox.setObjectName(u'ButtonBox')
self.retranslateUi(PluginForm)
QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL(u'accepted()'), PluginForm.close)
QtCore.QMetaObject.connectSlotsByName(PluginForm)
def retranslateUi(self, PluginForm):
PluginForm.setWindowTitle(translate(u'PluginForm', u'Plugin list'))
self.PluginViewList.horizontalHeaderItem(0).setText(translate(u'PluginForm', u'Name'))
self.PluginViewList.horizontalHeaderItem(1).setText(translate(u'PluginForm', u'Version'))
self.PluginViewList.horizontalHeaderItem(2).setText(translate(u'PluginForm', u'Status'))
def load(self):
"""
Load the plugin details into the screen
"""
for plugin in self.parent.plugin_manager.plugin_list:
row = self.PluginViewList.rowCount()
self.PluginViewList.setRowCount(row + 1)
item1 = QtGui.QTableWidgetItem(plugin[u'name'])
item1.setTextAlignment(QtCore.Qt.AlignVCenter)
item2 = QtGui.QTableWidgetItem(plugin[u'version'])
item2.setTextAlignment(QtCore.Qt.AlignVCenter)
item3 = QtGui.QTableWidgetItem(translate(u'PluginForm', plugin[u'status']))
item3.setTextAlignment(QtCore.Qt.AlignVCenter)
self.PluginViewList.setItem(row, 0, item1)
self.PluginViewList.setItem(row, 1, item2)
self.PluginViewList.setItem(row, 2, item3)
self.PluginViewList.setRowHeight(row, 15)

View File

@ -19,6 +19,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA
""" """
from mediaitem import PresentationMediaItem from mediaitem import PresentationMediaItem
from presentationtab import PresentationTab from presentationtab import PresentationTab
from impressslidecontroller import impressToolbar from impresscontroller import impressController
__all__ = ['PresentationMediaItem', 'PresentationTab', 'impressToolbar'] __all__ = ['PresentationMediaItem', 'PresentationTab', 'impressController']

View File

@ -20,14 +20,14 @@ Place, Suite 330, Boston, MA 02111-1307 USA
from PyQt4 import Qt, QtCore, QtGui from PyQt4 import Qt, QtCore, QtGui
from openlp.core.lib import SettingsTab, translate from openlp.core.lib import SettingsTab, translate, str_to_bool
class PresentationTab(SettingsTab): class PresentationTab(SettingsTab):
""" """
PresentationsTab is the Presentations settings tab in the settings dialog. PresentationsTab is the Presentations settings tab in the settings dialog.
""" """
def __init__(self): def __init__(self):
SettingsTab.__init__(self, translate(u'PresentationTab', u'Presentation'), u'Presentation') SettingsTab.__init__(self, translate(u'PresentationTab', u'Presentation'), u'Presentations')
def setupUi(self): def setupUi(self):
self.setObjectName(u'PresentationTab') self.setObjectName(u'PresentationTab')
@ -41,7 +41,6 @@ class PresentationTab(SettingsTab):
self.PresentationLeftLayout.setObjectName(u'PresentationLeftLayout') self.PresentationLeftLayout.setObjectName(u'PresentationLeftLayout')
self.PresentationLeftLayout.setSpacing(8) self.PresentationLeftLayout.setSpacing(8)
self.PresentationLeftLayout.setMargin(0) self.PresentationLeftLayout.setMargin(0)
self.VerseDisplayGroupBox = QtGui.QGroupBox(self) self.VerseDisplayGroupBox = QtGui.QGroupBox(self)
self.VerseDisplayGroupBox.setObjectName(u'VerseDisplayGroupBox') self.VerseDisplayGroupBox.setObjectName(u'VerseDisplayGroupBox')
self.VerseDisplayLayout = QtGui.QGridLayout(self.VerseDisplayGroupBox) self.VerseDisplayLayout = QtGui.QGridLayout(self.VerseDisplayGroupBox)
@ -53,36 +52,25 @@ class PresentationTab(SettingsTab):
self.VerseTypeLayout.setSpacing(8) self.VerseTypeLayout.setSpacing(8)
self.VerseTypeLayout.setMargin(0) self.VerseTypeLayout.setMargin(0)
self.VerseTypeLayout.setObjectName(u'VerseTypeLayout') self.VerseTypeLayout.setObjectName(u'VerseTypeLayout')
self.PowerpointCheckBox = QtGui.QCheckBox(self.VerseDisplayGroupBox) self.PowerpointCheckBox = QtGui.QCheckBox(self.VerseDisplayGroupBox)
self.PowerpointCheckBox.setTristate(False)
self.PowerpointCheckBox.setObjectName(u'PowerpointCheckBox') self.PowerpointCheckBox.setObjectName(u'PowerpointCheckBox')
self.VerseDisplayLayout.addWidget(self.PowerpointCheckBox, 0, 0, 1, 1) self.VerseDisplayLayout.addWidget(self.PowerpointCheckBox, 0, 0, 1, 1)
self.PowerpointPath = QtGui.QLineEdit(self.VerseDisplayGroupBox)
self.PowerpointPath.setObjectName(u'PowerpointPath')
self.VerseDisplayLayout.addWidget(self.PowerpointPath, 1, 0, 1, 1)
self.ImpressCheckBox = QtGui.QCheckBox(self.VerseDisplayGroupBox) self.ImpressCheckBox = QtGui.QCheckBox(self.VerseDisplayGroupBox)
self.ImpressCheckBox.setTristate(False)
self.ImpressCheckBox.setObjectName(u'ImpressCheckBox') self.ImpressCheckBox.setObjectName(u'ImpressCheckBox')
self.VerseDisplayLayout.addWidget(self.ImpressCheckBox, 2, 0, 1, 1) self.VerseDisplayLayout.addWidget(self.ImpressCheckBox, 2, 0, 1, 1)
self.ImpressPath = QtGui.QLineEdit(self.VerseDisplayGroupBox)
self.ImpressPath.setObjectName(u'ImpressPath')
self.VerseDisplayLayout.addWidget(self.ImpressPath, 3, 0, 1, 1)
self.PresentationThemeWidget = QtGui.QWidget(self.VerseDisplayGroupBox) self.PresentationThemeWidget = QtGui.QWidget(self.VerseDisplayGroupBox)
self.PresentationThemeWidget.setObjectName(u'PresentationThemeWidget') self.PresentationThemeWidget.setObjectName(u'PresentationThemeWidget')
self.PresentationThemeLayout = QtGui.QHBoxLayout(self.PresentationThemeWidget) self.PresentationThemeLayout = QtGui.QHBoxLayout(self.PresentationThemeWidget)
self.PresentationThemeLayout.setSpacing(8) self.PresentationThemeLayout.setSpacing(8)
self.PresentationThemeLayout.setMargin(0) self.PresentationThemeLayout.setMargin(0)
self.PresentationThemeLayout.setObjectName(u'PresentationThemeLayout') self.PresentationThemeLayout.setObjectName(u'PresentationThemeLayout')
self.PresentationLeftLayout.addWidget(self.VerseDisplayGroupBox) self.PresentationLeftLayout.addWidget(self.VerseDisplayGroupBox)
self.PresentationLeftSpacer = QtGui.QSpacerItem(40, 20, self.PresentationLeftSpacer = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.PresentationLeftLayout.addItem(self.PresentationLeftSpacer) self.PresentationLeftLayout.addItem(self.PresentationLeftSpacer)
self.PresentationLayout.addWidget(self.PresentationLeftWidget) self.PresentationLayout.addWidget(self.PresentationLeftWidget)
self.PresentationRightWidget = QtGui.QWidget(self) self.PresentationRightWidget = QtGui.QWidget(self)
self.PresentationRightWidget.setObjectName(u'PresentationRightWidget') self.PresentationRightWidget.setObjectName(u'PresentationRightWidget')
self.PresentationRightLayout = QtGui.QVBoxLayout(self.PresentationRightWidget) self.PresentationRightLayout = QtGui.QVBoxLayout(self.PresentationRightWidget)
@ -94,42 +82,15 @@ class PresentationTab(SettingsTab):
self.PresentationRightLayout.addItem(self.PresentationRightSpacer) self.PresentationRightLayout.addItem(self.PresentationRightSpacer)
self.PresentationLayout.addWidget(self.PresentationRightWidget) self.PresentationLayout.addWidget(self.PresentationRightWidget)
# Signals and slots
#QtCore.QObject.connect(self.NewChaptersCheckBox,
# QtCore.SIGNAL(u'stateChanged(int)'), self.onNewChaptersCheckBoxChanged)
def retranslateUi(self): def retranslateUi(self):
self.PowerpointCheckBox.setText(translate(u'PresentationTab', 'Powerpoint available:')) self.PowerpointCheckBox.setText(translate(u'PresentationTab', 'Powerpoint available:'))
self.ImpressCheckBox.setText(translate(u'PresentationTab', 'Impress available:')) self.ImpressCheckBox.setText(translate(u'PresentationTab', 'Impress available:'))
self.PowerpointPath.setText(u'powerpoint.exe ')
self.ImpressPath.setText(u'openoffice.org -nologo -show ')
def onNewChaptersCheckBoxChanged(self):
check_state = self.NewChaptersCheckBox.checkState()
self.show_new_chapters = False
if check_state == 2: # we have a set value convert to True/False
self.show_new_chapters = True
def load(self): def load(self):
pass self.PowerpointCheckBox.setChecked(int(self.config.get_config(u'Powerpoint', 0)))
# self.paragraph_style = (self.config.get_config(u'paragraph style', u'True')) self.ImpressCheckBox.setChecked(int(self.config.get_config(u'Impress', 0)))
# self.show_new_chapters = (self.config.get_config(u'display new chapter', u"False'))
# self.display_style = int(self.config.get_config(u'display brackets', u'0'))
# self.Presentation_theme = int(self.config.get_config(u'Presentation theme', u'0'))
# self.Presentation_search = (self.config.get_config(u'search as type', u'True'))
# if self.paragraph_style:
# self.ParagraphRadioButton.setChecked(True)
# else:
# self.VerseRadioButton.setChecked(True)
# self.NewChaptersCheckBox.setChecked(self.show_new_chapters)
# self.DisplayStyleComboBox.setCurrentIndex(self.display_style)
# self.PresentationSearchCheckBox.setChecked(self.Presentation_search)
def save(self): def save(self):
pass self.config.set_config(u'Powerpoint', unicode(self.PowerpointCheckBox.checkState()))
# self.config.set_config(u'paragraph style', unicode(self.paragraph_style)) self.config.set_config(u'Impress', unicode(self.ImpressCheckBox.checkState()))
# self.config.set_config(u'display new chapter', unicode(self.show_new_chapters)) print self.PowerpointCheckBox.checkState(), unicode(self.PowerpointCheckBox.checkState())
# self.config.set_config(u'display brackets', unicode(self.display_style))
# self.config.set_config(u'search as type', unicode(self.Presentation_search))
# self.config.set_config(u'Presentation theme', unicode(self.Presentation_theme))

View File

@ -24,7 +24,7 @@ import logging
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, MediaManagerItem from openlp.core.lib import Plugin, MediaManagerItem
from openlp.plugins.presentations.lib import PresentationMediaItem, PresentationTab, impressToolbar from openlp.plugins.presentations.lib import PresentationMediaItem, PresentationTab, impressController
class PresentationPlugin(Plugin): class PresentationPlugin(Plugin):
@ -66,17 +66,17 @@ class PresentationPlugin(Plugin):
If Not do not install the plugin. If Not do not install the plugin.
""" """
log.debug('check_pre_conditions') log.debug('check_pre_conditions')
impress = True
try: if int(self.config.get_config(u'Powerpoint', 0)) == 2:
#Check to see if we have uno installed try:
import uno #Check to see if we have uno installed
#openoffice = impressToolbar() import uno
self.registerControllers(u'Impress', None) #openoffice = impressController()
except: self.registerControllers(u'Impress', None)
pass except:
pass
#If we have no controllers disable plugin #If we have no controllers disable plugin
if len(self.controllers) > 0: if len(self.controllers) > 0:
return True return True
else: else:
return False return False
# return self.openoffice.checkOoPid()

View File

@ -18,4 +18,4 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA Place, Suite 330, Boston, MA 02111-1307 USA
""" """
from mediaitem import RemoteMediaItem from remotetab import RemoteTab

View File

@ -1,215 +0,0 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley
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
"""
import logging
from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, SongXMLParser, ServiceItem, translate, BaseListWithDnD
class RemoteListView(BaseListWithDnD):
def __init__(self, parent=None):
self.PluginName = u'Remote'
BaseListWithDnD.__init__(self, parent)
class RemoteMediaItem(MediaManagerItem):
"""
This is the custom media manager item for Custom Slides.
"""
global log
log=logging.getLogger(u'RemoteMediaItem')
log.info(u'Remote Media Item loaded')
def __init__(self, parent, icon, title):
MediaManagerItem.__init__(self, parent, icon, title)
self.parent = parent
self.TranslationContext = u'RemotesPlugin'
self.PluginTextShort = u'Remotes'
self.ConfigSection = u'Remotes'
self.ListViewWithDnD_class = RemoteListView
MediaManagerItem.__init__(self, parent, icon, title)
def initialise(self):
pass
def setupUi(self):
# Add a toolbar
self.addToolbar()
# # Create buttons for the toolbar
# ## New Custom Button ##
# self.addToolbarButton(
# translate(u'CustomMediaItem',u'New Custom Item'),
# translate(u'CustomMediaItem',u'Add a new Custom Item'),
# u':/custom/custom_new.png', self.onCustomNewClick, u'CustomNewItem')
# ## Edit Custom Button ##
# self.addToolbarButton(
# translate(u'CustomMediaItem',u'Edit Custom Item'),
# translate(u'CustomMediaItem',u'Edit the selected Custom Item'),
# u':/custom/custom_edit.png', self.onCustomEditClick, u'CustomEditItem')
# ## Delete Custom Button ##
# self.addToolbarButton(
# translate(u'CustomMediaItem',u'Delete Custom Item'),
# translate(u'CustomMediaItem',u'Delete the selected Custom Item'),
# u':/custom/custom_delete.png', self.onCustomDeleteClick, u'CustomDeleteItem')
# ## Separator Line ##
# self.addToolbarSeparator()
# ## Preview Custom Button ##
# self.addToolbarButton(
# translate(u'CustomMediaItem',u'Preview Custom Item'),
# translate(u'CustomMediaItem',u'Preview the selected Custom Item'),
# u':/system/system_preview.png', self.onCustomPreviewClick, u'CustomPreviewItem')
# ## Live Custom Button ##
# self.addToolbarButton(
# translate(u'CustomMediaItem',u'Go Live'),
# translate(u'CustomMediaItem', u'Send the selected Custom live'),
# u':/system/system_live.png', self.onCustomLiveClick, u'CustomLiveItem')
# ## Add Custom Button ##
# self.addToolbarButton(
# translate(u'CustomMediaItem',u'Add Custom To Service'),
# translate(u'CustomMediaItem',u'Add the selected Custom(s) to the service'),
# u':/system/system_add.png', self.onCustomAddClick, u'CustomAddItem')
# # Add the Customlist widget
# self.CustomWidget = QtGui.QWidget(self)
# sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
# sizePolicy.setHorizontalStretch(0)
# sizePolicy.setVerticalStretch(0)
# sizePolicy.setHeightForWidth(self.CustomWidget.sizePolicy().hasHeightForWidth())
# self.CustomWidget.setSizePolicy(sizePolicy)
# self.CustomWidget.setObjectName(u'CustomWidget')
# # Add the Custom widget to the page layout
# self.PageLayout.addWidget(self.CustomWidget)
# self.CustomListView = CustomList()
# self.CustomListView.setAlternatingRowColors(True)
# self.CustomListData = TextListData()
# self.CustomListView.setModel(self.CustomListData)
# self.CustomListView.setDragEnabled(True)
# self.PageLayout.addWidget(self.CustomListView)
# # Signals
# QtCore.QObject.connect(self.CustomListView,
# QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onCustomPreviewClick)
# #define and add the context menu
# self.CustomListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
# self.CustomListView.addAction(self.contextMenuAction(self.CustomListView,
# ':/custom/custom_edit.png', translate(u'CustomMediaItem', u'&Edit Custom'),
# self.onCustomEditClick))
# self.CustomListView.addAction(self.contextMenuSeparator(self.CustomListView))
# self.CustomListView.addAction(self.contextMenuAction(
# self.CustomListView, ':/system/system_preview.png',
# translate(u'CustomMediaItem',u'&Preview Custom'), self.onCustomPreviewClick))
# self.CustomListView.addAction(self.contextMenuAction(
# self.CustomListView, ':/system/system_live.png',
# translate(u'CustomMediaItem',u'&Show Live'), self.onCustomLiveClick))
# self.CustomListView.addAction(self.contextMenuAction(
# self.CustomListView, ':/system/system_add.png',
# translate(u'CustomMediaItem',u'&Add to Service'), self.onCustomAddClick))
# def retranslateUi(self):
# self.ClearTextButton.setText(translate(u'CustomMediaItem', u'Clear'))
# self.SearchTextButton.setText(translate(u'CustomMediaItem', u'Search'))
# def initialise(self):
# self.loadCustomList(self.parent.custommanager.get_all_slides())
#
# def loadCustomList(self, list):
# self.CustomListData.resetStore()
# for CustomSlide in list:
# self.CustomListData.addRow(CustomSlide.id,CustomSlide.title)
#
# def onClearTextButtonClick(self):
# """
# Clear the search text.
# """
# self.SearchTextEdit.clear()
#
# def onSearchTextEditChanged(self, text):
# # only search if > 3 characters
# if len(text) > 3:
# self.onSearchTextButtonClick()
#
# def onSearchTextButtonClick(self):
# search_keywords = str(self.SearchTextEdit.displayText())
# search_results = []
# search_type = self.SearchTypeComboBox.currentText()
# search_results = self.Custommanager.search_Custom_lyrics(search_keywords)
# self._display_results(search_results)
#
# def onCustomNewClick(self):
# self.parent.edit_custom_form.loadCustom(0)
# self.parent.edit_custom_form.exec_()
# self.initialise()
#
# def onCustomEditClick(self):
# indexes = self.CustomListView.selectedIndexes()
# for index in indexes:
# self.parent.edit_custom_form.loadCustom(self.CustomListData.getId(index))
# self.parent.edit_custom_form.exec_()
# self.initialise()
#
# def onCustomDeleteClick(self):
# indexes = self.CustomListView.selectedIndexes()
# for index in indexes:
# id = self.CustomListData.getId(index)
# self.parent.custommanager.delete_custom(id)
# self.CustomListData.deleteRow(index)
#
# def onCustomPreviewClick(self):
# log.debug(u'Custom Preview Requested')
# service_item = ServiceItem(self.parent)
# service_item.addIcon(u':/media/media_song.png')
# self.generateSlideData(service_item)
# self.parent.preview_controller.addServiceItem(service_item)
#
# def onCustomLiveClick(self):
# log.debug(u'Custom Live Requested')
# service_item = ServiceItem(self.parent)
# service_item.addIcon(u':/media/media_song.png')
# self.generateSlideData(service_item)
# self.parent.live_controller.addServiceItem(service_item)
#
# def onCustomAddClick(self):
# log.debug(u'Custom Add Requested')
# service_item = ServiceItem(self.parent)
# service_item.addIcon(u':/media/media_song.png')
# self.generateSlideData(service_item)
# self.parent.service_manager.addServiceItem(service_item)
#
# def generateSlideData(self, service_item):
# raw_slides =[]
# raw_footer = []
# slide = None
# theme = None
# indexes = self.CustomListView.selectedIndexes()
# for index in indexes:
# id = self.CustomListData.getId(index)
# customSlide = self.parent.custommanager.get_custom(id)
# title = customSlide.title
# credit = customSlide.credits
# theme = customSlide.theme_name
# if len(theme) is not 0 :
# service_item.theme = theme
# songXML=SongXMLParser(customSlide.text)
# verseList = songXML.get_verses()
# for verse in verseList:
# raw_slides.append(verse[1])
# raw_footer.append(title + u' '+ credit)
# if theme is not None:
# service_item.title = title
# for slide in raw_slides:
# service_item.add_from_text(slide[:30], slide)
# service_item.raw_footer = raw_footer

View File

@ -23,6 +23,7 @@ import sys
from PyQt4 import QtNetwork, QtGui, QtCore from PyQt4 import QtNetwork, QtGui, QtCore
from openlp.core.lib import Plugin, Event, EventType from openlp.core.lib import Plugin, Event, EventType
from openlp.plugins.remotes.lib import RemoteTab
class RemotesPlugin(Plugin): class RemotesPlugin(Plugin):
@ -35,10 +36,16 @@ class RemotesPlugin(Plugin):
Plugin.__init__(self, u'Remotes', u'1.9.0', plugin_helpers) Plugin.__init__(self, u'Remotes', u'1.9.0', plugin_helpers)
self.weight = -1 self.weight = -1
self.server = QtNetwork.QUdpSocket() self.server = QtNetwork.QUdpSocket()
self.server.bind(4316) self.server.bind(int(self.config.get_config(u'remote port', 4316)))
QtCore.QObject.connect(self.server, QtCore.QObject.connect(self.server,
QtCore.SIGNAL(u'readyRead()'), self.readData) QtCore.SIGNAL(u'readyRead()'), self.readData)
def get_settings_tab(self):
"""
Create the settings Tab
"""
return RemoteTab()
def readData(self): def readData(self):
log.info(u'Remoted data has arrived') log.info(u'Remoted data has arrived')
while self.server.hasPendingDatagrams(): while self.server.hasPendingDatagrams():

View File

@ -0,0 +1,108 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PluginViewDialog</class>
<widget class="QWidget" name="PluginViewDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>393</height>
</rect>
</property>
<property name="windowTitle">
<string>Plugin list</string>
</property>
<widget class="QTableWidget" name="PluginViewList">
<property name="geometry">
<rect>
<x>20</x>
<y>10</y>
<width>371</width>
<height>331</height>
</rect>
</property>
<property name="showGrid">
<bool>false</bool>
</property>
<property name="gridStyle">
<enum>Qt::SolidLine</enum>
</property>
<property name="rowCount">
<number>1</number>
</property>
<attribute name="horizontalHeaderVisible">
<bool>true</bool>
</attribute>
<attribute name="horizontalHeaderShowSortIndicator" stdset="0">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<row/>
<column>
<property name="text">
<string>Name</string>
</property>
</column>
<column>
<property name="text">
<string>Version</string>
</property>
</column>
<column>
<property name="text">
<string>Status</string>
</property>
</column>
<item row="0" column="0">
<property name="text">
<string>qqq</string>
</property>
</item>
<item row="0" column="1">
<property name="text">
<string>aaa</string>
</property>
</item>
<item row="0" column="2">
<property name="text">
<string>ccc</string>
</property>
</item>
</widget>
<widget class="QDialogButtonBox" name="ButtonBox">
<property name="geometry">
<rect>
<x>220</x>
<y>350</y>
<width>170</width>
<height>25</height>
</rect>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Ok</set>
</property>
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>ButtonBox</sender>
<signal>accepted()</signal>
<receiver>PluginViewDialog</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>370</x>
<y>364</y>
</hint>
<hint type="destinationlabel">
<x>460</x>
<y>367</y>
</hint>
</hints>
</connection>
</connections>
</ui>