47 @pyqtSlot() |
47 @pyqtSlot() |
48 def on_documentsList_itemSelectionChanged(self): |
48 def on_documentsList_itemSelectionChanged(self): |
49 """ |
49 """ |
50 Private slot handling a change of the documents selection. |
50 Private slot handling a change of the documents selection. |
51 """ |
51 """ |
52 self.removeButton.setEnabled(len(self.documentsList.selectedItems()) != 0) |
52 self.removeButton.setEnabled( |
|
53 len(self.documentsList.selectedItems()) != 0) |
53 |
54 |
54 @pyqtSlot() |
55 @pyqtSlot() |
55 def on_addButton_clicked(self): |
56 def on_addButton_clicked(self): |
56 """ |
57 """ |
57 Private slot to add documents to the help database. |
58 Private slot to add documents to the help database. |
67 for fileName in fileNames: |
68 for fileName in fileNames: |
68 ns = QHelpEngineCore.namespaceName(fileName) |
69 ns = QHelpEngineCore.namespaceName(fileName) |
69 if not ns: |
70 if not ns: |
70 E5MessageBox.warning(self, |
71 E5MessageBox.warning(self, |
71 self.trUtf8("Add Documentation"), |
72 self.trUtf8("Add Documentation"), |
72 self.trUtf8("""The file <b>{0}</b> is not a valid Qt Help File.""")\ |
73 self.trUtf8( |
73 .format(fileName) |
74 """The file <b>{0}</b> is not a valid""" |
|
75 """ Qt Help File.""").format(fileName) |
74 ) |
76 ) |
75 continue |
77 continue |
76 |
78 |
77 if len(self.documentsList.findItems(ns, Qt.MatchFixedString)): |
79 if len(self.documentsList.findItems(ns, Qt.MatchFixedString)): |
78 E5MessageBox.warning(self, |
80 E5MessageBox.warning(self, |
79 self.trUtf8("Add Documentation"), |
81 self.trUtf8("Add Documentation"), |
80 self.trUtf8("""The namespace <b>{0}</b> is already registered.""")\ |
82 self.trUtf8( |
|
83 """The namespace <b>{0}</b> is already registered.""")\ |
81 .format(ns) |
84 .format(ns) |
82 ) |
85 ) |
83 continue |
86 continue |
84 |
87 |
85 self.__engine.registerDocumentation(fileName) |
88 self.__engine.registerDocumentation(fileName) |
93 """ |
96 """ |
94 Private slot to remove a document from the help database. |
97 Private slot to remove a document from the help database. |
95 """ |
98 """ |
96 res = E5MessageBox.question(self, |
99 res = E5MessageBox.question(self, |
97 self.trUtf8("Remove Documentation"), |
100 self.trUtf8("Remove Documentation"), |
98 self.trUtf8("""Do you really want to remove the selected documentation """ |
101 self.trUtf8( |
99 """sets from the database?""")) |
102 """Do you really want to remove the selected documentation """ |
|
103 """sets from the database?""")) |
100 if not res: |
104 if not res: |
101 return |
105 return |
102 |
106 |
103 openedDocs = self.__mw.getSourceFileList() |
107 openedDocs = self.__mw.getSourceFileList() |
104 |
108 |
106 for item in items: |
110 for item in items: |
107 ns = item.text() |
111 ns = item.text() |
108 if ns in list(openedDocs.values()): |
112 if ns in list(openedDocs.values()): |
109 res = E5MessageBox.yesNo(self, |
113 res = E5MessageBox.yesNo(self, |
110 self.trUtf8("Remove Documentation"), |
114 self.trUtf8("Remove Documentation"), |
111 self.trUtf8("""Some documents currently opened reference the """ |
115 self.trUtf8( |
112 """documentation you are attempting to remove. """ |
116 """Some documents currently opened reference the """ |
113 """Removing the documentation will close those """ |
117 """documentation you are attempting to remove. """ |
114 """documents. Remove anyway?"""), |
118 """Removing the documentation will close those """ |
|
119 """documents. Remove anyway?"""), |
115 icon=E5MessageBox.Warning) |
120 icon=E5MessageBox.Warning) |
116 if not res: |
121 if not res: |
117 return |
122 return |
118 self.__unregisteredDocs.append(ns) |
123 self.__unregisteredDocs.append(ns) |
119 for id in openedDocs: |
124 for id in openedDocs: |
123 del itm |
128 del itm |
124 |
129 |
125 self.__engine.unregisterDocumentation(ns) |
130 self.__engine.unregisterDocumentation(ns) |
126 |
131 |
127 if self.documentsList.count(): |
132 if self.documentsList.count(): |
128 self.documentsList.setCurrentRow(0, QItemSelectionModel.ClearAndSelect) |
133 self.documentsList.setCurrentRow( |
|
134 0, QItemSelectionModel.ClearAndSelect) |
129 |
135 |
130 def hasChanges(self): |
136 def hasChanges(self): |
131 """ |
137 """ |
132 Public slot to test the dialog for changes. |
138 Public slot to test the dialog for changes. |
133 |
139 |