← Back to team overview

openlp-core team mailing list archive

[Bug 1385438] Re: OpenLP Settings Fail on PyQt4 v 4.11

 

Code re-factored and corrected.

** Changed in: openlp
     Assignee: (unassigned) => Raoul Snyman (raoul-snyman)

** Changed in: openlp
       Status: Confirmed => Fix Committed

-- 
You received this bug notification because you are a member of OpenLP
Core, which is subscribed to OpenLP.
https://bugs.launchpad.net/bugs/1385438

Title:
  OpenLP Settings Fail on PyQt4 v 4.11

Status in OpenLP - Worship Presentation Software:
  Fix Committed

Bug description:
  If settingsform.py the code says this:
          for plugin in self.plugin_manager.plugins:
              if plugin.settings_tab:
                  self.insert_tab(plugin.settings_tab, count, plugin.is_active())
                  count += 1
          self.setting_list_widget.setCurrentRow(0)
          return QtGui.QDialog.exec_(self)

      def insert_tab(self, tab, location, is_active=True):
          """
          Add a tab to the form at a specific location
          """
          log.debug('Inserting %s tab' % tab.tab_title)
          # add the tab to get it to display in the correct part of the screen
          pos = self.stacked_layout.addWidget(tab)
          if is_active:
              item_name = QtGui.QListWidgetItem(tab.tab_title_visible)
              icon = build_icon(tab.icon_path)
              item_name.setIcon(icon)
              self.setting_list_widget.insertItem(location, item_name)
          else:
              # then remove tab to stop the UI displaying it even if it is not required.
              self.stacked_layout.takeAt(pos)

  In Pyqt4 4.11 this means the first tab is removed if any plugins are inactive and all the displays are one out.
  The code looks strange!
  If the code is corrected to

          for plugin in self.plugin_manager.plugins:
              if plugin.settings_tab and plugin.is_active():
                  self.insert_tab(plugin.settings_tab, count, plugin.is_active())
                  count += 1
          self.setting_list_widget.setCurrentRow(0)
          return QtGui.QDialog.exec_(self)

      def insert_tab(self, tab, location, is_active=True):
          """
          Add a tab to the form at a specific location
          """
          log.debug('Inserting %s tab' % tab.tab_title)
          # add the tab to get it to display in the correct part of the screen
          pos = self.stacked_layout.addWidget(tab)
          if is_active:
              item_name = QtGui.QListWidgetItem(tab.tab_title_visible)
              icon = build_icon(tab.icon_path)
              item_name.setIcon(icon)
              self.setting_list_widget.insertItem(location, item_name)
          else:
              # then remove tab to stop the UI displaying it even if it is not required.
              self.stacked_layout.takeAt(pos)

  The the tabs are fine but a widget appears at the top to the list and
  cannot be removed and obscures the General line.

To manage notifications about this bug go to:
https://bugs.launchpad.net/openlp/+bug/1385438/+subscriptions


References