forked from openlp/openlp
Bug #959116: Split slide button inserts tag on its own line
This commit is contained in:
parent
9d3093a99f
commit
36fc1b5339
@ -72,16 +72,25 @@ class EditCustomSlideForm(QtGui.QDialog, Ui_CustomSlideEditDialog):
|
|||||||
"""
|
"""
|
||||||
Adds a slide split at the cursor.
|
Adds a slide split at the cursor.
|
||||||
"""
|
"""
|
||||||
if self.slideTextEdit.textCursor().columnNumber() != 0:
|
self.insertSingleLineTextAtCursor(u'[===]')
|
||||||
self.slideTextEdit.insertPlainText(u'\n')
|
|
||||||
self.slideTextEdit.insertPlainText(u'[===]\n')
|
|
||||||
self.slideTextEdit.setFocus()
|
self.slideTextEdit.setFocus()
|
||||||
|
|
||||||
def onSplitButtonPressed(self):
|
def onSplitButtonPressed(self):
|
||||||
"""
|
"""
|
||||||
Adds a virtual split at cursor.
|
Adds a virtual split at cursor.
|
||||||
"""
|
"""
|
||||||
if self.slideTextEdit.textCursor().columnNumber() != 0:
|
self.insertSingleLineTextAtCursor(u'[---]')
|
||||||
self.slideTextEdit.insertPlainText(u'\n')
|
|
||||||
self.slideTextEdit.insertPlainText(u'[---]')
|
|
||||||
self.slideTextEdit.setFocus()
|
self.slideTextEdit.setFocus()
|
||||||
|
|
||||||
|
def insertSingleLineTextAtCursor(self, text):
|
||||||
|
"""
|
||||||
|
Adds ``text`` in a single line at the cursor position.
|
||||||
|
"""
|
||||||
|
full_text = self.slideTextEdit.toPlainText()
|
||||||
|
position = self.slideTextEdit.textCursor().position()
|
||||||
|
if position and full_text[position-1] != u'\n':
|
||||||
|
text = u'\n' + text
|
||||||
|
if position == len(full_text) or full_text[position] != u'\n':
|
||||||
|
text += u'\n'
|
||||||
|
self.slideTextEdit.insertPlainText(text)
|
||||||
|
|
||||||
|
@ -75,10 +75,14 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
|
|||||||
self.verseTextEdit.setFocus()
|
self.verseTextEdit.setFocus()
|
||||||
|
|
||||||
def onSplitButtonClicked(self):
|
def onSplitButtonClicked(self):
|
||||||
verse_type_index = self.verseTypeComboBox.currentIndex()
|
text = self.verseTextEdit.toPlainText()
|
||||||
if self.verseTextEdit.textCursor().columnNumber() != 0:
|
position = self.verseTextEdit.textCursor().position()
|
||||||
self.verseTextEdit.insertPlainText(u'\n')
|
insert_string = u'[---]'
|
||||||
self.verseTextEdit.insertPlainText(u'[---]')
|
if position and text[position-1] != u'\n':
|
||||||
|
insert_string = u'\n' + insert_string
|
||||||
|
if position == len(text) or text[position] != u'\n':
|
||||||
|
insert_string += u'\n'
|
||||||
|
self.verseTextEdit.insertPlainText(insert_string)
|
||||||
self.verseTextEdit.setFocus()
|
self.verseTextEdit.setFocus()
|
||||||
|
|
||||||
def onInsertButtonClicked(self):
|
def onInsertButtonClicked(self):
|
||||||
@ -113,8 +117,7 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
|
|||||||
verse_num = int(match.group(2))
|
verse_num = int(match.group(2))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
verse_num = 1
|
verse_num = 1
|
||||||
verse_type_index = VerseType.from_loose_input(verse_tag, None)
|
if VerseType.from_loose_input(verse_tag, False):
|
||||||
if verse_type_index is not None:
|
|
||||||
self.verseNumberBox.setValue(verse_num)
|
self.verseNumberBox.setValue(verse_num)
|
||||||
|
|
||||||
def onCursorPositionChanged(self):
|
def onCursorPositionChanged(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user