src/eric7/WebBrowser/QtHelp/QtHelpDocumentationConfigurationDialog.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9473
3f23dbf37dbe
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
9 9
10 from PyQt6.QtCore import pyqtSlot 10 from PyQt6.QtCore import pyqtSlot
11 from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QAbstractButton 11 from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QAbstractButton
12 12
13 from .Ui_QtHelpDocumentationConfigurationDialog import ( 13 from .Ui_QtHelpDocumentationConfigurationDialog import (
14 Ui_QtHelpDocumentationConfigurationDialog 14 Ui_QtHelpDocumentationConfigurationDialog,
15 ) 15 )
16 16
17 from .QtHelpDocumentationSettings import QtHelpDocumentationSettings 17 from .QtHelpDocumentationSettings import QtHelpDocumentationSettings
18 18
19 19
21 QDialog, Ui_QtHelpDocumentationConfigurationDialog 21 QDialog, Ui_QtHelpDocumentationConfigurationDialog
22 ): 22 ):
23 """ 23 """
24 Class implementing a dialog to manage the QtHelp documentation database. 24 Class implementing a dialog to manage the QtHelp documentation database.
25 """ 25 """
26
26 def __init__(self, engine, parent=None): 27 def __init__(self, engine, parent=None):
27 """ 28 """
28 Constructor 29 Constructor
29 30
30 @param engine reference to the Qt help engine 31 @param engine reference to the Qt help engine
31 @type QHelpEngineCore 32 @type QHelpEngineCore
32 @param parent reference to the parent widget (defaults to None) 33 @param parent reference to the parent widget (defaults to None)
33 @type QWidget (optional) 34 @type QWidget (optional)
34 """ 35 """
35 super().__init__(parent) 36 super().__init__(parent)
36 self.setupUi(self) 37 self.setupUi(self)
37 38
38 self.__engine = engine 39 self.__engine = engine
39 40
40 self.__settings = QtHelpDocumentationSettings.readSettings( 41 self.__settings = QtHelpDocumentationSettings.readSettings(self.__engine)
41 self.__engine) 42
42
43 self.documentationSettingsWidget.documentationSettingsChanged.connect( 43 self.documentationSettingsWidget.documentationSettingsChanged.connect(
44 self.__documentationSettingsChanged) 44 self.__documentationSettingsChanged
45 self.documentationSettingsWidget.setDocumentationSettings( 45 )
46 self.__settings) 46 self.documentationSettingsWidget.setDocumentationSettings(self.__settings)
47 47
48 self.filterSettingsWidget.setAvailableComponents( 48 self.filterSettingsWidget.setAvailableComponents(self.__settings.components())
49 self.__settings.components()) 49 self.filterSettingsWidget.setAvailableVersions(self.__settings.versions())
50 self.filterSettingsWidget.setAvailableVersions(
51 self.__settings.versions())
52 self.filterSettingsWidget.readSettings(self.__engine.filterEngine()) 50 self.filterSettingsWidget.readSettings(self.__engine.filterEngine())
53 51
54 @pyqtSlot(QtHelpDocumentationSettings) 52 @pyqtSlot(QtHelpDocumentationSettings)
55 def __documentationSettingsChanged(self, settings): 53 def __documentationSettingsChanged(self, settings):
56 """ 54 """
57 Private slot to handle a change of the QtHelp documentation 55 Private slot to handle a change of the QtHelp documentation
58 configuration. 56 configuration.
59 57
60 @param settings reference to the documentation settings object 58 @param settings reference to the documentation settings object
61 @type QtHelpDocumentationSettings 59 @type QtHelpDocumentationSettings
62 """ 60 """
63 self.__settings = settings 61 self.__settings = settings
64 62
65 self.filterSettingsWidget.setAvailableComponents( 63 self.filterSettingsWidget.setAvailableComponents(self.__settings.components())
66 self.__settings.components()) 64 self.filterSettingsWidget.setAvailableVersions(self.__settings.versions())
67 self.filterSettingsWidget.setAvailableVersions( 65
68 self.__settings.versions())
69
70 @pyqtSlot(QAbstractButton) 66 @pyqtSlot(QAbstractButton)
71 def on_buttonBox_clicked(self, button): 67 def on_buttonBox_clicked(self, button):
72 """ 68 """
73 Private slot called by a button of the button box clicked. 69 Private slot called by a button of the button box clicked.
74 70
75 @param button button that was clicked 71 @param button button that was clicked
76 @type QAbstractButton 72 @type QAbstractButton
77 """ 73 """
78 if button == self.buttonBox.button( 74 if button == self.buttonBox.button(QDialogButtonBox.StandardButton.Apply):
79 QDialogButtonBox.StandardButton.Apply):
80 self.__applyConfiguration() 75 self.__applyConfiguration()
81 76
82 self.__settings = QtHelpDocumentationSettings.readSettings( 77 self.__settings = QtHelpDocumentationSettings.readSettings(self.__engine)
83 self.__engine) 78
84
85 self.filterSettingsWidget.setAvailableComponents( 79 self.filterSettingsWidget.setAvailableComponents(
86 self.__settings.components()) 80 self.__settings.components()
87 self.filterSettingsWidget.setAvailableVersions( 81 )
88 self.__settings.versions()) 82 self.filterSettingsWidget.setAvailableVersions(self.__settings.versions())
89 self.filterSettingsWidget.readSettings( 83 self.filterSettingsWidget.readSettings(self.__engine.filterEngine())
90 self.__engine.filterEngine()) 84 elif button == self.buttonBox.button(QDialogButtonBox.StandardButton.Ok):
91 elif button == self.buttonBox.button(
92 QDialogButtonBox.StandardButton.Ok):
93 self.__applyConfiguration() 85 self.__applyConfiguration()
94 self.accept() 86 self.accept()
95 87
96 def __applyConfiguration(self): 88 def __applyConfiguration(self):
97 """ 89 """
98 Private method to apply the current QtHelp documentation configuration. 90 Private method to apply the current QtHelp documentation configuration.
99 """ 91 """
100 changed = QtHelpDocumentationSettings.applySettings( 92 changed = QtHelpDocumentationSettings.applySettings(
101 self.__engine, self.__settings) 93 self.__engine, self.__settings
102 changed |= self.filterSettingsWidget.applySettings( 94 )
103 self.__engine.filterEngine()) 95 changed |= self.filterSettingsWidget.applySettings(self.__engine.filterEngine())
104 96
105 if changed: 97 if changed:
106 # In order to update the filter combobox and index widget according 98 # In order to update the filter combobox and index widget according
107 # to the new filter configuration. 99 # to the new filter configuration.
108 self.__engine.setupData() 100 self.__engine.setupData()

eric ide

mercurial