329 """ |
329 """ |
330 self.filterEdit.clear() |
330 self.filterEdit.clear() |
331 |
331 |
332 output, ok = self.__runUicLoadUi("signatures") |
332 output, ok = self.__runUicLoadUi("signatures") |
333 if ok and output: |
333 if ok and output: |
334 objectsList = json.loads(output.strip()) |
334 try: |
335 |
335 objectsList = json.loads(output.strip()) |
336 signatureList = self.__signatures() |
336 |
337 |
337 signatureList = self.__signatures() |
338 self.slotsModel.clear() |
338 |
339 self.slotsModel.setHorizontalHeaderLabels([""]) |
339 self.slotsModel.clear() |
340 for objectDict in objectsList: |
340 self.slotsModel.setHorizontalHeaderLabels([""]) |
341 itm = QStandardItem( |
341 for objectDict in objectsList: |
342 "{0} ({1})".format(objectDict["name"], objectDict["class_name"]) |
342 itm = QStandardItem( |
|
343 "{0} ({1})".format(objectDict["name"], objectDict["class_name"]) |
|
344 ) |
|
345 self.slotsModel.appendRow(itm) |
|
346 for methodDict in objectDict["methods"]: |
|
347 itm2 = QStandardItem(methodDict["signature"]) |
|
348 itm.appendRow(itm2) |
|
349 |
|
350 if self.__module is not None and ( |
|
351 methodDict["methods"][0] in signatureList |
|
352 or methodDict["methods"][1] in signatureList |
|
353 ): |
|
354 itm2.setFlags(Qt.ItemFlag.ItemIsEnabled) |
|
355 itm2.setCheckState(Qt.CheckState.Checked) |
|
356 if ericApp().usesDarkPalette(): |
|
357 itm2.setForeground(QBrush(QColor("#75bfff"))) |
|
358 else: |
|
359 itm2.setForeground(QBrush(Qt.GlobalColor.blue)) |
|
360 continue |
|
361 |
|
362 itm2.setData(methodDict["pyqt_signature"], pyqtSignatureRole) |
|
363 itm2.setData( |
|
364 methodDict["python_signature"], pythonSignatureRole |
|
365 ) |
|
366 itm2.setData(methodDict["return_type"], returnTypeRole) |
|
367 itm2.setData( |
|
368 methodDict["parameter_types"], parameterTypesListRole |
|
369 ) |
|
370 itm2.setData( |
|
371 methodDict["parameter_names"], parameterNamesListRole |
|
372 ) |
|
373 |
|
374 itm2.setFlags( |
|
375 Qt.ItemFlag.ItemIsUserCheckable |
|
376 | Qt.ItemFlag.ItemIsEnabled |
|
377 | Qt.ItemFlag.ItemIsSelectable |
|
378 ) |
|
379 itm2.setCheckState(Qt.CheckState.Unchecked) |
|
380 |
|
381 self.slotsView.sortByColumn(0, Qt.SortOrder.AscendingOrder) |
|
382 except json.JSONDecodeError as err: |
|
383 EricMessageBox.critical( |
|
384 self, |
|
385 self.tr("Update Slots List"), |
|
386 self.tr( |
|
387 "<p>The update of the slots list failed because invalid data" |
|
388 " was received.</p><p>Error: {0}</p><p>Data: {1}</p>" |
|
389 ).format(str(err), output), |
343 ) |
390 ) |
344 self.slotsModel.appendRow(itm) |
|
345 for methodDict in objectDict["methods"]: |
|
346 itm2 = QStandardItem(methodDict["signature"]) |
|
347 itm.appendRow(itm2) |
|
348 |
|
349 if self.__module is not None and ( |
|
350 methodDict["methods"][0] in signatureList |
|
351 or methodDict["methods"][1] in signatureList |
|
352 ): |
|
353 itm2.setFlags(Qt.ItemFlag.ItemIsEnabled) |
|
354 itm2.setCheckState(Qt.CheckState.Checked) |
|
355 if ericApp().usesDarkPalette(): |
|
356 itm2.setForeground(QBrush(QColor("#75bfff"))) |
|
357 else: |
|
358 itm2.setForeground(QBrush(Qt.GlobalColor.blue)) |
|
359 continue |
|
360 |
|
361 itm2.setData(methodDict["pyqt_signature"], pyqtSignatureRole) |
|
362 itm2.setData(methodDict["python_signature"], pythonSignatureRole) |
|
363 itm2.setData(methodDict["return_type"], returnTypeRole) |
|
364 itm2.setData(methodDict["parameter_types"], parameterTypesListRole) |
|
365 itm2.setData(methodDict["parameter_names"], parameterNamesListRole) |
|
366 |
|
367 itm2.setFlags( |
|
368 Qt.ItemFlag.ItemIsUserCheckable |
|
369 | Qt.ItemFlag.ItemIsEnabled |
|
370 | Qt.ItemFlag.ItemIsSelectable |
|
371 ) |
|
372 itm2.setCheckState(Qt.CheckState.Unchecked) |
|
373 |
|
374 self.slotsView.sortByColumn(0, Qt.SortOrder.AscendingOrder) |
|
375 |
391 |
376 def __generateCode(self): |
392 def __generateCode(self): |
377 """ |
393 """ |
378 Private slot to generate the code as requested by the user. |
394 Private slot to generate the code as requested by the user. |
379 """ |
395 """ |