← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~trb143/openlp/latest-fixes into lp:openlp

 

Tim Bentley has proposed merging lp:~trb143/openlp/latest-fixes into lp:openlp.

Commit message:
Undo an incorrect change and replace missing code as pert of the display revamp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #1840092 in OpenLP: "version 2889 song edit window 'save and preview' button only saves"
  https://bugs.launchpad.net/openlp/+bug/1840092
  Bug #1841196 in OpenLP: "V2892 Service Theme not working"
  https://bugs.launchpad.net/openlp/+bug/1841196

For more details, see:
https://code.launchpad.net/~trb143/openlp/latest-fixes/+merge/371774

The save Button did not need renaming it has been moved by QT.

Replace the logic to set the theme for a given item.
-- 
Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/latest-fixes into lp:openlp.
=== modified file 'openlp/core/display/render.py'
--- openlp/core/display/render.py	2019-08-06 20:46:41 +0000
+++ openlp/core/display/render.py	2019-08-25 16:15:40 +0000
@@ -503,6 +503,26 @@
         self.force_page = False
         return None
 
+    def get_theme(self, item):
+        """
+        :param item: The :class:`~openlp.core.lib.serviceitem.ServiceItem` item object
+        :return string: The name of the theme to be used
+
+        """
+        # Just assume we use the global theme.
+        theme_name = Registry().get('theme_manager').global_theme
+        # The theme level is either set to Service or Item. Use the service theme if one is set. We also have to use the
+        # service theme, even when the theme level is set to Item, because the item does not necessarily have to have a
+        # theme.
+        if self.theme_level != ThemeLevel.Global:
+            # When the theme level is at Service and we actually have a service theme then use it.
+            if self.theme_level != ThemeLevel.Service:
+                theme_name = Registry().get('service_manager').service_theme
+        # If we have Item level and have an item theme then use it.
+        if self.theme_level == ThemeLevel.Song and item.theme:
+            theme_name = item.theme
+        return theme_name
+
     def format_slide(self, text, item):
         """
         Calculate how much text can fit on a slide.
@@ -515,7 +535,7 @@
             QtWidgets.QApplication.instance().processEvents()
         self.log_debug('format slide')
         if item:
-            theme_name = item.theme if item.theme else Registry().get('theme_manager').global_theme
+            theme_name = self.get_theme(item)
             theme_data = Registry().get('theme_manager').get_theme_data(theme_name)
             self.theme_height = theme_data.font_main_height
             # Set theme for preview

=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py	2019-08-04 13:13:33 +0000
+++ openlp/core/ui/mainwindow.py	2019-08-25 16:15:40 +0000
@@ -546,7 +546,8 @@
         Wait for the threads
         """
         # Sometimes the threads haven't finished, let's wait for them
-        wait_dialog = QtWidgets.QProgressDialog('Waiting for some things to finish...', '', 0, 0, self)
+        wait_dialog = QtWidgets.QProgressDialog(translate('OpenLP.MainWindow', 'Waiting for some things to finish...'),
+                                                '', 0, 0, self)
         wait_dialog.setWindowModality(QtCore.Qt.WindowModal)
         wait_dialog.setAutoClose(False)
         wait_dialog.setCancelButton(None)

=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py	2019-08-04 13:13:33 +0000
+++ openlp/core/ui/servicemanager.py	2019-08-25 16:15:40 +0000
@@ -1617,8 +1617,6 @@
             theme_group.addAction(create_widget_action(self.theme_menu, theme, text=theme, checked=False,
                                   triggers=self.on_theme_change_action))
         find_and_set_in_combo_box(self.theme_combo_box, self.service_theme)
-        # TODO: Sort this out
-        # self.renderer.set_service_theme(self.service_theme)
         self.regenerate_service_items()
 
     def on_theme_change_action(self):

=== modified file 'openlp/plugins/songs/forms/editsongdialog.py'
--- openlp/plugins/songs/forms/editsongdialog.py	2019-07-31 20:12:11 +0000
+++ openlp/plugins/songs/forms/editsongdialog.py	2019-08-25 16:15:40 +0000
@@ -291,7 +291,6 @@
         self.warning_label.setObjectName('warning_label')
         self.bottom_layout.addWidget(self.warning_label)
         self.button_box = create_button_box(edit_song_dialog, 'button_box', ['cancel', 'save'])
-        self.save_button = self.button_box.button(QtWidgets.QDialogButtonBox.Save)
         self.bottom_layout.addWidget(self.button_box)
         self.dialog_layout.addLayout(self.bottom_layout)
         self.retranslate_ui(edit_song_dialog)
@@ -342,7 +341,6 @@
             translate('SongsPlugin.EditSongForm', '<strong>Warning:</strong> Not all of the verses are in use.')
         self.no_verse_order_entered_warning =  \
             translate('SongsPlugin.EditSongForm', '<strong>Warning:</strong> You have not entered a verse order.')
-        self.save_button.setText(UiStrings().SaveAndPreview)
 
 
 def create_combo_box(parent, name, editable=True):


Follow ups