openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #08683
[Merge] lp:~googol-hush/openlp/trivial into lp:openlp
Andreas Preikschat has proposed merging lp:~googol-hush/openlp/trivial into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~googol-hush/openlp/trivial/+merge/60271
- 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/60271
Your team OpenLP Core is requested to review the proposed merge of lp:~googol-hush/openlp/trivial into 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 11:27:30 +0000
@@ -87,8 +87,7 @@
Creates an instance of a class and populates it, returning the instance
"""
instance = cls()
- for key in kwargs:
- instance.__setattr__(key, kwargs[key])
+ [instance.__setattr__(key, kwargs[key]) for key in kwargs]
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 11:27:30 +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 11:27:30 +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/lib/toolbar.py'
--- openlp/core/lib/toolbar.py 2011-04-02 13:08:54 +0000
+++ openlp/core/lib/toolbar.py 2011-05-07 11:27:30 +0000
@@ -140,8 +140,7 @@
``widgets``
The list of names of widgets to be hidden.
"""
- for widget in widgets:
- self.actions[widget].setVisible(False)
+ [self.actions[widget].setVisible(False) for widget in widgets]
def makeWidgetsVisible(self, widgets):
"""
@@ -150,8 +149,7 @@
``widgets``
The list of names of widgets to be shown.
"""
- for widget in widgets:
- self.actions[widget].setVisible(True)
+ [self.actions[widget].setVisible(True) for widget in widgets]
def addPushButton(self, image_file=None, text=u''):
"""
=== 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 11:27:30 +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 11:27:30 +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 11:27:30 +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