← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~meths/openlp/trivialfixes into lp:openlp

 

Jon Tibble has proposed merging lp:~meths/openlp/trivialfixes into lp:openlp.

    Requested reviews:
    OpenLP Core (openlp-core)

-- 
https://code.launchpad.net/~meths/openlp/trivialfixes/+merge/14397
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp.pyw'
--- openlp.pyw	2009-11-01 09:07:10 +0000
+++ openlp.pyw	2009-11-04 01:20:28 +0000
@@ -137,7 +137,7 @@
     log.addHandler(logfile)
     # Parse command line options and deal with them.
     (options, args) = parser.parse_args()
-    if options.debug is not None:
+    if options.debug:
         log.setLevel(logging.DEBUG)
     else:
         log.setLevel(logging.INFO)

=== modified file 'openlp/core/lib/__init__.py'
--- openlp/core/lib/__init__.py	2009-10-26 23:51:48 +0000
+++ openlp/core/lib/__init__.py	2009-11-04 01:20:28 +0000
@@ -110,7 +110,7 @@
     Utility method to help build context menus for plugins
     """
     action = QtGui.QAction(text, base)
-    if icon is not None:
+    if icon:
         action.setIcon(buildIcon(icon))
     QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered()'), slot)
     return action

=== modified file 'openlp/core/lib/dockwidget.py'
--- openlp/core/lib/dockwidget.py	2009-10-11 06:29:25 +0000
+++ openlp/core/lib/dockwidget.py	2009-11-04 01:20:28 +0000
@@ -36,7 +36,7 @@
         """
         QtGui.QDockWidget.__init__(self, parent)
         self.parent = parent
-        if name is not None:
+        if name:
             self.setObjectName(name)
         self.setFloating(False)
         self.log = logging.getLogger(u'OpenLPDockWidget')

=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py	2009-11-03 01:12:35 +0000
+++ openlp/core/lib/mediamanageritem.py	2009-11-04 01:20:28 +0000
@@ -110,7 +110,7 @@
                 QtGui.QIcon.Normal, QtGui.QIcon.Off)
         else:
             self.icon = None
-        if title is not None:
+        if title:
             self.title = title
         self.Toolbar = None
         self.ServiceItemIconName = None
@@ -364,7 +364,7 @@
                 self.trUtf8(u'You must select one or more items'))
         log.debug(self.PluginNameShort + u' Preview Requested')
         service_item = self.buildServiceItem()
-        if service_item is not None:
+        if service_item:
             service_item.fromPlugin = True
             self.parent.preview_controller.addServiceItem(service_item)
 
@@ -375,7 +375,7 @@
                 self.trUtf8(u'You must select one or more items'))
         log.debug(self.PluginNameShort + u' Live Requested')
         service_item = self.buildServiceItem()
-        if service_item is not None:
+        if service_item:
             service_item.fromPlugin = True
             service_item.uuid = unicode(uuid.uuid1())
             self.parent.live_controller.addServiceItem(service_item)
@@ -387,7 +387,7 @@
                 self.trUtf8(u'You must select one or more items'))
         log.debug(self.PluginNameShort + u' Add Requested')
         service_item = self.buildServiceItem()
-        if service_item is not None:
+        if service_item:
             service_item.fromPlugin = False
             service_item.uuid = unicode(uuid.uuid1())
             self.parent.service_manager.addServiceItem(service_item)
@@ -397,13 +397,12 @@
         Common method for generating a service item
         """
         service_item = ServiceItem(self.parent)
-        if self.ServiceItemIconName is not None:
+        if self.ServiceItemIconName:
             service_item.addIcon(self.ServiceItemIconName)
         else:
             service_item.addIcon(
                 u':/media/media_' + self.PluginNameShort.lower() + u'.png')
         if self.generateSlideData(service_item):
-            self.ListView.clearSelection()
             return service_item
         else:
             return None

=== modified file 'openlp/core/lib/plugin.py'
--- openlp/core/lib/plugin.py	2009-10-30 20:34:11 +0000
+++ openlp/core/lib/plugin.py	2009-11-04 01:20:28 +0000
@@ -112,7 +112,7 @@
         """
         QtCore.QObject.__init__(self)
         self.name = name
-        if version is not None:
+        if version:
             self.version = version
         self.icon = None
         self.config = PluginConfig(self.name)
@@ -236,7 +236,7 @@
         """
         Called by the plugin Manager to initialise anything it needs.
         """
-        if self.media_item is not None:
+        if self.media_item:
             self.media_item.initialise()
 
     def finalise(self):
@@ -256,7 +256,7 @@
         """
         Called by plugin to replace toolbar
         """
-        if self.media_item is not None:
+        if self.media_item:
             self.mediadock.insert_dock(self.media_item, self.icon, self.weight)
-        if self.settings_tab is not None:
+        if self.settings_tab:
             self.settings.insertTab(self.settings_tab, self.weight)

=== modified file 'openlp/core/lib/pluginconfig.py'
--- openlp/core/lib/pluginconfig.py	2009-09-25 23:06:54 +0000
+++ openlp/core/lib/pluginconfig.py	2009-11-04 01:20:28 +0000
@@ -107,7 +107,7 @@
             files = os.listdir(self.get_data_path())
         except:
             return []
-        if suffix is not None:
+        if suffix:
             return_files = []
             for file in files:
                 if file.find(u'.') != -1:
@@ -131,7 +131,7 @@
             The name of the list.
         """
         list_count = self.get_config(u'%s count' % name)
-        if list_count is not None:
+        if list_count:
             list_count = int(list_count)
         else:
             list_count = 0
@@ -169,12 +169,12 @@
         ``num``
             Defaults to *None*. A further qualifier.
         """
-        if num is not None:
+        if num:
             name = u'last directory %d' % num
         else:
             name = u'last directory'
         last_dir = self.get_config(name)
-        if last_dir is None:
+        if not last_dir:
             last_dir = u''
         return last_dir
 
@@ -185,7 +185,7 @@
         ``num``
             Defaults to *None*. A further qualifier.
         """
-        if num is not None:
+        if num:
             name = u'last directory %d' % num
         else:
             name = u'last directory'

=== modified file 'openlp/core/lib/pluginmanager.py'
--- openlp/core/lib/pluginmanager.py	2009-10-30 20:34:11 +0000
+++ openlp/core/lib/pluginmanager.py	2009-11-04 01:20:28 +0000
@@ -149,8 +149,9 @@
         for plugin in self.plugins:
             if plugin.status is not PluginStatus.Disabled:
                 plugin.settings_tab = plugin.get_settings_tab()
-                if plugin.settings_tab is not None:
-                    log.debug(u'Inserting settings tab item from %s' % plugin.name)
+                if plugin.settings_tab:
+                    log.debug(u'Inserting settings tab item from %s' %
+                        plugin.name)
                     settingsform.addTab(plugin.name, plugin.settings_tab)
                 else:
                     log.debug(u'No tab settings in %s' % plugin.name)

=== modified file 'openlp/core/lib/renderer.py'
--- openlp/core/lib/renderer.py	2009-11-03 01:12:35 +0000
+++ openlp/core/lib/renderer.py	2009-11-04 01:20:28 +0000
@@ -59,7 +59,7 @@
         ``debug``
             The debug mode.
         """
-        self._debug=debug
+        self._debug = debug
 
     def set_theme(self, theme):
         """
@@ -76,7 +76,7 @@
         self.theme_name = theme.theme_name
         self._set_theme_font()
         if theme.background_type == u'image':
-            if theme.background_filename is not None:
+            if theme.background_filename:
                 self.set_bg_image(theme.background_filename)
 
     def set_bg_image(self, filename):
@@ -88,7 +88,7 @@
         """
         log.debug(u'set bg image %s', filename)
         self._bg_image_filename = unicode(filename)
-        if self._frame is not None:
+        if self._frame:
             self.scale_bg_image()
 
     def scale_bg_image(self):
@@ -128,13 +128,13 @@
         ``preview``
             Defaults to *False*. Whether or not to generate a preview.
         """
-        if preview == True:
+        if preview:
             self.bg_frame = None
         log.debug(u'set frame dest (frame) w %d h %d', frame_width,
             frame_height)
         self._frame = QtGui.QImage(frame_width, frame_height,
             QtGui.QImage.Format_ARGB32_Premultiplied)
-        if self._bg_image_filename is not None and self.bg_image is None:
+        if self._bg_image_filename and not self.bg_image:
             self.scale_bg_image()
         if self.bg_frame is None:
             self._generate_background_frame()
@@ -241,13 +241,13 @@
         """
         log.debug(u'generate_frame_from_lines - Start')
         bbox = self._render_lines_unaligned(lines, False)
-        if footer_lines is not None:
+        if footer_lines:
             bbox1 = self._render_lines_unaligned(footer_lines, True)
         # reset the frame. first time do not worry about what you paint on.
         self._frame = QtGui.QImage(self.bg_frame)
         x, y = self._correctAlignment(self._rect, bbox)
         bbox = self._render_lines_unaligned(lines, False, (x, y), True)
-        if footer_lines is not None:
+        if footer_lines:
             bbox = self._render_lines_unaligned(footer_lines, True,
                 (self._rect_footer.left(), self._rect_footer.top()), True)
         log.debug(u'generate_frame_from_lines - Finish')
@@ -305,7 +305,7 @@
             elif self._theme.background_type == u'image':
                 # image
                 painter.fillRect(self._frame.rect(), QtCore.Qt.black)
-                if self.bg_image is not None:
+                if self.bg_image:
                     painter.drawImage(0, 0, self.bg_image)
         painter.end()
         log.debug(u'render background End')
@@ -321,13 +321,13 @@
             Footer dimensions?
         """
         x = rect.left()
-        if int(self._theme.display_verticalAlign) == 0:
+        if self._theme.display_verticalAlign == 0:
             # top align
             y = rect.top()
-        elif int(self._theme.display_verticalAlign) == 2:
+        elif self._theme.display_verticalAlign == 2:
             # bottom align
             y = rect.bottom() - bbox.height()
-        elif int(self._theme.display_verticalAlign) == 1:
+        elif self._theme.display_verticalAlign == 1:
             # centre align
             y = rect.top() + (rect.height() - bbox.height()) / 2
         else:
@@ -410,7 +410,7 @@
             align = 0
             shadow_offset = self._shadow_offset_footer
         else:
-            align = int(self._theme .display_horizontalAlign)
+            align = self._theme.display_horizontalAlign
             shadow_offset = self._shadow_offset
         for linenum in range(len(lines)):
             line = lines[linenum]
@@ -501,18 +501,18 @@
         if self._theme.font_footer_weight == u'Bold':
             footer_weight = 75
         self.footerFont = QtGui.QFont(self._theme.font_footer_name,
-                     int(self._theme.font_footer_proportion), # size
-                     int(footer_weight), # weight
+                     self._theme.font_footer_proportion, # size
+                     footer_weight, # weight
                      self._theme.font_footer_italics) # italic
-        self.footerFont.setPixelSize(int(self._theme.font_footer_proportion))
+        self.footerFont.setPixelSize(self._theme.font_footer_proportion)
         main_weight = 50
         if self._theme.font_main_weight == u'Bold':
             main_weight = 75
         self.mainFont = QtGui.QFont(self._theme.font_main_name,
-                     int(self._theme.font_main_proportion), # size
-                     int(main_weight), # weight
+                     self._theme.font_main_proportion, # size
+                     main_weight, # weight
                      self._theme.font_main_italics)# italic
-        self.mainFont.setPixelSize(int(self._theme.font_main_proportion))
+        self.mainFont.setPixelSize(self._theme.font_main_proportion)
 
     def _get_extent_and_render(self, line, footer, tlcorner=(0, 0), draw=False,
         color=None):
@@ -571,5 +571,5 @@
             Defaults to *None*. Another image to save to disk.
         """
         image.save(u'renderer.png', u'png')
-        if image2 is not None:
+        if image2:
             image2.save(u'renderer2.png', u'png')

=== modified file 'openlp/core/lib/rendermanager.py'
--- openlp/core/lib/rendermanager.py	2009-10-24 07:22:44 +0000
+++ openlp/core/lib/rendermanager.py	2009-11-04 01:20:28 +0000
@@ -121,7 +121,7 @@
             else:
                 self.theme = self.service_theme
         else:
-            if theme is not None:
+            if theme:
                 self.theme = theme
             elif self.global_style == u'Song' or \
                 self.global_style == u'Service':
@@ -139,17 +139,19 @@
             self.renderer.set_theme(self.themedata)
             self.build_text_rectangle(self.themedata)
         #Replace the backgrount image from renderer with one from image
-        if self.override_background is not None:
+        if self.override_background:
             if self.save_bg_frame is None:
                 self.save_bg_frame = self.renderer.bg_frame
             if self.override_background_changed:
-                self.renderer.bg_frame = self.resize_image(self.override_background)
+                self.renderer.bg_frame = self.resize_image(
+                    self.override_background)
                 self.override_background_changed = False
         else:
             if self.override_background_changed:
-                self.renderer.bg_frame = self.resize_image(self.override_background)
+                self.renderer.bg_frame = self.resize_image(
+                    self.override_background)
                 self.override_background_changed = False
-            if self.save_bg_frame is not None:
+            if self.save_bg_frame:
                 self.renderer.bg_frame = self.save_bg_frame
                 self.save_bg_frame = None
 
@@ -164,20 +166,19 @@
         log.debug(u'build_text_rectangle')
         main_rect = None
         footer_rect = None
-        if theme.font_main_override == False:
+        if not theme.font_main_override:
             main_rect = QtCore.QRect(10, 0, self.width - 1,
                 self.footer_start - 20)
         else:
-            main_rect = QtCore.QRect(int(theme.font_main_x),
-                int(theme.font_main_y), int(theme.font_main_width)-1,
-                int(theme.font_main_height) - 1)
-        if theme.font_footer_override == False:
-            footer_rect = QtCore.QRect(10,self.footer_start, self.width - 1,
+            main_rect = QtCore.QRect(theme.font_main_x, theme.font_main_y,
+                theme.font_main_width - 1, theme.font_main_height - 1)
+        if not theme.font_footer_override:
+            footer_rect = QtCore.QRect(10, self.footer_start, self.width - 1,
                 self.height-self.footer_start)
         else:
-            footer_rect = QtCore.QRect(int(theme.font_footer_x),
-                int(theme.font_footer_y), int(theme.font_footer_width)-1,
-                int(theme.font_footer_height) - 1)
+            footer_rect = QtCore.QRect(theme.font_footer_x,
+                theme.font_footer_y, theme.font_footer_width - 1,
+                theme.font_footer_height - 1)
         self.renderer.set_text_rectangle(main_rect, footer_rect)
 
     def generate_preview(self, themedata):

=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py	2009-11-01 16:06:59 +0000
+++ openlp/core/lib/serviceitem.py	2009-11-04 01:20:28 +0000
@@ -57,7 +57,7 @@
             The plugin that this service item belongs to.
         """
         self.plugin = hostplugin
-        if hostplugin is not None:
+        if hostplugin:
             self.RenderManager = self.plugin.render_manager
             self.shortname = hostplugin.name
             self.name = self.plugin.name

=== modified file 'openlp/core/lib/themexmlhandler.py'
--- openlp/core/lib/themexmlhandler.py	2009-10-23 16:10:09 +0000
+++ openlp/core/lib/themexmlhandler.py	2009-11-04 01:20:28 +0000
@@ -91,7 +91,7 @@
         ``path``
             The path name to be added.
         """
-        if self.background_filename is not None and path is not None:
+        if self.background_filename and path:
             self.theme_name = self.theme_name.rstrip().lstrip()
             self.background_filename = self.background_filename.rstrip().lstrip()
             self.background_filename = os.path.join(path, self.theme_name,
@@ -371,7 +371,7 @@
                         else:
                             setattr(self, field, e[1])
             else:
-                if element.tag is not None:
+                if element.tag:
                     field = master + element.tag
                     if element.text == u'True' or element.text == u'False':
                         setattr(self, field, str_to_bool(element.text))

=== modified file 'openlp/core/lib/toolbar.py'
--- openlp/core/lib/toolbar.py	2009-10-19 16:18:32 +0000
+++ openlp/core/lib/toolbar.py	2009-11-04 01:20:28 +0000
@@ -68,12 +68,12 @@
             The name of the object, as used in `<button>.setObjectName()`.
         """
         ButtonIcon = buildIcon(icon)
-        if ButtonIcon is not None:
-            if slot is not None:
+        if ButtonIcon:
+            if slot:
                 ToolbarButton = self.addAction(ButtonIcon, title, slot)
             else:
                 ToolbarButton = self.addAction(ButtonIcon, title)
-            if tooltip is not None:
+            if tooltip:
                 ToolbarButton.setToolTip(tooltip)
             self.icons[title] = ButtonIcon
             self.actions[title] = ToolbarButton

=== modified file 'openlp/core/ui/amendthemeform.py'
--- openlp/core/ui/amendthemeform.py	2009-10-30 21:47:15 +0000
+++ openlp/core/ui/amendthemeform.py	2009-11-04 01:20:28 +0000
@@ -246,21 +246,18 @@
         else:
             self.theme.font_main_override = True
 
-        if int(self.theme.font_main_x) == 0 and \
-            int(self.theme.font_main_y) == 0 and \
-            int(self.theme.font_main_width) == 0 and \
-            int(self.theme.font_main_height) == 0:
+        if not self.theme.font_main_x and not self.theme.font_main_y and \
+            not self.theme.font_main_width and not self.theme.font_main_height:
             self.theme.font_main_x = u'10'
             self.theme.font_main_y = u'10'
             self.theme.font_main_width = u'1024'
             self.theme.font_main_height = u'730'
-            self.FontMainXSpinBox.setValue(int(self.theme.font_main_x))
-            self.FontMainYSpinBox.setValue(int(self.theme.font_main_y))
-            self.FontMainWidthSpinBox.setValue(int(self.theme.font_main_width))
-            self.FontMainHeightSpinBox.setValue(int( \
-                self.theme.font_main_height))
-            self.FontMainLineSpacingSpinBox.setValue(int( \
-                self.theme.font_main_indentation))
+            self.FontMainXSpinBox.setValue(self.theme.font_main_x)
+            self.FontMainYSpinBox.setValue(self.theme.font_main_y)
+            self.FontMainWidthSpinBox.setValue(self.theme.font_main_width)
+            self.FontMainHeightSpinBox.setValue(self.theme.font_main_height)
+            self.FontMainLineSpacingSpinBox.setValue(
+                self.theme.font_main_indentation)
         self.stateChanging(self.theme)
         self.previewTheme(self.theme)
 
@@ -280,8 +277,10 @@
             self.previewTheme(self.theme)
 
     def onFontMainLineSpacingSpinBoxChanged(self):
-        if self.theme.font_main_indentation != self.FontMainLineSpacingSpinBox.value():
-            self.theme.font_main_indentation = self.FontMainLineSpacingSpinBox.value()
+        if self.theme.font_main_indentation != \
+            self.FontMainLineSpacingSpinBox.value():
+            self.theme.font_main_indentation = \
+                self.FontMainLineSpacingSpinBox.value()
             self.previewTheme(self.theme)
 
     def onFontMainHeightSpinBoxChanged(self):
@@ -331,23 +330,18 @@
             self.theme.font_footer_override = False
         else:
             self.theme.font_footer_override = True
-
-        if int(self.theme.font_footer_x) == 0 and \
-            int(self.theme.font_footer_y) == 0 and \
-            int(self.theme.font_footer_width) == 0 and \
-            int(self.theme.font_footer_height) == 0:
+        if not self.theme.font_footer_x and not self.theme.font_footer_y and \
+            not self.theme.font_footer_width and \
+            not self.theme.font_footer_height:
             self.theme.font_footer_x = u'10'
             self.theme.font_footer_y = u'730'
             self.theme.font_footer_width = u'1024'
             self.theme.font_footer_height = u'38'
-
-            self.FontFooterXSpinBox.setValue(int(self.theme.font_footer_x))
-            self.FontFooterYSpinBox.setValue(int(self.theme.font_footer_y))
-            self.FontFooterWidthSpinBox.setValue(int( \
-                self.theme.font_footer_width))
-            self.FontFooterHeightSpinBox.setValue(int( \
-                self.theme.font_footer_height))
-
+            self.FontFooterXSpinBox.setValue(self.theme.font_footer_x)
+            self.FontFooterYSpinBox.setValue(self.theme.font_footer_y)
+            self.FontFooterWidthSpinBox.setValue(self.theme.font_footer_width)
+            self.FontFooterHeightSpinBox.setValue(
+                self.theme.font_footer_height)
         self.stateChanging(self.theme)
         self.previewTheme(self.theme)
 
@@ -369,7 +363,8 @@
     def onFontFooterHeightSpinBoxChanged(self):
         if self.theme.font_footer_height != \
             self.FontFooterHeightSpinBox.value():
-            self.theme.font_footer_height = self.FontFooterHeightSpinBox.value()
+            self.theme.font_footer_height = \
+                self.FontFooterHeightSpinBox.value()
             self.previewTheme(self.theme)
     #
     #Background Tab
@@ -502,7 +497,7 @@
         # Font Main Tab
         self.FontMainComboBox.setCurrentFont(
             QtGui.QFont(self.theme.font_main_name))
-        self.FontMainSizeSpinBox.setValue(int(self.theme.font_main_proportion))
+        self.FontMainSizeSpinBox.setValue(self.theme.font_main_proportion)
         if not self.theme.font_main_italics and \
             self.theme.font_main_weight == u'Normal':
             self.FontMainWeightComboBox.setCurrentIndex(0)
@@ -514,16 +509,17 @@
             self.FontMainWeightComboBox.setCurrentIndex(2)
         else:
             self.FontMainWeightComboBox.setCurrentIndex(3)
-        self.FontMainLineSpacingSpinBox.setValue(int(self.theme.font_main_indentation))
-        self.FontMainXSpinBox.setValue(int(self.theme.font_main_x))
-        self.FontMainYSpinBox.setValue(int(self.theme.font_main_y))
-        self.FontMainWidthSpinBox.setValue(int(self.theme.font_main_width))
-        self.FontMainHeightSpinBox.setValue(int(self.theme.font_main_height))
+        self.FontMainLineSpacingSpinBox.setValue(
+            self.theme.font_main_indentation)
+        self.FontMainXSpinBox.setValue(self.theme.font_main_x)
+        self.FontMainYSpinBox.setValue(self.theme.font_main_y)
+        self.FontMainWidthSpinBox.setValue(self.theme.font_main_width)
+        self.FontMainHeightSpinBox.setValue(self.theme.font_main_height)
         # Font Footer Tab
         self.FontFooterComboBox.setCurrentFont(
             QtGui.QFont(self.theme.font_footer_name))
         self.FontFooterSizeSpinBox.setValue(
-            int(self.theme.font_footer_proportion))
+            self.theme.font_footer_proportion)
         if not self.theme.font_footer_italics and \
             self.theme.font_footer_weight == u'Normal':
             self.FontFooterWeightComboBox.setCurrentIndex(0)
@@ -535,22 +531,21 @@
             self.FontFooterWeightComboBox.setCurrentIndex(2)
         else:
             self.FontFooterWeightComboBox.setCurrentIndex(3)
-        self.FontFooterXSpinBox.setValue(int(self.theme.font_footer_x))
-        self.FontFooterYSpinBox.setValue(int(self.theme.font_footer_y))
-        self.FontFooterWidthSpinBox.setValue(int(self.theme.font_footer_width))
-        self.FontFooterHeightSpinBox.setValue(
-            int(self.theme.font_footer_height))
+        self.FontFooterXSpinBox.setValue(self.theme.font_footer_x)
+        self.FontFooterYSpinBox.setValue(self.theme.font_footer_y)
+        self.FontFooterWidthSpinBox.setValue(self.theme.font_footer_width)
+        self.FontFooterHeightSpinBox.setValue(self.theme.font_footer_height)
         self.FontMainColorPushButton.setStyleSheet(
             u'background-color: %s' % unicode(theme.font_main_color))
         self.FontFooterColorPushButton.setStyleSheet(
             u'background-color: %s' % unicode(theme.font_footer_color))
 
-        if self.theme.font_main_override == False:
+        if not self.theme.font_main_override:
             self.FontMainDefaultCheckBox.setChecked(True)
         else:
             self.FontMainDefaultCheckBox.setChecked(False)
 
-        if self.theme.font_footer_override == False:
+        if not self.theme.font_footer_override:
             self.FontFooterDefaultCheckBox.setChecked(True)
         else:
             self.FontFooterDefaultCheckBox.setChecked(False)
@@ -575,23 +570,22 @@
             self.ShadowColorPushButton.setEnabled(False)
 
         self.HorizontalComboBox.setCurrentIndex(
-            int(self.theme.display_horizontalAlign))
-        self.VerticalComboBox.setCurrentIndex(
-            int(self.theme.display_verticalAlign))
+            self.theme.display_horizontalAlign)
+        self.VerticalComboBox.setCurrentIndex(self.theme.display_verticalAlign)
 
     def stateChanging(self, theme):
         if theme.background_mode == u'transparent':
-                self.Color1Label.setVisible(False)
-                self.Color1PushButton.setVisible(False)
-                self.Color2Label.setVisible(False)
-                self.Color2PushButton.setVisible(False)
-                self.ImageLabel.setVisible(False)
-                self.ImageLineEdit.setVisible(False)
-                self.ImageFilenameWidget.setVisible(False)
-                self.GradientLabel.setVisible(False)
-                self.GradientComboBox.setVisible(False)
-                self.BackgroundTypeComboBox.setVisible(False)
-                self.BackgroundTypeLabel.setVisible(False)
+            self.Color1Label.setVisible(False)
+            self.Color1PushButton.setVisible(False)
+            self.Color2Label.setVisible(False)
+            self.Color2PushButton.setVisible(False)
+            self.ImageLabel.setVisible(False)
+            self.ImageLineEdit.setVisible(False)
+            self.ImageFilenameWidget.setVisible(False)
+            self.GradientLabel.setVisible(False)
+            self.GradientComboBox.setVisible(False)
+            self.BackgroundTypeComboBox.setVisible(False)
+            self.BackgroundTypeLabel.setVisible(False)
         else:
             self.BackgroundTypeComboBox.setVisible(True)
             self.BackgroundTypeLabel.setVisible(True)
@@ -635,7 +629,7 @@
                 self.GradientLabel.setVisible(False)
                 self.GradientComboBox.setVisible(False)
 
-        if theme.font_main_override == False:
+        if not theme.font_main_override:
             self.FontMainXSpinBox.setEnabled(False)
             self.FontMainYSpinBox.setEnabled(False)
             self.FontMainWidthSpinBox.setEnabled(False)
@@ -646,7 +640,7 @@
             self.FontMainWidthSpinBox.setEnabled(True)
             self.FontMainHeightSpinBox.setEnabled(True)
 
-        if theme.font_footer_override == False:
+        if not theme.font_footer_override:
             self.FontFooterXSpinBox.setEnabled(False)
             self.FontFooterYSpinBox.setEnabled(False)
             self.FontFooterWidthSpinBox.setEnabled(False)
@@ -674,15 +668,18 @@
             if self.theme.font_main_weight == u'Bold':
                 main_weight = 75
             mainFont = QtGui.QFont(self.theme.font_main_name,
-                         int(self.theme.font_main_proportion), # size
-                         int(main_weight), # weight
+                         self.theme.font_main_proportion, # size
+                         main_weight, # weight
                          self.theme.font_main_italics)# italic
-            mainFont.setPixelSize(int(self.theme.font_main_proportion))
+            mainFont.setPixelSize(self.theme.font_main_proportion)
             metrics = QtGui.QFontMetrics(mainFont)
-            page_length = (int(self.FontMainHeightSpinBox.value()) / metrics.height() - 2) - 1
+            page_length = \
+                (self.FontMainHeightSpinBox.value() / metrics.height() - 2) - 1
             log.debug(u'Page Length area height %s, metrics %s, lines %s' %
-                      (int(self.FontMainHeightSpinBox.value()), metrics.height(), page_length))
+                (self.FontMainHeightSpinBox.value(), metrics.height(),
+                page_length))
             page_length_text = unicode(self.trUtf8(u'Slide Height is %s rows'))
             self.FontMainLinesPageLabel.setText(page_length_text % page_length)
             frame = self.thememanager.generateImage(theme)
             self.ThemePreview.setPixmap(QtGui.QPixmap.fromImage(frame))
+

=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py	2009-11-03 00:04:41 +0000
+++ openlp/core/ui/maindisplay.py	2009-11-04 01:20:28 +0000
@@ -208,7 +208,7 @@
             self.display.setPixmap(QtGui.QPixmap.fromImage(self.blankFrame))
         else:
             self.displayBlank = False
-            if self.frame is not None:
+            if self.frame:
                 self.frameView(self.frame)
         if self.parent.LiveController.blackPushButton.isChecked() != \
             self.displayBlank:

=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py	2009-11-01 09:07:10 +0000
+++ openlp/core/ui/mainwindow.py	2009-11-04 01:20:28 +0000
@@ -606,7 +606,7 @@
         """
         Hook to close the main window and display windows on exit
         """
-        if self.serviceNotSaved == True:
+        if self.serviceNotSaved:
             ret = QtGui.QMessageBox.question(None,
                 self.trUtf8(u'Save Changes to Service?'),
                 self.trUtf8(u'Your service has changed, do you want to save those changes?'),
@@ -655,7 +655,7 @@
             service_name = u'(unsaved service)'
         else:
             service_name = serviceName
-        if reset == True:
+        if reset:
             self.serviceNotSaved = False
             title = u'%s - %s' % (self.mainTitle, service_name)
         else:

=== modified file 'openlp/core/ui/mediadockmanager.py'
--- openlp/core/ui/mediadockmanager.py	2009-10-30 20:34:11 +0000
+++ openlp/core/ui/mediadockmanager.py	2009-11-04 01:20:28 +0000
@@ -1,5 +1,5 @@
 # -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expanddock textwidth=80 dockstop=4 softdockstop=4
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
 
 ###############################################################################
 # OpenLP - Open Source Lyrics Projection                                      #
@@ -54,7 +54,7 @@
     def remove_dock(self, name):
         log.debug(u'remove %s dock' % name)
         for dock_index in range(0, self.media_dock.count()):
-            if self.media_dock.widget(dock_index) is not None:
+            if self.media_dock.widget(dock_index):
                 if self.media_dock.widget(dock_index).ConfigSection == name:
                     self.media_dock.widget(dock_index).hide()
                     self.media_dock.removeItem(dock_index)

=== modified file 'openlp/core/ui/pluginform.py'
--- openlp/core/ui/pluginform.py	2009-10-30 20:34:11 +0000
+++ openlp/core/ui/pluginform.py	2009-11-04 01:20:28 +0000
@@ -71,7 +71,7 @@
                 status_text = 'Disabled'
             item.setText(u'%s (%s)' % (plugin.name, status_text))
             # If the plugin has an icon, set it!
-            if plugin.icon is not None:
+            if plugin.icon:
                 item.setIcon(plugin.icon)
             self.PluginListWidget.addItem(item)
 
@@ -101,13 +101,13 @@
             if plugin.name == plugin_name:
                 self.activePlugin = plugin
                 break
-        if self.activePlugin is not None:
+        if self.activePlugin:
             self._setDetails()
         else:
             self._clearDetails()
 
     def onStatusComboBoxChanged(self, status):
-        if self.programaticChange is True:
+        if self.programaticChange:
             self.programaticChange = False
             return
         self.activePlugin.toggle_status(status)

=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py	2009-11-03 18:39:58 +0000
+++ openlp/core/ui/servicemanager.py	2009-11-04 01:20:28 +0000
@@ -247,7 +247,7 @@
                 serviceIterator.setSelected(False)
             if serviceIterator.isSelected():
                 #We are on the first record
-                if tempItem is not None:
+                if tempItem:
                     tempItem.setSelected(True)
                     serviceIterator.setSelected(False)
             else:

=== modified file 'openlp/core/ui/settingsform.py'
--- openlp/core/ui/settingsform.py	2009-10-29 13:00:48 +0000
+++ openlp/core/ui/settingsform.py	2009-11-04 01:20:28 +0000
@@ -54,12 +54,13 @@
     def insertTab(self, tab, location):
         log.debug(u'Inserting %s tab' % tab.tabTitle)
         #13 : There are 3 tables currently and locations starts at -10
-        self.SettingsTabWidget.insertTab(location + 13, tab, tab.tabTitleVisible)
+        self.SettingsTabWidget.insertTab(
+            location + 13, tab, tab.tabTitleVisible)
 
     def removeTab(self, name):
         log.debug(u'remove %s tab' % name)
         for tab_index in range(0, self.SettingsTabWidget.count()):
-            if self.SettingsTabWidget.widget(tab_index) is not None:
+            if self.SettingsTabWidget.widget(tab_index):
                 if self.SettingsTabWidget.widget(tab_index).tabTitle == name:
                     self.SettingsTabWidget.removeTab(tab_index)
 

=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py	2009-11-03 06:15:35 +0000
+++ openlp/core/ui/slidecontroller.py	2009-11-04 01:20:28 +0000
@@ -100,9 +100,11 @@
         # Type label for the top of the slide controller
         self.TypeLabel = QtGui.QLabel(self.Panel)
         if self.isLive:
-            self.TypeLabel.setText(u'<strong>%s</strong>' % self.trUtf8(u'Live'))
+            self.TypeLabel.setText(u'<strong>%s</strong>' %
+                self.trUtf8(u'Live'))
         else:
-            self.TypeLabel.setText(u'<strong>%s</strong>' % self.trUtf8(u'Preview'))
+            self.TypeLabel.setText(u'<strong>%s</strong>' %
+                self.trUtf8(u'Preview'))
         self.TypeLabel.setAlignment(QtCore.Qt.AlignCenter)
         self.PanelLayout.addWidget(self.TypeLabel)
         # Splitter
@@ -126,7 +128,8 @@
         self.PreviewListWidget.setColumnWidth(1, self.Controller.width())
         self.PreviewListWidget.isLive = self.isLive
         self.PreviewListWidget.setObjectName(u'PreviewListWidget')
-        self.PreviewListWidget.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
+        self.PreviewListWidget.setEditTriggers(
+            QtGui.QAbstractItemView.NoEditTriggers)
         self.ControllerLayout.addWidget(self.PreviewListWidget)
         # Build the full toolbar
         self.Toolbar = OpenLPToolbar(self)
@@ -302,7 +305,7 @@
                 str_to_bool(self.songsconfig.get_config(u'display songbar', True)):
                 for action in self.Songbar.actions:
                     self.Songbar.actions[action].setVisible(False)
-                if item.verse_order is not None:
+                if item.verse_order:
                     verses = item.verse_order.split(u' ')
                     for verse in verses:
                         try:
@@ -336,7 +339,7 @@
         """
         log.debug(u'addServiceItem')
         #If old item was a command tell it to stop
-        if self.commandItem is not None and \
+        if self.commandItem and \
             self.commandItem.service_item_type == ServiceItemType.Command:
             Receiver().send_message(u'%s_stop'% self.commandItem.name.lower())
         self.commandItem = item
@@ -358,7 +361,7 @@
         """
         Replacement item following a remote edit
         """
-        if self.commandItem is not None and \
+        if self.commandItem and \
             item.uuid == self.commandItem.uuid:
             self.addServiceManagerItem(item, self.PreviewListWidget.currentRow())
 
@@ -370,7 +373,7 @@
         """
         log.debug(u'addServiceManagerItem')
         #If old item was a command tell it to stop
-        if self.commandItem is not None and \
+        if self.commandItem and \
             self.commandItem.service_item_type == ServiceItemType.Command:
             Receiver().send_message(u'%s_stop'% self.commandItem.name.lower())
         self.commandItem = item
@@ -413,7 +416,7 @@
             self.PreviewListWidget.setItem(framenumber, 0, item)
             if slide_height != 0:
                 self.PreviewListWidget.setRowHeight(framenumber, slide_height)
-        if self.serviceitem.frames[0][u'text'] is not None:
+        if self.serviceitem.frames[0][u'text']:
             self.PreviewListWidget.resizeRowsToContents()
         self.PreviewListWidget.setColumnWidth(
             0, self.PreviewListWidget.viewport().size().width())
@@ -433,7 +436,7 @@
         """
         Go to the first slide.
         """
-        if self.commandItem is not None and \
+        if self.commandItem and \
             self.commandItem.service_item_type == ServiceItemType.Command:
             Receiver().send_message(u'%s_first'% self.commandItem.name.lower())
             QtCore.QTimer.singleShot(0.5, self.grabMainDisplay)
@@ -445,7 +448,7 @@
         """
         Blank the screen.
         """
-        if self.commandItem is not None and \
+        if self.commandItem and \
             self.commandItem.service_item_type == ServiceItemType.Command:
             if blanked:
                 Receiver().send_message(u'%s_blank'% self.commandItem.name.lower())
@@ -499,7 +502,7 @@
         """
         Go to the next slide.
         """
-        if self.commandItem is not None and \
+        if self.commandItem and \
             self.commandItem.service_item_type == ServiceItemType.Command:
             Receiver().send_message(u'%s_next'% self.commandItem.name.lower())
             QtCore.QTimer.singleShot(0.5, self.grabMainDisplay)
@@ -514,7 +517,7 @@
         """
         Go to the previous slide.
         """
-        if self.commandItem is not None and \
+        if self.commandItem and \
             self.commandItem.service_item_type == ServiceItemType.Command:
             Receiver().send_message(
                 u'%s_previous'% self.commandItem.name.lower())
@@ -530,7 +533,7 @@
         """
         Go to the last slide.
         """
-        if self.commandItem is not None and \
+        if self.commandItem and \
             self.commandItem.service_item_type == ServiceItemType.Command:
             Receiver().send_message(u'%s_last'% self.commandItem.name.lower())
             QtCore.QTimer.singleShot(0.5, self.grabMainDisplay)

=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py	2009-10-29 13:58:03 +0000
+++ openlp/core/ui/thememanager.py	2009-11-04 01:20:28 +0000
@@ -78,17 +78,25 @@
         self.ThemeListWidget.addAction(
             contextMenuAction(self.ThemeListWidget, u':/themes/theme_edit.png',
             self.trUtf8(u'Edit a theme'), self.onEditTheme))
-        self.ThemeListWidget.addAction(contextMenuSeparator(self.ThemeListWidget))
-        self.ThemeListWidget.addAction(
-            contextMenuAction(self.ThemeListWidget, u':/themes/theme_delete.png',
-            self.trUtf8(u'Delete theme'), self.onDeleteTheme))
-        self.ThemeListWidget.addAction(
-            contextMenuAction(self.ThemeListWidget, u':/themes/theme_export.png',
-            self.trUtf8(u'Make Global'), self.changeGlobalFromScreen))
-        self.ThemeListWidget.addAction(
-            contextMenuAction(self.ThemeListWidget, u':/themes/theme_export.png',
-            self.trUtf8(u'Export theme'), self.onExportTheme))
-        self.ThemeListWidget.addAction(contextMenuSeparator(self.ThemeListWidget))
+        self.ThemeListWidget.addAction(
+            contextMenuSeparator(self.ThemeListWidget))
+        self.ThemeListWidget.addAction(
+            contextMenuAction(self.ThemeListWidget,
+                u':/themes/theme_delete.png',
+                self.trUtf8(u'Delete theme'),
+            self.onDeleteTheme))
+        self.ThemeListWidget.addAction(
+            contextMenuAction(self.ThemeListWidget,
+                u':/themes/theme_export.png',
+                self.trUtf8(u'Make Global'),
+            self.changeGlobalFromScreen))
+        self.ThemeListWidget.addAction(
+            contextMenuAction(self.ThemeListWidget,
+                u':/themes/theme_export.png',
+                self.trUtf8(u'Export theme'),
+            self.onExportTheme))
+        self.ThemeListWidget.addAction(
+            contextMenuSeparator(self.ThemeListWidget))
         #Signals
         QtCore.QObject.connect(self.ThemeListWidget,
             QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
@@ -148,17 +156,18 @@
 
     def onEditTheme(self):
         item = self.ThemeListWidget.currentItem()
-        if item is not None:
+        if item:
             self.amendThemeForm.loadTheme(
                 unicode(item.data(QtCore.Qt.UserRole).toString()))
-            self.saveThemeName = unicode(item.data(QtCore.Qt.UserRole).toString())
+            self.saveThemeName = unicode(
+                item.data(QtCore.Qt.UserRole).toString())
             self.amendThemeForm.exec_()
 
     def onDeleteTheme(self):
         self.global_theme = unicode(
             self.config.get_config(u'theme global theme', u''))
         item = self.ThemeListWidget.currentItem()
-        if item is not None:
+        if item:
             theme = unicode(item.text())
             # should be the same unless default
             if theme != unicode(item.data(QtCore.Qt.UserRole).toString()):
@@ -275,7 +284,7 @@
 
     def checkThemesExists(self, dir):
         log.debug(u'check themes')
-        if os.path.exists(dir) == False:
+        if not os.path.exists(dir):
             os.mkdir(dir)
 
     def unzipTheme(self, filename, dir):
@@ -299,7 +308,7 @@
         for file in zip.namelist():
             if file.endswith(os.path.sep):
                 theme_dir = os.path.join(dir, file)
-                if os.path.exists(theme_dir) == False:
+                if not os.path.exists(theme_dir):
                     os.mkdir(os.path.join(dir, file))
             else:
                 fullpath = os.path.join(dir, file)
@@ -386,7 +395,7 @@
         """
         log.debug(u'saveTheme %s %s', name, theme_xml)
         theme_dir = os.path.join(self.path, name)
-        if os.path.exists(theme_dir) == False:
+        if not os.path.exists(theme_dir):
             os.mkdir(os.path.join(self.path, name))
         theme_file = os.path.join(theme_dir, name + u'.xml')
         log.debug(theme_file)
@@ -406,7 +415,7 @@
             outfile = open(theme_file, u'w')
             outfile.write(theme_pretty_xml)
             outfile.close()
-            if image_from is not None and image_from != image_to:
+            if image_from and image_from != image_to:
                 print "if", image_from
                 print "it", image_to
                 shutil.copyfile(image_from, image_to)
@@ -466,33 +475,36 @@
         #theme.background_type
         if theme.display_display:
             theme.display_display = theme.display_display.strip()
-        theme.display_horizontalAlign = theme.display_horizontalAlign.strip()
+        theme.display_horizontalAlign = \
+            int(theme.display_horizontalAlign.strip())
         theme.display_outline = str_to_bool(theme.display_outline)
         #theme.display_outline_color
         theme.display_shadow = str_to_bool(theme.display_shadow)
         #theme.display_shadow_color
-        theme.display_verticalAlign = theme.display_verticalAlign.strip()
+        theme.display_verticalAlign = int(theme.display_verticalAlign.strip())
         theme.display_wrapStyle = theme.display_wrapStyle.strip()
         theme.font_footer_color = theme.font_footer_color.strip()
-        theme.font_footer_height = theme.font_footer_height.strip()
+        theme.font_footer_height = int(theme.font_footer_height.strip())
         theme.font_footer_italics = str_to_bool(theme.font_footer_italics)
         theme.font_footer_name = theme.font_footer_name.strip()
         #theme.font_footer_override
-        theme.font_footer_proportion = theme.font_footer_proportion.strip()
+        theme.font_footer_proportion = \
+            int(theme.font_footer_proportion.strip())
         theme.font_footer_weight = theme.font_footer_weight.strip()
-        theme.font_footer_width = theme.font_footer_width.strip()
-        theme.font_footer_x = theme.font_footer_x.strip()
-        theme.font_footer_y = theme.font_footer_y.strip()
+        theme.font_footer_width = int(theme.font_footer_width.strip())
+        theme.font_footer_x = int(theme.font_footer_x.strip())
+        theme.font_footer_y = int(theme.font_footer_y.strip())
         theme.font_main_color = theme.font_main_color.strip()
-        theme.font_main_height = theme.font_main_height.strip()
+        theme.font_main_height = int(theme.font_main_height.strip())
         theme.font_main_italics = str_to_bool(theme.font_main_italics)
         theme.font_main_indentation = int(theme.font_main_indentation)
         theme.font_main_name = theme.font_main_name.strip()
         #theme.font_main_override
-        theme.font_main_proportion = theme.font_main_proportion.strip()
+        theme.font_main_proportion = int(theme.font_main_proportion.strip())
         theme.font_main_weight = theme.font_main_weight.strip()
-        theme.font_main_x = theme.font_main_x.strip()
-        theme.font_main_y = theme.font_main_y.strip()
+        theme.font_main_width = int(theme.font_main_width.strip())
+        theme.font_main_x = int(theme.font_main_x.strip())
+        theme.font_main_y = int(theme.font_main_y.strip())
         #theme.theme_mode
         theme.theme_name = theme.theme_name.strip()
         #theme.theme_version

=== modified file 'openlp/core/utils/confighelper.py'
--- openlp/core/utils/confighelper.py	2009-09-29 02:54:32 +0000
+++ openlp/core/utils/confighelper.py	2009-11-04 01:20:28 +0000
@@ -57,7 +57,7 @@
         if reg.has_value(section, key):
             return reg.get_value(section, key, default)
         else:
-            if default is not None:
+            if default:
                 ConfigHelper.set_config(section, key, default)
             return default
 

=== modified file 'openlp/plugins/bibles/bibleplugin.py'
--- openlp/plugins/bibles/bibleplugin.py	2009-10-30 20:34:11 +0000
+++ openlp/plugins/bibles/bibleplugin.py	2009-11-04 01:20:28 +0000
@@ -85,7 +85,7 @@
         self.ExportBibleItem.setVisible(False)
 
     def onBibleNewClick(self):
-        if self.media_item is not None:
+        if self.media_item:
             self.media_item.onNewClick()
 
     def about(self):

=== modified file 'openlp/plugins/bibles/forms/bibleimportform.py'
--- openlp/plugins/bibles/forms/bibleimportform.py	2009-10-29 06:45:37 +0000
+++ openlp/plugins/bibles/forms/bibleimportform.py	2009-11-04 01:20:28 +0000
@@ -199,7 +199,7 @@
 
     def onImportButtonClicked(self):
         message = self.trUtf8(u'Bible import completed')
-        if self.biblemanager is not None:
+        if self.biblemanager:
             if not self.bible_type is None and \
                 len(self.BibleNameEdit.displayText()) > 0:
                 self.MessageLabel.setText(self.trUtf8(u'Import Started'))
@@ -208,7 +208,7 @@
                 self.ProgressBar.setValue(0)
                 self.biblemanager.process_dialog(self)
                 status, msg = self.importBible()
-                if msg is not None:
+                if msg:
                     message = msg
                 self.MessageLabel.setText(message)
                 self.ProgressBar.setValue(self.barmax)

=== modified file 'openlp/plugins/bibles/lib/bibleCSVimpl.py'
--- openlp/plugins/bibles/lib/bibleCSVimpl.py	2009-09-28 20:45:04 +0000
+++ openlp/plugins/bibles/lib/bibleCSVimpl.py	2009-11-04 01:20:28 +0000
@@ -44,17 +44,17 @@
             QtCore.SIGNAL(u'openlpstopimport'), self.stop_import)
 
     def stop_import(self):
-        self.loadbible= False
+        self.loadbible = False
 
     def load_data(self, booksfile, versesfile, dialogobject):
         #Populate the Tables
-        fbooks=open(booksfile, 'r')
-        fverse=open(versesfile, 'r')
+        fbooks = open(booksfile, 'r')
+        fverse = open(versesfile, 'r')
 
         count = 0
         for line in fbooks:
             # cancel pressed
-            if self.loadbible == False:
+            if not self.loadbible:
                 break
             details = chardet.detect(line)
             line = unicode(line, details['encoding'])
@@ -72,7 +72,7 @@
         count = 0
         book_ptr = None
         for line in fverse:
-            if self.loadbible == False:  # cancel pressed
+            if not self.loadbible:  # cancel pressed
                 break
             details = chardet.detect(line)
             line = unicode(line, details['encoding'])

=== modified file 'openlp/plugins/bibles/lib/bibleDBimpl.py'
--- openlp/plugins/bibles/lib/bibleDBimpl.py	2009-10-24 05:58:49 +0000
+++ openlp/plugins/bibles/lib/bibleDBimpl.py	2009-11-04 01:20:28 +0000
@@ -160,7 +160,7 @@
             everse)
         #Look up book name or abbreviation
         book = self.get_bible_book(bookname)
-        if book is not None:
+        if book:
             bookname = book.name
             log.debug(u'bookname corrected to  %s' % bookname)
         verses = self.session.query(Verse).join(Book).filter(

=== modified file 'openlp/plugins/bibles/lib/bibleOSISimpl.py'
--- openlp/plugins/bibles/lib/bibleOSISimpl.py	2009-10-24 16:40:36 +0000
+++ openlp/plugins/bibles/lib/bibleOSISimpl.py	2009-11-04 01:20:28 +0000
@@ -96,7 +96,7 @@
         testament = 1
         for file_record in osis.readlines():
             # cancel pressed on UI
-            if self.loadbible == False:
+            if not self.loadbible:
                 break
             pos = file_record.find(verseText)
             # we have a verse

=== modified file 'openlp/plugins/bibles/lib/common.py'
--- openlp/plugins/bibles/lib/common.py	2009-10-27 16:55:09 +0000
+++ openlp/plugins/bibles/lib/common.py	2009-11-04 01:20:28 +0000
@@ -97,7 +97,7 @@
             The URL of a proxy server used to access the Internet.
         """
         log.debug(u'get_web_text %s %s', proxyurl, urlstring)
-        if proxyurl is not None:
+        if proxyurl:
             proxy_support = urllib2.ProxyHandler({'http': self.proxyurl})
             http_support = urllib2.HTTPHandler()
             opener = urllib2.build_opener(proxy_support, http_support)

=== modified file 'openlp/plugins/bibles/lib/manager.py'
--- openlp/plugins/bibles/lib/manager.py	2009-10-30 19:29:02 +0000
+++ openlp/plugins/bibles/lib/manager.py	2009-11-04 01:20:28 +0000
@@ -97,7 +97,7 @@
                 # look to see if lazy load bible exists and get create getter.
                 meta = self.bible_db_cache[bname].get_meta(u'proxy')
                 proxy = None
-                if meta is not None:
+                if meta:
                     proxy = meta.value
                     # tell The Server where to get the verses from.
                 nhttp.set_proxy(proxy)
@@ -173,14 +173,14 @@
             nbible.save_meta(u'WEB', biblesource)
             # store the web id of the bible
             nbible.save_meta(u'bibleid', bibleid)
-            if proxyurl is not None and proxyurl != u'':
+            if proxyurl and proxyurl != u'':
                 # store the proxy URL
                 nbible.save_meta(u'proxy', proxyurl)
                 nhttp.set_proxy(proxyurl)
-            if proxyid is not None and proxyid != u'':
+            if proxyid and proxyid != u'':
                 # store the proxy userid
                 nbible.save_meta(u'proxyid', proxyid)
-            if proxypass is not None and proxypass != u'':
+            if proxypass and proxypass != u'':
                 # store the proxy password
                 nbible.save_meta(u'proxypass', proxypass)
             return True
@@ -247,7 +247,7 @@
         log.debug(u'get_bibles')
         bible_list = []
         for bible_name, bible_object in self.bible_db_cache.iteritems():
-            if self.bible_http_cache[bible_name] is not None:
+            if self.bible_http_cache[bible_name]:
                 bible_name = u'%s (%s)' % (bible_name, self.web)
             bible_list.append(bible_name)
         return bible_list
@@ -338,13 +338,14 @@
         # check to see if book/chapter exists fow HTTP bibles and load cache
         # if necessary
         web, bible = self.is_bible_web(bible)
-        if self.bible_http_cache[bible] is not None:
+        if self.bible_http_cache[bible]:
             book = self.bible_db_cache[bible].get_bible_book(bookname)
             if book is None:
                 log.debug(u'get_verse_text : new book')
                 for chapter in range(schapter, echapter + 1):
                     self.media.setQuickMessage(
-                        unicode(self.media.trUtf8(u'Downloading %s: %s')) % (bookname, chapter))
+                        unicode(self.media.trUtf8(u'Downloading %s: %s')) %
+                            (bookname, chapter))
                     search_results = \
                         self.bible_http_cache[bible].get_bible_chapter(
                             bible, bookname, chapter)

=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py	2009-10-30 17:44:16 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py	2009-11-04 01:20:28 +0000
@@ -380,7 +380,7 @@
                 bible, text)
         else:
             self.searchByReference(bible, text)
-        if self.search_results is not None:
+        if self.search_results:
             self.displayResults(bible)
 
     def generateSlideData(self, service_item):
@@ -518,9 +518,9 @@
             bible_verse.setData(QtCore.Qt.UserRole,
                 QtCore.QVariant(bible_text))
             self.ListView.addItem(bible_verse)
-            cr = self.ListView.setCurrentRow(count)
-            if cr is not None:
-                cr.setSelected(True)
+            row = self.ListView.setCurrentRow(count)
+            if row:
+                row.setSelected(True)
 
     def searchByReference(self, bible, search):
         log.debug(u'searchByReference %s, %s', bible, search)

=== modified file 'openlp/plugins/custom/lib/mediaitem.py'
--- openlp/plugins/custom/lib/mediaitem.py	2009-10-30 17:44:16 +0000
+++ openlp/plugins/custom/lib/mediaitem.py	2009-11-04 01:20:28 +0000
@@ -90,14 +90,14 @@
 
     def onRemoteEdit(self, item_id):
         valid = self.parent.custommanager.get_custom(item_id)
-        if valid is not None:
+        if valid:
             self.fromServiceManager = item_id
             self.parent.edit_custom_form.loadCustom(item_id)
             self.parent.edit_custom_form.exec_()
 
     def onEditClick(self):
         item = self.ListView.currentItem()
-        if item is not None:
+        if item:
             item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
             self.parent.edit_custom_form.loadCustom(item_id)
             self.parent.edit_custom_form.exec_()
@@ -105,7 +105,7 @@
 
     def onDeleteClick(self):
         item = self.ListView.currentItem()
-        if item is not None:
+        if item:
             item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
             self.parent.custommanager.delete_custom(item_id)
             row = self.ListView.row(item)
@@ -137,7 +137,7 @@
         for verse in verseList:
             raw_slides.append(verse[1])
         raw_footer.append(title + u' '+ credit)
-        if theme is not None:
+        if theme:
             service_item.title = title
             for slide in raw_slides:
                 service_item.add_from_text(slide[:30], slide)

=== modified file 'openlp/plugins/images/lib/mediaitem.py'
--- openlp/plugins/images/lib/mediaitem.py	2009-11-03 01:12:35 +0000
+++ openlp/plugins/images/lib/mediaitem.py	2009-11-04 01:20:28 +0000
@@ -76,7 +76,7 @@
         self.ListView.setIconSize(QtCore.QSize(88,50))
         self.servicePath = os.path.join(
             self.parent.config.get_data_path(), u'.thumbnails')
-        if os.path.exists(self.servicePath) == False:
+        if not os.path.exists(self.servicePath):
             os.mkdir(self.servicePath)
         self.loadList(self.parent.config.load_list(self.ConfigSection))
 
@@ -113,7 +113,7 @@
 
     def onDeleteClick(self):
         item = self.ListView.currentItem()
-        if item is not None:
+        if item:
             try:
                 os.remove(os.path.join(self.servicePath, unicode(item.text())))
             except:
@@ -141,16 +141,17 @@
 
     def generateSlideData(self, service_item):
         items = self.ListView.selectedIndexes()
-        if len(items) == 0:
+        if items:
+            service_item.title = self.trUtf8(u'Image(s)')
+            for item in items:
+                bitem = self.ListView.item(item.row())
+                filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString())
+                frame = QtGui.QImage(unicode(filename))
+                (path, name) = os.path.split(filename)
+                service_item.add_from_image(path, name, frame)
+            return True
+        else:
             return False
-        service_item.title = self.trUtf8(u'Image(s)')
-        for item in items:
-            bitem = self.ListView.item(item.row())
-            filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString())
-            frame = QtGui.QImage(unicode(filename))
-            (path, name) = os.path.split(filename)
-            service_item.add_from_image(path, name, frame)
-        return True
 
     def toggleOverrideState(self):
         self.overrideActive = not self.overrideActive

=== modified file 'openlp/plugins/media/lib/mediaitem.py'
--- openlp/plugins/media/lib/mediaitem.py	2009-11-03 01:38:15 +0000
+++ openlp/plugins/media/lib/mediaitem.py	2009-11-04 01:20:28 +0000
@@ -96,7 +96,7 @@
 
     def onDeleteClick(self):
         item = self.ListView.currentItem()
-        if item is not None:
+        if item:
             row = self.ListView.row(item)
             self.ListView.takeItem(row)
             self.parent.config.set_list(

=== modified file 'openlp/plugins/presentations/lib/impresscontroller.py'
--- openlp/plugins/presentations/lib/impresscontroller.py	2009-10-30 01:26:45 +0000
+++ openlp/plugins/presentations/lib/impresscontroller.py	2009-11-04 01:20:28 +0000
@@ -225,8 +225,8 @@
         Triggerent by new object being added to SlideController orOpenLP
         being shut down
         """
-        if self.document is not None:
-            if self.presentation is not None:
+        if self.document:
+            if self.presentation:
                 self.presentation.end()
                 self.presentation = None
             self.document.dispose()

=== modified file 'openlp/plugins/presentations/lib/mediaitem.py'
--- openlp/plugins/presentations/lib/mediaitem.py	2009-11-01 23:15:19 +0000
+++ openlp/plugins/presentations/lib/mediaitem.py	2009-11-04 01:20:28 +0000
@@ -121,7 +121,7 @@
 
     def onDeleteClick(self):
         item = self.ListView.currentItem()
-        if item is not None:
+        if item:
             row = self.ListView.row(item)
             self.ListView.takeItem(row)
             self.parent.config.set_list(
@@ -146,7 +146,7 @@
                 cont.load_presentation(filename)
             i = 1
             img = cont.get_slide_preview_file(i)
-            while img is not None:
+            while img:
                 service_item.add_from_command(path, name, img)
                 i = i + 1
                 img = cont.get_slide_preview_file(i)

=== modified file 'openlp/plugins/presentations/lib/messagelistener.py'
--- openlp/plugins/presentations/lib/messagelistener.py	2009-10-30 01:26:45 +0000
+++ openlp/plugins/presentations/lib/messagelistener.py	2009-11-04 01:20:28 +0000
@@ -86,7 +86,7 @@
         
     def slide(self, message):
         self.activate()
-        if message is not None:
+        if message:
             self.controller.goto_slide(message[0]+1)
             self.controller.poll_slidenumber()
 

=== modified file 'openlp/plugins/presentations/lib/pptviewcontroller.py'
--- openlp/plugins/presentations/lib/pptviewcontroller.py	2009-10-16 23:34:56 +0000
+++ openlp/plugins/presentations/lib/pptviewcontroller.py	2009-11-04 01:20:28 +0000
@@ -78,7 +78,7 @@
             """
             Loads the PPTVIEWLIB library
             """
-            if self.process is not None:
+            if self.process:
                 return
             log.debug(u'start PPTView')
             self.process = cdll.LoadLibrary(r'openlp\plugins\presentations\lib\pptviewlib\pptviewlib.dll')

=== modified file 'openlp/plugins/remotes/remoteclient-cli.py'
--- openlp/plugins/remotes/remoteclient-cli.py	2009-10-30 01:26:45 +0000
+++ openlp/plugins/remotes/remoteclient-cli.py	2009-11-04 01:20:28 +0000
@@ -69,7 +69,7 @@
     elif options.address is None:
         parser.print_help()
         parser.error("IP address missing")
-    elif options.slidenext is not None:
+    elif options.slidenext:
         options.event = u'next_slide'
         options.message = u''
         text = format_message(options)

=== modified file 'openlp/plugins/remotes/remoteplugin.py'
--- openlp/plugins/remotes/remoteplugin.py	2009-10-30 20:34:11 +0000
+++ openlp/plugins/remotes/remoteplugin.py	2009-11-04 01:20:28 +0000
@@ -55,7 +55,7 @@
     def finalise(self):
         log.debug(u'finalise')
         self.remove_toolbox_item()
-        if self.server is not None:
+        if self.server:
             self.server.close()
 
     def get_settings_tab(self):

=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py	2009-11-01 21:02:31 +0000
+++ openlp/plugins/songs/forms/editsongform.py	2009-11-04 01:20:28 +0000
@@ -66,7 +66,8 @@
         QtCore.QObject.connect(self.VerseAddButton,
             QtCore.SIGNAL(u'clicked()'), self.onVerseAddButtonClicked)
         QtCore.QObject.connect(self.VerseListWidget,
-            QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onVerseEditButtonClicked)
+            QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
+            self.onVerseEditButtonClicked)
         QtCore.QObject.connect(self.VerseEditButton,
             QtCore.SIGNAL(u'clicked()'), self.onVerseEditButtonClicked)
         QtCore.QObject.connect(self.VerseEditAllButton,
@@ -183,7 +184,7 @@
                 # Not Found
                 id = 0
             self.SongbookCombo.setCurrentIndex(id)
-        if self.song.theme_name is not None and len(self.song.theme_name) > 0:
+        if self.song.theme_name:
             id = self.ThemeSelectionComboItem.findText(
                 unicode(self.song.theme_name), QtCore.Qt.MatchExactly)
             if id == -1:
@@ -193,20 +194,20 @@
             self.ThemeSelectionComboItem.setCurrentIndex(id)
         if len(title) > 1:
             self.AlternativeEdit.setText(title[1])
-        if self.song.copyright is not None:
+        if self.song.copyright:
             self.CopyrightEditItem.setText(self.song.copyright)
         else:
             self.CopyrightEditItem.setText(u'')
         self.VerseListWidget.clear()
-        if self.song.verse_order is not None:
+        if self.song.verse_order:
             self.VerseOrderEdit.setText(self.song.verse_order)
         else:
             self.VerseOrderEdit.setText(u'')
-        if self.song.comments is not None:
+        if self.song.comments:
             self.CommentsEdit.setPlainText(self.song.comments)
         else:
             self.CommentsEdit.setPlainText(u'')
-        if self.song.ccli_number is not None:
+        if self.song.ccli_number:
             self.CCLNumberEdit.setText(self.song.ccli_number)
         else:
             self.CCLNumberEdit.setText(u'')
@@ -311,7 +312,7 @@
 
     def onVerseEditButtonClicked(self):
         item = self.VerseListWidget.currentItem()
-        if item is not None:
+        if item:
             tempText = item.text()
             self.verse_form.setVerse(tempText)
             self.verse_form.exec_()
@@ -463,7 +464,8 @@
             self.song.search_lyrics = unicode(text)
             self.song.lyrics = unicode(sxml.extract_xml())
         except:
-            log.exception(u'Problem processing song Lyrics \n%s', sxml.dump_xml())
+            log.exception(u'Problem processing song Lyrics \n%s',
+                sxml.dump_xml())
 
     def processTitle(self):
         log.debug(u'processTitle')

=== modified file 'openlp/plugins/songs/forms/songmaintenanceform.py'
--- openlp/plugins/songs/forms/songmaintenanceform.py	2009-10-24 16:40:36 +0000
+++ openlp/plugins/songs/forms/songmaintenanceform.py	2009-11-04 01:20:28 +0000
@@ -68,7 +68,7 @@
 
     def _getCurrentItemId(self, ListWidget):
         item = ListWidget.currentItem()
-        if item is not None:
+        if item:
             item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
             return item_id
         else:
@@ -79,9 +79,10 @@
         item_id = self._getCurrentItemId(list_widget)
         if item_id != -1:
             item = get_func(item_id)
-            if item is not None and len(item.songs) == 0:
+            if item and len(item.songs) == 0:
                 if QtGui.QMessageBox.warning(self, dlg_title, del_text,
-                        QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | QtGui.QMessageBox.Yes)
+                        QtGui.QMessageBox.StandardButtons(
+                            QtGui.QMessageBox.No | QtGui.QMessageBox.Yes)
                         ) == QtGui.QMessageBox.Yes:
                     del_func(item.id)
                     reset_func()
@@ -96,7 +97,7 @@
         self.AuthorsListWidget.clear()
         authors = self.songmanager.get_authors()
         for author in authors:
-            if author.display_name is not None and author.display_name != u'':
+            if author.display_name:
                 author_name = QtGui.QListWidgetItem(author.display_name)
             else:
                 author_name = QtGui.QListWidgetItem(

=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py	2009-11-03 06:15:35 +0000
+++ openlp/plugins/songs/lib/mediaitem.py	2009-11-04 01:20:28 +0000
@@ -53,8 +53,8 @@
         self.edit_song_form = EditSongForm(self.parent.songmanager, self)
         self.song_maintenance_form = SongMaintenanceForm(
             self.parent.songmanager, self)
-        #Holds information about whether the edit is remotly triggered and which
-        #Song is required.
+        # Holds information about whether the edit is remotly triggered and
+        # which Song is required.
         self.remoteTriggered = None
         self.remoteSong = -1
 
@@ -131,7 +131,7 @@
         QtCore.QObject.connect(Receiver.get_receiver(),
             QtCore.SIGNAL(u'%s_edit' % self.parent.name), self.onRemoteEdit)
         QtCore.QObject.connect(Receiver.get_receiver(),
-            QtCore.SIGNAL(u'remote_edit_clear' ), self.onRemoteEditClear)
+            QtCore.SIGNAL(u'remote_edit_clear'), self.onRemoteEditClear)
 
     def configUpdated(self):
         self.searchAsYouType = str_to_bool(
@@ -254,7 +254,7 @@
         """
         fields = songid.split(u':')
         valid = self.parent.songmanager.get_song(fields[1])
-        if valid is not None:
+        if valid:
             self.remoteSong = fields[1]
             self.remoteTriggered = fields[0]
             self.edit_song_form.loadSong(fields[1], (fields[0] == u'P'))
@@ -262,14 +262,14 @@
 
     def onEditClick(self, preview=False):
         item = self.ListView.currentItem()
-        if item is not None:
+        if item:
             item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
             self.edit_song_form.loadSong(item_id, False)
             self.edit_song_form.exec_()
 
     def onDeleteClick(self):
         item = self.ListView.currentItem()
-        if item is not None:
+        if item:
             item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
             self.parent.songmanager.delete_song(item_id)
             row = self.ListView.row(item)
@@ -296,7 +296,7 @@
             songXML=SongXMLParser(song.lyrics)
             verseList = songXML.get_verses()
             for verse in verseList:
-                if verse[1] is not None:
+                if verse[1]:
                     service_item.add_from_text(verse[1][:30], verse[1])
         else:
             verses = song.lyrics.split(u'\n\n')
@@ -322,3 +322,35 @@
             song.title, author_audit, song.copyright, song.ccli_number
         ]
         return True
+
+    def onPreviewClick(self):
+        if not self.remoteTriggered:
+            MediaManagerItem.onPreviewClick(self)
+        else:
+            log.debug(self.PluginNameShort + u' Preview Requested')
+            service_item = self.buildServiceItem()
+            if service_item:
+                service_item.fromPlugin = True
+                self.parent.preview_controller.addServiceItem(service_item)
+
+    def onLiveClick(self):
+        if not self.remoteTriggered:
+            MediaManagerItem.onLiveClick(self)
+        else:
+            log.debug(self.PluginNameShort + u' Live Requested')
+            service_item = self.buildServiceItem()
+            if service_item:
+                service_item.fromPlugin = True
+                service_item.uuid = unicode(uuid.uuid1())
+                self.parent.live_controller.addServiceItem(service_item)
+
+    def onAddClick(self):
+        if not self.remoteTriggered:
+            MediaManagerItem.onAddClick(self)
+        else:
+            log.debug(self.PluginNameShort + u' Add Requested')
+            service_item = self.buildServiceItem()
+            if service_item:
+                service_item.fromPlugin = False
+                service_item.uuid = unicode(uuid.uuid1())
+                self.parent.service_manager.addServiceItem(service_item)

=== modified file 'openlp/plugins/songs/lib/songxml.py'
--- openlp/plugins/songs/lib/songxml.py	2009-09-25 23:06:54 +0000
+++ openlp/plugins/songs/lib/songxml.py	2009-11-04 01:20:28 +0000
@@ -85,7 +85,7 @@
     def from_buffer(self, xmlContent):
         """Initialize from buffer(string) with xml content"""
         self._reset()
-        if xmlContent is not None:
+        if xmlContent:
             self._setFromXml(xmlContent, 'song')
 
     def get_author_list(self):
@@ -95,7 +95,7 @@
         return as a string
         """
         res = []
-        if self.author is not None:
+        if self.author:
             lst = self.author.split(u' and ')
             for l in lst:
                 res.append(l.strip())
@@ -108,9 +108,9 @@
         return as a string
         """
         res = []
-        if self.theme is not None:
+        if self.theme:
             res.append(self.theme)
-        if self.alttheme is not None:
+        if self.alttheme:
             res.append(self.alttheme)
         s = u', u'.join(res)
         return s
@@ -264,13 +264,13 @@
         """Initialize from buffer(string) of xml lines in opensong format"""
         self._reset()
         opensong = _OpenSong(xmlcontent)
-        if opensong.title is not None:
+        if opensong.title:
             self.set_title(opensong.title)
-        if opensong.copyright is not None:
+        if opensong.copyright:
             self.set_copyright(opensong.copyright)
-        if opensong.presentation is not None:
+        if opensong.presentation:
             self.set_verse_order(opensong.presentation)
-        if opensong.ccli is not None:
+        if opensong.ccli:
             self.set_song_cclino(opensong.ccli)
         self.set_author_list(opensong.get_author_list())
         self.set_category_array(opensong.get_category_array())
@@ -402,7 +402,7 @@
     def _split_to_list(self, aString):
         """Split a string into a list - comma separated"""
         res = []
-        if aString is not None:
+        if aString:
             lst = aString.split(u',')
             for l in lst:
                 # remove whitespace


Follow ups