eric7/Preferences/ConfigurationPages/EditorDocViewerPage.py

branch
eric7
changeset 8312
800c432b34c8
parent 8218
7c09585bd960
child 8356
68ec9c3d4de5
equal deleted inserted replaced
8311:4e8b98454baa 8312:800c432b34c8
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2017 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing the Editor Documentation Viewer configuration page.
8 """
9
10 from .ConfigurationPageBase import ConfigurationPageBase
11 from .Ui_EditorDocViewerPage import Ui_EditorDocViewerPage
12
13 from E5Gui.E5Application import e5App
14
15 import Preferences
16
17
18 class EditorDocViewerPage(ConfigurationPageBase, Ui_EditorDocViewerPage):
19 """
20 Class implementing the Editor Documentation Viewer configuration page.
21 """
22 def __init__(self):
23 """
24 Constructor
25 """
26 super().__init__()
27 self.setupUi(self)
28 self.setObjectName("EditorExportersPage")
29
30 try:
31 providers = e5App().getObject("DocuViewer").getProviders()
32 for provider, text in providers:
33 self.providerComboBox.addItem(text, provider)
34
35 self.infoLabel.clear()
36
37 # set initial values
38 self.parenthesisCheckBox.setChecked(
39 Preferences.getDocuViewer("ShowInfoOnOpenParenthesis"))
40
41 provider = Preferences.getDocuViewer("Provider")
42 self.viewerGroupBox.setChecked(provider != "disabled")
43
44 index = self.providerComboBox.findData(provider)
45 if index >= 0:
46 self.providerComboBox.setCurrentIndex(index)
47 except KeyError:
48 # documentation viewer is globally disabled
49 self.viewerGroupBox.setChecked(False)
50 self.viewerGroupBox.setEnabled(False)
51 self.infoLabel.setText(self.tr(
52 "The Documentation Viewer is disabled globally. Re-enable it"
53 " on the Interface/Interface configuration page and restart"
54 " the eric."))
55
56 def save(self):
57 """
58 Public slot to save the Editor Typing configuration.
59 """
60 enabled = self.viewerGroupBox.isChecked()
61 if enabled:
62 Preferences.setDocuViewer(
63 "ShowInfoOnOpenParenthesis",
64 self.parenthesisCheckBox.isChecked())
65 Preferences.setDocuViewer(
66 "Provider",
67 self.providerComboBox.itemData(
68 self.providerComboBox.currentIndex())
69 )
70 else:
71 Preferences.setDocuViewer("Provider", "disabled")
72
73
74 def create(dlg):
75 """
76 Module function to create the configuration page.
77
78 @param dlg reference to the configuration dialog
79 @return reference to the instantiated page (ConfigurationPageBase)
80 """
81 page = EditorDocViewerPage()
82 return page

eric ide

mercurial