← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~trb143/openlp/bugs into lp:openlp

 

Tim Bentley has proposed merging lp:~trb143/openlp/bugs into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  #693150 Custom Slide Display footer option
  https://bugs.launchpad.net/bugs/693150
  #693202 delete theme
  https://bugs.launchpad.net/bugs/693202

For more details, see:
https://code.launchpad.net/~trb143/openlp/bugs/+merge/49857

Update the Print Dialog allowing text to be copied to the clipboard in text or HTML format.
Keep verses together if they have the same verse tag but have been split over a number of slides.
-- 
https://code.launchpad.net/~trb143/openlp/bugs/+merge/49857
Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/bugs into lp:openlp.
=== modified file 'openlp.pyw'
--- openlp.pyw	2011-02-04 16:49:30 +0000
+++ openlp.pyw	2011-02-15 18:59:29 +0000
@@ -188,7 +188,8 @@
                 u'primary': (self.desktop().primaryScreen() == screen)})
             log.info(u'Screen %d found with resolution %s', screen, size)
         # start the main app window
-        self.mainWindow = MainWindow(screens, app_version)
+        self.appClipboard = self.clipboard()
+        self.mainWindow = MainWindow(screens, app_version, self.appClipboard)
         self.mainWindow.show()
         if show_splash:
             # now kill the splashscreen

=== modified file 'openlp/core/lib/ui.py'
--- openlp/core/lib/ui.py	2011-02-14 17:30:41 +0000
+++ openlp/core/lib/ui.py	2011-02-15 18:59:29 +0000
@@ -44,6 +44,8 @@
     Advanced = translate('OpenLP.Ui', 'Advanced')
     AllFiles = translate('OpenLP.Ui', 'All Files')
     Authors = translate('OpenLP.Ui', 'Authors')
+    CopyToHtml = translate('OpenLP.Ui', 'Copy to Html')
+    CopyToText = translate('OpenLP.Ui', 'Copy to Text')
     CreateService = translate('OpenLP.Ui', 'Create a new service.')
     Delete = translate('OpenLP.Ui', '&Delete')
     Edit = translate('OpenLP.Ui', '&Edit')

=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py	2011-02-14 17:25:51 +0000
+++ openlp/core/ui/mainwindow.py	2011-02-15 18:59:29 +0000
@@ -240,7 +240,7 @@
                 languageItem.setChecked(True)
             add_actions(self.LanguageGroup, [languageItem])
         self.SettingsShortcutsItem = icon_action(mainWindow,
-            u'SettingsShortcutsItem', 
+            u'SettingsShortcutsItem',
             u':/system/system_configure_shortcuts.png')
         self.SettingsConfigureItem = icon_action(mainWindow,
             u'SettingsConfigureItem', u':/system/system_settings.png')
@@ -457,7 +457,7 @@
 
     actionList = ActionList()
 
-    def __init__(self, screens, applicationVersion):
+    def __init__(self, screens, applicationVersion, clipboard):
         """
         This constructor sets up the interface, the various managers, and the
         plugins.
@@ -466,6 +466,7 @@
         self.screens = screens
         self.actionList = ActionList()
         self.applicationVersion = applicationVersion
+        self.clipboard = clipboard
         # Set up settings sections for the main application
         # (not for use by plugins)
         self.uiSettingsSection = u'user interface'

=== modified file 'openlp/core/ui/printserviceorderdialog.py'
--- openlp/core/ui/printserviceorderdialog.py	2011-02-07 18:02:13 +0000
+++ openlp/core/ui/printserviceorderdialog.py	2011-02-15 18:59:29 +0000
@@ -27,6 +27,7 @@
 from PyQt4 import QtCore, QtGui
 
 from openlp.core.lib import build_icon, translate, SpellTextEdit
+from openlp.core.lib.ui import UiStrings
 
 class Ui_PrintServiceOrderDialog(object):
     def setupUi(self, printServiceOrderDialog):
@@ -75,6 +76,9 @@
         self.printMetaDataCheckBox = QtGui.QCheckBox(printServiceOrderDialog)
         self.printMetaDataCheckBox.setObjectName(u'printMetaDataCheckBox')
         self.settingsLayout.addWidget(self.printMetaDataCheckBox)
+        self.copyMetaDataCheckBox = QtGui.QCheckBox(printServiceOrderDialog)
+        self.copyMetaDataCheckBox.setObjectName(u'copyMetaDataCheckBox')
+        self.settingsLayout.addWidget(self.copyMetaDataCheckBox)
         spacerItem = QtGui.QSpacerItem(20, 40,
             QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
         self.settingsLayout.addItem(spacerItem)
@@ -90,12 +94,15 @@
         spacerItem = QtGui.QSpacerItem(40, 20,
             QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
         self.buttonLayout.addItem(spacerItem)
+        self.copyTextButton = QtGui.QPushButton(printServiceOrderDialog)
+        self.copyTextButton.setObjectName(u'copyTextButton')
+        self.buttonLayout.addWidget(self.copyTextButton)
+        self.printButton = QtGui.QPushButton(printServiceOrderDialog)
+        self.printButton.setObjectName(u'printButton')
+        self.buttonLayout.addWidget(self.printButton)
         self.cancelButton = QtGui.QPushButton(printServiceOrderDialog)
         self.cancelButton.setObjectName(u'cancelButton')
         self.buttonLayout.addWidget(self.cancelButton)
-        self.printButton = QtGui.QPushButton(printServiceOrderDialog)
-        self.printButton.setObjectName(u'printButton')
-        self.buttonLayout.addWidget(self.printButton)
         self.dialogLayout.addLayout(self.buttonLayout, 1, 3, 1, 1)
         self.zoomButtonLayout = QtGui.QHBoxLayout()
         self.zoomButtonLayout.setObjectName(u'zoomButtonLayout')
@@ -119,7 +126,7 @@
         printServiceOrderDialog.setWindowTitle(
             translate('OpenLP.PrintServiceOrderForm', 'Print Service Order'))
         self.previewLabel.setText(
-            translate('OpenLP.ServiceManager', '<b>Preview:</b>'))
+            translate('OpenLP.PrintServiceOrderForm', '<b>Preview:</b>'))
         self.printSlideTextCheckBox.setText(translate(
             'OpenLP.PrintServiceOrderForm', 'Include slide text if available'))
         self.printNotesCheckBox.setText(translate(
@@ -127,10 +134,14 @@
         self.printMetaDataCheckBox.setText(
             translate('OpenLP.PrintServiceOrderForm',
             'Include play length of media items'))
+        self.copyMetaDataCheckBox.setText(
+            translate('OpenLP.PrintServiceOrderForm',
+            'Copy output as HTML'))
         self.serviceTitleLabel.setText(translate(
             'OpenLP.PrintServiceOrderForm', 'Title:'))
         self.serviceTitleLineEdit.setText(translate('OpenLP.ServiceManager',
             'Service Order Sheet'))
+        self.copyTextButton.setText(UiStrings.CopyToText)
         self.printButton.setText(translate('OpenLP.ServiceManager', 'Print'))
         self.cancelButton.setText(translate('OpenLP.ServiceManager', 'Cancel'))
         self.customNotesLabel.setText(

=== modified file 'openlp/core/ui/printserviceorderform.py'
--- openlp/core/ui/printserviceorderform.py	2011-02-14 21:07:05 +0000
+++ openlp/core/ui/printserviceorderform.py	2011-02-15 18:59:29 +0000
@@ -28,14 +28,17 @@
 from PyQt4 import QtCore, QtGui
 
 from openlp.core.lib import translate
+from openlp.core.lib.ui import UiStrings
 from openlp.core.ui.printserviceorderdialog import Ui_PrintServiceOrderDialog
 
 class PrintServiceOrderForm(QtGui.QDialog, Ui_PrintServiceOrderDialog):
+
     def __init__(self, parent, serviceManager):
         """
         Constructor
         """
         QtGui.QDialog.__init__(self, parent)
+        self.parent = parent
         self.serviceManager = serviceManager
         self.printer = QtGui.QPrinter()
         self.printDialog = QtGui.QPrintDialog(self.printer, self)
@@ -50,6 +53,10 @@
             u'print file meta data', QtCore.QVariant(False)).toBool())
         self.printNotesCheckBox.setChecked(settings.value(
             u'print notes', QtCore.QVariant(False)).toBool())
+        self.copyMetaDataCheckBox.setChecked(settings.value(
+            u'html copy', QtCore.QVariant(False)).toBool())
+        if self.copyMetaDataCheckBox.isChecked():
+            self.copyTextButton.setText(UiStrings.CopyToHtml)
         settings.endGroup()
         # Signals
         QtCore.QObject.connect(self.printButton,
@@ -73,6 +80,10 @@
             QtCore.SIGNAL(u'textChanged()'), self.updatePreviewText)
         QtCore.QObject.connect(self.cancelButton,
             QtCore.SIGNAL(u'clicked()'), self.reject)
+        QtCore.QObject.connect(self.copyTextButton,
+            QtCore.SIGNAL(u'clicked()'), self.copyText)
+        QtCore.QObject.connect(self.copyMetaDataCheckBox,
+            QtCore.SIGNAL(u'stateChanged(int)'), self.updateTextFormat)
         self.updatePreviewText()
 
     def updatePreviewText(self):
@@ -85,14 +96,23 @@
         for item in self.serviceManager.serviceItems:
             item = item[u'service_item']
             # Add the title of the service item.
-            text += u'<h4><img src="%s" /> %s</h4>' % (item.icon,
+            text += u'<h3><img src="%s" /> %s</h3>' % (item.icon,
                 item.get_display_title())
             # Add slide text of the service item.
             if self.printSlideTextCheckBox.isChecked():
                 if item.is_text():
                     # Add the text of the service item.
+                    verse = None
                     for slide in item.get_frames():
-                        text += u'<p>' + slide[u'text'] + u'</p>'
+                        if not verse:
+                            text += u'<p>' + slide[u'html']
+                            verse = slide[u'verseTag']
+                        elif verse != slide[u'verseTag']:
+                            text += u'<\p><p>' + slide[u'html']
+                            verse = slide[u'verseTag']
+                        else:
+                            text += u'<br/>' + slide[u'html']
+                    text += u'</p>'
                 elif item.is_image():
                     # Add the image names of the service item.
                     text += u'<ol>'
@@ -129,6 +149,13 @@
         """
         self.document.print_(printer)
 
+    def copyText(self):
+        if self.copyMetaDataCheckBox.isChecked():
+            self.parent.clipboard.setText(self.document.toHtml())
+        else:
+            self.parent.clipboard.setText(self.document.toPlainText())
+        self.accept()
+
     def printServiceOrder(self):
         """
         Called, when the *printButton* is clicked. Opens the *printDialog*.
@@ -151,6 +178,16 @@
         """
         self.previewWidget.zoomOut()
 
+    def updateTextFormat(self, value):
+        """
+        Called when html copy check box is selected.
+        """
+        if value == QtCore.Qt.Checked:
+            self.copyTextButton.setText(UiStrings.CopyToHtml)
+        else:
+            self.copyTextButton.setText(UiStrings.CopyToText)
+
+
     def accept(self):
         """
         Save the settings and close the dialog.
@@ -164,6 +201,8 @@
             QtCore.QVariant(self.printMetaDataCheckBox.isChecked()))
         settings.setValue(u'print notes',
             QtCore.QVariant(self.printNotesCheckBox.isChecked()))
+        settings.setValue(u'html copy',
+            QtCore.QVariant(self.copyMetaDataCheckBox.isChecked()))
         settings.endGroup()
         # Close the dialog.
         return QtGui.QDialog.accept(self)


Follow ups