eric6/WebBrowser/QtHelp/QtHelpDocumentationDialog.py

changeset 7269
0c63ea7f94bd
parent 7235
4f23ea4af43c
child 7360
9190402e4505
equal deleted inserted replaced
7268:a28338eaf694 7269:0c63ea7f94bd
8 """ 8 """
9 9
10 import sqlite3 10 import sqlite3
11 11
12 from PyQt5.QtCore import pyqtSlot, Qt, QItemSelectionModel 12 from PyQt5.QtCore import pyqtSlot, Qt, QItemSelectionModel
13 from PyQt5.QtWidgets import QDialog, QTreeWidgetItem, QListWidgetItem, \ 13 from PyQt5.QtWidgets import (
14 QInputDialog, QLineEdit 14 QDialog, QTreeWidgetItem, QListWidgetItem, QInputDialog, QLineEdit
15 )
15 from PyQt5.QtHelp import QHelpEngineCore 16 from PyQt5.QtHelp import QHelpEngineCore
16 17
17 from E5Gui import E5MessageBox, E5FileDialog 18 from E5Gui import E5MessageBox, E5FileDialog
18 from E5Gui.E5Application import e5App 19 from E5Gui.E5Application import e5App
19 20
48 Private slot handling a change of the current tab. 49 Private slot handling a change of the current tab.
49 50
50 @param index index of the current tab 51 @param index index of the current tab
51 @type int 52 @type int
52 """ 53 """
53 if index != 1 and \ 54 if (
54 (self.__hasChangedFilters() or self.__removedAttributes): 55 index != 1 and
56 (self.__hasChangedFilters() or self.__removedAttributes)
57 ):
55 yes = E5MessageBox.yesNo( 58 yes = E5MessageBox.yesNo(
56 self, 59 self,
57 self.tr("Unsaved Filter Changes"), 60 self.tr("Unsaved Filter Changes"),
58 self.tr("""The page contains unsaved changes. Shall they be""" 61 self.tr("""The page contains unsaved changes. Shall they be"""
59 """ saved?"""), 62 """ saved?"""),
78 self.__registeredDocs = [] 81 self.__registeredDocs = []
79 self.__unregisteredDocs = [] 82 self.__unregisteredDocs = []
80 self.__tabsToClose = [] 83 self.__tabsToClose = []
81 84
82 try: 85 try:
83 self.__pluginHelpDocuments = \ 86 self.__pluginHelpDocuments = (
84 e5App().getObject("PluginManager").getPluginQtHelpFiles() 87 e5App().getObject("PluginManager").getPluginQtHelpFiles()
88 )
85 except KeyError: 89 except KeyError:
86 from PluginManager.PluginManager import PluginManager 90 from PluginManager.PluginManager import PluginManager
87 pluginManager = PluginManager(self, doLoadPlugins=False) 91 pluginManager = PluginManager(self, doLoadPlugins=False)
88 pluginManager.loadDocumentationSetPlugins() 92 pluginManager.loadDocumentationSetPlugins()
89 pluginManager.activatePlugins() 93 pluginManager.activatePlugins()
117 def on_addPluginButton_clicked(self): 121 def on_addPluginButton_clicked(self):
118 """ 122 """
119 Private slot to add QtHelp documents provided by plug-ins to 123 Private slot to add QtHelp documents provided by plug-ins to
120 the help database. 124 the help database.
121 """ 125 """
122 from .QtHelpDocumentationSelectionDialog import \ 126 from .QtHelpDocumentationSelectionDialog import (
123 QtHelpDocumentationSelectionDialog 127 QtHelpDocumentationSelectionDialog
128 )
124 dlg = QtHelpDocumentationSelectionDialog( 129 dlg = QtHelpDocumentationSelectionDialog(
125 self.__pluginHelpDocuments, 130 self.__pluginHelpDocuments,
126 QtHelpDocumentationSelectionDialog.AddMode, 131 QtHelpDocumentationSelectionDialog.AddMode,
127 self) 132 self)
128 if dlg.exec_() == QDialog.Accepted: 133 if dlg.exec_() == QDialog.Accepted:
135 @pyqtSlot() 140 @pyqtSlot()
136 def on_managePluginButton_clicked(self): 141 def on_managePluginButton_clicked(self):
137 """ 142 """
138 Private slot to manage the QtHelp documents provided by plug-ins. 143 Private slot to manage the QtHelp documents provided by plug-ins.
139 """ 144 """
140 from .QtHelpDocumentationSelectionDialog import \ 145 from .QtHelpDocumentationSelectionDialog import (
141 QtHelpDocumentationSelectionDialog 146 QtHelpDocumentationSelectionDialog
147 )
142 dlg = QtHelpDocumentationSelectionDialog( 148 dlg = QtHelpDocumentationSelectionDialog(
143 self.__pluginHelpDocuments, 149 self.__pluginHelpDocuments,
144 QtHelpDocumentationSelectionDialog.ManageMode, 150 QtHelpDocumentationSelectionDialog.ManageMode,
145 self) 151 self)
146 dlg.exec_() 152 dlg.exec_()
232 documents. 238 documents.
233 239
234 @return flag indicating presence of changes 240 @return flag indicating presence of changes
235 @rtype bool 241 @rtype bool
236 """ 242 """
237 return len(self.__registeredDocs) > 0 or \ 243 return (
244 len(self.__registeredDocs) > 0 or
238 len(self.__unregisteredDocs) > 0 245 len(self.__unregisteredDocs) > 0
246 )
239 247
240 def getTabsToClose(self): 248 def getTabsToClose(self):
241 """ 249 """
242 Public method to get the list of tabs to close. 250 Public method to get the list of tabs to close.
243 251

eric ide

mercurial