eric7/Preferences/ConfigurationPages/HelpViewersPage.py

branch
eric7
changeset 8312
800c432b34c8
parent 8218
7c09585bd960
child 8318
962bce857696
equal deleted inserted replaced
8311:4e8b98454baa 8312:800c432b34c8
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2006 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing the Help Viewers configuration page.
8 """
9
10 from PyQt5.QtWidgets import QButtonGroup
11
12 from Globals import getWebBrowserSupport
13
14 from E5Gui.E5PathPicker import E5PathPickerModes
15
16 from .ConfigurationPageBase import ConfigurationPageBase
17 from .Ui_HelpViewersPage import Ui_HelpViewersPage
18
19 import Preferences
20
21
22 class HelpViewersPage(ConfigurationPageBase, Ui_HelpViewersPage):
23 """
24 Class implementing the Help Viewers configuration page.
25 """
26 def __init__(self):
27 """
28 Constructor
29 """
30 super().__init__()
31 self.setupUi(self)
32 self.setObjectName("HelpViewersPage")
33
34 self.customViewerPicker.setMode(E5PathPickerModes.OpenFileMode)
35
36 self.helpViewerGroup = QButtonGroup()
37 self.helpViewerGroup.addButton(self.helpBrowserButton)
38 self.helpViewerGroup.addButton(self.qtAssistantButton)
39 self.helpViewerGroup.addButton(self.webBrowserButton)
40 self.helpViewerGroup.addButton(self.customViewerButton)
41
42 # set initial values
43 webBrowserVariant = getWebBrowserSupport()
44 if webBrowserVariant == "QtWebEngine":
45 hvId = Preferences.getWebBrowser("HelpViewerType")
46 else:
47 hvId = 3
48 self.helpBrowserButton.setEnabled(False)
49
50 if hvId == 1:
51 self.helpBrowserButton.setChecked(True)
52 elif hvId == 2:
53 self.qtAssistantButton.setChecked(True)
54 elif hvId == 3:
55 self.webBrowserButton.setChecked(True)
56 else:
57 self.customViewerButton.setChecked(True)
58 self.customViewerPicker.setText(
59 Preferences.getHelp("CustomViewer"))
60
61 def save(self):
62 """
63 Public slot to save the Help Viewers configuration.
64 """
65 if self.helpBrowserButton.isChecked():
66 hvId = 1
67 elif self.qtAssistantButton.isChecked():
68 hvId = 2
69 elif self.webBrowserButton.isChecked():
70 hvId = 3
71 elif self.customViewerButton.isChecked():
72 hvId = 4
73 Preferences.setHelp("HelpViewerType", hvId)
74 Preferences.setWebBrowser("HelpViewerType", hvId)
75 Preferences.setHelp(
76 "CustomViewer",
77 self.customViewerPicker.text())
78
79
80 def create(dlg):
81 """
82 Module function to create the configuration page.
83
84 @param dlg reference to the configuration dialog
85 @return reference to the instantiated page (ConfigurationPageBase)
86 """
87 page = HelpViewersPage()
88 return page

eric ide

mercurial