← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~googol-hush/openlp/trivial into lp:openlp

 

Andreas Preikschat has proposed merging lp:~googol-hush/openlp/trivial into lp:openlp.

Requested reviews:
  Raoul Snyman (raoul-snyman)
  Tim Bentley (trb143)

For more details, see:
https://code.launchpad.net/~googol-hush/openlp/trivial/+merge/60278

- changed a few loops to list comprehensions
- fixed unclosed file
- attempt to reduce possible tracebacks when running two instances of the FRW
-- 
https://code.launchpad.net/~googol-hush/openlp/trivial/+merge/60278
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/db.py'
--- openlp/core/lib/db.py	2011-03-24 19:04:02 +0000
+++ openlp/core/lib/db.py	2011-05-07 14:25:51 +0000
@@ -87,8 +87,8 @@
         Creates an instance of a class and populates it, returning the instance
         """
         instance = cls()
-        for key in kwargs:
-            instance.__setattr__(key, kwargs[key])
+        for key, value in kwargs.iteritems():
+            instance.__setattr__(key, value)
         return instance
 
 

=== modified file 'openlp/core/lib/searchedit.py'
--- openlp/core/lib/searchedit.py	2011-04-15 12:55:56 +0000
+++ openlp/core/lib/searchedit.py	2011-05-07 14:25:51 +0000
@@ -74,10 +74,10 @@
         if hasattr(self, u'menuButton'):
             leftPadding = self.menuButton.width()
             self.setStyleSheet(
-                u'QLineEdit { padding-left: %spx; padding-right: %spx; } ' % \
+                u'QLineEdit { padding-left: %spx; padding-right: %spx; } ' %
                 (leftPadding, rightPadding))
         else:
-            self.setStyleSheet(u'QLineEdit { padding-right: %spx; } ' % \
+            self.setStyleSheet(u'QLineEdit { padding-right: %spx; } ' %
                 rightPadding)
         msz = self.minimumSizeHint()
         self.setMinimumSize(

=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py	2011-04-26 17:03:19 +0000
+++ openlp/core/lib/serviceitem.py	2011-05-07 14:25:51 +0000
@@ -269,11 +269,9 @@
         }
         service_data = []
         if self.service_item_type == ServiceItemType.Text:
-            for slide in self._raw_frames:
-                service_data.append(slide)
+            service_data = [slide for slide in self._raw_frames]
         elif self.service_item_type == ServiceItemType.Image:
-            for slide in self._raw_frames:
-                service_data.append(slide[u'title'])
+            service_data = [slide[u'title'] for slide in self._raw_frames]
         elif self.service_item_type == ServiceItemType.Command:
             for slide in self._raw_frames:
                 service_data.append(

=== modified file 'openlp/core/ui/exceptionform.py'
--- openlp/core/ui/exceptionform.py	2011-04-15 21:43:59 +0000
+++ openlp/core/ui/exceptionform.py	2011-05-07 14:25:51 +0000
@@ -130,9 +130,12 @@
                     file.close()
                     file = open(filename, u'wb')
                     file.write(report.encode(u'utf-8'))
-                file.close()
+                finally:
+                    file.close()
             except IOError:
                 log.exception(u'Failed to write crash report')
+            finally:
+                file.close()
 
     def onSendReportButtonPressed(self):
         """
@@ -185,4 +188,5 @@
 
     def __buttonState(self, state):
         self.saveReportButton.setEnabled(state)
-        self.sendReportButton.setEnabled(state)
\ No newline at end of file
+        self.sendReportButton.setEnabled(state)
+

=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py	2011-04-29 09:07:41 +0000
+++ openlp/core/ui/mainwindow.py	2011-05-07 14:25:51 +0000
@@ -38,7 +38,7 @@
     ThemeManager, SlideController, PluginForm, MediaDockManager, \
     ShortcutListForm, DisplayTagForm
 from openlp.core.utils import AppLocation, add_actions, LanguageManager, \
-    get_application_version
+    get_application_version, delete_file
 from openlp.core.utils.actions import ActionList, CategoryOrder
 
 log = logging.getLogger(__name__)
@@ -657,8 +657,10 @@
                 plugin.firstTime()
         Receiver.send_message(u'openlp_process_events')
         temp_dir = os.path.join(unicode(gettempdir()), u'openlp')
+        if not os.path.exists(temp_dir):
+            return
         for filename in os.listdir(temp_dir):
-            os.remove(os.path.join(temp_dir, filename))
+            delete_file(os.path.join(temp_dir, filename))
         os.removedirs(temp_dir)
 
     def blankCheck(self):

=== modified file 'openlp/plugins/songs/songsplugin.py'
--- openlp/plugins/songs/songsplugin.py	2011-05-06 05:17:13 +0000
+++ openlp/plugins/songs/songsplugin.py	2011-05-07 14:25:51 +0000
@@ -229,12 +229,14 @@
         If the first time wizard has run, this function is run to import all the
         new songs into the database.
         """
+        self.onToolsReindexItemTriggered()
         db_dir = unicode(os.path.join(gettempdir(), u'openlp'))
+        if not os.path.exists(db_dir):
+            return
         song_dbs = []
         for sfile in os.listdir(db_dir):
             if sfile.startswith(u'songs_') and sfile.endswith(u'.sqlite'):
                 song_dbs.append(os.path.join(db_dir, sfile))
-        self.onToolsReindexItemTriggered()
         if len(song_dbs) == 0:
             return
         progress = QtGui.QProgressDialog(self.formparent)


Follow ups