← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~googol/openlp/trivial2 into lp:openlp

 

Andreas Preikschat has proposed merging lp:~googol/openlp/trivial2 into lp:openlp.

Requested reviews:
  Tim Bentley (trb143)
  Jonathan Corwin (j-corwin)
  Raoul Snyman (raoul-snyman)

For more details, see:
https://code.launchpad.net/~googol/openlp/trivial2/+merge/102923

Hello,

- trivial clean ups

Note: In the lines 62-143 I moved the for loop out of the if.
-- 
https://code.launchpad.net/~googol/openlp/trivial2/+merge/102923
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/renderer.py'
--- openlp/core/lib/renderer.py	2012-04-18 21:55:44 +0000
+++ openlp/core/lib/renderer.py	2012-04-20 19:42:41 +0000
@@ -364,7 +364,7 @@
         self.web.setVisible(False)
         self.web.resize(self.page_width, self.page_height)
         self.web_frame = self.web.page().mainFrame()
-        # Adjust width and height to account for shadow. outline done in css
+        # Adjust width and height to account for shadow. outline done in css.
         html = u"""<!DOCTYPE html><html><head><script>
             function show_text(newtext) {
                 var main = document.getElementById('main');

=== modified file 'openlp/core/lib/settingsmanager.py'
--- openlp/core/lib/settingsmanager.py	2011-12-27 10:33:55 +0000
+++ openlp/core/lib/settingsmanager.py	2012-04-20 19:42:41 +0000
@@ -104,7 +104,7 @@
             u'%s count' % name, QtCore.QVariant(0)).toInt()[0]
         new_count = len(list)
         settings.setValue(u'%s count' % name, QtCore.QVariant(new_count))
-        for counter in range (0, new_count):
+        for counter in range(new_count):
             settings.setValue(
                 u'%s %d' % (name, counter), QtCore.QVariant(list[counter-1]))
         if old_count > new_count:
@@ -130,7 +130,7 @@
             u'%s count' % name, QtCore.QVariant(0)).toInt()[0]
         list = []
         if list_count:
-            for counter in range(0, list_count):
+            for counter in range(list_count):
                 item = unicode(
                     settings.value(u'%s %d' % (name, counter)).toString())
                 if item:

=== modified file 'openlp/plugins/bibles/bibleplugin.py'
--- openlp/plugins/bibles/bibleplugin.py	2012-03-11 21:24:22 +0000
+++ openlp/plugins/bibles/bibleplugin.py	2012-04-20 19:42:41 +0000
@@ -145,11 +145,10 @@
     def usesTheme(self, theme):
         """
         Called to find out if the bible plugin is currently using a theme.
-        Returns True if the theme is being used, otherwise returns False.
+        Returns ``True`` if the theme is being used, otherwise returns
+        ``False``.
         """
-        if unicode(self.settings_tab.bible_theme) == theme:
-            return True
-        return False
+        return unicode(self.settings_tab.bible_theme) == theme
 
     def renameTheme(self, oldTheme, newTheme):
         """

=== modified file 'openlp/plugins/presentations/lib/impresscontroller.py'
--- openlp/plugins/presentations/lib/impresscontroller.py	2012-02-25 13:01:47 +0000
+++ openlp/plugins/presentations/lib/impresscontroller.py	2012-04-20 19:42:41 +0000
@@ -339,7 +339,6 @@
         Returns true if a presentation is loaded
         """
         log.debug(u'is loaded OpenOffice')
-        #print "is_loaded "
         if self.presentation is None or self.document is None:
             log.debug("is_loaded: no presentation or document")
             return False
@@ -357,14 +356,9 @@
         Returns true if a presentation is active and running
         """
         log.debug(u'is active OpenOffice')
-        #print "is_active "
         if not self.is_loaded():
-            #print "False "
-            return False
-        #print "self.con ", self.control
-        if self.control is None:
-            return False
-        return True
+            return False
+        return self.control is not None
 
     def unblank_screen(self):
         """

=== modified file 'openlp/plugins/presentations/lib/mediaitem.py'
--- openlp/plugins/presentations/lib/mediaitem.py	2012-04-13 21:47:15 +0000
+++ openlp/plugins/presentations/lib/mediaitem.py	2012-04-20 19:42:41 +0000
@@ -263,50 +263,49 @@
         service_item.add_capability(ItemCapabilities.ProvidesOwnDisplay)
         service_item.add_capability(ItemCapabilities.HasDetailedTitleDisplay)
         shortname = service_item.shortname
-        if shortname:
-            for bitem in items:
-                filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
-                if os.path.exists(filename):
-                    if shortname == self.Automatic:
-                        service_item.shortname = \
-                            self.findControllerByType(filename)
-                        if not service_item.shortname:
-                            return False
-                    controller = self.controllers[service_item.shortname]
-                    (path, name) = os.path.split(filename)
-                    doc = controller.add_document(filename)
-                    if doc.get_thumbnail_path(1, True) is None:
-                        doc.load_presentation()
-                    i = 1
-                    img = doc.get_thumbnail_path(i, True)
-                    if img:
-                        while img:
-                            service_item.add_from_command(path, name, img)
-                            i = i + 1
-                            img = doc.get_thumbnail_path(i, True)
-                        doc.close_presentation()
-                        return True
-                    else:
-                        # File is no longer present
-                        if not remote:
-                            critical_error_message_box(
-                                translate('PresentationPlugin.MediaItem',
-                                'Missing Presentation'),
-                                unicode(translate(
-                                'PresentationPlugin.MediaItem',
-                                'The Presentation %s is incomplete,'
-                                ' please reload.')) % filename)
+        if not shortname:
+            return False
+        for bitem in items:
+            filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
+            if os.path.exists(filename):
+                if shortname == self.Automatic:
+                    service_item.shortname = self.findControllerByType(filename)
+                    if not service_item.shortname:
                         return False
+                controller = self.controllers[service_item.shortname]
+                (path, name) = os.path.split(filename)
+                doc = controller.add_document(filename)
+                if doc.get_thumbnail_path(1, True) is None:
+                    doc.load_presentation()
+                i = 1
+                img = doc.get_thumbnail_path(i, True)
+                if img:
+                    while img:
+                        service_item.add_from_command(path, name, img)
+                        i = i + 1
+                        img = doc.get_thumbnail_path(i, True)
+                    doc.close_presentation()
+                    return True
                 else:
                     # File is no longer present
+                    if not remote:
+                        critical_error_message_box(
+                            translate('PresentationPlugin.MediaItem',
+                            'Missing Presentation'),
+                            unicode(translate(
+                            'PresentationPlugin.MediaItem',
+                            'The presentation %s is incomplete,'
+                            ' please reload.')) % filename)
+                    return False
+            else:
+                # File is no longer present
+                if not remote:
                     critical_error_message_box(
                         translate('PresentationPlugin.MediaItem',
                         'Missing Presentation'),
                         unicode(translate('PresentationPlugin.MediaItem',
-                        'The Presentation %s no longer exists.')) % filename)
-                    return False
-        else:
-            return False
+                        'The presentation %s no longer exists.')) % filename)
+                return False
 
     def findControllerByType(self, filename):
         """

=== modified file 'openlp/plugins/presentations/presentationplugin.py'
--- openlp/plugins/presentations/presentationplugin.py	2011-12-27 10:33:55 +0000
+++ openlp/plugins/presentations/presentationplugin.py	2012-04-20 19:42:41 +0000
@@ -134,10 +134,7 @@
         for controller_class in controller_classes:
             controller = controller_class(self)
             self.registerControllers(controller)
-        if self.controllers:
-            return True
-        else:
-            return False
+        return bool(self.controllers)
 
     def about(self):
         """


Follow ups