forked from openlp/openlp
Bringing up to date with trunk.
This commit is contained in:
commit
0df9e356a6
@ -45,6 +45,9 @@ class Plugin(object):
|
|||||||
``log``
|
``log``
|
||||||
A log object used to log debugging messages. This is pre-instantiated.
|
A log object used to log debugging messages. This is pre-instantiated.
|
||||||
|
|
||||||
|
``weight``
|
||||||
|
A numerical value used to order the plugins.
|
||||||
|
|
||||||
**Hook Functions**
|
**Hook Functions**
|
||||||
|
|
||||||
``check_pre_conditions()``
|
``check_pre_conditions()``
|
||||||
|
@ -20,7 +20,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
from PyQt4 import Qt, QtCore, QtGui
|
from PyQt4 import Qt, QtCore, QtGui
|
||||||
|
|
||||||
from editcustomdialog import Ui_customEditDialog
|
from editcustomdialog import Ui_customEditDialog
|
||||||
from openlp.core.lib import SongXMLBuilder, SongXMLParser, Receiver
|
from openlp.core.lib import SongXMLBuilder, SongXMLParser, Receiver, translate
|
||||||
from openlp.plugins.custom.lib.models import CustomSlide
|
from openlp.plugins.custom.lib.models import CustomSlide
|
||||||
|
|
||||||
class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
|
class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
|
||||||
@ -44,7 +44,6 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
|
|||||||
QtCore.QObject.connect(self.ClearButton, QtCore.SIGNAL(u'pressed()'), self.onClearButtonPressed)
|
QtCore.QObject.connect(self.ClearButton, QtCore.SIGNAL(u'pressed()'), self.onClearButtonPressed)
|
||||||
QtCore.QObject.connect(self.UpButton, QtCore.SIGNAL(u'pressed()'), self.onUpButtonPressed)
|
QtCore.QObject.connect(self.UpButton, QtCore.SIGNAL(u'pressed()'), self.onUpButtonPressed)
|
||||||
QtCore.QObject.connect(self.DownButton, QtCore.SIGNAL(u'pressed()'), self.onDownButtonPressed)
|
QtCore.QObject.connect(self.DownButton, QtCore.SIGNAL(u'pressed()'), self.onDownButtonPressed)
|
||||||
QtCore.QObject.connect(self.TitleEdit, QtCore.SIGNAL(u'lostFocus()'), self.validate)
|
|
||||||
|
|
||||||
QtCore.QObject.connect(self.VerseListView,
|
QtCore.QObject.connect(self.VerseListView,
|
||||||
QtCore.SIGNAL(u'itemDoubleClicked(QListWidgetItem*)'), self.onVerseListViewSelected)
|
QtCore.SIGNAL(u'itemDoubleClicked(QListWidgetItem*)'), self.onVerseListViewSelected)
|
||||||
@ -92,25 +91,29 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
|
|||||||
if id == -1:
|
if id == -1:
|
||||||
id = 0 # Not Found
|
id = 0 # Not Found
|
||||||
self.ThemecomboBox.setCurrentIndex(id)
|
self.ThemecomboBox.setCurrentIndex(id)
|
||||||
self.validate()
|
|
||||||
else:
|
else:
|
||||||
self.ThemecomboBox.setCurrentIndex(0)
|
self.ThemecomboBox.setCurrentIndex(0)
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
if self.validate():
|
valid , message = self._validate()
|
||||||
sxml=SongXMLBuilder()
|
if not valid:
|
||||||
sxml.new_document()
|
QtGui.QMessageBox.critical(self,
|
||||||
sxml.add_lyrics_to_song()
|
translate(u'customEditDialog', u'Error'), message,
|
||||||
count = 1
|
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
||||||
for i in range (0, self.VerseListView.count()):
|
return
|
||||||
sxml.add_verse_to_lyrics(u'custom', unicode(count), unicode(self.VerseListView.item(i).text()))
|
sxml=SongXMLBuilder()
|
||||||
count += 1
|
sxml.new_document()
|
||||||
self.customSlide.title = unicode(self.TitleEdit.displayText())
|
sxml.add_lyrics_to_song()
|
||||||
self.customSlide.text = unicode(sxml.extract_xml())
|
count = 1
|
||||||
self.customSlide.credits = unicode(self.CreditEdit.displayText())
|
for i in range (0, self.VerseListView.count()):
|
||||||
self.customSlide.theme_name = unicode(self.ThemecomboBox.currentText())
|
sxml.add_verse_to_lyrics(u'custom', unicode(count), unicode(self.VerseListView.item(i).text()))
|
||||||
self.custommanager.save_slide(self.customSlide)
|
count += 1
|
||||||
self.close()
|
self.customSlide.title = unicode(self.TitleEdit.displayText())
|
||||||
|
self.customSlide.text = unicode(sxml.extract_xml())
|
||||||
|
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):
|
def rejected(self):
|
||||||
self.close()
|
self.close()
|
||||||
@ -138,25 +141,34 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
|
|||||||
self.EditButton.setEnabled(True)
|
self.EditButton.setEnabled(True)
|
||||||
|
|
||||||
def onVerseListViewSelected(self, item):
|
def onVerseListViewSelected(self, item):
|
||||||
self.VerseTextEdit.setPlainText(item.text())
|
self.editText(item.text())
|
||||||
self.DeleteButton.setEnabled(False)
|
|
||||||
self.EditButton.setEnabled(False)
|
|
||||||
self.SaveButton.setEnabled(True)
|
|
||||||
|
|
||||||
def onAddButtonPressed(self):
|
def onAddButtonPressed(self):
|
||||||
self.VerseListView.addItem(self.VerseTextEdit.toPlainText())
|
self.VerseListView.addItem(self.VerseTextEdit.toPlainText())
|
||||||
self.DeleteButton.setEnabled(False)
|
self.DeleteButton.setEnabled(False)
|
||||||
self.VerseTextEdit.clear()
|
self.VerseTextEdit.clear()
|
||||||
self.validate()
|
|
||||||
|
|
||||||
def onEditButtonPressed(self):
|
def onEditButtonPressed(self):
|
||||||
self.VerseTextEdit.setPlainText(self.VerseListView.currentItem().text())
|
self.editText(self.VerseListView.currentItem().text())
|
||||||
|
|
||||||
|
def editText(self, text):
|
||||||
|
self.beforeText = text
|
||||||
|
self.VerseTextEdit.setPlainText(text)
|
||||||
self.DeleteButton.setEnabled(False)
|
self.DeleteButton.setEnabled(False)
|
||||||
self.EditButton.setEnabled(False)
|
self.EditButton.setEnabled(False)
|
||||||
self.SaveButton.setEnabled(True)
|
self.SaveButton.setEnabled(True)
|
||||||
|
|
||||||
def onSaveButtonPressed(self):
|
def onSaveButtonPressed(self):
|
||||||
self.VerseListView.currentItem().setText(self.VerseTextEdit.toPlainText())
|
self.VerseListView.currentItem().setText(self.VerseTextEdit.toPlainText())
|
||||||
|
#number of lines has change
|
||||||
|
if len(self.beforeText.split(u'\n')) != len(self.VerseTextEdit.toPlainText().split(u'\n')):
|
||||||
|
tempList = {}
|
||||||
|
for row in range(0, self.VerseListView.count()):
|
||||||
|
tempList[row] = self.VerseListView.item(row).text()
|
||||||
|
self.VerseListView.clear()
|
||||||
|
for row in range (0, len(tempList)):
|
||||||
|
self.VerseListView.addItem(tempList[row])
|
||||||
|
self.VerseListView.repaint()
|
||||||
self.SaveButton.setEnabled(False)
|
self.SaveButton.setEnabled(False)
|
||||||
self.EditButton.setEnabled(False)
|
self.EditButton.setEnabled(False)
|
||||||
|
|
||||||
@ -164,17 +176,14 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
|
|||||||
self.VerseListView.takeItem(self.VerseListView.currentRow())
|
self.VerseListView.takeItem(self.VerseListView.currentRow())
|
||||||
self.EditButton.setEnabled(False)
|
self.EditButton.setEnabled(False)
|
||||||
|
|
||||||
def validate(self):
|
def _validate(self):
|
||||||
valid = True
|
valid = True
|
||||||
|
message = u''
|
||||||
if len(self.TitleEdit.displayText()) == 0:
|
if len(self.TitleEdit.displayText()) == 0:
|
||||||
valid = False
|
valid = False
|
||||||
self.TitleEdit.setStyleSheet(u'background-color: red; color: white')
|
message = translate(u'customEditDialog', u'You need to enter a title \n')
|
||||||
else:
|
|
||||||
self.TitleEdit.setStyleSheet(u'')
|
|
||||||
# must have 1 slide
|
# must have 1 slide
|
||||||
if self.VerseListView.count() == 0:
|
if self.VerseListView.count() == 0:
|
||||||
valid = False
|
valid = False
|
||||||
self.VerseListView.setStyleSheet(u'background-color: red; color: white')
|
message += translate(u'customEditDialog', u'You need to enter a slide \n')
|
||||||
else:
|
return valid, message
|
||||||
self.VerseListView.setStyleSheet(u'')
|
|
||||||
return valid
|
|
||||||
|
@ -35,10 +35,6 @@ class RemotesPlugin(Plugin):
|
|||||||
# Call the parent constructor
|
# Call the parent constructor
|
||||||
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.bind(int(self.config.get_config(u'remote port', 4316)))
|
|
||||||
QtCore.QObject.connect(self.server,
|
|
||||||
QtCore.SIGNAL(u'readyRead()'), self.readData)
|
|
||||||
|
|
||||||
def check_pre_conditions(self):
|
def check_pre_conditions(self):
|
||||||
"""
|
"""
|
||||||
@ -51,6 +47,12 @@ class RemotesPlugin(Plugin):
|
|||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def initialise(self):
|
||||||
|
self.server = QtNetwork.QUdpSocket()
|
||||||
|
self.server.bind(int(self.config.get_config(u'remote port', 4316)))
|
||||||
|
QtCore.QObject.connect(self.server,
|
||||||
|
QtCore.SIGNAL(u'readyRead()'), self.readData)
|
||||||
|
|
||||||
def get_settings_tab(self):
|
def get_settings_tab(self):
|
||||||
"""
|
"""
|
||||||
Create the settings Tab
|
Create the settings Tab
|
||||||
@ -60,7 +62,8 @@ class RemotesPlugin(Plugin):
|
|||||||
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():
|
||||||
datagram, host, port = self.server.readDatagram(self.server.pendingDatagramSize())
|
datagram, host, port = self.server.readDatagram(
|
||||||
|
self.server.pendingDatagramSize())
|
||||||
self.handle_datagram(datagram)
|
self.handle_datagram(datagram)
|
||||||
|
|
||||||
def handle_datagram(self, datagram):
|
def handle_datagram(self, datagram):
|
||||||
|
@ -290,9 +290,20 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
def onVerseEditButtonClicked(self):
|
def onVerseEditButtonClicked(self):
|
||||||
item = self.VerseListWidget.currentItem()
|
item = self.VerseListWidget.currentItem()
|
||||||
if item is not None:
|
if item is not None:
|
||||||
self.verse_form.setVerse(item.text())
|
tempText = item.text()
|
||||||
|
self.verse_form.setVerse(tempText)
|
||||||
self.verse_form.exec_()
|
self.verse_form.exec_()
|
||||||
item.setText(self.verse_form.getVerse())
|
afterText = self.verse_form.getVerse()
|
||||||
|
item.setText(afterText)
|
||||||
|
#number of lines has change
|
||||||
|
if len(tempText.split(u'\n')) != len(afterText.split(u'\n')):
|
||||||
|
tempList = {}
|
||||||
|
for row in range(0, self.VerseListWidget.count()):
|
||||||
|
tempList[row] = self.VerseListWidget.item(row).text()
|
||||||
|
self.VerseListWidget.clear()
|
||||||
|
for row in range (0, len(tempList)):
|
||||||
|
self.VerseListWidget.addItem(tempList[row])
|
||||||
|
self.VerseListWidget.repaint()
|
||||||
self.VerseEditButton.setEnabled(False)
|
self.VerseEditButton.setEnabled(False)
|
||||||
self.VerseDeleteButton.setEnabled(False)
|
self.VerseDeleteButton.setEnabled(False)
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ class Ui_SongMaintenanceDialog(object):
|
|||||||
self.TypeListWidget.setIconSize(QtCore.QSize(112, 100));
|
self.TypeListWidget.setIconSize(QtCore.QSize(112, 100));
|
||||||
self.TypeListWidget.setMovement(QtGui.QListView.Static);
|
self.TypeListWidget.setMovement(QtGui.QListView.Static);
|
||||||
self.TypeListWidget.setMaximumWidth(118);
|
self.TypeListWidget.setMaximumWidth(118);
|
||||||
self.TypeListWidget.setSpacing(3);
|
self.TypeListWidget.setSpacing(0);
|
||||||
self.TypeListWidget.setSortingEnabled(False)
|
self.TypeListWidget.setSortingEnabled(False)
|
||||||
self.TypeListWidget.setUniformItemSizes(True)
|
self.TypeListWidget.setUniformItemSizes(True)
|
||||||
self.TypeListWidget.setObjectName(u'TypeListWidget')
|
self.TypeListWidget.setObjectName(u'TypeListWidget')
|
||||||
|
Loading…
Reference in New Issue
Block a user