Preferences/ConfigurationPages/EditorDocViewerPage.py

Mon, 17 Sep 2018 19:25:49 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 17 Sep 2018 19:25:49 +0200
changeset 6505
470d878cbe9f
parent 6380
4a932a7ab987
child 6559
1265efa7364f
permissions
-rw-r--r--

CodeDocumentationViewer: chanegd code to always show the HTML based documentation viewer, if QtWebEngine or QtWebKit is available.

# -*- coding: utf-8 -*-

# Copyright (c) 2017 - 2018 Detlev Offenbach <detlev@die-offenbachs.de>
#

"""
Module implementing the Editor Documentation Viewer configuration page.
"""

from __future__ import unicode_literals

from .ConfigurationPageBase import ConfigurationPageBase
from .Ui_EditorDocViewerPage import Ui_EditorDocViewerPage

from E5Gui.E5Application import e5App

import Preferences


class EditorDocViewerPage(ConfigurationPageBase, Ui_EditorDocViewerPage):
    """
    Class implementing the Editor Documentation Viewer configuration page.
    """
    def __init__(self):
        """
        Constructor
        """
        super(EditorDocViewerPage, self).__init__()
        self.setupUi(self)
        self.setObjectName("EditorExportersPage")
        
        providers = e5App().getObject("DocuViewer").getProviders()
        for provider, text in providers:
            self.providerComboBox.addItem(text, provider)
        
        # set initial values
        self.parenthesisCheckBox.setChecked(
            Preferences.getDocuViewer("ShowInfoOnOpenParenthesis"))
        
        provider = Preferences.getDocuViewer("Provider")
        self.viewerGroupBox.setChecked(provider != "disabled")
            
        index = self.providerComboBox.findData(provider)
        if index >= 0:
            self.providerComboBox.setCurrentIndex(index)
    
    def save(self):
        """
        Public slot to save the Editor Typing configuration.
        """
        enabled = self.viewerGroupBox.isChecked()
        if enabled:
            Preferences.setDocuViewer(
                "ShowInfoOnOpenParenthesis",
                self.parenthesisCheckBox.isChecked())
            Preferences.setDocuViewer(
                "Provider",
                self.providerComboBox.itemData(
                    self.providerComboBox.currentIndex())
            )
        else:
            Preferences.setDocuViewer("Provider", "disabled")


def create(dlg):
    """
    Module function to create the configuration page.
    
    @param dlg reference to the configuration dialog
    @return reference to the instantiated page (ConfigurationPageBase)
    """
    page = EditorDocViewerPage()
    return page

eric ide

mercurial