17 |
17 |
18 class EditorDocViewerPage(ConfigurationPageBase, Ui_EditorDocViewerPage): |
18 class EditorDocViewerPage(ConfigurationPageBase, Ui_EditorDocViewerPage): |
19 """ |
19 """ |
20 Class implementing the Editor Documentation Viewer configuration page. |
20 Class implementing the Editor Documentation Viewer configuration page. |
21 """ |
21 """ |
|
22 |
22 def __init__(self): |
23 def __init__(self): |
23 """ |
24 """ |
24 Constructor |
25 Constructor |
25 """ |
26 """ |
26 super().__init__() |
27 super().__init__() |
27 self.setupUi(self) |
28 self.setupUi(self) |
28 self.setObjectName("EditorExportersPage") |
29 self.setObjectName("EditorExportersPage") |
29 |
30 |
30 try: |
31 try: |
31 providers = ericApp().getObject("DocuViewer").getProviders() |
32 providers = ericApp().getObject("DocuViewer").getProviders() |
32 for provider, text in providers: |
33 for provider, text in providers: |
33 self.providerComboBox.addItem(text, provider) |
34 self.providerComboBox.addItem(text, provider) |
34 |
35 |
35 self.infoLabel.clear() |
36 self.infoLabel.clear() |
36 |
37 |
37 # set initial values |
38 # set initial values |
38 self.parenthesisCheckBox.setChecked( |
39 self.parenthesisCheckBox.setChecked( |
39 Preferences.getDocuViewer("ShowInfoOnOpenParenthesis")) |
40 Preferences.getDocuViewer("ShowInfoOnOpenParenthesis") |
40 |
41 ) |
|
42 |
41 provider = Preferences.getDocuViewer("Provider") |
43 provider = Preferences.getDocuViewer("Provider") |
42 self.viewerGroupBox.setChecked(provider != "disabled") |
44 self.viewerGroupBox.setChecked(provider != "disabled") |
43 |
45 |
44 index = self.providerComboBox.findData(provider) |
46 index = self.providerComboBox.findData(provider) |
45 if index >= 0: |
47 if index >= 0: |
46 self.providerComboBox.setCurrentIndex(index) |
48 self.providerComboBox.setCurrentIndex(index) |
47 except KeyError: |
49 except KeyError: |
48 # documentation viewer is globally disabled |
50 # documentation viewer is globally disabled |
49 self.viewerGroupBox.setChecked(False) |
51 self.viewerGroupBox.setChecked(False) |
50 self.viewerGroupBox.setEnabled(False) |
52 self.viewerGroupBox.setEnabled(False) |
51 self.infoLabel.setText(self.tr( |
53 self.infoLabel.setText( |
52 "The Documentation Viewer is disabled globally. Re-enable it" |
54 self.tr( |
53 " on the Interface/Interface configuration page and restart" |
55 "The Documentation Viewer is disabled globally. Re-enable it" |
54 " the eric.")) |
56 " on the Interface/Interface configuration page and restart" |
55 |
57 " the eric." |
|
58 ) |
|
59 ) |
|
60 |
56 def save(self): |
61 def save(self): |
57 """ |
62 """ |
58 Public slot to save the Editor Typing configuration. |
63 Public slot to save the Editor Typing configuration. |
59 """ |
64 """ |
60 enabled = self.viewerGroupBox.isChecked() |
65 enabled = self.viewerGroupBox.isChecked() |
61 if enabled: |
66 if enabled: |
62 Preferences.setDocuViewer( |
67 Preferences.setDocuViewer( |
63 "ShowInfoOnOpenParenthesis", |
68 "ShowInfoOnOpenParenthesis", self.parenthesisCheckBox.isChecked() |
64 self.parenthesisCheckBox.isChecked()) |
69 ) |
65 Preferences.setDocuViewer( |
70 Preferences.setDocuViewer( |
66 "Provider", |
71 "Provider", |
67 self.providerComboBox.itemData( |
72 self.providerComboBox.itemData(self.providerComboBox.currentIndex()), |
68 self.providerComboBox.currentIndex()) |
|
69 ) |
73 ) |
70 else: |
74 else: |
71 Preferences.setDocuViewer("Provider", "disabled") |
75 Preferences.setDocuViewer("Provider", "disabled") |
72 |
76 |
73 |
77 |
74 def create(dlg): |
78 def create(dlg): |
75 """ |
79 """ |
76 Module function to create the configuration page. |
80 Module function to create the configuration page. |
77 |
81 |
78 @param dlg reference to the configuration dialog |
82 @param dlg reference to the configuration dialog |
79 @return reference to the instantiated page (ConfigurationPageBase) |
83 @return reference to the instantiated page (ConfigurationPageBase) |
80 """ |
84 """ |
81 page = EditorDocViewerPage() |
85 page = EditorDocViewerPage() |
82 return page |
86 return page |