115 @param directory directory name to be tested |
115 @param directory directory name to be tested |
116 @type str |
116 @type str |
117 @return flag indicating that the given directory is already included |
117 @return flag indicating that the given directory is already included |
118 @rtype bool |
118 @rtype bool |
119 """ |
119 """ |
120 return len(self.idList.findItems(directory, Qt.MatchExactly)) > 0 |
120 return len(self.idList.findItems( |
|
121 directory, Qt.MatchFlag.MatchExactly)) > 0 |
121 |
122 |
122 @pyqtSlot() |
123 @pyqtSlot() |
123 def on_idList_itemSelectionChanged(self): |
124 def on_idList_itemSelectionChanged(self): |
124 """ |
125 """ |
125 Private slot handling the selection of an 'Include Directory' entry. |
126 Private slot handling the selection of an 'Include Directory' entry. |
221 value = nameValueList[1].strip() |
222 value = nameValueList[1].strip() |
222 else: |
223 else: |
223 value = "" |
224 value = "" |
224 QTreeWidgetItem(self.dnList, [name, value]) |
225 QTreeWidgetItem(self.dnList, [name, value]) |
225 |
226 |
226 self.dnList.sortItems(0, Qt.AscendingOrder) |
227 self.dnList.sortItems(0, Qt.SortOrder.AscendingOrder) |
227 |
228 |
228 def __generateDefinedNamesList(self): |
229 def __generateDefinedNamesList(self): |
229 """ |
230 """ |
230 Private method to prepare the list of 'Defined Names'. |
231 Private method to prepare the list of 'Defined Names'. |
231 |
232 |
252 @param name variable name to be tested |
253 @param name variable name to be tested |
253 @type str |
254 @type str |
254 @return flag indicating that the given name is already included |
255 @return flag indicating that the given name is already included |
255 @rtype bool |
256 @rtype bool |
256 """ |
257 """ |
257 return len(self.dnList.findItems(name, Qt.MatchExactly, 0)) > 0 |
258 return len(self.dnList.findItems( |
|
259 name, Qt.MatchFlag.MatchExactly, 0)) > 0 |
258 |
260 |
259 @pyqtSlot() |
261 @pyqtSlot() |
260 def on_dnList_itemSelectionChanged(self): |
262 def on_dnList_itemSelectionChanged(self): |
261 """ |
263 """ |
262 Private slot handling the selection of a 'Define Name' entry. |
264 Private slot handling the selection of a 'Define Name' entry. |
267 def on_dnAddButton_clicked(self): |
269 def on_dnAddButton_clicked(self): |
268 """ |
270 """ |
269 Private slot to add a 'Define Name' entry. |
271 Private slot to add a 'Define Name' entry. |
270 """ |
272 """ |
271 dlg = IdlCompilerDefineNameDialog(parent=self) |
273 dlg = IdlCompilerDefineNameDialog(parent=self) |
272 if dlg.exec() == QDialog.Accepted: |
274 if dlg.exec() == QDialog.DialogCode.Accepted: |
273 name, value = dlg.getData() |
275 name, value = dlg.getData() |
274 if not self.__definedNamesContain(name): |
276 if not self.__definedNamesContain(name): |
275 QTreeWidgetItem(self.dnList, [name, value]) |
277 QTreeWidgetItem(self.dnList, [name, value]) |
276 |
278 |
277 self.dnList.sortItems(0, Qt.AscendingOrder) |
279 self.dnList.sortItems(0, Qt.SortOrder.AscendingOrder) |
278 |
280 |
279 @pyqtSlot() |
281 @pyqtSlot() |
280 def on_dnDeleteButton_clicked(self): |
282 def on_dnDeleteButton_clicked(self): |
281 """ |
283 """ |
282 Private slot to delete the selected 'Define Name' entry. |
284 Private slot to delete the selected 'Define Name' entry. |
293 """ |
295 """ |
294 itm = self.dnList.selectedItems()[0] |
296 itm = self.dnList.selectedItems()[0] |
295 |
297 |
296 dlg = IdlCompilerDefineNameDialog( |
298 dlg = IdlCompilerDefineNameDialog( |
297 name=itm.text(0), value=itm.text(1), parent=self) |
299 name=itm.text(0), value=itm.text(1), parent=self) |
298 if dlg.exec() == QDialog.Accepted: |
300 if dlg.exec() == QDialog.DialogCode.Accepted: |
299 name, value = dlg.getData() |
301 name, value = dlg.getData() |
300 if self.__definedNamesContain(name) and itm.text(0) != name: |
302 if self.__definedNamesContain(name) and itm.text(0) != name: |
301 # the entry exists already, delete the edited one |
303 # the entry exists already, delete the edited one |
302 index = self.dnList.indexOfTopLevelItem(itm) |
304 index = self.dnList.indexOfTopLevelItem(itm) |
303 self.dnList.takeTopLevelItem(index) |
305 self.dnList.takeTopLevelItem(index) |
304 del itm |
306 del itm |
305 |
307 |
306 # change the named one |
308 # change the named one |
307 itm = self.dnList.findItems(name, Qt.MatchExactly, 0)[0] |
309 itm = self.dnList.findItems( |
|
310 name, Qt.MatchFlag.MatchExactly, 0)[0] |
308 itm.setText(1, value) |
311 itm.setText(1, value) |
309 else: |
312 else: |
310 itm.setText(0, name) |
313 itm.setText(0, name) |
311 itm.setText(1, value) |
314 itm.setText(1, value) |
312 |
315 |
313 self.dnList.sortItems(0, Qt.AscendingOrder) |
316 self.dnList.sortItems(0, Qt.SortOrder.AscendingOrder) |
314 |
317 |
315 ####################################################################### |
318 ####################################################################### |
316 ## Methods implementing the 'Undefine Name' option |
319 ## Methods implementing the 'Undefine Name' option |
317 ####################################################################### |
320 ####################################################################### |
318 |
321 |
344 @param name variable name to be tested |
347 @param name variable name to be tested |
345 @type str |
348 @type str |
346 @return flag indicating that the given name is already included |
349 @return flag indicating that the given name is already included |
347 @rtype bool |
350 @rtype bool |
348 """ |
351 """ |
349 return len(self.unList.findItems(name, Qt.MatchExactly)) > 0 |
352 return len(self.unList.findItems(name, Qt.MatchFlag.MatchExactly)) > 0 |
350 |
353 |
351 @pyqtSlot() |
354 @pyqtSlot() |
352 def on_unList_itemSelectionChanged(self): |
355 def on_unList_itemSelectionChanged(self): |
353 """ |
356 """ |
354 Private slot handling the selection of a 'Undefine Name' entry. |
357 Private slot handling the selection of a 'Undefine Name' entry. |