openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #16323
[Merge] lp:~martin-barrett/openlp/printservice into lp:openlp
Martin Barrett has proposed merging lp:~martin-barrett/openlp/printservice into lp:openlp.
Requested reviews:
Andreas Preikschat (googol)
Tim Bentley (trb143)
Related bugs:
Bug #986688 in OpenLP: "Print Service copy does not separate verses"
https://bugs.launchpad.net/openlp/+bug/986688
For more details, see:
https://code.launchpad.net/~martin-barrett/openlp/printservice/+merge/112906
Tested on winxp, winvista, win7, opensuse, ubuntu server and consistently ok on each.
This works round a windows problem with QTextDocument.toPlainText() which translates both \n and \r\n into <br>.
I collect the text direct from QTextDocument using a cursor and do my own translation.
I also remove the icon from the text as it's no use in text mode, and have not touched the html or preview text so that still prints and copies ok.
syntax fixed where I had blank line and blank space.......
--
https://code.launchpad.net/~martin-barrett/openlp/printservice/+merge/112906
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/ui/printserviceform.py'
--- openlp/core/ui/printserviceform.py 2012-06-22 14:14:53 +0000
+++ openlp/core/ui/printserviceform.py 2012-06-30 18:54:18 +0000
@@ -330,7 +330,24 @@
Copies the display text to the clipboard as plain text
"""
self.update_song_usage()
- self.mainWindow.clipboard.setText(self.document.toPlainText())
+ cursor = QtGui.QTextCursor(self.document)
+ cursor.select(QtGui.QTextCursor.Document)
+ clipboard_text = cursor.selectedText()
+ # We now have the unprocessed unicode service text in the cursor
+ # So we replace u2028 with \n and u2029 with \n\n and a few others
+ clipboard_text = clipboard_text.replace(u'\u2028', u'\n')
+ clipboard_text = clipboard_text.replace(u'\u2029', u'\n\n')
+ clipboard_text = clipboard_text.replace(u'\u2018', u'\'')
+ clipboard_text = clipboard_text.replace(u'\u2019', u'\'')
+ clipboard_text = clipboard_text.replace(u'\u201c', u'"')
+ clipboard_text = clipboard_text.replace(u'\u201d', u'"')
+ clipboard_text = clipboard_text.replace(u'\u2026', u'...')
+ clipboard_text = clipboard_text.replace(u'\u2013', u'-')
+ clipboard_text = clipboard_text.replace(u'\u2014', u'-')
+ # remove the icon from the text
+ clipboard_text = clipboard_text.replace(u'\ufffc\xa0', u'')
+ # and put it all on the clipboard
+ self.mainWindow.clipboard.setText(clipboard_text)
def copyHtmlText(self):
"""
References