← Back to team overview

openlp-core team mailing list archive

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

 

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

Requested reviews:
  OpenLP Core (openlp-core)


- added error messages
- comments/line length clean up
-- 
https://code.launchpad.net/~googol-hush/openlp/trivial/+merge/30077
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/maindisplay.py'
--- openlp/core/ui/maindisplay.py	2010-07-15 18:07:23 +0000
+++ openlp/core/ui/maindisplay.py	2010-07-16 09:31:42 +0000
@@ -167,7 +167,7 @@
 
     def keyPressEvent(self, event):
         if isinstance(event, QtGui.QKeyEvent):
-            #here accept the event and do something
+            # Here accept the event and do something.
             if event.key() == QtCore.Qt.Key_Up:
                 Receiver.send_message(u'slidecontroller_live_previous')
                 event.accept()
@@ -233,8 +233,8 @@
         self.setupBlank()
         self.blankFrame = None
         self.frame = None
-        #Hide desktop for now until we know where to put it
-        #and what size it should be.
+        # Hide desktop for now until we know where to put it
+        # and what size it should be.
         self.setVisible(False)
 
     def setup(self):
@@ -245,13 +245,12 @@
             self.screens, self.screens.monitor_number))
         self.setVisible(False)
         self.screen = self.screens.current
-        #Sort out screen locations and sizes
+        # Sort out screen locations and sizes.
         self.setGeometry(self.screen[u'size'])
-        self.scene.setSceneRect(0, 0, self.size().width(),
-            self.size().height())
+        self.scene.setSceneRect(0, 0, self.size().width(), self.size().height())
         self.webView.setGeometry(0, 0, self.size().width(),
             self.size().height())
-        #Build a custom splash screen
+        # Build a custom splash screen.
         self.initialFrame = QtGui.QImage(
             self.screen[u'size'].width(),
             self.screen[u'size'].height(),
@@ -266,7 +265,7 @@
             splash_image)
         self.displayImage(self.initialFrame)
         self.repaint()
-        #Build a Black screen
+        # Build a Black screen.
         painter = QtGui.QPainter()
         self.blankFrame = QtGui.QImage(
             self.screen[u'size'].width(),
@@ -274,11 +273,11 @@
             QtGui.QImage.Format_ARGB32_Premultiplied)
         painter.begin(self.blankFrame)
         painter.fillRect(self.blankFrame.rect(), QtCore.Qt.black)
-        #build a blank transparent image
+        # Build a blank transparent image.
         self.transparent = QtGui.QPixmap(
             self.screen[u'size'].width(), self.screen[u'size'].height())
         self.transparent.fill(QtCore.Qt.transparent)
-#        self.displayText.setPixmap(self.transparent)
+        #self.displayText.setPixmap(self.transparent)
         #self.frameView(self.transparent)
         # To display or not to display?
         if not self.screen[u'primary']:
@@ -371,7 +370,7 @@
         self.displayBlank.setPixmap(self.transparent)
         if self.isHidden():
             self.setVisible(True)
-        #Trigger actions when display is active again
+        # Trigger actions when display is active again.
         Receiver.send_message(u'maindisplay_active')
 
     def addImageWithText(self, frame):
@@ -421,8 +420,7 @@
         log.debug(u'adddisplayVideo')
         self.displayImage(self.transparent)
         self.videoDisplay.setHtml(HTMLVIDEO %
-            (path, self.screen[u'size'].width(),
-            self.screen[u'size'].height()))
+            (path, self.screen[u'size'].width(), self.screen[u'size'].height()))
 
     def frameView(self, frame, transition=False):
         """
@@ -510,7 +508,7 @@
 
     def keyPressEvent(self, event):
         if isinstance(event, QtGui.QKeyEvent):
-            #here accept the event and do something
+            # Here accept the event and do something.
             if event.key() == QtCore.Qt.Key_Escape:
                 self.onMediaStop()
                 event.accept()
@@ -525,7 +523,7 @@
         log.debug(u'VideoDisplay Setup %s for %s ' % (self.screens,
             self.screens.monitor_number))
         self.screen = self.screens.current
-        #Sort out screen locations and sizes
+        # Sort out screen locations and sizes.
         self.setGeometry(self.screen[u'size'])
         # To display or not to display?
         if not self.screen[u'primary']: # and self.isVisible():
@@ -552,10 +550,10 @@
 #        if it is triggered from the plugin
 #        """
 #        log.debug(u'VideoDisplay Queue new media message %s' % message)
-#        #If not file take the stored one
+#        # If not file take the stored one.
 #        if not message:
 #            message = self.message
-#        # still no file name then stop as it was a normal video stopping
+#        # Still no file name then stop as it was a normal video stopping.
 #        if message:
 #            self.mediaObject.setCurrentSource(Phonon.MediaSource(message))
 #            self.message = message

=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py	2010-07-12 14:32:48 +0000
+++ openlp/core/ui/mainwindow.py	2010-07-16 09:31:42 +0000
@@ -114,7 +114,7 @@
         MainWindow.setSizePolicy(sizePolicy)
         MainIcon = build_icon(u':/icon/openlp-logo-16x16.png')
         MainWindow.setWindowIcon(MainIcon)
-        # Set up the main container, which contains all the other form widgets
+        # Set up the main container, which contains all the other form widgets.
         self.MainContent = QtGui.QWidget(MainWindow)
         sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
             QtGui.QSizePolicy.Expanding)

=== modified file 'openlp/plugins/bibles/bibleplugin.py'
--- openlp/plugins/bibles/bibleplugin.py	2010-07-12 21:11:00 +0000
+++ openlp/plugins/bibles/bibleplugin.py	2010-07-16 09:31:42 +0000
@@ -40,7 +40,7 @@
         self.weight = -9
         self.icon_path = u':/plugins/plugin_bibles.png'
         self.icon = build_icon(self.icon_path)
-        #Register the bible Manager
+        # Register the bible Manager.
         self.status = PluginStatus.Active
         self.manager = None
 
@@ -62,7 +62,7 @@
         return BiblesTab(self.name)
 
     def getMediaManagerItem(self):
-        # Create the BibleManagerItem object
+        # Create the BibleManagerItem object.
         return BibleMediaItem(self, self.icon, self.name)
 
     def addImportMenuItem(self, import_menu):
@@ -71,7 +71,7 @@
         import_menu.addAction(self.ImportBibleItem)
         self.ImportBibleItem.setText(
             translate('BiblePlugin', '&Bible'))
-        # Signals and slots
+        # signals and slots
         QtCore.QObject.connect(self.ImportBibleItem,
             QtCore.SIGNAL(u'triggered()'), self.onBibleImportClick)
         self.ImportBibleItem.setVisible(False)

=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py	2010-07-08 13:50:06 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py	2010-07-16 09:31:42 +0000
@@ -129,8 +129,7 @@
         self.QuickClearLabel.setObjectName(u'QuickSearchLabel')
         self.QuickLayout.addWidget(self.QuickClearLabel, 4, 0, 1, 1)
         self.ClearQuickSearchComboBox = QtGui.QComboBox(self.QuickTab)
-        self.ClearQuickSearchComboBox.setObjectName(
-            u'ClearQuickSearchComboBox')
+        self.ClearQuickSearchComboBox.setObjectName(u'ClearQuickSearchComboBox')
         self.QuickLayout.addWidget(self.ClearQuickSearchComboBox, 4, 1, 1, 2)
         self.QuickSearchButtonLayout = QtGui.QHBoxLayout()
         self.QuickSearchButtonLayout.setMargin(0)
@@ -168,8 +167,7 @@
         self.AdvancedVersionComboBox.setObjectName(u'AdvancedVersionComboBox')
         self.AdvancedLayout.addWidget(self.AdvancedVersionComboBox, 0, 1, 1, 2)
         self.AdvancedSecondBibleLabel = QtGui.QLabel(self.AdvancedTab)
-        self.AdvancedSecondBibleLabel.setObjectName(
-            u'AdvancedSecondBibleLabel')
+        self.AdvancedSecondBibleLabel.setObjectName(u'AdvancedSecondBibleLabel')
         self.AdvancedLayout.addWidget(self.AdvancedSecondBibleLabel, 1, 0, 1, 1)
         self.AdvancedSecondBibleComboBox = QtGui.QComboBox(self.AdvancedTab)
         self.AdvancedSecondBibleComboBox.setSizeAdjustPolicy(
@@ -223,8 +221,7 @@
             u'AdvancedSearchButtonLayout')
         self.AdvancedSearchButtonSpacer = QtGui.QSpacerItem(40, 20,
             QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
-        self.AdvancedSearchButtonLayout.addItem(
-            self.AdvancedSearchButtonSpacer)
+        self.AdvancedSearchButtonLayout.addItem(self.AdvancedSearchButtonSpacer)
         self.AdvancedSearchButton = QtGui.QPushButton(self.AdvancedTab)
         self.AdvancedSearchButton.setObjectName(u'AdvancedSearchButton')
         self.AdvancedSearchButtonLayout.addWidget(self.AdvancedSearchButton)
@@ -618,8 +615,7 @@
         else:
             self.AdvancedSearchButton.setEnabled(True)
             self.AdvancedMessage.setText(u'')
-            self.adjustComboBox(1, self.chapters_from,
-                self.AdvancedFromChapter)
+            self.adjustComboBox(1, self.chapters_from, self.AdvancedFromChapter)
             self.adjustComboBox(1, self.chapters_from, self.AdvancedToChapter)
             self.adjustComboBox(1, self.verses, self.AdvancedFromVerse)
             self.adjustComboBox(1, self.verses, self.AdvancedToVerse)

=== modified file 'openlp/plugins/songs/forms/songmaintenanceform.py'
--- openlp/plugins/songs/forms/songmaintenanceform.py	2010-07-12 13:18:07 +0000
+++ openlp/plugins/songs/forms/songmaintenanceform.py	2010-07-16 09:31:42 +0000
@@ -216,11 +216,16 @@
             if self.checkAuthor(author):
                 if self.songmanager.save_object(author):
                     self.resetAuthors()
+                else:
+                    QtGui.QMessageBox.critical(self,
+                        translate('SongsPlugin.SongMaintenanceForm', 'Error'),
+                        translate('SongsPlugin.SongMaintenanceForm',
+                        'Could not add your author.'))
             else:
                 QtGui.QMessageBox.critical(self,
                     translate('SongsPlugin.SongMaintenanceForm', 'Error'),
                     translate('SongsPlugin.SongMaintenanceForm',
-                    'Could not add your author.'))
+                    'Could not add your author, because he already exists.'))
 
     def onTopicAddButtonClick(self):
         if self.topicform.exec_():
@@ -228,11 +233,16 @@
             if self.checkTopic(topic):
                 if self.songmanager.save_object(topic):
                     self.resetTopics()
+                else:
+                    QtGui.QMessageBox.critical(self,
+                        translate('SongsPlugin.SongMaintenanceForm', 'Error'),
+                        translate('SongsPlugin.SongMaintenanceForm',
+                        'Could not add your topic.'))
             else:
                 QtGui.QMessageBox.critical(self,
                     translate('SongsPlugin.SongMaintenanceForm', 'Error'),
                     translate('SongsPlugin.SongMaintenanceForm',
-                    'Could not add your topic.'))
+                    'Could not add your topic, because it already exists.'))
 
     def onBookAddButtonClick(self):
         if self.bookform.exec_():
@@ -242,11 +252,16 @@
             if self.checkBook(book):
                 if self.songmanager.save_object(book):
                     self.resetBooks()
+                else:
+                    QtGui.QMessageBox.critical(self,
+                        translate('SongsPlugin.SongMaintenanceForm', 'Error'),
+                        translate('SongsPlugin.SongMaintenanceForm',
+                        'Could not add your book.'))
             else:
                 QtGui.QMessageBox.critical(self,
                     translate('SongsPlugin.SongMaintenanceForm', 'Error'),
                     translate('SongsPlugin.SongMaintenanceForm',
-                    'Could not add your book.'))
+                    'Could not add your book, because it already exists.'))
 
     def onAuthorEditButtonClick(self):
         author_id = self._getCurrentItemId(self.AuthorsListWidget)
@@ -270,6 +285,11 @@
                 if self.checkAuthor(author, True):
                     if self.songmanager.save_object(author):
                         self.resetAuthors()
+                    else:
+                        QtGui.QMessageBox.critical(self,
+                            translate('SongsPlugin.SongMaintenanceForm', 'Error'),
+                            translate('SongsPlugin.SongMaintenanceForm',
+                            'Could not save your changes.'))
                 else:
                     # We restore the author's old first and last name as well as
                     # his display name.
@@ -279,7 +299,8 @@
                     QtGui.QMessageBox.critical(self,
                         translate('SongsPlugin.SongMaintenanceForm', 'Error'),
                         translate('SongsPlugin.SongMaintenanceForm',
-                        'Could not save your author.'))
+                        'Could not save your modified author, because he '
+                        'already exists.'))
 
     def onTopicEditButtonClick(self):
         topic_id = self._getCurrentItemId(self.TopicsListWidget)
@@ -293,13 +314,19 @@
                 if self.checkTopic(topic, True):
                     if self.songmanager.save_object(topic):
                         self.resetTopics()
+                    else:
+                        QtGui.QMessageBox.critical(self,
+                            translate('SongsPlugin.SongMaintenanceForm', 'Error'),
+                            translate('SongsPlugin.SongMaintenanceForm',
+                            'Could not save your changes.'))
                 else:
                     # We restore the topics's old name.
                     topic.name = temp_name
                     QtGui.QMessageBox.critical(self,
                         translate('SongsPlugin.SongMaintenanceForm', 'Error'),
                         translate('SongsPlugin.SongMaintenanceForm',
-                        'Could not save your topic.'))
+                        'Could not save your modified topic, because it '
+                        'already exists.'))
 
     def onBookEditButtonClick(self):
         book_id = self._getCurrentItemId(self.BooksListWidget)
@@ -317,6 +344,11 @@
                 if self.checkBook(book, True):
                     if self.songmanager.save_object(book):
                         self.resetBooks()
+                    else:
+                        QtGui.QMessageBox.critical(self,
+                            translate('SongsPlugin.SongMaintenanceForm', 'Error'),
+                            translate('SongsPlugin.SongMaintenanceForm',
+                            'Could not save your changes.'))
                 else:
                     # We restore the book's old name and publisher.
                     book.name = temp_name
@@ -324,7 +356,8 @@
                     QtGui.QMessageBox.critical(self,
                         translate('SongsPlugin.SongMaintenanceForm', 'Error'),
                         translate('SongsPlugin.SongMaintenanceForm',
-                        'Could not save your book.'))
+                        'Could not save your modified book, because it already '
+                        'exists.'))
 
     def onAuthorDeleteButtonClick(self):
         """


Follow ups