21 |
21 |
22 class HelpViewersPage(ConfigurationPageBase, Ui_HelpViewersPage): |
22 class HelpViewersPage(ConfigurationPageBase, Ui_HelpViewersPage): |
23 """ |
23 """ |
24 Class implementing the Help Viewers configuration page. |
24 Class implementing the Help Viewers configuration page. |
25 """ |
25 """ |
|
26 |
26 def __init__(self): |
27 def __init__(self): |
27 """ |
28 """ |
28 Constructor |
29 Constructor |
29 """ |
30 """ |
30 super().__init__() |
31 super().__init__() |
31 self.setupUi(self) |
32 self.setupUi(self) |
32 self.setObjectName("HelpViewersPage") |
33 self.setObjectName("HelpViewersPage") |
33 |
34 |
34 self.customViewerPicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) |
35 self.customViewerPicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) |
35 |
36 |
36 self.helpViewerGroup = QButtonGroup() |
37 self.helpViewerGroup = QButtonGroup() |
37 self.helpViewerGroup.addButton(self.internalViewerButton, 0) |
38 self.helpViewerGroup.addButton(self.internalViewerButton, 0) |
38 self.helpViewerGroup.addButton(self.helpBrowserButton, 1) |
39 self.helpViewerGroup.addButton(self.helpBrowserButton, 1) |
39 self.helpViewerGroup.addButton(self.qtAssistantButton, 2) |
40 self.helpViewerGroup.addButton(self.qtAssistantButton, 2) |
40 self.helpViewerGroup.addButton(self.webBrowserButton, 3) |
41 self.helpViewerGroup.addButton(self.webBrowserButton, 3) |
41 self.helpViewerGroup.addButton(self.customViewerButton, 4) |
42 self.helpViewerGroup.addButton(self.customViewerButton, 4) |
42 |
43 |
43 # set initial values |
44 # set initial values |
44 hvId = Preferences.getHelp("HelpViewerType") |
45 hvId = Preferences.getHelp("HelpViewerType") |
45 webBrowserVariant = getWebBrowserSupport() |
46 webBrowserVariant = getWebBrowserSupport() |
46 if webBrowserVariant != "QtWebEngine": |
47 if webBrowserVariant != "QtWebEngine": |
47 if hvId == 1: |
48 if hvId == 1: |
48 hvId = 0 |
49 hvId = 0 |
49 self.helpBrowserButton.setEnabled(False) |
50 self.helpBrowserButton.setEnabled(False) |
50 |
51 |
51 self.helpViewerGroup.button(hvId).setChecked(True) |
52 self.helpViewerGroup.button(hvId).setChecked(True) |
52 self.customViewerPicker.setText( |
53 self.customViewerPicker.setText(Preferences.getHelp("CustomViewer")) |
53 Preferences.getHelp("CustomViewer")) |
54 |
54 |
|
55 def save(self): |
55 def save(self): |
56 """ |
56 """ |
57 Public slot to save the Help Viewers configuration. |
57 Public slot to save the Help Viewers configuration. |
58 """ |
58 """ |
59 Preferences.setHelp( |
59 Preferences.setHelp("HelpViewerType", self.helpViewerGroup.checkedId()) |
60 "HelpViewerType", |
60 Preferences.setHelp("CustomViewer", self.customViewerPicker.text()) |
61 self.helpViewerGroup.checkedId()) |
61 |
62 Preferences.setHelp( |
|
63 "CustomViewer", |
|
64 self.customViewerPicker.text()) |
|
65 |
|
66 |
62 |
67 def create(dlg): |
63 def create(dlg): |
68 """ |
64 """ |
69 Module function to create the configuration page. |
65 Module function to create the configuration page. |
70 |
66 |
71 @param dlg reference to the configuration dialog |
67 @param dlg reference to the configuration dialog |
72 @return reference to the instantiated page (ConfigurationPageBase) |
68 @return reference to the instantiated page (ConfigurationPageBase) |
73 """ |
69 """ |
74 page = HelpViewersPage() |
70 page = HelpViewersPage() |
75 return page |
71 return page |