OpenLP Settings Fail on PyQt4 v 4.11

Bug #1385438 reported by Tim Bentley
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenLP
Fix Released
Critical
Raoul Snyman

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.

Related branches

Revision history for this message
Tim Bentley (trb143) wrote :

Code re-factored and corrected.

Changed in openlp:
assignee: nobody → Raoul Snyman (raoul-snyman)
status: Confirmed → Fix Committed
Tim Bentley (trb143)
Changed in openlp:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.