eric6/Preferences/ConfigurationPages/EditorDocViewerPage.py

Wed, 30 Dec 2020 11:00:44 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 30 Dec 2020 11:00:44 +0100
branch
maintenance
changeset 7924
8a96736d465e
parent 7780
41420f82c0ac
child 8218
7c09585bd960
permissions
-rw-r--r--

Updated copyright for 2021.

5912
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7924
8a96736d465e Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
3 # Copyright (c) 2017 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
5912
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing the Editor Documentation Viewer configuration page.
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 from .ConfigurationPageBase import ConfigurationPageBase
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 from .Ui_EditorDocViewerPage import Ui_EditorDocViewerPage
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 from E5Gui.E5Application import e5App
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 import Preferences
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 class EditorDocViewerPage(ConfigurationPageBase, Ui_EditorDocViewerPage):
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 """
6047
39586a2de99d Fixed some forgotten source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5919
diff changeset
20 Class implementing the Editor Documentation Viewer configuration page.
5912
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 """
6380
4a932a7ab987 Configuration pages: corrected the constructor of some configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
22 def __init__(self):
5912
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 """
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 Constructor
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 """
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 super(EditorDocViewerPage, self).__init__()
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 self.setupUi(self)
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 self.setObjectName("EditorExportersPage")
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29
6559
1265efa7364f Some fixes for configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6505
diff changeset
30 try:
1265efa7364f Some fixes for configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6505
diff changeset
31 providers = e5App().getObject("DocuViewer").getProviders()
1265efa7364f Some fixes for configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6505
diff changeset
32 for provider, text in providers:
1265efa7364f Some fixes for configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6505
diff changeset
33 self.providerComboBox.addItem(text, provider)
1265efa7364f Some fixes for configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6505
diff changeset
34
1265efa7364f Some fixes for configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6505
diff changeset
35 self.infoLabel.clear()
1265efa7364f Some fixes for configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6505
diff changeset
36
1265efa7364f Some fixes for configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6505
diff changeset
37 # set initial values
1265efa7364f Some fixes for configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6505
diff changeset
38 self.parenthesisCheckBox.setChecked(
1265efa7364f Some fixes for configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6505
diff changeset
39 Preferences.getDocuViewer("ShowInfoOnOpenParenthesis"))
5912
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40
6559
1265efa7364f Some fixes for configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6505
diff changeset
41 provider = Preferences.getDocuViewer("Provider")
1265efa7364f Some fixes for configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6505
diff changeset
42 self.viewerGroupBox.setChecked(provider != "disabled")
1265efa7364f Some fixes for configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6505
diff changeset
43
1265efa7364f Some fixes for configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6505
diff changeset
44 index = self.providerComboBox.findData(provider)
1265efa7364f Some fixes for configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6505
diff changeset
45 if index >= 0:
1265efa7364f Some fixes for configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6505
diff changeset
46 self.providerComboBox.setCurrentIndex(index)
1265efa7364f Some fixes for configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6505
diff changeset
47 except KeyError:
1265efa7364f Some fixes for configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6505
diff changeset
48 # documentation viewer is globally disabled
1265efa7364f Some fixes for configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6505
diff changeset
49 self.viewerGroupBox.setChecked(False)
1265efa7364f Some fixes for configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6505
diff changeset
50 self.viewerGroupBox.setEnabled(False)
1265efa7364f Some fixes for configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6505
diff changeset
51 self.infoLabel.setText(self.tr(
1265efa7364f Some fixes for configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6505
diff changeset
52 "The Documentation Viewer is disabled globally. Re-enable it"
1265efa7364f Some fixes for configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6505
diff changeset
53 " on the Interface/Interface configuration page and restart"
1265efa7364f Some fixes for configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6505
diff changeset
54 " the eric."))
5912
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 def save(self):
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 """
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 Public slot to save the Editor Typing configuration.
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 """
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 enabled = self.viewerGroupBox.isChecked()
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 if enabled:
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 Preferences.setDocuViewer(
5919
d0de2b378b24 Improved and beautified the rich text display of the documentation viewer some more.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5912
diff changeset
63 "ShowInfoOnOpenParenthesis",
d0de2b378b24 Improved and beautified the rich text display of the documentation viewer some more.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5912
diff changeset
64 self.parenthesisCheckBox.isChecked())
d0de2b378b24 Improved and beautified the rich text display of the documentation viewer some more.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5912
diff changeset
65 Preferences.setDocuViewer(
5912
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 "Provider",
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 self.providerComboBox.itemData(
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 self.providerComboBox.currentIndex())
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 )
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 else:
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 Preferences.setDocuViewer("Provider", "disabled")
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 def create(dlg):
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 """
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 Module function to create the configuration page.
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 @param dlg reference to the configuration dialog
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 @return reference to the instantiated page (ConfigurationPageBase)
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80 """
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 page = EditorDocViewerPage()
b6643d36dddd Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 return page

eric ide

mercurial