forked from openlp/openlp
Add Split items to songs and custom, improve impress error handling
bzr-revno: 1564
This commit is contained in:
commit
b6a85d0405
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import translate, SpellTextEdit
|
from openlp.core.lib import translate, SpellTextEdit, build_icon
|
||||||
from openlp.core.lib.ui import create_accept_reject_button_box
|
from openlp.core.lib.ui import create_accept_reject_button_box
|
||||||
|
|
||||||
class Ui_CustomSlideEditDialog(object):
|
class Ui_CustomSlideEditDialog(object):
|
||||||
@ -39,9 +39,15 @@ class Ui_CustomSlideEditDialog(object):
|
|||||||
self.dialogLayout.addWidget(self.slideTextEdit)
|
self.dialogLayout.addWidget(self.slideTextEdit)
|
||||||
self.buttonBox = create_accept_reject_button_box(customSlideEditDialog)
|
self.buttonBox = create_accept_reject_button_box(customSlideEditDialog)
|
||||||
self.splitButton = QtGui.QPushButton(customSlideEditDialog)
|
self.splitButton = QtGui.QPushButton(customSlideEditDialog)
|
||||||
|
self.splitButton.setIcon(build_icon(u':/general/general_add.png'))
|
||||||
self.splitButton.setObjectName(u'splitButton')
|
self.splitButton.setObjectName(u'splitButton')
|
||||||
self.buttonBox.addButton(self.splitButton,
|
self.buttonBox.addButton(self.splitButton,
|
||||||
QtGui.QDialogButtonBox.ActionRole)
|
QtGui.QDialogButtonBox.ActionRole)
|
||||||
|
self.insertButton = QtGui.QPushButton(customSlideEditDialog)
|
||||||
|
self.insertButton.setIcon(build_icon(u':/general/general_add.png'))
|
||||||
|
self.insertButton.setObjectName(u'insertButton')
|
||||||
|
self.buttonBox.addButton(self.insertButton,
|
||||||
|
QtGui.QDialogButtonBox.ActionRole)
|
||||||
self.dialogLayout.addWidget(self.buttonBox)
|
self.dialogLayout.addWidget(self.buttonBox)
|
||||||
self.retranslateUi(customSlideEditDialog)
|
self.retranslateUi(customSlideEditDialog)
|
||||||
QtCore.QMetaObject.connectSlotsByName(customSlideEditDialog)
|
QtCore.QMetaObject.connectSlotsByName(customSlideEditDialog)
|
||||||
@ -50,5 +56,10 @@ class Ui_CustomSlideEditDialog(object):
|
|||||||
self.splitButton.setText(
|
self.splitButton.setText(
|
||||||
translate('CustomPlugin.EditCustomForm', 'Split Slide'))
|
translate('CustomPlugin.EditCustomForm', 'Split Slide'))
|
||||||
self.splitButton.setToolTip(
|
self.splitButton.setToolTip(
|
||||||
|
translate('CustomPlugin.EditCustomForm', 'Split a slide into two '
|
||||||
|
'only if it does not fit on the screen as one slide.'))
|
||||||
|
self.insertButton.setText(
|
||||||
|
translate('CustomPlugin.EditCustomForm', 'Insert Slide'))
|
||||||
|
self.insertButton.setToolTip(
|
||||||
translate('CustomPlugin.EditCustomForm', 'Split a slide into two '
|
translate('CustomPlugin.EditCustomForm', 'Split a slide into two '
|
||||||
'by inserting a slide splitter.'))
|
'by inserting a slide splitter.'))
|
||||||
|
@ -44,6 +44,8 @@ class EditCustomSlideForm(QtGui.QDialog, Ui_CustomSlideEditDialog):
|
|||||||
QtGui.QDialog.__init__(self, parent)
|
QtGui.QDialog.__init__(self, parent)
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
# Connecting signals and slots
|
# Connecting signals and slots
|
||||||
|
QtCore.QObject.connect(self.insertButton,
|
||||||
|
QtCore.SIGNAL(u'clicked()'), self.onInsertButtonPressed)
|
||||||
QtCore.QObject.connect(self.splitButton,
|
QtCore.QObject.connect(self.splitButton,
|
||||||
QtCore.SIGNAL(u'clicked()'), self.onSplitButtonPressed)
|
QtCore.SIGNAL(u'clicked()'), self.onSplitButtonPressed)
|
||||||
|
|
||||||
@ -65,7 +67,7 @@ class EditCustomSlideForm(QtGui.QDialog, Ui_CustomSlideEditDialog):
|
|||||||
"""
|
"""
|
||||||
return self.slideTextEdit.toPlainText().split(u'\n[===]\n')
|
return self.slideTextEdit.toPlainText().split(u'\n[===]\n')
|
||||||
|
|
||||||
def onSplitButtonPressed(self):
|
def onInsertButtonPressed(self):
|
||||||
"""
|
"""
|
||||||
Adds a slide split at the cursor.
|
Adds a slide split at the cursor.
|
||||||
"""
|
"""
|
||||||
@ -73,3 +75,12 @@ class EditCustomSlideForm(QtGui.QDialog, Ui_CustomSlideEditDialog):
|
|||||||
self.slideTextEdit.insertPlainText(u'\n')
|
self.slideTextEdit.insertPlainText(u'\n')
|
||||||
self.slideTextEdit.insertPlainText(u'[===]\n')
|
self.slideTextEdit.insertPlainText(u'[===]\n')
|
||||||
self.slideTextEdit.setFocus()
|
self.slideTextEdit.setFocus()
|
||||||
|
|
||||||
|
def onSplitButtonPressed(self):
|
||||||
|
"""
|
||||||
|
Adds a virtual split at cursor.
|
||||||
|
"""
|
||||||
|
if self.slideTextEdit.textCursor().columnNumber() != 0:
|
||||||
|
self.slideTextEdit.insertPlainText(u'\n')
|
||||||
|
self.slideTextEdit.insertPlainText(u'[---]')
|
||||||
|
self.slideTextEdit.setFocus()
|
||||||
|
@ -45,6 +45,7 @@ else:
|
|||||||
try:
|
try:
|
||||||
import uno
|
import uno
|
||||||
from com.sun.star.beans import PropertyValue
|
from com.sun.star.beans import PropertyValue
|
||||||
|
from com.sun.star.task import ErrorCodeIOException
|
||||||
uno_available = True
|
uno_available = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
uno_available = False
|
uno_available = False
|
||||||
@ -286,6 +287,9 @@ class ImpressDocument(PresentationDocument):
|
|||||||
doc.storeToURL(urlpath, props)
|
doc.storeToURL(urlpath, props)
|
||||||
self.convert_thumbnail(path, idx + 1)
|
self.convert_thumbnail(path, idx + 1)
|
||||||
delete_file(path)
|
delete_file(path)
|
||||||
|
except ErrorCodeIOException, exception:
|
||||||
|
log.exception(u'ERROR! ErrorCodeIOException %d' %
|
||||||
|
exception.ErrCode)
|
||||||
except:
|
except:
|
||||||
log.exception(u'%s - Unable to store openoffice preview' % path)
|
log.exception(u'%s - Unable to store openoffice preview' % path)
|
||||||
|
|
||||||
|
@ -42,6 +42,10 @@ class Ui_EditVerseDialog(object):
|
|||||||
self.dialogLayout.addWidget(self.verseTextEdit)
|
self.dialogLayout.addWidget(self.verseTextEdit)
|
||||||
self.verseTypeLayout = QtGui.QHBoxLayout()
|
self.verseTypeLayout = QtGui.QHBoxLayout()
|
||||||
self.verseTypeLayout.setObjectName(u'verseTypeLayout')
|
self.verseTypeLayout.setObjectName(u'verseTypeLayout')
|
||||||
|
self.splitButton = QtGui.QPushButton(editVerseDialog)
|
||||||
|
self.splitButton.setIcon(build_icon(u':/general/general_add.png'))
|
||||||
|
self.splitButton.setObjectName(u'splitButton')
|
||||||
|
self.verseTypeLayout.addWidget(self.splitButton)
|
||||||
self.verseTypeLabel = QtGui.QLabel(editVerseDialog)
|
self.verseTypeLabel = QtGui.QLabel(editVerseDialog)
|
||||||
self.verseTypeLabel.setObjectName(u'verseTypeLabel')
|
self.verseTypeLabel.setObjectName(u'verseTypeLabel')
|
||||||
self.verseTypeLayout.addWidget(self.verseTypeLabel)
|
self.verseTypeLayout.addWidget(self.verseTypeLabel)
|
||||||
@ -84,5 +88,13 @@ class Ui_EditVerseDialog(object):
|
|||||||
VerseType.TranslatedNames[VerseType.Ending])
|
VerseType.TranslatedNames[VerseType.Ending])
|
||||||
self.verseTypeComboBox.setItemText(VerseType.Other,
|
self.verseTypeComboBox.setItemText(VerseType.Other,
|
||||||
VerseType.TranslatedNames[VerseType.Other])
|
VerseType.TranslatedNames[VerseType.Other])
|
||||||
|
self.splitButton.setText(
|
||||||
|
translate('SongsPlugin.EditVerseForm', '&Split'))
|
||||||
|
self.splitButton.setToolTip(
|
||||||
|
translate('SongsPlugin.EditVerseForm', 'Split a slide into two '
|
||||||
|
'only if it does not fit on the screen as one slide.'))
|
||||||
self.insertButton.setText(
|
self.insertButton.setText(
|
||||||
translate('SongsPlugin.EditVerseForm', '&Insert'))
|
translate('SongsPlugin.EditVerseForm', '&Insert'))
|
||||||
|
self.insertButton.setToolTip(
|
||||||
|
translate('SongsPlugin.EditVerseForm', 'Split a slide into two '
|
||||||
|
'by inserting a verse splitter.'))
|
||||||
|
@ -51,6 +51,8 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
|
|||||||
self.contextMenu)
|
self.contextMenu)
|
||||||
QtCore.QObject.connect(self.insertButton, QtCore.SIGNAL(u'clicked()'),
|
QtCore.QObject.connect(self.insertButton, QtCore.SIGNAL(u'clicked()'),
|
||||||
self.onInsertButtonClicked)
|
self.onInsertButtonClicked)
|
||||||
|
QtCore.QObject.connect(self.splitButton, QtCore.SIGNAL(u'clicked()'),
|
||||||
|
self.onSplitButtonClicked)
|
||||||
QtCore.QObject.connect(self.verseTextEdit,
|
QtCore.QObject.connect(self.verseTextEdit,
|
||||||
QtCore.SIGNAL(u'cursorPositionChanged()'),
|
QtCore.SIGNAL(u'cursorPositionChanged()'),
|
||||||
self.onCursorPositionChanged)
|
self.onCursorPositionChanged)
|
||||||
@ -70,6 +72,13 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
|
|||||||
(verse_tag, verse_num))
|
(verse_tag, verse_num))
|
||||||
self.verseTextEdit.setFocus()
|
self.verseTextEdit.setFocus()
|
||||||
|
|
||||||
|
def onSplitButtonClicked(self):
|
||||||
|
verse_type_index = self.verseTypeComboBox.currentIndex()
|
||||||
|
if self.verseTextEdit.textCursor().columnNumber() != 0:
|
||||||
|
self.verseTextEdit.insertPlainText(u'\n')
|
||||||
|
self.verseTextEdit.insertPlainText(u'[---]')
|
||||||
|
self.verseTextEdit.setFocus()
|
||||||
|
|
||||||
def onInsertButtonClicked(self):
|
def onInsertButtonClicked(self):
|
||||||
verse_type_index = self.verseTypeComboBox.currentIndex()
|
verse_type_index = self.verseTypeComboBox.currentIndex()
|
||||||
self.insertVerse(VerseType.Tags[verse_type_index],
|
self.insertVerse(VerseType.Tags[verse_type_index],
|
||||||
|
Loading…
Reference in New Issue
Block a user