Sun, 04 Dec 2022 14:20:53 +0100
Changed the communication with the generator client in CreateDialogCodeDialog.py to use sys.stderr and surround the data with a guard string (see issue462).
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 | |
8881
54e42bc2437a
Updated copyright for 2022.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8551
diff
changeset
|
3 | # Copyright (c) 2011 - 2022 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 | |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9278
diff
changeset
|
10 | import contextlib |
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 json |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9278
diff
changeset
|
12 | import sys |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
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 | |
9560
abffba70297f
Changed the communication with the generator client in CreateDialogCodeDialog.py to use sys.stderr and surround the data with a guard string (see issue462).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
15 | |
abffba70297f
Changed the communication with the generator client in CreateDialogCodeDialog.py to use sys.stderr and surround the data with a guard string (see issue462).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
16 | def _printout(dataString): |
abffba70297f
Changed the communication with the generator client in CreateDialogCodeDialog.py to use sys.stderr and surround the data with a guard string (see issue462).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
17 | """ |
abffba70297f
Changed the communication with the generator client in CreateDialogCodeDialog.py to use sys.stderr and surround the data with a guard string (see issue462).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
18 | Function to print the given string to sys.stdout with a guard string. |
abffba70297f
Changed the communication with the generator client in CreateDialogCodeDialog.py to use sys.stderr and surround the data with a guard string (see issue462).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
19 | |
abffba70297f
Changed the communication with the generator client in CreateDialogCodeDialog.py to use sys.stderr and surround the data with a guard string (see issue462).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
20 | @param dataString string to be printed |
abffba70297f
Changed the communication with the generator client in CreateDialogCodeDialog.py to use sys.stderr and surround the data with a guard string (see issue462).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
21 | @type str |
abffba70297f
Changed the communication with the generator client in CreateDialogCodeDialog.py to use sys.stderr and surround the data with a guard string (see issue462).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
22 | """ |
abffba70297f
Changed the communication with the generator client in CreateDialogCodeDialog.py to use sys.stderr and surround the data with a guard string (see issue462).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
23 | print("@@eric_start@@{0}@@eric_end@@".format(dataString), file=sys.stderr) |
abffba70297f
Changed the communication with the generator client in CreateDialogCodeDialog.py to use sys.stderr and surround the data with a guard string (see issue462).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
24 | |
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
|
25 | try: |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9278
diff
changeset
|
26 | from PyQt5 import uic |
9017
ab708b168534
Fixed some issues in the UI loaders.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
27 | from PyQt5.QtCore import QByteArray, QMetaMethod |
ab708b168534
Fixed some issues in the UI loaders.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
28 | from PyQt5.QtWidgets import QAction, QApplication, QWidget |
ab708b168534
Fixed some issues in the UI loaders.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
29 | except ModuleNotFoundError: |
9560
abffba70297f
Changed the communication with the generator client in CreateDialogCodeDialog.py to use sys.stderr and surround the data with a guard string (see issue462).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
30 | _printout("PyQt5 could not be found.") |
7198
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7192
diff
changeset
|
31 | sys.exit(1) |
9017
ab708b168534
Fixed some issues in the UI loaders.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
32 | except ImportError as err: |
9560
abffba70297f
Changed the communication with the generator client in CreateDialogCodeDialog.py to use sys.stderr and surround the data with a guard string (see issue462).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
33 | _printout("PyQt5 could not be imported. Issue: {0}".format(str(err))) |
9017
ab708b168534
Fixed some issues in the UI loaders.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
34 | 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
|
35 | |
8240
93b8a353c4bf
Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
36 | with contextlib.suppress(ImportError): |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
37 | from PyQt5 import QtWebEngineWidgets # __IGNORE_WARNING__ |
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
|
38 | |
7842
8fd1bd39e633
Fixed a code style issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7834
diff
changeset
|
39 | |
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
|
40 | 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
|
41 | """ |
77c817301ca1
CreateDialogCodeDialog: third attempt on 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 | Function to get the object name of a form. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
43 | |
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
|
44 | @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
|
45 | @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
|
46 | @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
|
47 | @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
|
48 | """ |
9017
ab708b168534
Fixed some issues in the UI loaders.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
49 | sys.path.append(projectPath) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
50 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
51 | app = QApplication([]) # __IGNORE_WARNING__ |
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
|
52 | 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
|
53 | dlg = uic.loadUi(formFile, package=projectPath) |
9560
abffba70297f
Changed the communication with the generator client in CreateDialogCodeDialog.py to use sys.stderr and surround the data with a guard string (see issue462).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
54 | _printout(dlg.objectName()) |
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
|
55 | sys.exit(0) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
56 | except (AttributeError, ImportError, xml.etree.ElementTree.ParseError) as err: |
9560
abffba70297f
Changed the communication with the generator client in CreateDialogCodeDialog.py to use sys.stderr and surround the data with a guard string (see issue462).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
57 | _printout(str(err)) |
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
|
58 | 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
|
59 | |
77c817301ca1
CreateDialogCodeDialog: third attempt on 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 | 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
|
62 | """ |
77c817301ca1
CreateDialogCodeDialog: third attempt on 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 | Function to get the class name of a form. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
64 | |
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
|
65 | @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
|
66 | @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
|
67 | @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
|
68 | @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
|
69 | """ |
9017
ab708b168534
Fixed some issues in the UI loaders.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
70 | sys.path.append(projectPath) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
71 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
72 | app = QApplication([]) # __IGNORE_WARNING__ |
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
|
73 | 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
|
74 | dlg = uic.loadUi(formFile, package=projectPath) |
9560
abffba70297f
Changed the communication with the generator client in CreateDialogCodeDialog.py to use sys.stderr and surround the data with a guard string (see issue462).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
75 | _printout(dlg.metaObject().className()) |
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
|
76 | sys.exit(0) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
77 | except (AttributeError, ImportError, xml.etree.ElementTree.ParseError) as err: |
9560
abffba70297f
Changed the communication with the generator client in CreateDialogCodeDialog.py to use sys.stderr and surround the data with a guard string (see issue462).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
78 | _printout(str(err)) |
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
|
79 | 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
|
80 | |
77c817301ca1
CreateDialogCodeDialog: third attempt on 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 | 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
|
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 | 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
|
85 | correct Python type. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
86 | |
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
|
87 | @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
|
88 | @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
|
89 | @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
|
90 | @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
|
91 | """ |
77c817301ca1
CreateDialogCodeDialog: third attempt on 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
|
92 | mapped = bytes(type_).decode() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
93 | |
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
|
94 | # 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
|
95 | mapped = mapped.replace("*", "") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
96 | |
7198
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7192
diff
changeset
|
97 | # 1. check for const |
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7192
diff
changeset
|
98 | mapped = mapped.replace("const ", "") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
99 | |
7198
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7192
diff
changeset
|
100 | # 2. replace QString and QStringList |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
101 | mapped = mapped.replace("QStringList", "list").replace("QString", "str") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
102 | |
7198
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7192
diff
changeset
|
103 | # 3. replace double by float |
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7192
diff
changeset
|
104 | mapped = mapped.replace("double", "float") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
105 | |
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
|
106 | 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
|
107 | |
77c817301ca1
CreateDialogCodeDialog: third attempt on 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 | |
77c817301ca1
CreateDialogCodeDialog: third attempt on 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 | 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
|
110 | """ |
77c817301ca1
CreateDialogCodeDialog: third attempt on 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 | Function to get the signatures of form elements. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
112 | |
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
|
113 | @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
|
114 | @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
|
115 | @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
|
116 | @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
|
117 | """ |
9017
ab708b168534
Fixed some issues in the UI loaders.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
118 | sys.path.append(projectPath) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
119 | |
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
|
120 | objectsList = [] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
121 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
122 | app = QApplication([]) # __IGNORE_WARNING__ |
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
|
123 | 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
|
124 | 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
|
125 | 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
|
126 | 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
|
127 | 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
|
128 | 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
|
129 | # 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
|
130 | continue |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
131 | |
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
|
132 | 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
|
133 | 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
|
134 | "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
|
135 | "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
|
136 | "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
|
137 | } |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
138 | |
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
|
139 | 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
|
140 | metaMethod = metaObject.method(index) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
141 | if metaMethod.methodType() == QMetaMethod.MethodType.Signal: |
9278
36448ca469c2
Simplified some code iaw. recommendations of the extended style checker and reformatted the code with black.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
142 | signatureDict = { |
36448ca469c2
Simplified some code iaw. recommendations of the extended style checker and reformatted the code with black.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
143 | "signature": "on_{0}_{1}".format( |
36448ca469c2
Simplified some code iaw. recommendations of the extended style checker and reformatted the code with black.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
144 | name, bytes(metaMethod.methodSignature()).decode() |
36448ca469c2
Simplified some code iaw. recommendations of the extended style checker and reformatted the code with black.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
145 | ), |
36448ca469c2
Simplified some code iaw. recommendations of the extended style checker and reformatted the code with black.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
146 | "methods": [ |
36448ca469c2
Simplified some code iaw. recommendations of the extended style checker and reformatted the code with black.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
147 | "on_{0}_{1}".format( |
36448ca469c2
Simplified some code iaw. recommendations of the extended style checker and reformatted the code with black.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
148 | name, |
36448ca469c2
Simplified some code iaw. recommendations of the extended style checker and reformatted the code with black.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
149 | bytes(metaMethod.methodSignature()) |
36448ca469c2
Simplified some code iaw. recommendations of the extended style checker and reformatted the code with black.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
150 | .decode() |
36448ca469c2
Simplified some code iaw. recommendations of the extended style checker and reformatted the code with black.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
151 | .split("(")[0], |
36448ca469c2
Simplified some code iaw. recommendations of the extended style checker and reformatted the code with black.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
152 | ), |
36448ca469c2
Simplified some code iaw. recommendations of the extended style checker and reformatted the code with black.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
153 | ], |
36448ca469c2
Simplified some code iaw. recommendations of the extended style checker and reformatted the code with black.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
154 | } |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
155 | signatureDict["methods"].append( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
156 | "{0}({1})".format( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
157 | signatureDict["methods"][-1], |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
158 | ", ".join( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
159 | [__mapType(t) for t in metaMethod.parameterTypes()] |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
160 | ), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
161 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
162 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
163 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
164 | returnType = __mapType(metaMethod.typeName().encode()) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
165 | if returnType == "void": |
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
|
166 | 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
|
167 | 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
|
168 | parameterTypesList = [ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
169 | __mapType(t) for t in metaMethod.parameterTypes() |
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
|
170 | ] |
77c817301ca1
CreateDialogCodeDialog: third attempt on 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 | 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
|
172 | 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
|
173 | signatureDict["pyqt_signature"] = pyqtSignature |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
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 | 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
|
176 | 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
|
177 | 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
|
178 | if not parameterNames[index]: |
7265
0665c4d509c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
179 | parameterNames[index] = QByteArray( |
0665c4d509c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
180 | "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
|
181 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
182 | parameterNamesList = [bytes(n).decode() for n in parameterNames] |
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
|
183 | 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
|
184 | methNamesSig = ", ".join(parameterNamesList) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
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:
diff
changeset
|
186 | if methNamesSig: |
7265
0665c4d509c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
187 | 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
|
188 | name, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
189 | bytes(metaMethod.methodSignature()).decode().split("(")[0], |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
190 | methNamesSig, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
191 | ) |
7198
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7192
diff
changeset
|
192 | else: |
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7192
diff
changeset
|
193 | pythonSignature = "on_{0}_{1}(self)".format( |
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7192
diff
changeset
|
194 | name, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
195 | bytes(metaMethod.methodSignature()).decode().split("(")[0], |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
196 | ) |
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
|
197 | signatureDict["python_signature"] = pythonSignature |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
198 | |
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
|
199 | objectDict["methods"].append(signatureDict) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
200 | |
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
|
201 | objectsList.append(objectDict) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
202 | |
9560
abffba70297f
Changed the communication with the generator client in CreateDialogCodeDialog.py to use sys.stderr and surround the data with a guard string (see issue462).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
203 | _printout(json.dumps(objectsList)) |
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
|
204 | sys.exit(0) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
205 | except (AttributeError, ImportError, xml.etree.ElementTree.ParseError) as err: |
9560
abffba70297f
Changed the communication with the generator client in CreateDialogCodeDialog.py to use sys.stderr and surround the data with a guard string (see issue462).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
206 | _printout(str(err)) |
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
|
207 | 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
|
208 | |
77c817301ca1
CreateDialogCodeDialog: third attempt on 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 __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
|
211 | if len(sys.argv) != 4: |
9560
abffba70297f
Changed the communication with the generator client in CreateDialogCodeDialog.py to use sys.stderr and surround the data with a guard string (see issue462).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
212 | _printout("Wrong number of arguments.") |
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
|
213 | sys.exit(1) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
214 | |
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
|
215 | 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
|
216 | 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
|
217 | 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
|
218 | 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
|
219 | 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
|
220 | 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
|
221 | else: |
9560
abffba70297f
Changed the communication with the generator client in CreateDialogCodeDialog.py to use sys.stderr and surround the data with a guard string (see issue462).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
222 | _printout("Unknow operation given.") |
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
|
223 | sys.exit(1) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
224 | |
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
|
225 | # |
77c817301ca1
CreateDialogCodeDialog: third attempt on 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
|
226 | # eflag: noqa = M701, M801 |