← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~googol/openlp/python3-eq into lp:openlp

 

Andreas Preikschat has proposed merging lp:~googol/openlp/python3-eq into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~googol/openlp/python3-eq/+merge/172248

Hello,

- removed depreciated warnings
- clean up

NOTE: Calling hash(customSlide) will crash when you call it before the slide was saved to the db (because the id is still None, but __hash__ should return an int). But as a hash should actually never change I did not change it to return -1 in such as case. (And we will notice it if we once call it before we saved it (traceback)).
-- 
https://code.launchpad.net/~googol/openlp/python3-eq/+merge/172248
Your team OpenLP Core is requested to review the proposed merge of lp:~googol/openlp/python3-eq into lp:openlp.
=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py	2013-05-24 20:17:47 +0000
+++ openlp/core/lib/serviceitem.py	2013-06-30 18:44:27 +0000
@@ -485,6 +485,12 @@
         """
         return self.unique_identifier != other.unique_identifier
 
+    def __hash__(self):
+        """
+        Return the hash for the service item.
+        """
+        return self.unique_identifier
+
     def is_media(self):
         """
         Confirms if the ServiceItem is media

=== modified file 'openlp/plugins/custom/forms/editcustomform.py'
--- openlp/plugins/custom/forms/editcustomform.py	2013-04-17 18:33:44 +0000
+++ openlp/plugins/custom/forms/editcustomform.py	2013-06-30 18:44:27 +0000
@@ -100,8 +100,7 @@
             self.credit_edit.setText(self.custom_slide.credits)
             custom_XML = CustomXMLParser(self.custom_slide.text)
             slide_list = custom_XML.get_verses()
-            for slide in slide_list:
-                self.slide_list_view.addItem(slide[1])
+            self.slide_list_view.addItems([slide[1] for slide in slide_list])
             theme = self.custom_slide.theme_name
             find_and_set_in_combo_box(self.theme_combo_box, theme)
         self.title_edit.setFocus()

=== modified file 'openlp/plugins/custom/lib/db.py'
--- openlp/plugins/custom/lib/db.py	2013-04-05 17:41:01 +0000
+++ openlp/plugins/custom/lib/db.py	2013-06-30 18:44:27 +0000
@@ -41,14 +41,19 @@
     """
     CustomSlide model
     """
-    # By default sort the customs by its title considering language specific
-    # characters.
+    # By default sort the customs by its title considering language specific characters.
     def __lt__(self, other):
         return get_locale_key(self.title) < get_locale_key(other.title)
 
     def __eq__(self, other):
         return get_locale_key(self.title) == get_locale_key(other.title)
 
+    def __hash__(self):
+        """
+        Return the hash for a custom slide.
+        """
+        return self.id
+
 
 def init_schema(url):
     """


Follow ups