← 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:
  OpenLP Core (openlp-core)

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


-- 
https://code.launchpad.net/~googol-hush/openlp/trivial/+merge/63075
Your team OpenLP Core is requested to review the proposed merge of lp:~googol-hush/openlp/trivial into lp:openlp.
=== modified file 'openlp/core/ui/exceptionform.py'
--- openlp/core/ui/exceptionform.py	2011-05-26 17:11:22 +0000
+++ openlp/core/ui/exceptionform.py	2011-06-01 06:58:24 +0000
@@ -106,7 +106,7 @@
         """
         Saving exception log and system informations to a file.
         """
-        report = unicode(translate('OpenLP.ExceptionForm',
+        report_text = unicode(translate('OpenLP.ExceptionForm',
             '**OpenLP Bug Report**\n'
             'Version: %s\n\n'
             '--- Details of the Exception. ---\n\n%s\n\n '
@@ -122,21 +122,21 @@
             filename = unicode(QtCore.QDir.toNativeSeparators(filename))
             SettingsManager.set_last_dir(self.settingsSection, os.path.dirname(
                 filename))
-            report = report % self._createReport()
+            report_text = report_text % self._createReport()
             try:
-                file = open(filename, u'w')
+                report_file = open(filename, u'w')
                 try:
-                    file.write(report)
+                    report_file.write(report_text)
                 except UnicodeError:
-                    file.close()
-                    file = open(filename, u'wb')
-                    file.write(report.encode(u'utf-8'))
+                    report_file.close()
+                    report_file = open(filename, u'wb')
+                    report_file.write(report_text.encode(u'utf-8'))
                 finally:
-                    file.close()
+                    report_file.close()
             except IOError:
                 log.exception(u'Failed to write crash report')
             finally:
-                file.close()
+                report_file.close()
 
     def onSendReportButtonPressed(self):
         """

=== modified file 'openlp/core/ui/screen.py'
--- openlp/core/ui/screen.py	2011-05-26 17:11:22 +0000
+++ openlp/core/ui/screen.py	2011-06-01 06:58:24 +0000
@@ -79,7 +79,7 @@
         ``number``
             The number of the screen, which size has changed.
         """
-        log.info(u'screenResolutionChanged %d' % number)
+        log.info(u'screen_resolution_changed %d' % number)
         for screen in self.screen_list:
             if number == screen[u'number']:
                 newScreen = {
@@ -104,6 +104,9 @@
         ``changed_screen``
             The screen's number which has been (un)plugged.
         """
+        # Do not log at start up.
+        if changed_screen != -1:
+            log.info(u'screen_count_changed %d' % number)
         # Remove unplugged screens.
         for screen in copy.deepcopy(self.screen_list):
             if screen[u'number'] == self.desktop.numScreens():
@@ -116,8 +119,7 @@
                     u'size': self.desktop.screenGeometry(number),
                     u'primary': (self.desktop.primaryScreen() == number)
                 })
-        # We do not want to send this message, when the method is called the
-        # first time.
+        # We do not want to send this message at start up.
         if changed_screen != -1:
             # Reload setting tabs to apply possible changes.
             Receiver.send_message(u'config_screen_changed')

=== modified file 'openlp/plugins/bibles/forms/bibleupgradeform.py'
--- openlp/plugins/bibles/forms/bibleupgradeform.py	2011-05-28 21:01:27 +0000
+++ openlp/plugins/bibles/forms/bibleupgradeform.py	2011-06-01 06:58:24 +0000
@@ -33,7 +33,8 @@
 
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.lib import Receiver, SettingsManager, translate
+from openlp.core.lib import Receiver, SettingsManager, translate, \
+    check_directory_exists
 from openlp.core.lib.db import delete_database
 from openlp.core.lib.ui import UiStrings, critical_error_message_box
 from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
@@ -94,7 +95,7 @@
 
     def onCheckBoxIndexChanged(self, index):
         """
-        Show/ Hide warnings if CheckBox state has changed
+        Show/Hide warnings if CheckBox state has changed
         """
         for number, filename in enumerate(self.files):
             if not self.checkBox[number].checkState() == QtCore.Qt.Checked:
@@ -154,17 +155,19 @@
         self.backupDirectoryEdit.setEnabled(not checked)
         self.backupBrowseButton.setEnabled(not checked)
 
-    def backupOldBibles(self, backupdirectory):
+    def backupOldBibles(self, backup_directory):
         """
         Backup old bible databases in a given folder.
         """
+        check_directory_exists(backup_directory)
+        success = True
         for filename in self.files:
             try:
-                shutil.copy(os.path.join(self.path, filename[0]), 
-                    backupdirectory)
+                shutil.copy(os.path.join(self.path, filename[0]),
+                    backup_directory)
             except:
-                return False
-        return True
+                success = False
+        return success
 
     def customInit(self):
         """
@@ -318,7 +321,7 @@
                 QtGui.QFormLayout.FieldRole, self.versionNameEdit[number])
             self.versionNameEdit[number].setText(bible.get_name())
             self.formLayout.addWidget(self.formWidget[number])
-            #Set up the Signal for the checkbox
+            # Set up the Signal for the checkbox.
             QtCore.QObject.connect(self.checkBox[number],
                 QtCore.SIGNAL(u'stateChanged(int)'),
                 self.onCheckBoxIndexChanged)
@@ -414,29 +417,23 @@
             return True
         elif self.currentPage() == self.backupPage:
             if not self.noBackupCheckBox.checkState() == QtCore.Qt.Checked:
-                if not unicode(self.backupDirectoryEdit.text()):
+                backup_path = unicode(self.backupDirectoryEdit.text())
+                if not backup_path:
                     critical_error_message_box(UiStrings().EmptyField,
                         translate('BiblesPlugin.UpgradeWizardForm',
                         'You need to specify a Backup Directory for your '
                         'Bibles.'))
                     self.backupDirectoryEdit.setFocus()
                     return False
-                elif not os.path.exists(unicode(
-                    self.backupDirectoryEdit.text())):
-                    critical_error_message_box(UiStrings().Error,
-                        translate('BiblesPlugin.UpgradeWizardForm',
-                        'The given path is not an existing directory.'))
-                    self.backupDirectoryEdit.setFocus()
-                    return False
                 else:
-                    if not self.backupOldBibles(unicode(
-                        self.backupDirectoryEdit.text())):
+                    if not self.backupOldBibles(backup_path):
                         critical_error_message_box(UiStrings().Error,
-                        translate('BiblesPlugin.UpgradeWizardForm',
-                        'The backup was not successfull.\nTo backup your '
-                        'Bibles you need the permission to write in the given '
-                        'directory. If you have a permissions to write and '
-                        'this error still occurs, please report a bug.'))
+                            translate('BiblesPlugin.UpgradeWizardForm',
+                            'The backup was not successfull.\nTo backup your '
+                            'Bibles you need the permission to write in the '
+                            'given directory. If you have a permissions to '
+                            'write and this error still occurs, please report '
+                            'a bug.'))
                         return False
             return True
         elif self.currentPage() == self.selectPage:

=== modified file 'openlp/plugins/bibles/forms/booknameform.py'
--- openlp/plugins/bibles/forms/booknameform.py	2011-05-28 12:48:10 +0000
+++ openlp/plugins/bibles/forms/booknameform.py	2011-06-01 06:58:24 +0000
@@ -70,15 +70,15 @@
             self.onCheckBoxIndexChanged)
 
     def onCheckBoxIndexChanged(self, index):
-        '''
+        """
         Reload Combobox if CheckBox state has changed
-        '''
+        """
         self.reloadComboBox()
 
     def reloadComboBox(self):
-        '''
+        """
         Reload the Combobox items
-        '''
+        """
         self.correspondingComboBox.clear()
         items = BiblesResourcesDB.get_books()
         for item in items:

=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py	2011-05-30 20:00:36 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py	2011-06-01 06:58:24 +0000
@@ -845,7 +845,8 @@
             service_item.theme = None
         else:
             service_item.theme = self.settings.bible_theme
-        [service_item.add_from_text(slide[:30], slide) for slide in raw_slides]
+        for slide in raw_slides:
+            service_item.add_from_text(slide[:30], slide)
         return True
 
     def formatTitle(self, start_bitem, old_bitem):

=== modified file 'openlp/plugins/songs/forms/songimportform.py'
--- openlp/plugins/songs/forms/songimportform.py	2011-05-26 17:11:22 +0000
+++ openlp/plugins/songs/forms/songimportform.py	2011-06-01 06:58:24 +0000
@@ -772,9 +772,9 @@
             SettingsManager.get_last_dir(self.plugin.settingsSection, 1))
         if not filename:
             return
-        file = codecs.open(filename, u'w', u'utf-8')
-        file.write(self.errorReportTextEdit.toPlainText())
-        file.close()
+        report_file = codecs.open(filename, u'w', u'utf-8')
+        report_file.write(self.errorReportTextEdit.toPlainText())
+        report_file.close()
 
     def addFileSelectItem(self, prefix, obj_prefix=None, can_disable=False,
         single_select=False):

=== modified file 'openlp/plugins/songs/lib/easislidesimport.py'
--- openlp/plugins/songs/lib/easislidesimport.py	2011-05-26 17:11:22 +0000
+++ openlp/plugins/songs/lib/easislidesimport.py	2011-06-01 06:58:24 +0000
@@ -61,8 +61,8 @@
         """
         log.info(u'Importing EasiSlides XML file %s', self.import_source)
         parser = etree.XMLParser(remove_blank_text=True)
-        file = etree.parse(self.import_source, parser)
-        xml = unicode(etree.tostring(file))
+        parsed_file = etree.parse(self.import_source, parser)
+        xml = unicode(etree.tostring(parsed_file))
         song_xml = objectify.fromstring(xml)
         self.import_wizard.progressBar.setMaximum(len(song_xml.Item))
         for song in song_xml.Item:

=== modified file 'openlp/plugins/songs/lib/importer.py'
--- openlp/plugins/songs/lib/importer.py	2011-05-30 20:14:36 +0000
+++ openlp/plugins/songs/lib/importer.py	2011-06-01 06:58:24 +0000
@@ -28,6 +28,7 @@
 The :mod:`importer` modules provides the general song import functionality.
 """
 import logging
+
 from opensongimport import OpenSongImport
 from easislidesimport import EasiSlidesImport
 from olpimport import OpenLPSongImport


Follow ups