← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~felipe-q/openlp/refactoring_fixes into lp:openlp

 

Felipe Polo-Wood has proposed merging lp:~felipe-q/openlp/refactoring_fixes into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~felipe-q/openlp/refactoring_fixes/+merge/200892

Encountered several problems after merging with the refactored changes:
- Settings.__default_settings__[key] fails for non-existant keys... changed to .get(key,'')
- clear() before setRowCount(0) on the previewwidget triggers a row change with the wrong row, switched the two lines
- selectedItems wrongly refactored to selected_items
- set the selected_row in a couple of places where it was missing
- Removed the triggering of slidecontroller_%s_changed from on_slide_change since the only registered listener was itself!
-- 
https://code.launchpad.net/~felipe-q/openlp/refactoring_fixes/+merge/200892
Your team OpenLP Core is requested to review the proposed merge of lp:~felipe-q/openlp/refactoring_fixes into lp:openlp.
=== modified file 'openlp/core/common/settings.py'
--- openlp/core/common/settings.py	2013-12-24 08:56:50 +0000
+++ openlp/core/common/settings.py	2014-01-08 19:15:44 +0000
@@ -386,7 +386,7 @@
         """
         if self.group():
             key = self.group() + '/' + key
-        return Settings.__default_settings__[key]
+        return Settings.__default_settings__.get(key,'')
 
     def remove_obsolete_settings(self):
         """
@@ -424,9 +424,9 @@
         """
         # if group() is not empty the group has not been specified together with the key.
         if self.group():
-            default_value = Settings.__default_settings__[self.group() + '/' + key]
+            default_value = Settings.__default_settings__.get(self.group() + '/' + key,'')
         else:
-            default_value = Settings.__default_settings__[key]
+            default_value = Settings.__default_settings__.get(key,'')
         setting = super(Settings, self).value(key, default_value)
         return self._convert_value(setting, default_value)
 

=== modified file 'openlp/core/ui/listpreviewwidget.py'
--- openlp/core/ui/listpreviewwidget.py	2013-12-28 21:33:38 +0000
+++ openlp/core/ui/listpreviewwidget.py	2014-01-08 19:15:44 +0000
@@ -94,8 +94,8 @@
         Displays the given slide.
         """
         self.service_item = service_item
+        self.setRowCount(0)
         self.clear()
-        self.setRowCount(0)
         self.setColumnWidth(0, width)
         row = 0
         text = []

=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py	2014-01-04 16:33:20 +0000
+++ openlp/core/ui/servicemanager.py	2014-01-08 19:15:44 +0000
@@ -1020,9 +1020,9 @@
         """
         Called by the SlideController to select the next service item.
         """
-        if not self.service_manager_list.selected_items():
+        if not self.service_manager_list.selectedItems():
             return
-        selected = self.service_manager_list.selected_items()[0]
+        selected = self.service_manager_list.selectedItems()[0]
         look_for = 0
         service_iterator = QtGui.QTreeWidgetItemIterator(self.service_manager_list)
         while service_iterator.value():
@@ -1040,9 +1040,9 @@
 
         :param last_slide: Is this the last slide in the service_item.
         """
-        if not self.service_manager_list.selected_items():
+        if not self.service_manager_list.selectedItems():
             return
-        selected = self.service_manager_list.selected_items()[0]
+        selected = self.service_manager_list.selectedItems()[0]
         prev_item = None
         prev_item_last_slide = None
         service_iterator = QtGui.QTreeWidgetItemIterator(self.service_manager_list)

=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py	2014-01-04 11:50:27 +0000
+++ openlp/core/ui/slidecontroller.py	2014-01-08 19:15:44 +0000
@@ -843,6 +843,7 @@
         if self.service_item.is_command():
             Registry().execute('%s_slide' % self.service_item.name.lower(), [self.service_item, self.is_live, index])
             self.update_preview()
+            self.selected_row = index
         else:
             self.preview_widget.change_slide(index)
             self.slide_selected()
@@ -1017,7 +1018,7 @@
         """
         self.preview_widget.change_slide(row)
         self.update_preview()
-        Registry().execute('slidecontroller_%s_changed' % self.type_prefix, row)
+        self.selected_row = row
 
     def update_preview(self):
         """


Follow ups