Project/CreateDialogCodeDialog.py

Thu, 18 Oct 2018 18:46:53 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 18 Oct 2018 18:46:53 +0200
changeset 6548
21f8260753b5
parent 6547
77c817301ca1
child 6590
8cad6f50ff4c
permissions
-rw-r--r--

CreateDialogCodeDialog: fixed an oversight in the recent code changes causing the dialog to be populated multiple times.

0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
6048
82ad8ec9548c Updated copyright for 2018.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
3 # Copyright (c) 2007 - 2018 Detlev Offenbach <detlev@die-offenbachs.de>
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
2297
e8a46f81517c Adjusted some display strings to be independant of the Qt version (Qt4/Qt5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2223
diff changeset
7 Module implementing a dialog to generate code for a Qt4/Qt5 dialog.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
3145
a9de05d4a22f # __IGNORE_WARNING__ added/ removed.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3142
diff changeset
10 from __future__ import unicode_literals
6547
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
11 try:
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
12 str = unicode # __IGNORE_EXCEPTION__
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
13 except NameError:
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
14 pass
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2492
diff changeset
15
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 import os
6547
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
17 import json
4259
c90a1cb373f2 Added code to intercept a parse error of form files to the dialog code creation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4094
diff changeset
18 import xml.etree.ElementTree
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
20 from PyQt5.QtCore import QMetaObject, QByteArray, QRegExp, Qt, pyqtSlot, \
6547
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
21 QMetaMethod, QSortFilterProxyModel, QProcess
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
22 from PyQt5.QtGui import QStandardItemModel, QBrush, QStandardItem
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
23 from PyQt5.QtWidgets import QWidget, QDialog, QDialogButtonBox, QAction
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
24 from PyQt5 import uic
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
25
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26
55
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 53
diff changeset
27 from E5Gui.E5Application import e5App
537
72b32daeb8d6 Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 535
diff changeset
28 from E5Gui import E5MessageBox
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
30 from .Ui_CreateDialogCodeDialog import Ui_CreateDialogCodeDialog
3110
af7a8dda4c32 Corrected a not working import in the dialog creation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3038
diff changeset
31 from .NewDialogClassDialog import NewDialogClassDialog
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
33 from eric6config import getConfig
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34
5736
000ea446ff4b Prepared the code for Qt > 5.9.99.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
35 from Globals import qVersionTuple
000ea446ff4b Prepared the code for Qt > 5.9.99.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
36
000ea446ff4b Prepared the code for Qt > 5.9.99.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
37
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
38 pyqtSignatureRole = Qt.UserRole + 1
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 pythonSignatureRole = Qt.UserRole + 2
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
40 rubySignatureRole = Qt.UserRole + 3
4485
28743e3251ce Improved the dialog code generation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4332
diff changeset
41 returnTypeRole = Qt.UserRole + 4
28743e3251ce Improved the dialog code generation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4332
diff changeset
42 parameterTypesListRole = Qt.UserRole + 5
28743e3251ce Improved the dialog code generation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4332
diff changeset
43 parameterNamesListRole = Qt.UserRole + 6
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
44
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 class CreateDialogCodeDialog(QDialog, Ui_CreateDialogCodeDialog):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 """
2297
e8a46f81517c Adjusted some display strings to be independant of the Qt version (Qt4/Qt5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2223
diff changeset
48 Class implementing a dialog to generate code for a Qt4/Qt5 dialog.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 """
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
50 DialogClasses = {
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
51 "QDialog", "QWidget", "QMainWindow", "QWizard", "QWizardPage",
2492
91ab554e3465 Added support for more widgets in the code creation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2408
diff changeset
52 "QDockWidget", "QFrame", "QGroupBox", "QScrollArea", "QMdiArea",
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
53 "QTabWidget", "QToolBox", "QStackedWidget"
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
54 }
1869
3e34d5c362d9 Enhanced the dialog code generation dialog by presenting classes not directly derived from QWidget, QDialog, QMainWindow or QWizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1862
diff changeset
55 Separator = 25 * "="
1275
3db9193a528b Fixed an issue with the Create Dialog Code dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1206
diff changeset
56
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
57 def __init__(self, formName, project, parent=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 Constructor
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 @param formName name of the file containing the form (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 @param project reference to the project object
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 @param parent parent widget if the dialog (QWidget)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2492
diff changeset
65 super(CreateDialogCodeDialog, self).__init__(parent)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 self.setupUi(self)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 self.okButton = self.buttonBox.button(QDialogButtonBox.Ok)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 self.slotsView.header().hide()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 self.project = project
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 self.formFile = formName
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 filename, ext = os.path.splitext(self.formFile)
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
76 self.srcFile = '{0}{1}'.format(
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
77 filename, self.project.getDefaultSourceExtension())
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 self.slotsModel = QStandardItemModel()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80 self.proxyModel = QSortFilterProxyModel()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 self.proxyModel.setDynamicSortFilter(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 self.proxyModel.setSourceModel(self.slotsModel)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 self.slotsView.setModel(self.proxyModel)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 # initialize some member variables
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 self.__initError = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87 self.__module = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 if os.path.exists(self.srcFile):
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 45
diff changeset
90 vm = e5App().getObject("ViewManager")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 ed = vm.getOpenEditor(self.srcFile)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92 if ed and not vm.checkDirty(ed):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 self.__initError = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95
1016
72b6b0778e06 Fixed an issue in the code creation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
96 try:
1844
0388a36b5fcf Fixed an issue in the dialog code creation dialog with scanning a Python source file not having the standard extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1819
diff changeset
97 splitExt = os.path.splitext(self.srcFile)
0388a36b5fcf Fixed an issue in the dialog code creation dialog with scanning a Python source file not having the standard extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1819
diff changeset
98 if len(splitExt) == 2:
0388a36b5fcf Fixed an issue in the dialog code creation dialog with scanning a Python source file not having the standard extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1819
diff changeset
99 exts = [splitExt[1]]
0388a36b5fcf Fixed an issue in the dialog code creation dialog with scanning a Python source file not having the standard extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1819
diff changeset
100 else:
0388a36b5fcf Fixed an issue in the dialog code creation dialog with scanning a Python source file not having the standard extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1819
diff changeset
101 exts = None
2408
dc3a7c9d8f6e Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
102 from Utilities import ModuleParser
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
103 self.__module = ModuleParser.readModule(
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
104 self.srcFile, extensions=exts, caching=False)
1016
72b6b0778e06 Fixed an issue in the code creation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
105 except ImportError:
72b6b0778e06 Fixed an issue in the code creation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
106 pass
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 if self.__module is not None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 self.filenameEdit.setText(self.srcFile)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111 classesList = []
1869
3e34d5c362d9 Enhanced the dialog code generation dialog by presenting classes not directly derived from QWidget, QDialog, QMainWindow or QWizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1862
diff changeset
112 vagueClassesList = []
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
113 for cls in list(self.__module.classes.values()):
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
114 if not set(cls.super).isdisjoint(
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
115 CreateDialogCodeDialog.DialogClasses):
1275
3db9193a528b Fixed an issue with the Create Dialog Code dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1206
diff changeset
116 classesList.append(cls.name)
1869
3e34d5c362d9 Enhanced the dialog code generation dialog by presenting classes not directly derived from QWidget, QDialog, QMainWindow or QWizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1862
diff changeset
117 else:
3e34d5c362d9 Enhanced the dialog code generation dialog by presenting classes not directly derived from QWidget, QDialog, QMainWindow or QWizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1862
diff changeset
118 vagueClassesList.append(cls.name)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119 classesList.sort()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120 self.classNameCombo.addItems(classesList)
1869
3e34d5c362d9 Enhanced the dialog code generation dialog by presenting classes not directly derived from QWidget, QDialog, QMainWindow or QWizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1862
diff changeset
121 if vagueClassesList:
3e34d5c362d9 Enhanced the dialog code generation dialog by presenting classes not directly derived from QWidget, QDialog, QMainWindow or QWizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1862
diff changeset
122 if classesList:
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
123 self.classNameCombo.addItem(
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
124 CreateDialogCodeDialog.Separator)
1869
3e34d5c362d9 Enhanced the dialog code generation dialog by presenting classes not directly derived from QWidget, QDialog, QMainWindow or QWizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1862
diff changeset
125 self.classNameCombo.addItems(sorted(vagueClassesList))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126
1016
72b6b0778e06 Fixed an issue in the code creation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
127 if os.path.exists(self.srcFile) and \
72b6b0778e06 Fixed an issue in the code creation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
128 self.__module is not None and \
72b6b0778e06 Fixed an issue in the code creation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
129 self.classNameCombo.count() == 0:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 self.__initError = True
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2995
diff changeset
131 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2995
diff changeset
132 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
133 self.tr("Create Dialog Code"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
134 self.tr(
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
135 """The file <b>{0}</b> exists but does not contain"""
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
136 """ any classes.""").format(self.srcFile))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138 self.okButton.setEnabled(self.classNameCombo.count() > 0)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
139
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
140 self.__updateSlotsModel()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
142 def initError(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
143 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
144 Public method to determine, if there was an initialzation error.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
145
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
146 @return flag indicating an initialzation error (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
148 return self.__initError
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149
6547
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
150 def __objectNameExternal(self):
6544
51996454f89f CreateDialogCodeDialog: extended the logic to support projects loading custom widgets from outside the eric or project directories (via a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6291
diff changeset
151 """
6547
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
152 Private method to get the object name of a form via an external
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
153 interpreter.
6544
51996454f89f CreateDialogCodeDialog: extended the logic to support projects loading custom widgets from outside the eric or project directories (via a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6291
diff changeset
154
6547
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
155 @return object name
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
156 @rtype str
6544
51996454f89f CreateDialogCodeDialog: extended the logic to support projects loading custom widgets from outside the eric or project directories (via a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6291
diff changeset
157 """
51996454f89f CreateDialogCodeDialog: extended the logic to support projects loading custom widgets from outside the eric or project directories (via a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6291
diff changeset
158 interpreter = self.project.getDebugProperty("INTERPRETER")
6547
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
159 objectName = ""
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
160
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
161 loadUi = os.path.join(os.path.dirname(__file__), "UicLoadUi.py")
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
162 args = [
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
163 loadUi,
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
164 "object_name",
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
165 self.formFile,
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
166 self.project.getProjectPath(),
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
167 ]
6544
51996454f89f CreateDialogCodeDialog: extended the logic to support projects loading custom widgets from outside the eric or project directories (via a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6291
diff changeset
168
6547
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
169 proc = QProcess()
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
170 proc.start(interpreter, args)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
171 finished = proc.waitForFinished(30000)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
172 if finished:
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
173 text = proc.readAllStandardOutput()
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
174 if proc.exitCode() == 0:
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
175 objectName = str(text, "utf-8", "replace").strip()
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
176 else:
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
177 errorText = str(text, "utf-8", "replace")
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
178 E5MessageBox.critical(
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
179 self,
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
180 self.tr("uic error"),
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
181 self.tr(
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
182 """<p>There was an error loading the form <b>{0}</b>"""
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
183 """.</p><p>{1}</p>""").format(
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
184 self.formFile, errorText))
6544
51996454f89f CreateDialogCodeDialog: extended the logic to support projects loading custom widgets from outside the eric or project directories (via a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6291
diff changeset
185
6547
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
186 return objectName
6544
51996454f89f CreateDialogCodeDialog: extended the logic to support projects loading custom widgets from outside the eric or project directories (via a virtual environment).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6291
diff changeset
187
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
188 def __objectName(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189 """
6547
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
190 Private method to get the object name of a form.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
191
6547
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
192 @return object name
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
193 @rtype str
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
194 """
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
195 if self.project.getDebugProperty("INTERPRETER"):
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
196 return self.__objectNameExternal()
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
197 else:
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
198 try:
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
199 dlg = uic.loadUi(
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
200 self.formFile, package=self.project.getProjectPath())
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
201 return dlg.objectName()
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
202 except (AttributeError, ImportError,
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
203 xml.etree.ElementTree.ParseError) as err:
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
204 E5MessageBox.critical(
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
205 self,
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
206 self.tr("uic error"),
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
207 self.tr(
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
208 """<p>There was an error loading the form <b>{0}</b>"""
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
209 """.</p><p>{1}</p>""").format(self.formFile, str(err)))
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
210 return ""
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
211
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
212 def __classNameExternal(self):
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
213 """
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
214 Private method to get the class name of a form via an external
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
215 interpreter.
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
216
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
217 @return class name
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
218 @rtype str
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
219 """
6547
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
220 interpreter = self.project.getDebugProperty("INTERPRETER")
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
221 className = ""
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
222
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
223 loadUi = os.path.join(os.path.dirname(__file__), "UicLoadUi.py")
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
224 args = [
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
225 loadUi,
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
226 "class_name",
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
227 self.formFile,
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
228 self.project.getProjectPath(),
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
229 ]
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
230
6547
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
231 proc = QProcess()
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
232 proc.start(interpreter, args)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
233 finished = proc.waitForFinished(30000)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
234 if finished:
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
235 text = proc.readAllStandardOutput()
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
236 if proc.exitCode() == 0:
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
237 className = str(text, "utf-8", "replace").strip()
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
238 else:
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
239 errorText = str(text, "utf-8", "replace")
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
240 E5MessageBox.critical(
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
241 self,
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
242 self.tr("uic error"),
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
243 self.tr(
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
244 """<p>There was an error loading the form <b>{0}</b>"""
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
245 """.</p><p>{1}</p>""").format(
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
246 self.formFile, errorText))
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
247
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
248 return className
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
249
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
250 def __className(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
251 """
6547
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
252 Private method to get the class name of a form.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
253
6547
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
254 @return class name
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
255 @rtype str
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
256 """
6547
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
257 if self.project.getDebugProperty("INTERPRETER"):
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
258 return self.__objectNameExternal()
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
259 else:
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
260 try:
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
261 dlg = uic.loadUi(
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
262 self.formFile, package=self.project.getProjectPath())
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
263 return dlg.metaObject().className()
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
264 except (AttributeError, ImportError,
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
265 xml.etree.ElementTree.ParseError) as err:
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
266 E5MessageBox.critical(
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
267 self,
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
268 self.tr("uic error"),
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
269 self.tr(
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
270 """<p>There was an error loading the form <b>{0}</b>"""
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
271 """.</p><p>{1}</p>""").format(self.formFile, str(err)))
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
272 return ""
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
273
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
274 def __signatures(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
275 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
276 Private slot to get the signatures.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
277
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
278 @return list of signatures (list of strings)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
279 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
280 if self.__module is None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
281 return []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
282
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
283 signatures = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
284 clsName = self.classNameCombo.currentText()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
285 if clsName:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
286 cls = self.__module.classes[clsName]
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
287 for meth in list(cls.methods.values()):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
288 if meth.name.startswith("on_"):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289 if meth.pyqtSignature is not None:
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
290 sig = ", ".join(
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3030
diff changeset
291 [bytes(QMetaObject.normalizedType(t)).decode()
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
292 for t in meth.pyqtSignature.split(",")])
427
6af5d12cfecb Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
293 signatures.append("{0}({1})".format(meth.name, sig))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
294 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295 signatures.append(meth.name)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296 return signatures
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
297
42
23b45a742e17 Fixed a bunch of issues including a workaround for a bug in the Python email package (s. EmailDialog.py).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 15
diff changeset
298 def __mapType(self, type_):
23b45a742e17 Fixed a bunch of issues including a workaround for a bug in the Python email package (s. EmailDialog.py).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 15
diff changeset
299 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
300 Private method to map a type as reported by Qt's meta object to the
42
23b45a742e17 Fixed a bunch of issues including a workaround for a bug in the Python email package (s. EmailDialog.py).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 15
diff changeset
301 correct Python type.
23b45a742e17 Fixed a bunch of issues including a workaround for a bug in the Python email package (s. EmailDialog.py).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 15
diff changeset
302
23b45a742e17 Fixed a bunch of issues including a workaround for a bug in the Python email package (s. EmailDialog.py).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 15
diff changeset
303 @param type_ type as reported by Qt (QByteArray)
23b45a742e17 Fixed a bunch of issues including a workaround for a bug in the Python email package (s. EmailDialog.py).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 15
diff changeset
304 @return mapped Python type (string)
23b45a742e17 Fixed a bunch of issues including a workaround for a bug in the Python email package (s. EmailDialog.py).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 15
diff changeset
305 """
23b45a742e17 Fixed a bunch of issues including a workaround for a bug in the Python email package (s. EmailDialog.py).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 15
diff changeset
306 mapped = bytes(type_).decode()
23b45a742e17 Fixed a bunch of issues including a workaround for a bug in the Python email package (s. EmailDialog.py).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 15
diff changeset
307
6547
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
308 # I. always check for *
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
309 mapped = mapped.replace("*", "")
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
310
1139
b18376d58832 Added dialog support for PySide.
detlev@die-offenbachs.de
parents: 1137
diff changeset
311 if self.project.getProjectLanguage() != "Python2" or \
6291
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
312 self.project.getProjectType in ("PySide", "PySide2"):
1139
b18376d58832 Added dialog support for PySide.
detlev@die-offenbachs.de
parents: 1137
diff changeset
313 # 1. check for const
b18376d58832 Added dialog support for PySide.
detlev@die-offenbachs.de
parents: 1137
diff changeset
314 mapped = mapped.replace("const ", "")
b18376d58832 Added dialog support for PySide.
detlev@die-offenbachs.de
parents: 1137
diff changeset
315
6547
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
316 # 2. replace QString and QStringList
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
317 mapped = mapped.replace("QStringList", "list")\
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
318 .replace("QString", "str")
1139
b18376d58832 Added dialog support for PySide.
detlev@die-offenbachs.de
parents: 1137
diff changeset
319
6547
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
320 # 3. replace double by float
1139
b18376d58832 Added dialog support for PySide.
detlev@die-offenbachs.de
parents: 1137
diff changeset
321 mapped = mapped.replace("double", "float")
42
23b45a742e17 Fixed a bunch of issues including a workaround for a bug in the Python email package (s. EmailDialog.py).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 15
diff changeset
322
23b45a742e17 Fixed a bunch of issues including a workaround for a bug in the Python email package (s. EmailDialog.py).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 15
diff changeset
323 return mapped
6547
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
324
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
325 def __updateSlotsModelExternal(self):
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
326 """
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
327 Private slot to update the slots tree display getting the data via an
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
328 external interpreter.
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
329 """
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
330 interpreter = self.project.getDebugProperty("INTERPRETER")
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
331 objectsList = []
42
23b45a742e17 Fixed a bunch of issues including a workaround for a bug in the Python email package (s. EmailDialog.py).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 15
diff changeset
332
6547
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
333 loadUi = os.path.join(os.path.dirname(__file__), "UicLoadUi.py")
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
334 args = [
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
335 loadUi,
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
336 "signatures",
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
337 self.formFile,
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
338 self.project.getProjectPath(),
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
339 ]
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
340
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
341 proc = QProcess()
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
342 proc.start(interpreter, args)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
343 finished = proc.waitForFinished(30000)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
344 if not finished:
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
345 return
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
346
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
347 text = proc.readAllStandardOutput()
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
348 if proc.exitCode() != 0:
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
349 errorText = str(text, "utf-8", "replace")
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
350 E5MessageBox.critical(
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
351 self,
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
352 self.tr("uic error"),
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
353 self.tr(
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
354 """<p>There was an error loading the form <b>{0}</b>"""
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
355 """.</p><p>{1}</p>""").format(
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
356 self.formFile, errorText))
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
357 else:
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
358 objectsListStr = str(text, "utf-8", "replace").strip()
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
359 objectsList = json.loads(objectsListStr)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
360
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
361 signatureList = self.__signatures()
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
362
6548
21f8260753b5 CreateDialogCodeDialog: fixed an oversight in the recent code changes causing the dialog to be populated multiple times.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6547
diff changeset
363 self.slotsModel.clear()
21f8260753b5 CreateDialogCodeDialog: fixed an oversight in the recent code changes causing the dialog to be populated multiple times.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6547
diff changeset
364 self.slotsModel.setHorizontalHeaderLabels([""])
6547
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
365 for objectDict in objectsList:
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
366 itm = QStandardItem("{0} ({1})".format(
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
367 objectDict["name"],
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
368 objectDict["class_name"]))
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
369 self.slotsModel.appendRow(itm)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
370 for methodDict in objectDict["methods"]:
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
371 itm2 = QStandardItem(methodDict["signature"])
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
372 itm.appendRow(itm2)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
373
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
374 if self.__module is not None:
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
375 if methodDict["methods"][0] in signatureList or \
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
376 methodDict["methods"][1] in signatureList:
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
377 itm2.setFlags(
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
378 Qt.ItemFlags(Qt.ItemIsEnabled))
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
379 itm2.setCheckState(Qt.Checked)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
380 itm2.setForeground(QBrush(Qt.blue))
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
381 continue
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
382
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
383 itm2.setData(methodDict["pyqt_signature"],
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
384 pyqtSignatureRole)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
385 itm2.setData(methodDict["python_signature"],
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
386 pythonSignatureRole)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
387 itm2.setData(methodDict["return_type"],
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
388 returnTypeRole)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
389 itm2.setData(methodDict["parameter_types"],
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
390 parameterTypesListRole)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
391 itm2.setData(methodDict["parameter_names"],
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
392 parameterNamesListRole)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
393
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
394 itm2.setFlags(Qt.ItemFlags(
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
395 Qt.ItemIsUserCheckable |
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
396 Qt.ItemIsEnabled |
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
397 Qt.ItemIsSelectable)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
398 )
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
399 itm2.setCheckState(Qt.Unchecked)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
400
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
401 self.slotsView.sortByColumn(0, Qt.AscendingOrder)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
402
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
403 def __updateSlotsModel(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
404 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
405 Private slot to update the slots tree display.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
406 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
407 self.filterEdit.clear()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
408
6547
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
409 if self.project.getDebugProperty("INTERPRETER"):
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
410 self.__updateSlotsModelExternal()
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
411 else:
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
412 try:
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
413 dlg = uic.loadUi(
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
414 self.formFile, package=self.project.getProjectPath())
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
415 objects = dlg.findChildren(QWidget) + dlg.findChildren(QAction)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
416
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
417 signatureList = self.__signatures()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
418
6547
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
419 self.slotsModel.clear()
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
420 self.slotsModel.setHorizontalHeaderLabels([""])
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
421 for obj in objects:
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
422 name = obj.objectName()
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
423 if not name or name.startswith("qt_"):
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
424 # ignore un-named or internal objects
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
425 continue
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
426
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
427 metaObject = obj.metaObject()
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
428 className = metaObject.className()
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
429 itm = QStandardItem("{0} ({1})".format(name, className))
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
430 self.slotsModel.appendRow(itm)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
431 for index in range(metaObject.methodCount()):
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
432 metaMethod = metaObject.method(index)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
433 if metaMethod.methodType() == QMetaMethod.Signal:
5736
000ea446ff4b Prepared the code for Qt > 5.9.99.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
434 if qVersionTuple() >= (5, 0, 0):
6547
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
435 itm2 = QStandardItem("on_{0}_{1}".format(
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
436 name,
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3030
diff changeset
437 bytes(metaMethod.methodSignature())
6547
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
438 .decode()
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
439 ))
2094
88620e11c67c Made the seventh set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1870
diff changeset
440 else:
6547
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
441 itm2 = QStandardItem("on_{0}_{1}".format(
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
442 name, metaMethod.signature()
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
443 ))
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
444 itm.appendRow(itm2)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
445 if self.__module is not None:
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
446 if qVersionTuple() >= (5, 0, 0):
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
447 method = "on_{0}_{1}".format(
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
448 name,
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3030
diff changeset
449 bytes(metaMethod.methodSignature())
6547
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
450 .decode().split("(")[0])
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
451 else:
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
452 method = "on_{0}_{1}".format(
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
453 name,
6547
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
454 metaMethod.signature().split("(")[0])
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
455 method2 = "{0}({1})".format(
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
456 method,
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
457 ", ".join([
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
458 self.__mapType(t)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
459 for t in metaMethod.parameterTypes()
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
460 ])
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
461 )
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
462
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
463 if method2 in signatureList or \
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
464 method in signatureList:
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
465 itm2.setFlags(
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
466 Qt.ItemFlags(Qt.ItemIsEnabled))
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
467 itm2.setCheckState(Qt.Checked)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
468 itm2.setForeground(QBrush(Qt.blue))
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
469 continue
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
470
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
471 returnType = self.__mapType(
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
472 metaMethod.typeName().encode())
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
473 if returnType == 'void':
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
474 returnType = ""
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
475 parameterTypesList = [
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
476 self.__mapType(t)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
477 for t in metaMethod.parameterTypes()]
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
478 pyqtSignature = ", ".join(parameterTypesList)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
479
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
480 parameterNames = metaMethod.parameterNames()
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
481 if parameterNames:
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
482 for index in range(len(parameterNames)):
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
483 if not parameterNames[index]:
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
484 parameterNames[index] = \
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
485 QByteArray("p{0:d}".format(index)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
486 .encode("utf-8"))
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
487 parameterNamesList = [bytes(n).decode()
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
488 for n in parameterNames]
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
489 methNamesSig = ", ".join(parameterNamesList)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
490
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
491 if methNamesSig:
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
492 if qVersionTuple() >= (5, 0, 0):
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
493 pythonSignature = \
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
494 "on_{0}_{1}(self, {2})".format(
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
495 name,
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
496 bytes(metaMethod.methodSignature())
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
497 .decode().split("(")[0],
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
498 methNamesSig)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
499 else:
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
500 pythonSignature = \
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
501 "on_{0}_{1}(self, {2})".format(
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
502 name,
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
503 metaMethod.signature()
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
504 .split("(")[0],
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
505 methNamesSig)
2094
88620e11c67c Made the seventh set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1870
diff changeset
506 else:
6547
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
507 if qVersionTuple() >= (5, 0, 0):
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
508 pythonSignature = "on_{0}_{1}(self)"\
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
509 .format(
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
510 name,
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
511 bytes(metaMethod.methodSignature())
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
512 .decode().split("(")[0])
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
513 else:
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
514 pythonSignature = "on_{0}_{1}(self)"\
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
515 .format(
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
516 name,
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
517 metaMethod.signature().split(
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
518 "(")[0])
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
519 itm2.setData(pyqtSignature, pyqtSignatureRole)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
520 itm2.setData(pythonSignature, pythonSignatureRole)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
521 itm2.setData(returnType, returnTypeRole)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
522 itm2.setData(parameterTypesList,
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
523 parameterTypesListRole)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
524 itm2.setData(parameterNamesList,
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
525 parameterNamesListRole)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
526
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
527 itm2.setFlags(Qt.ItemFlags(
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
528 Qt.ItemIsUserCheckable |
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
529 Qt.ItemIsEnabled |
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
530 Qt.ItemIsSelectable)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
531 )
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
532 itm2.setCheckState(Qt.Unchecked)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
533
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
534 self.slotsView.sortByColumn(0, Qt.AscendingOrder)
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
535 except (AttributeError, ImportError,
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
536 xml.etree.ElementTree.ParseError) as err:
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
537 E5MessageBox.critical(
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
538 self,
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
539 self.tr("uic error"),
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
540 self.tr(
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
541 """<p>There was an error loading the form <b>{0}</b>"""
77c817301ca1 CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6544
diff changeset
542 """.</p><p>{1}</p>""").format(self.formFile, str(err)))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
543
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
544 def __generateCode(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
545 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
546 Private slot to generate the code as requested by the user.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
547 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
548 # first decide on extension
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
549 if self.filenameEdit.text().endswith(".py") or \
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
550 self.filenameEdit.text().endswith(".pyw"):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
551 self.__generatePythonCode()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
552 elif self.filenameEdit.text().endswith(".rb"):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
553 pass
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
554 # second decide on project language
1137
1a37887aefa7 Fixed a little error in the code generation dialog.
detlev@die-offenbachs.de
parents: 1132
diff changeset
555 elif self.project.getProjectLanguage() in ["Python2", "Python3"]:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
556 self.__generatePythonCode()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
557 elif self.project.getProjectLanguage() == "Ruby":
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
558 pass
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
559 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
560 # assume Python (our global default)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
561 self.__generatePythonCode()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
562
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
563 def __generatePythonCode(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
564 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
565 Private slot to generate Python code as requested by the user.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
566 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
567 # init some variables
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
568 sourceImpl = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
569 appendAtIndex = -1
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
570 indentStr = " "
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
571 slotsCode = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
572
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
573 if self.__module is None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
574 # new file
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
575 try:
1139
b18376d58832 Added dialog support for PySide.
detlev@die-offenbachs.de
parents: 1137
diff changeset
576 if self.project.getProjectLanguage() == "Python2":
b18376d58832 Added dialog support for PySide.
detlev@die-offenbachs.de
parents: 1137
diff changeset
577 if self.project.getProjectType() == "PySide":
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
578 tmplName = os.path.join(
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
579 getConfig('ericCodeTemplatesDir'),
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
580 "impl_pyside.py2.tmpl")
6291
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
581 elif self.project.getProjectType() == "PySide2":
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
582 tmplName = os.path.join(
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
583 getConfig('ericCodeTemplatesDir'),
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
584 "impl_pyside2.py2.tmpl")
2741
d0d7836d0c01 Added PyQt5 support to the project resources and translations viewers and the code creation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2737
diff changeset
585 elif self.project.getProjectType() == "PyQt5":
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
586 tmplName = os.path.join(
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
587 getConfig('ericCodeTemplatesDir'),
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
588 "impl_pyqt5.py2.tmpl")
1139
b18376d58832 Added dialog support for PySide.
detlev@die-offenbachs.de
parents: 1137
diff changeset
589 else:
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
590 tmplName = os.path.join(
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
591 getConfig('ericCodeTemplatesDir'),
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
592 "impl_pyqt.py2.tmpl")
1139
b18376d58832 Added dialog support for PySide.
detlev@die-offenbachs.de
parents: 1137
diff changeset
593 else:
1862
b1498278335f Added dialog code generation capability for PySide and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1844
diff changeset
594 if self.project.getProjectType() == "PySide":
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
595 tmplName = os.path.join(
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
596 getConfig('ericCodeTemplatesDir'),
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
597 "impl_pyside.py.tmpl")
6291
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
598 elif self.project.getProjectType() == "PySide2":
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
599 tmplName = os.path.join(
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
600 getConfig('ericCodeTemplatesDir'),
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
601 "impl_pyside2.py.tmpl")
3858
4f4684967fee Fixed a few little issues in eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3670
diff changeset
602 elif self.project.getProjectType() in [
4f4684967fee Fixed a few little issues in eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3670
diff changeset
603 "PyQt5", "E6Plugin"]:
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
604 tmplName = os.path.join(
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
605 getConfig('ericCodeTemplatesDir'),
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
606 "impl_pyqt5.py.tmpl")
1862
b1498278335f Added dialog code generation capability for PySide and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1844
diff changeset
607 else:
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
608 tmplName = os.path.join(
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
609 getConfig('ericCodeTemplatesDir'),
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
610 "impl_pyqt.py.tmpl")
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
611 tmplFile = open(tmplName, 'r', encoding="utf-8")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
612 template = tmplFile.read()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
613 tmplFile.close()
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
614 except IOError as why:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2995
diff changeset
615 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2995
diff changeset
616 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
617 self.tr("Code Generation"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
618 self.tr(
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
619 """<p>Could not open the code template file"""
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3030
diff changeset
620 """ "{0}".</p><p>Reason: {1}</p>""")
3038
7fe9a53280bd Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
621 .format(tmplName, str(why)))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
622 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
623
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
624 objName = self.__objectName()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
625 if objName:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
626 template = template\
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
627 .replace(
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
628 "$FORMFILE$",
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
629 os.path.splitext(os.path.basename(self.formFile))[0])\
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
630 .replace("$FORMCLASS$", objName)\
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
631 .replace("$CLASSNAME$", self.classNameCombo.currentText())\
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
632 .replace("$SUPERCLASS$", self.__className())
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
633
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
634 sourceImpl = template.splitlines(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
635 appendAtIndex = -1
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
636
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
637 # determine indent string
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
638 for line in sourceImpl:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
639 if line.lstrip().startswith("def __init__"):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
640 indentStr = line.replace(line.lstrip(), "")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
641 break
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
642 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
643 # extend existing file
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
644 try:
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
645 srcFile = open(self.srcFile, 'r', encoding="utf-8")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
646 sourceImpl = srcFile.readlines()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
647 srcFile.close()
245
de5c4effc747 Fixed some issues related to Python's universal newline support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 124
diff changeset
648 if not sourceImpl[-1].endswith("\n"):
427
6af5d12cfecb Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
649 sourceImpl[-1] = "{0}{1}".format(sourceImpl[-1], "\n")
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
650 except IOError as why:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2995
diff changeset
651 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2995
diff changeset
652 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
653 self.tr("Code Generation"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
654 self.tr(
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
655 """<p>Could not open the source file "{0}".</p>"""
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3030
diff changeset
656 """<p>Reason: {1}</p>""")
3038
7fe9a53280bd Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
657 .format(self.srcFile, str(why)))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
658 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
659
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
660 cls = self.__module.classes[self.classNameCombo.currentText()]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
661 if cls.endlineno == len(sourceImpl) or cls.endlineno == -1:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
662 appendAtIndex = -1
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
663 # delete empty lines at end
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
664 while not sourceImpl[-1].strip():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
665 del sourceImpl[-1]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
666 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
667 appendAtIndex = cls.endlineno - 1
1132
f8275b31dbe5 Fixed the dialog code creation code to respect PEP-8 rules.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
668 while not sourceImpl[appendAtIndex].strip():
f8275b31dbe5 Fixed the dialog code creation code to respect PEP-8 rules.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
669 appendAtIndex -= 1
f8275b31dbe5 Fixed the dialog code creation code to respect PEP-8 rules.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
670 appendAtIndex += 1
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
671
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
672 # determine indent string
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
673 for line in sourceImpl[cls.lineno:cls.endlineno + 1]:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
674 if line.lstrip().startswith("def __init__"):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
675 indentStr = line.replace(line.lstrip(), "")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
676 break
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
677
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
678 # do the coding stuff
1139
b18376d58832 Added dialog support for PySide.
detlev@die-offenbachs.de
parents: 1137
diff changeset
679 if self.project.getProjectLanguage() == "Python2":
6291
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
680 if self.project.getProjectType() in ("PySide", "PySide2"):
1139
b18376d58832 Added dialog support for PySide.
detlev@die-offenbachs.de
parents: 1137
diff changeset
681 pyqtSignatureFormat = '@Slot({0})'
2741
d0d7836d0c01 Added PyQt5 support to the project resources and translations viewers and the code creation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2737
diff changeset
682 elif self.project.getProjectType() == "PyQt5":
d0d7836d0c01 Added PyQt5 support to the project resources and translations viewers and the code creation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2737
diff changeset
683 pyqtSignatureFormat = '@pyqtSlot({0})'
1139
b18376d58832 Added dialog support for PySide.
detlev@die-offenbachs.de
parents: 1137
diff changeset
684 else:
b18376d58832 Added dialog support for PySide.
detlev@die-offenbachs.de
parents: 1137
diff changeset
685 pyqtSignatureFormat = '@pyqtSignature("{0}")'
b18376d58832 Added dialog support for PySide.
detlev@die-offenbachs.de
parents: 1137
diff changeset
686 else:
6291
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
687 if self.project.getProjectType() in ("PySide", "PySide2"):
1862
b1498278335f Added dialog code generation capability for PySide and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1844
diff changeset
688 pyqtSignatureFormat = '@Slot({0})'
b1498278335f Added dialog code generation capability for PySide and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1844
diff changeset
689 else:
b1498278335f Added dialog code generation capability for PySide and Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1844
diff changeset
690 pyqtSignatureFormat = '@pyqtSlot({0})'
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
691 for row in range(self.slotsModel.rowCount()):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
692 topItem = self.slotsModel.item(row)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
693 for childRow in range(topItem.rowCount()):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
694 child = topItem.child(childRow)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
695 if child.checkState() and \
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
696 child.flags() & Qt.ItemFlags(Qt.ItemIsUserCheckable):
427
6af5d12cfecb Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
697 slotsCode.append('{0}\n'.format(indentStr))
1139
b18376d58832 Added dialog support for PySide.
detlev@die-offenbachs.de
parents: 1137
diff changeset
698 slotsCode.append('{0}{1}\n'.format(
1148
ddc482ded355 Corrected a PEP-8 related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1139
diff changeset
699 indentStr,
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
700 pyqtSignatureFormat.format(
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
701 child.data(pyqtSignatureRole))))
427
6af5d12cfecb Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
702 slotsCode.append('{0}def {1}:\n'.format(
6af5d12cfecb Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
703 indentStr, child.data(pythonSignatureRole)))
4485
28743e3251ce Improved the dialog code generation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4332
diff changeset
704 indentStr2 = indentStr * 2
28743e3251ce Improved the dialog code generation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4332
diff changeset
705 slotsCode.append('{0}"""\n'.format(indentStr2))
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
706 slotsCode.append(
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
707 '{0}Slot documentation goes here.\n'.format(
4485
28743e3251ce Improved the dialog code generation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4332
diff changeset
708 indentStr2))
28743e3251ce Improved the dialog code generation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4332
diff changeset
709 if child.data(returnTypeRole) or \
28743e3251ce Improved the dialog code generation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4332
diff changeset
710 child.data(parameterTypesListRole):
28743e3251ce Improved the dialog code generation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4332
diff changeset
711 slotsCode.append('{0}\n'.format(indentStr2))
28743e3251ce Improved the dialog code generation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4332
diff changeset
712 if child.data(parameterTypesListRole):
28743e3251ce Improved the dialog code generation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4332
diff changeset
713 for name, type_ in zip(
28743e3251ce Improved the dialog code generation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4332
diff changeset
714 child.data(parameterNamesListRole),
28743e3251ce Improved the dialog code generation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4332
diff changeset
715 child.data(parameterTypesListRole)):
28743e3251ce Improved the dialog code generation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4332
diff changeset
716 slotsCode.append(
28743e3251ce Improved the dialog code generation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4332
diff changeset
717 '{0}@param {1} DESCRIPTION\n'.format(
28743e3251ce Improved the dialog code generation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4332
diff changeset
718 indentStr2, name))
28743e3251ce Improved the dialog code generation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4332
diff changeset
719 slotsCode.append('{0}@type {1}\n'.format(
28743e3251ce Improved the dialog code generation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4332
diff changeset
720 indentStr2, type_))
28743e3251ce Improved the dialog code generation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4332
diff changeset
721 if child.data(returnTypeRole):
28743e3251ce Improved the dialog code generation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4332
diff changeset
722 slotsCode.append(
28743e3251ce Improved the dialog code generation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4332
diff changeset
723 '{0}@returns DESCRIPTION\n'.format(
28743e3251ce Improved the dialog code generation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4332
diff changeset
724 indentStr2))
28743e3251ce Improved the dialog code generation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4332
diff changeset
725 slotsCode.append('{0}@rtype {1}\n'.format(
28743e3251ce Improved the dialog code generation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4332
diff changeset
726 indentStr2, child.data(returnTypeRole)))
28743e3251ce Improved the dialog code generation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4332
diff changeset
727 slotsCode.append('{0}"""\n'.format(indentStr2))
427
6af5d12cfecb Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
728 slotsCode.append('{0}# {1}: not implemented yet\n'.format(
4485
28743e3251ce Improved the dialog code generation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4332
diff changeset
729 indentStr2, "TODO"))
427
6af5d12cfecb Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
730 slotsCode.append('{0}raise NotImplementedError\n'.format(
4485
28743e3251ce Improved the dialog code generation dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4332
diff changeset
731 indentStr2))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
732
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
733 if appendAtIndex == -1:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
734 sourceImpl.extend(slotsCode)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
735 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
736 sourceImpl[appendAtIndex:appendAtIndex] = slotsCode
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
737
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
738 # write the new code
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
739 try:
253
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 245
diff changeset
740 if self.project.useSystemEol():
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 245
diff changeset
741 newline = None
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 245
diff changeset
742 else:
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 245
diff changeset
743 newline = self.project.getEolString()
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
744 srcFile = open(self.filenameEdit.text(), 'w', encoding="utf-8",
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
745 newline=newline)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
746 srcFile.write("".join(sourceImpl))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
747 srcFile.close()
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
748 except IOError as why:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2995
diff changeset
749 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2995
diff changeset
750 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
751 self.tr("Code Generation"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
752 self.tr("""<p>Could not write the source file "{0}".</p>"""
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
753 """<p>Reason: {1}</p>""")
3038
7fe9a53280bd Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
754 .format(self.filenameEdit.text(), str(why)))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
755 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
756
6
52e8c820d0dd Removed some superfluous unicode() calls.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
757 self.project.appendFile(self.filenameEdit.text())
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
758
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
759 @pyqtSlot(int)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
760 def on_classNameCombo_activated(self, index):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
761 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
762 Private slot to handle the activated signal of the classname combo.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
763
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
764 @param index index of the activated item (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
765 """
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3030
diff changeset
766 if (self.classNameCombo.currentText() ==
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
767 CreateDialogCodeDialog.Separator):
1869
3e34d5c362d9 Enhanced the dialog code generation dialog by presenting classes not directly derived from QWidget, QDialog, QMainWindow or QWizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1862
diff changeset
768 self.okButton.setEnabled(False)
3e34d5c362d9 Enhanced the dialog code generation dialog by presenting classes not directly derived from QWidget, QDialog, QMainWindow or QWizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1862
diff changeset
769 self.filterEdit.clear()
3e34d5c362d9 Enhanced the dialog code generation dialog by presenting classes not directly derived from QWidget, QDialog, QMainWindow or QWizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1862
diff changeset
770 self.slotsModel.clear()
3e34d5c362d9 Enhanced the dialog code generation dialog by presenting classes not directly derived from QWidget, QDialog, QMainWindow or QWizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1862
diff changeset
771 self.slotsModel.setHorizontalHeaderLabels([""])
3e34d5c362d9 Enhanced the dialog code generation dialog by presenting classes not directly derived from QWidget, QDialog, QMainWindow or QWizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1862
diff changeset
772 else:
3e34d5c362d9 Enhanced the dialog code generation dialog by presenting classes not directly derived from QWidget, QDialog, QMainWindow or QWizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1862
diff changeset
773 self.okButton.setEnabled(True)
3e34d5c362d9 Enhanced the dialog code generation dialog by presenting classes not directly derived from QWidget, QDialog, QMainWindow or QWizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1862
diff changeset
774 self.__updateSlotsModel()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
775
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
776 def on_filterEdit_textChanged(self, text):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
777 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
778 Private slot called, when thext of the filter edit has changed.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
779
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
780 @param text changed text (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
781 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
782 re = QRegExp(text, Qt.CaseInsensitive, QRegExp.RegExp2)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
783 self.proxyModel.setFilterRegExp(re)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
784
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
785 @pyqtSlot()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
786 def on_newButton_clicked(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
787 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
788 Private slot called to enter the data for a new dialog class.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
789 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
790 path, file = os.path.split(self.srcFile)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
791 objName = self.__objectName()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
792 if objName:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
793 dlg = NewDialogClassDialog(objName, file, path, self)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
794 if dlg.exec_() == QDialog.Accepted:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
795 className, fileName = dlg.getData()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
796
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
797 self.classNameCombo.clear()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
798 self.classNameCombo.addItem(className)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
799 self.srcFile = fileName
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
800 self.filenameEdit.setText(self.srcFile)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
801 self.__module = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
802
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
803 self.okButton.setEnabled(self.classNameCombo.count() > 0)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
804
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
805 def on_buttonBox_clicked(self, button):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
806 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
807 Private slot to handle the buttonBox clicked signal.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
808
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
809 @param button reference to the button that was clicked
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2741
diff changeset
810 (QAbstractButton)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
811 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
812 if button == self.okButton:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
813 self.__generateCode()
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
814 self.accept()

eric ide

mercurial