Wed, 30 Dec 2020 11:00:44 +0100
Updated copyright for 2021.
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:
diff
changeset
|
1 | # -*- coding: 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:
diff
changeset
|
2 | |
7924
8a96736d465e
Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7842
diff
changeset
|
3 | # Copyright (c) 2011 - 2021 Detlev Offenbach <detlev@die-offenbachs.de> |
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:
diff
changeset
|
4 | # |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
5 | |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
6 | """ |
7229
53054eb5b15a
Removed obsolete "from __future__ import ..." statements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7198
diff
changeset
|
7 | Module to get the object name, class name or signatures of a Qt form (*.ui). |
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:
diff
changeset
|
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:
diff
changeset
|
9 | |
7834
6ffe1fe2ab4a
UicLoadUi: added code to add the eric package directory so eric plug-in development can access the eric specific GUI extensions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7628
diff
changeset
|
10 | 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:
diff
changeset
|
11 | import sys |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
12 | import json |
7628
f904d0eef264
Checked the reported security related issue reports generated by the new security checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
13 | import xml.etree.ElementTree # secok |
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:
diff
changeset
|
14 | |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
15 | try: |
7198
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7192
diff
changeset
|
16 | from PyQt5.QtCore import QMetaMethod, QByteArray |
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:
diff
changeset
|
17 | from PyQt5.QtWidgets import QAction, QWidget, QApplication |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
18 | from PyQt5 import uic |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
19 | except ImportError: |
7198
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7192
diff
changeset
|
20 | print("PyQt5 could not be found.") |
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7192
diff
changeset
|
21 | sys.exit(1) |
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:
diff
changeset
|
22 | |
7357
fe4e06357f54
UicLoadUi: fixed an issue causing the code generation to fail for forms containing QtWebEngine widgets (see issue313)
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7266
diff
changeset
|
23 | try: |
fe4e06357f54
UicLoadUi: fixed an issue causing the code generation to fail for forms containing QtWebEngine widgets (see issue313)
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7266
diff
changeset
|
24 | from PyQt5 import QtWebEngineWidgets # __IGNORE_WARNING__ |
fe4e06357f54
UicLoadUi: fixed an issue causing the code generation to fail for forms containing QtWebEngine widgets (see issue313)
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7266
diff
changeset
|
25 | except ImportError: |
fe4e06357f54
UicLoadUi: fixed an issue causing the code generation to fail for forms containing QtWebEngine widgets (see issue313)
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7266
diff
changeset
|
26 | pass |
fe4e06357f54
UicLoadUi: fixed an issue causing the code generation to fail for forms containing QtWebEngine widgets (see issue313)
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7266
diff
changeset
|
27 | |
7834
6ffe1fe2ab4a
UicLoadUi: added code to add the eric package directory so eric plug-in development can access the eric specific GUI extensions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7628
diff
changeset
|
28 | sys.path.append(os.path.dirname(os.path.dirname(__file__))) |
6ffe1fe2ab4a
UicLoadUi: added code to add the eric package directory so eric plug-in development can access the eric specific GUI extensions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7628
diff
changeset
|
29 | # add the eric package directory |
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:
diff
changeset
|
30 | |
7842
8fd1bd39e633
Fixed a code style issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7834
diff
changeset
|
31 | |
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:
diff
changeset
|
32 | def objectName(formFile, projectPath): |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
33 | """ |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
34 | Function to get the object name of a form. |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
35 | |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
36 | @param formFile file name of the form |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
37 | @type 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:
diff
changeset
|
38 | @param projectPath directory name of the project |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
39 | @type 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:
diff
changeset
|
40 | """ |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
41 | app = QApplication([]) # __IGNORE_WARNING__ |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
42 | 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:
diff
changeset
|
43 | dlg = uic.loadUi(formFile, package=projectPath) |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
44 | print(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:
diff
changeset
|
45 | sys.exit(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:
diff
changeset
|
46 | 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:
diff
changeset
|
47 | 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:
diff
changeset
|
48 | print(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:
diff
changeset
|
49 | sys.exit(1) |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
50 | |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
51 | |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
52 | def className(formFile, projectPath): |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
53 | """ |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
54 | Function to get the class name of a form. |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
55 | |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
56 | @param formFile file name of the form |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
57 | @type 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:
diff
changeset
|
58 | @param projectPath directory name of the project |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
59 | @type 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:
diff
changeset
|
60 | """ |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
61 | app = QApplication([]) # __IGNORE_WARNING__ |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
62 | 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:
diff
changeset
|
63 | dlg = uic.loadUi(formFile, package=projectPath) |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
64 | print(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:
diff
changeset
|
65 | sys.exit(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:
diff
changeset
|
66 | 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:
diff
changeset
|
67 | 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:
diff
changeset
|
68 | print(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:
diff
changeset
|
69 | sys.exit(1) |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
70 | |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
71 | |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
72 | def __mapType(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:
diff
changeset
|
73 | """ |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
74 | Private function to map a type as reported by Qt's meta object to the |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
75 | correct Python 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:
diff
changeset
|
76 | |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
77 | @param type_ type as reported by 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:
diff
changeset
|
78 | @type QByteArray or bytes |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
79 | @return mapped Python 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:
diff
changeset
|
80 | @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:
diff
changeset
|
81 | """ |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
82 | mapped = bytes(type_).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:
diff
changeset
|
83 | |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
84 | # 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:
diff
changeset
|
85 | 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:
diff
changeset
|
86 | |
7198
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7192
diff
changeset
|
87 | # 1. check for const |
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7192
diff
changeset
|
88 | mapped = mapped.replace("const ", "") |
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7192
diff
changeset
|
89 | |
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7192
diff
changeset
|
90 | # 2. replace QString and QStringList |
7265
0665c4d509c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
91 | mapped = ( |
0665c4d509c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
92 | mapped |
7266
d001bc703c29
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7265
diff
changeset
|
93 | .replace("QStringList", "list") |
7265
0665c4d509c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
94 | .replace("QString", "str") |
0665c4d509c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
95 | ) |
7198
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7192
diff
changeset
|
96 | |
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7192
diff
changeset
|
97 | # 3. replace double by float |
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7192
diff
changeset
|
98 | mapped = mapped.replace("double", "float") |
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:
diff
changeset
|
99 | |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
100 | return mapped |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
101 | |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
102 | |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
103 | def signatures(formFile, projectPath): |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
104 | """ |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
105 | Function to get the signatures of form elements. |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
106 | |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
107 | @param formFile file name of the form |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
108 | @type 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:
diff
changeset
|
109 | @param projectPath directory name of the project |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
110 | @type 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:
diff
changeset
|
111 | """ |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
112 | 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:
diff
changeset
|
113 | |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
114 | app = QApplication([]) # __IGNORE_WARNING__ |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
115 | 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:
diff
changeset
|
116 | dlg = uic.loadUi(formFile, package=projectPath) |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
117 | 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:
diff
changeset
|
118 | 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:
diff
changeset
|
119 | 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:
diff
changeset
|
120 | 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:
diff
changeset
|
121 | # 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:
diff
changeset
|
122 | 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:
diff
changeset
|
123 | |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
124 | 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:
diff
changeset
|
125 | objectDict = { |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
126 | "name": 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:
diff
changeset
|
127 | "class_name": 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:
diff
changeset
|
128 | "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:
diff
changeset
|
129 | } |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
130 | |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
131 | 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:
diff
changeset
|
132 | 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:
diff
changeset
|
133 | if metaMethod.methodType() == QMetaMethod.Signal: |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
134 | signatureDict = { |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
135 | "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:
diff
changeset
|
136 | } |
7198
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7192
diff
changeset
|
137 | signatureDict["signature"] = "on_{0}_{1}".format( |
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7192
diff
changeset
|
138 | name, |
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7192
diff
changeset
|
139 | bytes(metaMethod.methodSignature()).decode() |
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7192
diff
changeset
|
140 | ) |
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:
diff
changeset
|
141 | |
7198
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7192
diff
changeset
|
142 | signatureDict["methods"].append("on_{0}_{1}".format( |
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7192
diff
changeset
|
143 | name, |
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7192
diff
changeset
|
144 | bytes(metaMethod.methodSignature()) |
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7192
diff
changeset
|
145 | .decode().split("(")[0] |
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7192
diff
changeset
|
146 | )) |
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:
diff
changeset
|
147 | signatureDict["methods"].append("{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:
diff
changeset
|
148 | signatureDict["methods"][-1], |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
149 | ", ".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:
diff
changeset
|
150 | __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:
diff
changeset
|
151 | 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:
diff
changeset
|
152 | ]) |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
153 | )) |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
154 | |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
155 | returnType = __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:
diff
changeset
|
156 | 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:
diff
changeset
|
157 | 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:
diff
changeset
|
158 | 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:
diff
changeset
|
159 | signatureDict["return_type"] = 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:
diff
changeset
|
160 | 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:
diff
changeset
|
161 | __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:
diff
changeset
|
162 | 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:
diff
changeset
|
163 | ] |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
164 | signatureDict["parameter_types"] = 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:
diff
changeset
|
165 | 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:
diff
changeset
|
166 | signatureDict["pyqt_signature"] = pyqtSignature |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
167 | |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
168 | 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:
diff
changeset
|
169 | 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:
diff
changeset
|
170 | 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:
diff
changeset
|
171 | if not parameterNames[index]: |
7265
0665c4d509c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
172 | parameterNames[index] = QByteArray( |
0665c4d509c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
173 | "p{0:d}".format(index).encode("utf-8") |
0665c4d509c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
174 | ) |
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:
diff
changeset
|
175 | 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:
diff
changeset
|
176 | 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:
diff
changeset
|
177 | signatureDict["parameter_names"] = 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:
diff
changeset
|
178 | 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:
diff
changeset
|
179 | |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
180 | if methNamesSig: |
7265
0665c4d509c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
181 | pythonSignature = "on_{0}_{1}(self, {2})".format( |
0665c4d509c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
182 | name, |
0665c4d509c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
183 | bytes(metaMethod.methodSignature()) |
0665c4d509c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
184 | .decode().split("(")[0], |
0665c4d509c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
185 | methNamesSig) |
7198
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7192
diff
changeset
|
186 | else: |
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7192
diff
changeset
|
187 | pythonSignature = "on_{0}_{1}(self)".format( |
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7192
diff
changeset
|
188 | name, |
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7192
diff
changeset
|
189 | bytes(metaMethod.methodSignature()) |
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7192
diff
changeset
|
190 | .decode().split("(")[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:
diff
changeset
|
191 | signatureDict["python_signature"] = 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:
diff
changeset
|
192 | |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
193 | objectDict["methods"].append(signatureDict) |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
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:
diff
changeset
|
195 | objectsList.append(objectDict) |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
196 | |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
197 | print(json.dumps(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:
diff
changeset
|
198 | sys.exit(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:
diff
changeset
|
199 | 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:
diff
changeset
|
200 | 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:
diff
changeset
|
201 | print(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:
diff
changeset
|
202 | sys.exit(1) |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
203 | |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
204 | |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
205 | if __name__ == "__main__": |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
206 | if len(sys.argv) != 4: |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
207 | print("Wrong number of arguments.") |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
208 | sys.exit(1) |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
209 | |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
210 | if sys.argv[1] == "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:
diff
changeset
|
211 | objectName(sys.argv[2], sys.argv[3]) |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
212 | elif sys.argv[1] == "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:
diff
changeset
|
213 | className(sys.argv[2], sys.argv[3]) |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
214 | elif sys.argv[1] == "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:
diff
changeset
|
215 | signatures(sys.argv[2], sys.argv[3]) |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
216 | 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:
diff
changeset
|
217 | print("Unknow operation given.") |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
218 | sys.exit(1) |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
219 | |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
220 | # |
77c817301ca1
CreateDialogCodeDialog: third attempt on getting this working with projects using a virtual environment different from the one used to run eric.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
221 | # eflag: noqa = M701, M801 |