Head r634

This commit is contained in:
Jon Tibble 2009-10-29 15:20:28 +00:00
commit 1cf8b9c1b7
32 changed files with 329 additions and 129 deletions

View File

@ -78,6 +78,9 @@ class EventReceiver(QtCore.QObject):
``{plugin}_stop``
Requests a plugin to handle a stop event
``{plugin}_edit``
Requests a plugin edit a database item with the key as the payload
``songusage_live``
Sends live song audit requests to the audit component
@ -93,10 +96,14 @@ class EventReceiver(QtCore.QObject):
``preview_song``
Tells the song plugin the edit has finished and the song can be previewed
Only available if the edit was triggered by the Preview button.
``slidecontroller_change``
Informs the slidecontroller that a slide change has occurred
``remote_edite_clear``
Informs all components that remote edit has been aborted.
"""
global log
log = logging.getLogger(u'EventReceiver')
@ -154,4 +161,4 @@ class Receiver():
"""
Get the global ``eventreceiver`` instance.
"""
return Receiver.eventreceiver
return Receiver.eventreceiver

View File

@ -70,6 +70,7 @@ class ServiceItem(object):
self.theme = None
self.service_item_path = None
self.service_item_type = None
self.editEnabled = False
self.service_frames = []
def addIcon(self, icon):

View File

@ -45,6 +45,7 @@ class SettingsTab(QtGui.QWidget):
"""
QtGui.QWidget.__init__(self)
self.tabTitle = title
self.tabTitleVisible = None
self.setupUi()
self.retranslateUi()
self.initialise()
@ -54,21 +55,6 @@ class SettingsTab(QtGui.QWidget):
self.config = PluginConfig(section)
self.load()
def setTitle(self, title):
"""
Set the title of the tab.
``title``
The title of the tab, which is usually displayed on the tab.
"""
self.tabTitle = title
def title(self):
"""
Get the title of the tab.
"""
return self.tabTitle
def setupUi(self):
"""
Setup the tab's interface.

View File

@ -32,13 +32,12 @@ class AlertsTab(SettingsTab):
"""
def __init__(self):
SettingsTab.__init__(self, u'Alerts', u'Alerts')
# Use the line below when pulling the translation template file.
#SettingsTab.__init__(self, self.trUtf8(u'Alerts'), u'Alerts')
self.font_color = '#ffffff'
self.bg_color = '#660000'
def setupUi(self):
self.setObjectName(u'AlertsTab')
self.tabTitleVisible = self.trUtf8(u'Alerts')
self.AlertsLayout = QtGui.QHBoxLayout(self)
self.AlertsLayout.setSpacing(8)
self.AlertsLayout.setMargin(8)

View File

@ -33,11 +33,10 @@ class GeneralTab(SettingsTab):
def __init__(self, screen_list):
self.screen_list = screen_list
SettingsTab.__init__(self, u'General', u'General')
# Use this line when pulling the translation template
#SettingsTab.__init__(self, self.trUtf8(u'General'), u'General')
def setupUi(self):
self.setObjectName(u'GeneralTab')
self.tabTitleVisible = self.trUtf8(u'General')
self.GeneralLayout = QtGui.QHBoxLayout(self)
self.GeneralLayout.setSpacing(8)
self.GeneralLayout.setMargin(8)

View File

@ -38,6 +38,24 @@ class ServiceManagerList(QtGui.QTreeWidget):
QtGui.QTreeWidget.__init__(self,parent)
self.parent = parent
# def mousePressEvent(self, event):
# if event.button() == QtCore.Qt.RightButton:
# item = self.itemAt(event.pos())
# parentitem = item.parent()
# if parentitem is None:
# pos = item.data(0, QtCore.Qt.UserRole).toInt()[0]
# else:
# pos = parentitem.data(0, QtCore.Qt.UserRole).toInt()[0]
# serviceItem = self.parent.serviceItems[pos - 1]
# if serviceItem[u'data'].editEnabled:
# self.parent.editAction.setVisible(True)
# else:
# self.parent.editAction.setVisible(False)
# event.accept()
# else:
# event.ignore()
def keyPressEvent(self, event):
if type(event) == QtGui.QKeyEvent:
#here accept the event and do something
@ -111,6 +129,7 @@ class ServiceManager(QtGui.QWidget):
self.serviceItems = []
self.serviceName = u''
self.isNew = True
self.remoteEditTriggered = False
self.Layout = QtGui.QVBoxLayout(self)
self.Layout.setSpacing(0)
self.Layout.setMargin(0)
@ -157,6 +176,12 @@ class ServiceManager(QtGui.QWidget):
# Add a context menu to the service manager list
self.ServiceManagerList.setContextMenuPolicy(
QtCore.Qt.ActionsContextMenu)
self.editAction = contextMenuAction(
self.ServiceManagerList, ':/system/system_live.png',
self.trUtf8(u'&Edit Item'), self.remoteEdit)
self.ServiceManagerList.addAction(self.editAction)
self.ServiceManagerList.addAction(contextMenuSeparator(
self.ServiceManagerList))
self.ServiceManagerList.addAction(contextMenuAction(
self.ServiceManagerList, ':/system/system_preview.png',
self.trUtf8(u'&Preview Verse'), self.makePreview))
@ -205,6 +230,8 @@ class ServiceManager(QtGui.QWidget):
QtCore.SIGNAL(u'itemExpanded(QTreeWidgetItem*)'), self.expanded)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'update_themes'), self.updateThemeList)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'remote_edit_clear'), self.onRemoteEditClear)
# Last little bits of setting up
self.config = PluginConfig(u'ServiceManager')
self.servicePath = self.config.get_data_path()
@ -510,14 +537,19 @@ class ServiceManager(QtGui.QWidget):
"""
sitem, count = self.findServiceItem()
item.render()
if sitem == -1:
self.serviceItems.append({u'data': item,
u'order': len(self.serviceItems) + 1, u'expanded':True})
self.repaintServiceList(len(self.serviceItems) + 1, 0)
else:
self.serviceItems.insert(sitem + 1, {u'data': item,
u'order': len(self.serviceItems)+1, u'expanded':True})
if self.remoteEditTriggered:
self.serviceItems[sitem][u'data'] = item
self.remoteEditTriggered = False
self.repaintServiceList(sitem + 1, 0)
else:
if sitem == -1:
self.serviceItems.append({u'data': item,
u'order': len(self.serviceItems) + 1, u'expanded':True})
self.repaintServiceList(len(self.serviceItems) + 1, 0)
else:
self.serviceItems.insert(sitem + 1, {u'data': item,
u'order': len(self.serviceItems)+1, u'expanded':True})
self.repaintServiceList(sitem + 1, 0)
self.parent.serviceChanged(False, self.serviceName)
def makePreview(self):
@ -536,6 +568,19 @@ class ServiceManager(QtGui.QWidget):
self.parent.LiveController.addServiceManagerItem(
self.serviceItems[item][u'data'], count)
def remoteEdit(self):
"""
Posts a remote edit message to a plugin to allow item to be edited.
"""
item, count = self.findServiceItem()
if self.serviceItems[item][u'data'].editEnabled:
self.remoteEditTriggered = True
Receiver().send_message(u'%s_edit' % self.serviceItems[item][u'data'].name,
self.serviceItems[item][u'data'].editId )
def onRemoteEditClear(self):
self.remoteEditTriggered = False
def findServiceItem(self):
"""
Finds a ServiceItem in the list

View File

@ -36,20 +36,25 @@ class Ui_SettingsDialog(object):
self.SettingsTabWidget.setObjectName(u'SettingsTabWidget')
self.SettingsLayout.addWidget(self.SettingsTabWidget)
self.ButtonsBox = QtGui.QDialogButtonBox(SettingsDialog)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.ButtonsBox.sizePolicy().hasHeightForWidth())
sizePolicy.setHeightForWidth(
self.ButtonsBox.sizePolicy().hasHeightForWidth())
self.ButtonsBox.setSizePolicy(sizePolicy)
self.ButtonsBox.setMaximumSize(QtCore.QSize(16777215, 16777215))
self.ButtonsBox.setOrientation(QtCore.Qt.Horizontal)
self.ButtonsBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.ButtonsBox.setStandardButtons(
QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.ButtonsBox.setObjectName(u'ButtonsBox')
self.SettingsLayout.addWidget(self.ButtonsBox)
self.retranslateUi(SettingsDialog)
self.SettingsTabWidget.setCurrentIndex(0)
QtCore.QObject.connect(self.ButtonsBox, QtCore.SIGNAL(u'accepted()'), SettingsDialog.accept)
QtCore.QObject.connect(self.ButtonsBox, QtCore.SIGNAL(u'rejected()'), SettingsDialog.reject)
QtCore.QObject.connect(self.ButtonsBox,
QtCore.SIGNAL(u'accepted()'), SettingsDialog.accept)
QtCore.QObject.connect(self.ButtonsBox,
QtCore.SIGNAL(u'rejected()'), SettingsDialog.reject)
QtCore.QMetaObject.connectSlotsByName(SettingsDialog)
def retranslateUi(self, SettingsDialog):

View File

@ -48,18 +48,19 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
self.addTab(u'Alerts', self.AlertsTab)
def addTab(self, name, tab):
log.info(u'Adding %s tab' % tab.title())
self.SettingsTabWidget.addTab(tab, tab.title())
log.info(u'Adding %s tab' % tab.tabTitle)
self.SettingsTabWidget.addTab(tab, tab.tabTitleVisible)
def insertTab(self, tab, location):
log.debug(u'Inserting %s tab' % tab.title())
self.SettingsTabWidget.insertTab(location + 13, tab, tab.title())
log.debug(u'Inserting %s tab' % tab.tabTitle)
#13 : There are 3 tables currently and locations starts at -10
self.SettingsTabWidget.insertTab(location + 13, tab, tab.tabTitleVisible)
def removeTab(self, name):
log.debug(u'remove %s tab' % name)
for tab_index in range(0, self.SettingsTabWidget.count()):
if self.SettingsTabWidget.widget(tab_index) is not None:
if self.SettingsTabWidget.widget(tab_index).title() == name:
if self.SettingsTabWidget.widget(tab_index).tabTitle == name:
self.SettingsTabWidget.removeTab(tab_index)
def accept(self):

View File

@ -266,16 +266,7 @@ class ThemeManager(QtGui.QWidget):
try:
xml = file_to_xml(xml_file)
except:
newtheme = ThemeXML()
newtheme.new_document(self.trUtf8(u'New Theme'))
newtheme.add_background_solid(unicode(u'#000000'))
newtheme.add_font(unicode(QtGui.QFont().family()),
unicode(u'#FFFFFF'), unicode(30), u'False')
newtheme.add_font(unicode(QtGui.QFont().family()),
unicode(u'#FFFFFF'), unicode(12), u'False', u'footer')
newtheme.add_display(u'False', unicode(u'#FFFFFF'), u'False',
unicode(u'#FFFFFF'), unicode(0), unicode(0), unicode(0))
xml = newtheme.extract_xml()
xml = self.baseTheme()
theme = ThemeXML()
theme.parse(xml)
self.cleanTheme(theme)
@ -454,7 +445,7 @@ class ThemeManager(QtGui.QWidget):
def baseTheme(self):
log.debug(u'base theme created')
newtheme = ThemeXML()
newtheme.new_document(self.trUtf8(u'New Theme'))
newtheme.new_document(unicode(self.trUtf8(u'New Theme')))
newtheme.add_background_solid(unicode(u'#000000'))
newtheme.add_font(unicode(QtGui.QFont().family()), unicode(u'#FFFFFF'),
unicode(30), u'False')

View File

@ -33,11 +33,10 @@ class ThemesTab(SettingsTab):
def __init__(self, parent):
self.parent = parent
SettingsTab.__init__(self, u'Themes', u'Themes')
# Use the line below when pulling the translation template file.
#SettingsTab.__init__(self, self.trUtf8(u'Themes'), u'Themes')
def setupUi(self):
self.setObjectName(u'ThemesTab')
self.tabTitleVisible = self.trUtf8(u'Themes')
self.ThemesTabLayout = QtGui.QHBoxLayout(self)
self.ThemesTabLayout.setSpacing(8)
self.ThemesTabLayout.setMargin(8)

View File

@ -250,8 +250,6 @@ class Ui_BibleImportDialog(object):
self.LocationComboBox.setItemText(0, self.trUtf8(u'Crosswalk'))
self.LocationComboBox.setItemText(1, self.trUtf8(u'BibleGateway'))
self.BibleLabel.setText(self.trUtf8(u'Bible:'))
self.BibleComboBox.setItemText(1, self.trUtf8(u'NIV'))
self.BibleComboBox.setItemText(2, self.trUtf8(u'KJV'))
self.ProxyGroupBox.setTitle(self.trUtf8(u'Proxy Settings (Optional)'))
self.AddressLabel.setText(self.trUtf8(u'Proxy Address:'))
self.UsernameLabel.setText(self.trUtf8(u'Username:'))

View File

@ -50,21 +50,43 @@ class BibleImportForm(QtGui.QDialog, Ui_BibleImportDialog):
self.bible_type = None
self.barmax = 0
self.tabWidget.setCurrentIndex(0)
self.cwBibleVersions = {}
self.bgBibleVersions = {}
self.AddressEdit.setText(self.config.get_config(u'proxy_address', u''))
self.UsernameEdit.setText(self.config.get_config(u'proxy_username',u''))
self.PasswordEdit.setText(self.config.get_config(u'proxy_password',u''))
#Load and store Crosswalk Bibles
filepath = os.path.split(os.path.abspath(__file__))[0]
filepath = os.path.abspath(os.path.join(filepath, u'..',
u'resources', u'crosswalkbooks.csv'))
fbibles=open(filepath, 'r')
self.bible_versions = {}
try:
fbibles = open(filepath, 'r')
for line in fbibles:
p = line.split(u',')
self.cwBibleVersions[p[0]] = p[1].replace(u'\n', u'')
except:
log.exception(u'Crosswalk resources missing')
#Load and store BibleGateway Bibles
filepath = os.path.split(os.path.abspath(__file__))[0]
filepath = os.path.abspath(os.path.join(filepath, u'..',
u'resources', u'biblegateway.csv'))
try:
fbibles = open(filepath, 'r')
for line in fbibles:
p = line.split(u',')
self.bgBibleVersions[p[0]] = p[1].replace(u'\n', u'')
except:
log.exception(u'Biblegateway resources missing')
self.loadBibleCombo(self.cwBibleVersions)
self.cwActive = True
def loadBibleCombo(self, biblesList):
self.BibleComboBox.clear()
self.BibleComboBox.addItem(u'')
for line in fbibles:
p = line.split(u',')
self.bible_versions[p[0]] = p[1].replace(u'\n', u'')
self.BibleComboBox.addItem(unicode(p[0]))
for bible in biblesList:
row = self.BibleComboBox.count()
self.BibleComboBox.addItem(unicode(self.trUtf8(bible)))
self.BibleComboBox.setItemData(row, QtCore.QVariant(bible))
#Combo Boxes
QtCore.QObject.connect(self.LocationComboBox,
@ -101,7 +123,8 @@ class BibleImportForm(QtGui.QDialog, Ui_BibleImportDialog):
def onVersesFileButtonClicked(self):
filename = QtGui.QFileDialog.getOpenFileName(
self, self.trUtf8(u'Open file'), self.config.get_last_dir(1))
self, self.trUtf8(u'Open Bible Verses file'),
self.config.get_last_dir(1))
if filename != u'':
self.VerseLocationEdit.setText(filename)
self.config.set_last_dir(filename, 1)
@ -109,7 +132,8 @@ class BibleImportForm(QtGui.QDialog, Ui_BibleImportDialog):
def onBooksFileButtonClicked(self):
filename = QtGui.QFileDialog.getOpenFileName(
self, self.trUtf8(u'Open file'), self.config.get_last_dir(2))
self, self.trUtf8(u'Open Bible Books file'),
self.config.get_last_dir(2))
if filename != u'':
self.BooksLocationEdit.setText(filename)
self.config.set_last_dir(filename, 2)
@ -117,7 +141,8 @@ class BibleImportForm(QtGui.QDialog, Ui_BibleImportDialog):
def onOsisFileButtonClicked(self):
filename = QtGui.QFileDialog.getOpenFileName(
self, self.trUtf8(u'Open file'), self.config.get_last_dir(3))
self, self.trUtf8(u'Open OSIS import file'),
self.config.get_last_dir(3))
if filename != u'':
self.OSISLocationEdit.setText(filename)
self.config.set_last_dir(filename, 3)
@ -150,12 +175,19 @@ class BibleImportForm(QtGui.QDialog, Ui_BibleImportDialog):
self.config.set_config(
u'proxy_password', unicode(self.PasswordEdit.displayText()))
def onLocationComboBoxSelected(self):
def onLocationComboBoxSelected(self, value):
if value == 0:
self.loadBibleCombo(self.cwBibleVersions)
self.cwActive = True
else:
self.loadBibleCombo(self.bgBibleVersions)
self.cwActive = False
self.checkHttp()
def onBibleComboBoxSelected(self):
def onBibleComboBoxSelected(self, value):
self.checkHttp()
self.BibleNameEdit.setText(unicode(self.BibleComboBox.currentText()))
self.VersionNameEdit.setText(unicode(self.BibleComboBox.currentText()))
def onCancelButtonClicked(self):
# tell import to stop
@ -210,8 +242,12 @@ class BibleImportForm(QtGui.QDialog, Ui_BibleImportDialog):
else:
# set a value as it will not be needed
self.setMax(1)
bible = self.bible_versions[
unicode(self.BibleComboBox.currentText())]
if self.cwActive:
bible = self.cwBibleVersions[
unicode(self.BibleComboBox.currentText())]
else:
bible = self.bgBibleVersions[
unicode(self.BibleComboBox.currentText())]
loaded = self.biblemanager.register_http_bible(
unicode(self.BibleComboBox.currentText()),
unicode(self.LocationComboBox.currentText()),

View File

@ -50,12 +50,11 @@ class BGExtract(BibleCommon):
"""
log.debug(u'get_bible_chapter %s,%s,%s',
version, bookname, chapter)
version=u'nasb'
urlstring = \
u'http://www.biblegateway.com/passage/?search=%s %s&version=%s' % \
(bookname, unicode(chapter) , version)
u'http://www.biblegateway.com/passage/?search=%s+%d&version=%s' % \
(bookname, chapter, version)
log.debug(u'BibleGateway urm = %s' % urlstring)
xml_string = self._get_web_text(urlstring, self.proxyurl)
#print xml_string
verseSearch = u'<sup class=\"versenum'
verseFootnote = u'<sup class=\'footnote'
verse = 1
@ -68,13 +67,15 @@ class BGExtract(BibleCommon):
verseText = u''
versePos = xml_string.find(u'</sup>', versePos) + 6
i = xml_string.find(verseSearch, versePos + 1)
# Not sure if this is needed now
if i == -1:
i = xml_string.find(u'</div', versePos + 1)
j = xml_string.find(u'<strong', versePos + 1)
if j > 0 and j < i:
i = j
verseText = xml_string[versePos + 7 : i ]
bible[verse] = self._clean_text(verseText) # store the verse
# store the verse
bible[verse] = self._clean_text(verseText)
versePos = -1
else:
verseText = xml_string[versePos: i]
@ -85,8 +86,10 @@ class BGExtract(BibleCommon):
start_tag = verseText.find(verseFootnote)
# Chop off verse and start again
xml_string = xml_string[i:]
versePos = xml_string.find(verseSearch) #look for the next verse
bible[verse] = self._clean_text(verseText) # store the verse
#look for the next verse
versePos = xml_string.find(verseSearch)
# store the verse
bible[verse] = self._clean_text(verseText)
verse += 1
return SearchResults(bookname, chapter, bible)

View File

@ -42,10 +42,10 @@ class BiblesTab(SettingsTab):
self.show_new_chapters = False
self.display_style = 0
SettingsTab.__init__(self, u'Bibles', u'Bibles')
#SettingsTab.__init__(self, self.trUtf8(u'Bibles'), u'Bibles')
def setupUi(self):
self.setObjectName(u'BiblesTab')
self.tabTitleVisible = self.trUtf8(u'Bibles')
self.BibleLayout = QtGui.QHBoxLayout(self)
self.BibleLayout.setSpacing(8)
self.BibleLayout.setMargin(8)

View File

@ -66,15 +66,7 @@ class BibleManager(object):
self.bibleSuffix = u'sqlite'
self.dialogobject = None
self.reload_bibles()
def set_media_manager(self, media):
"""
Sets the reference to the media manager.
``media``
The reference to the media manager.
"""
self.media = media
self.media = None
def reload_bibles(self):
log.debug(u'Reload bibles')

View File

@ -271,7 +271,7 @@ class BibleMediaItem(MediaManagerItem):
def initialise(self):
log.debug(u'bible manager initialise')
self.loadBibles()
self.parent.biblemanager.set_media_manager(self)
self.parent.biblemanager.media = self
self.configUpdated()
log.debug(u'bible manager initialise complete')

View File

@ -0,0 +1,80 @@
Amuzgo de Guerrero,AMU
Arabic Life Application Bible,ALAB
Bulgarian Bible,BULG
1940 Bulgarian Bible,BG1940
Chinanteco de Comaltepec,CCO
Cakchiquel Occidental,CKW
Haitian Creole Version,HCV
Slovo na cestu,SNC
Dette er Biblen på dansk,DN1933
Hoffnung für Alle,HOF
Luther Bibel 1545,LUTH1545
New International Version,NIV
New American Standard Bible,NASB
The Message,MSG
Amplified Bible,AMP
New Living Translation,NLT
King James Version,KJV
English Standard Version,ESV
Contemporary English Version,CEV
New King James Version,NKJV
New Century Version,NCV
21st Century King James Version,KJ21
American Standard Version,ASV
Young's Literal Translation,YLT
Darby Translation,DARBY
Holman Christian Standard Bible,HCSB
New International Reader's Version,NIRV
Wycliffe New Testament,WYC
Worldwide English (New Testament),WE
New International Version - UK,NIVUK
Today's New International Version,TNIV
Reina-Valera 1960,RVR1960
Nueva Versión Internacional,NVI
Reina-Valera 1995,RVR1995
Castilian,CST
Reina-Valera Antigua,RVA
Biblia en Lenguaje Sencillo,BLS
La Biblia de las Américas,LBLA
Louis Segond,LSG
La Bible du Semeur,BDS
1881 Westcott-Hort New Testament,WHNU
1550 Stephanus New Testament,TR1550
1894 Scrivener New Testament,TR1894
The Westminster Leningrad Codex,WLC
Hiligaynon Bible,HLGN
Croatian Bible,CRO
Hungarian Károli,KAR
Icelandic Bible,ICELAND
La Nuova Diodati,LND
La Parola è Vita,LM
Jacalteco, Oriental,JAC
Kekchi,KEK
Korean Bible,KOREAN
Maori Bible,MAORI
Macedonian New Testament,MNT
Mam, Central,MVC
Mam de Todos Santos Chuchumatán,MVJ
Reimer 2001,REIMER
Náhuatl de Guerrero,NGU
Het Boek,HTB
Det Norsk Bibelselskap 1930,DNB1930
Levande Bibeln,LB
O Livro,OL
João Ferreira de Almeida Atualizada,AA
Quiché, Centro Occidental,QUT
Romanian,RMNN
Romanian,TLCR
Russian Synodal Version,RUSV
Slovo Zhizny,SZ
Nádej pre kazdého,NPK
Albanian Bible,ALB
Levande Bibeln,SVL
Svenska 1917,SV1917
Swahili New Testament,SNT
Ang Salita ng Diyos,SND
Ukrainian Bible,UKR
Uspanteco,USP
1934 Vietnamese Bible,VIET
Chinese Union Version (Simplified),CUVS
Chinese Union Version (Traditional),CUV
Can't render this file because it has a wrong number of fields in line 51.

View File

@ -69,4 +69,4 @@ class CustomPlugin(Plugin):
self.remove_toolbox_item()
def about(self):
return u'<b>Custom Plugin</b> <br>This plugin allows slides to be displayed on the screen in the same way songs are. The difference between this plugin and songs is this plugin provides greater freedom.<br><br>This is a core plugin and cannot be made inactive</b>'
return u'<b>Custom Plugin</b> <br>This plugin allows slides to be displayed on the screen in the same way songs are. The difference between this plugin and songs is this plugin provides greater freedom.<br>'

View File

@ -54,7 +54,8 @@ class Ui_customEditDialog(object):
self.UpButton.setIcon(icon1)
self.UpButton.setObjectName(u'UpButton')
self.verticalLayout.addWidget(self.UpButton)
spacerItem = QtGui.QSpacerItem(20, 128, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
spacerItem = QtGui.QSpacerItem(20, 128,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.verticalLayout.addItem(spacerItem)
self.DownButton = QtGui.QPushButton(customEditDialog)
icon2 = buildIcon(u':/services/service_down.png')
@ -94,7 +95,8 @@ class Ui_customEditDialog(object):
self.ClearButton = QtGui.QPushButton(self.ButtonWidge)
self.ClearButton.setObjectName(u'ClearButton')
self.verticalLayout_2.addWidget(self.ClearButton)
spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
spacerItem1 = QtGui.QSpacerItem(20, 40,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.verticalLayout_2.addItem(spacerItem1)
self.EditLayout_3.addWidget(self.ButtonWidge)
self.gridLayout.addWidget(self.EditWidget, 2, 0, 1, 1)
@ -117,11 +119,16 @@ class Ui_customEditDialog(object):
self.horizontalLayout_2.addWidget(self.CreditEdit)
self.gridLayout.addLayout(self.horizontalLayout_2, 4, 0, 1, 1)
self.buttonBox = QtGui.QDialogButtonBox(customEditDialog)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setStandardButtons(
QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(u'buttonBox')
self.gridLayout.addWidget(self.buttonBox, 5, 0, 1, 1)
self.retranslateUi(customEditDialog)
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'rejected()'), customEditDialog.closePressed)
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'accepted()'), customEditDialog.accept)
QtCore.QMetaObject.connectSlotsByName(customEditDialog)
customEditDialog.setTabOrder(self.TitleEdit, self.VerseTextEdit)
customEditDialog.setTabOrder(self.VerseTextEdit, self.AddButton)

View File

@ -40,10 +40,6 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
#self.parent = parent
self.setupUi(self)
# Connecting signals and slots
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'rejected()'), self.rejected)
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'accepted()'), self.accept)
QtCore.QObject.connect(self.AddButton,
QtCore.SIGNAL(u'pressed()'), self.onAddButtonPressed)
QtCore.QObject.connect(self.EditButton,
@ -113,6 +109,10 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
else:
self.ThemeComboBox.setCurrentIndex(0)
def closePressed(self):
Receiver().send_message(u'remote_edit_clear')
self.close()
def accept(self):
valid, message = self._validate()
if not valid:
@ -132,9 +132,7 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
self.customSlide.credits = unicode(self.CreditEdit.displayText())
self.customSlide.theme_name = unicode(self.ThemeComboBox.currentText())
self.custommanager.save_slide(self.customSlide)
self.close()
def rejected(self):
Receiver().send_message(u'load_custom_list')
self.close()
def onUpButtonPressed(self):

View File

@ -26,7 +26,7 @@ import logging
from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, SongXMLParser, BaseListWithDnD
from openlp.core.lib import MediaManagerItem, SongXMLParser, BaseListWithDnD, Receiver
class CustomListView(BaseListWithDnD):
def __init__(self, parent=None):
@ -53,6 +53,15 @@ class CustomMediaItem(MediaManagerItem):
self.servicePath = None
MediaManagerItem.__init__(self, parent, icon, title)
self.parent = parent
self.fromServiceManager = -1
def addEndHeaderBar(self):
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'%s_edit' % self.parent.name), self.onRemoteEdit)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'remote_edit_clear' ), self.onRemoteEditClear)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'load_custom_list'), self.initialise)
def initPluginNameVisible(self):
self.PluginNameVisible = self.trUtf8(self.PluginNameShort)
@ -71,12 +80,24 @@ class CustomMediaItem(MediaManagerItem):
custom_name.setData(
QtCore.Qt.UserRole, QtCore.QVariant(CustomSlide.id))
self.ListView.addItem(custom_name)
if CustomSlide.id == self.fromServiceManager:
self.onAddClick()
def onNewClick(self):
self.parent.edit_custom_form.loadCustom(0)
self.parent.edit_custom_form.exec_()
self.initialise()
def onRemoteEditClear(self):
self.fromServiceManager = -1
def onRemoteEdit(self, item_id):
valid = self.parent.custommanager.get_custom(item_id)
if valid is not None:
self.fromServiceManager = item_id
self.parent.edit_custom_form.loadCustom(item_id)
self.parent.edit_custom_form.exec_()
def onEditClick(self):
item = self.ListView.currentItem()
if item is not None:
@ -98,13 +119,19 @@ class CustomMediaItem(MediaManagerItem):
raw_footer = []
slide = None
theme = None
item = self.ListView.currentItem()
if item is None:
return False
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
if self.fromServiceManager == -1:
item = self.ListView.currentItem()
if item is None:
return False
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
else:
item_id = self.fromServiceManager
self.fromServiceManager = -1
customSlide = self.parent.custommanager.get_custom(item_id)
title = customSlide.title
credit = customSlide.credits
service_item.editEnabled = True
service_item.editId = item_id
theme = customSlide.theme_name
if len(theme) is not 0 :
service_item.theme = theme

View File

@ -31,11 +31,11 @@ class ImageTab(SettingsTab):
ImageTab is the Image settings tab in the settings dialog.
"""
def __init__(self):
#SettingsTab.__init__(self, self.trUtf8(u'Images'), u'Images')
SettingsTab.__init__(self, u'Images', u'Images')
def setupUi(self):
self.setObjectName(u'ImageTab')
self.tabTitleVisible = self.trUtf8(u'Images')
self.ImageLayout = QtGui.QFormLayout(self)
self.ImageLayout.setObjectName(u'ImageLayout')
self.ImageSettingsGroupBox = QtGui.QGroupBox(self)

View File

@ -32,10 +32,10 @@ class MediaTab(SettingsTab):
"""
def __init__(self):
SettingsTab.__init__(self, u'Media', u'Media')
#SettingsTab.__init__(self, self.trUtf8(u'Media'), u'Media')
def setupUi(self):
self.setObjectName(u'MediaTab')
self.tabTitleVisible = self.trUtf8(u'Media')
self.MediaLayout = QtGui.QFormLayout(self)
self.MediaLayout.setObjectName(u'MediaLayout')
self.MediaModeGroupBox = QtGui.QGroupBox(self)

View File

@ -32,10 +32,11 @@ class PresentationTab(SettingsTab):
"""
def __init__(self, controllers):
self.controllers = controllers
SettingsTab.__init__(self, u'Presentation', u'Presentations')
SettingsTab.__init__(self, u'Presentations', u'Presentations')
def setupUi(self):
self.setObjectName(u'PresentationTab')
self.tabTitleVisible = self.trUtf8(u'Presentations')
self.PresentationLayout = QtGui.QHBoxLayout(self)
self.PresentationLayout.setSpacing(8)
self.PresentationLayout.setMargin(8)

View File

@ -62,7 +62,11 @@ class PresentationPlugin(Plugin):
def finalise(self):
log.info(u'Plugin Finalise')
Plugin.finalise(self)
#Ask each controller to tidy up
for key in self.controllers:
controller = self.controllers[key]
if controller.enabled:
controller.kill()
self.remove_toolbox_item()
def get_media_manager_item(self):
@ -105,13 +109,5 @@ class PresentationPlugin(Plugin):
else:
return False
def finalise(self):
log.debug(u'Finalise')
#Ask each controller to tidy up
for key in self.controllers:
controller = self.controllers[key]
if controller.enabled:
controller.kill()
def about(self):
return u'<b>Presentation Plugin</b> <br> Delivers the ability to show presentations using a number of different programs. The choice of available presentaion programs is available in a drop down.'

View File

@ -31,6 +31,7 @@ class RemoteTab(SettingsTab):
def setupUi(self):
self.setObjectName(u'RemoteTab')
self.tabTitleVisible = self.trUtf8(u'Remotes')
self.RemoteLayout = QtGui.QFormLayout(self)
self.RemoteLayout.setObjectName(u'RemoteLayout')
self.RemoteModeGroupBox = QtGui.QGroupBox(self)

View File

@ -383,7 +383,7 @@ class Ui_EditSongDialog(object):
self.retranslateUi(EditSongDialog)
QtCore.QObject.connect(self.ButtonBox,
QtCore.SIGNAL(u'rejected()'), EditSongDialog.close)
QtCore.SIGNAL(u'rejected()'), EditSongDialog.closePressed)
QtCore.QObject.connect(self.ButtonBox,
QtCore.SIGNAL(u'accepted()'), EditSongDialog.accept)
QtCore.QMetaObject.connectSlotsByName(EditSongDialog)

View File

@ -400,15 +400,18 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
def onPreview(self, button):
log.debug(u'onPreview')
if button.text() == self.trUtf8(u'Save & Preview') and self.saveSong():
if button.text() == unicode(self.trUtf8(u'Save && Preview')) \
and self.saveSong():
Receiver().send_message(u'preview_song')
def closePressed(self):
Receiver().send_message(u'remote_edit_clear')
self.close()
def accept(self):
log.debug(u'accept')
if self.saveSong():
if self.title_change:
Receiver().send_message(u'load_song_list')
Receiver().send_message(u'preview_song')
Receiver().send_message(u'load_song_list')
self.close()
def saveSong(self):

View File

@ -55,7 +55,8 @@ class SongMediaItem(MediaManagerItem):
self.edit_song_form = EditSongForm(self.parent.songmanager, self)
self.song_maintenance_form = SongMaintenanceForm(
self.parent.songmanager, self)
self.fromPreview = None
self.fromPreview = -1
self.fromServiceManager = -1
def initPluginNameVisible(self):
self.PluginNameVisible = self.trUtf8(self.PluginNameShort)
@ -129,6 +130,10 @@ class SongMediaItem(MediaManagerItem):
QtCore.SIGNAL(u'edit_song'), self.onEventEditSong)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'preview_song'), self.onPreviewClick)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'%s_edit' % self.parent.name), self.onRemoteEdit)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'remote_edit_clear' ), self.onRemoteEditClear)
def configUpdated(self):
self.searchAsYouType = str_to_bool(
@ -182,8 +187,11 @@ class SongMediaItem(MediaManagerItem):
song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id))
self.ListView.addItem(song_name)
if song.id == self.fromPreview:
self.fromPreview = 0
self.ListView.setCurrentItem(song_name)
self.onPreviewClick()
self.fromPreview = -1
if song.id == self.fromServiceManager:
self.onAddClick()
def displayResultsAuthor(self, searchresults):
log.debug(u'display results Author')
@ -229,11 +237,21 @@ class SongMediaItem(MediaManagerItem):
def onSongMaintenanceClick(self):
self.song_maintenance_form.exec_()
def onRemoteEditClear(self):
self.fromServiceManager = -1
def onRemoteEdit(self, songid):
valid = self.parent.songmanager.get_song(songid)
if valid is not None:
self.fromServiceManager = songid
self.edit_song_form.loadSong(songid)
self.edit_song_form.exec_()
def onEditClick(self, preview=False):
item = self.ListView.currentItem()
if item is not None:
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
self.fromPreview = 0
self.fromPreview = -1
if preview:
self.fromPreview = item_id
self.edit_song_form.loadSong(item_id)
@ -256,12 +274,18 @@ class SongMediaItem(MediaManagerItem):
author_list = u''
author_audit = []
ccl = u''
item = self.ListView.currentItem()
if item is None:
return False
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
if self.fromServiceManager == -1:
item = self.ListView.currentItem()
if item is None:
return False
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
else:
item_id = self.fromServiceManager
self.fromServiceManager = -1
song = self.parent.songmanager.get_song(item_id)
service_item.theme = song.theme_name
service_item.editEnabled = True
service_item.editId = item_id
if song.lyrics.startswith(u'<?xml version='):
songXML=SongXMLParser(song.lyrics)
verseList = songXML.get_verses()

View File

@ -35,6 +35,7 @@ class SongsTab(SettingsTab):
def setupUi(self):
self.setObjectName(u'SongsTab')
self.tabTitleVisible = self.trUtf8(u'Songs')
self.SongsLayout = QtGui.QFormLayout(self)
self.SongsLayout.setObjectName(u'SongsLayout')
self.SongsModeGroupBox = QtGui.QGroupBox(self)

View File

@ -180,4 +180,4 @@ class SongsPlugin(Plugin):
self.opensong_export_form.show()
def about(self):
return u'<b>Song Plugin</b> <br>This plugin allows Songs to be managed and displayed.<br><br>This is a core plugin and cannot be made inactive</b>'
return u'<b>Song Plugin</b> <br>This plugin allows Songs to be managed and displayed.<br>'

View File

@ -101,7 +101,7 @@ class SongUsageManager():
return True
except:
self.session.rollback()
log.excertion(u'SongUsage Item failed to delete')
log.exception(u'SongUsage Item failed to delete')
return False
else:
return True
@ -116,7 +116,7 @@ class SongUsageManager():
return True
except:
self.session.rollback()
log.excertion(u'Failed to delete all Song Usage items')
log.exception(u'Failed to delete all Song Usage items')
return False
def delete_to_date(self, date):
@ -130,5 +130,5 @@ class SongUsageManager():
return True
except:
self.session.rollback()
log.excertion(u'Failed to delete all Song Usage items to %s' % date)
log.exception(u'Failed to delete all Song Usage items to %s' % date)
return False