Tue, 12 Nov 2024 18:01:04 +0100
Added a configuration entry on the Qt page to enter the path of the 'lrelease' program for that cases, where it cannot be detected automatically (e.g. due to different name).
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 | |
10439
21c28b0f9e41
Updated copyright for 2024.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10428
diff
changeset
|
3 | # Copyright (c) 2017 - 2024 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 | |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
10 | from eric7 import Preferences |
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
11 | from eric7.EricWidgets.EricApplication import ericApp |
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
12 | |
5912
b6643d36dddd
Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
13 | from .ConfigurationPageBase import ConfigurationPageBase |
b6643d36dddd
Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
14 | 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
|
15 | |
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 | class EditorDocViewerPage(ConfigurationPageBase, Ui_EditorDocViewerPage): |
b6643d36dddd
Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
18 | """ |
6047
39586a2de99d
Fixed some forgotten source code documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5919
diff
changeset
|
19 | 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
|
20 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
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 | """ |
8218
7c09585bd960
Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
26 | super().__init__() |
5912
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") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
29 | |
6559
1265efa7364f
Some fixes for configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6505
diff
changeset
|
30 | try: |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8312
diff
changeset
|
31 | providers = ericApp().getObject("DocuViewer").getProviders() |
6559
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) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
34 | |
6559
1265efa7364f
Some fixes for configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6505
diff
changeset
|
35 | self.infoLabel.clear() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
36 | |
6559
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( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
39 | Preferences.getDocuViewer("ShowInfoOnOpenParenthesis") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
40 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
41 | |
6559
1265efa7364f
Some fixes for configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6505
diff
changeset
|
42 | provider = Preferences.getDocuViewer("Provider") |
1265efa7364f
Some fixes for configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6505
diff
changeset
|
43 | self.viewerGroupBox.setChecked(provider != "disabled") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
44 | |
6559
1265efa7364f
Some fixes for configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6505
diff
changeset
|
45 | index = self.providerComboBox.findData(provider) |
1265efa7364f
Some fixes for configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6505
diff
changeset
|
46 | if index >= 0: |
1265efa7364f
Some fixes for configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6505
diff
changeset
|
47 | self.providerComboBox.setCurrentIndex(index) |
1265efa7364f
Some fixes for configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6505
diff
changeset
|
48 | except KeyError: |
1265efa7364f
Some fixes for configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6505
diff
changeset
|
49 | # documentation viewer is globally disabled |
1265efa7364f
Some fixes for configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6505
diff
changeset
|
50 | self.viewerGroupBox.setChecked(False) |
1265efa7364f
Some fixes for configuration pages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6505
diff
changeset
|
51 | self.viewerGroupBox.setEnabled(False) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
52 | self.infoLabel.setText( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
53 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
54 | "The Documentation Viewer is disabled globally. Re-enable it" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
55 | " on the Interface/Interface configuration page and restart" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
56 | " the eric." |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
57 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
58 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
59 | |
5912
b6643d36dddd
Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
60 | def save(self): |
b6643d36dddd
Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
61 | """ |
b6643d36dddd
Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
62 | 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
|
63 | """ |
b6643d36dddd
Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
64 | enabled = self.viewerGroupBox.isChecked() |
b6643d36dddd
Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
65 | if enabled: |
b6643d36dddd
Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
66 | Preferences.setDocuViewer( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
67 | "ShowInfoOnOpenParenthesis", self.parenthesisCheckBox.isChecked() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
68 | ) |
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
|
69 | Preferences.setDocuViewer( |
5912
b6643d36dddd
Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
70 | "Provider", |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
71 | self.providerComboBox.itemData(self.providerComboBox.currentIndex()), |
5912
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 | else: |
b6643d36dddd
Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
74 | Preferences.setDocuViewer("Provider", "disabled") |
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 | |
10683
779cda568acb
Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
77 | def create(_dlg): |
5912
b6643d36dddd
Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
78 | """ |
b6643d36dddd
Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
79 | Module function to create the configuration page. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
80 | |
10683
779cda568acb
Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
81 | @param _dlg reference to the configuration dialog (unused) |
10428
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10069
diff
changeset
|
82 | @type ConfigurationDialog |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10069
diff
changeset
|
83 | @return reference to the instantiated page |
a071d4065202
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10069
diff
changeset
|
84 | @rtype ConfigurationPageBase |
5912
b6643d36dddd
Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
85 | """ |
b6643d36dddd
Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
86 | page = EditorDocViewerPage() |
b6643d36dddd
Added the rich text view to the documentation viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
87 | return page |