q2rad 0.1.141__tar.gz → 0.1.142__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of q2rad might be problematic. Click here for more details.
- {q2rad-0.1.141 → q2rad-0.1.142}/PKG-INFO +1 -1
- {q2rad-0.1.141 → q2rad-0.1.142}/pyproject.toml +1 -1
- {q2rad-0.1.141 → q2rad-0.1.142}/q2rad/q2forms.py +1 -1
- {q2rad-0.1.141 → q2rad-0.1.142}/q2rad/q2modules.py +1 -1
- {q2rad-0.1.141 → q2rad-0.1.142}/q2rad/q2rad.py +75 -60
- q2rad-0.1.142/q2rad/version.py +1 -0
- q2rad-0.1.141/q2rad/version.py +0 -1
- {q2rad-0.1.141 → q2rad-0.1.142}/LICENSE +0 -0
- {q2rad-0.1.141 → q2rad-0.1.142}/README.md +0 -0
- {q2rad-0.1.141 → q2rad-0.1.142}/q2rad/__init__.py +0 -0
- {q2rad-0.1.141 → q2rad-0.1.142}/q2rad/__main__.py +0 -0
- {q2rad-0.1.141 → q2rad-0.1.142}/q2rad/q2actions.py +0 -0
- {q2rad-0.1.141 → q2rad-0.1.142}/q2rad/q2appmanager.py +0 -0
- {q2rad-0.1.141 → q2rad-0.1.142}/q2rad/q2appselector.py +0 -0
- {q2rad-0.1.141 → q2rad-0.1.142}/q2rad/q2constants.py +0 -0
- {q2rad-0.1.141 → q2rad-0.1.142}/q2rad/q2lines.py +0 -0
- {q2rad-0.1.141 → q2rad-0.1.142}/q2rad/q2market.py +0 -0
- {q2rad-0.1.141 → q2rad-0.1.142}/q2rad/q2packages.py +0 -0
- {q2rad-0.1.141 → q2rad-0.1.142}/q2rad/q2queries.py +0 -0
- {q2rad-0.1.141 → q2rad-0.1.142}/q2rad/q2raddb.py +0 -0
- {q2rad-0.1.141 → q2rad-0.1.142}/q2rad/q2reports.py +0 -0
- {q2rad-0.1.141 → q2rad-0.1.142}/q2rad/q2stylesettings.py +0 -0
- {q2rad-0.1.141 → q2rad-0.1.142}/q2rad/q2utils.py +0 -0
|
@@ -161,7 +161,7 @@ class Q2Forms(Q2Form, Q2_save_and_run):
|
|
|
161
161
|
self.add_control("comment", gridlabel=_("Comments"), datatype="longtext")
|
|
162
162
|
|
|
163
163
|
if self.add_control("/t", _("Build")):
|
|
164
|
-
self.add_control("/vs")
|
|
164
|
+
self.add_control("/vs", tag="build")
|
|
165
165
|
self.add_control("/v")
|
|
166
166
|
self.add_control(
|
|
167
167
|
"before_form_build",
|
|
@@ -86,7 +86,7 @@ set_logging()
|
|
|
86
86
|
_logger = logging.getLogger(__name__)
|
|
87
87
|
|
|
88
88
|
|
|
89
|
-
def get_report(report_name):
|
|
89
|
+
def get_report(report_name=""):
|
|
90
90
|
if report_name == "":
|
|
91
91
|
return Q2RadReport()
|
|
92
92
|
content = q2app.q2_app.db_logic.get("reports", f"name='{report_name}'", "content")
|
|
@@ -101,24 +101,19 @@ def run_form(form_name, order="", where=""):
|
|
|
101
101
|
return q2app.q2_app.run_form(form_name, order=order, where=where)
|
|
102
102
|
|
|
103
103
|
|
|
104
|
-
def run_module1(module_name):
|
|
105
|
-
return q2app.q2_app.run_module(module_name)
|
|
106
|
-
|
|
107
|
-
|
|
108
104
|
def run_module(module_name=None, globals=globals(), locals=locals(), script="", import_only=False):
|
|
109
105
|
if module_name is not None:
|
|
110
106
|
script = q2app.q2_app.db_logic.get("modules", f"name = '{module_name}'", "script")
|
|
111
107
|
if not script:
|
|
112
108
|
return
|
|
113
109
|
code = q2app.q2_app.code_compiler(script)
|
|
114
|
-
|
|
115
110
|
if code["code"] is False:
|
|
116
|
-
|
|
111
|
+
msg = code["error"]
|
|
117
112
|
if threading.current_thread() is threading.main_thread():
|
|
118
|
-
q2Mess(f"
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
113
|
+
q2Mess(f"{msg}".replace("\n", "<br>").replace(" ", " "))
|
|
114
|
+
print(f"{msg}")
|
|
115
|
+
print("-" * 25)
|
|
116
|
+
logging.error(msg)
|
|
122
117
|
return
|
|
123
118
|
else:
|
|
124
119
|
if import_only:
|
|
@@ -144,26 +139,59 @@ def run_module(module_name=None, globals=globals(), locals=locals(), script="",
|
|
|
144
139
|
except ReturnEvent:
|
|
145
140
|
pass
|
|
146
141
|
except Exception:
|
|
147
|
-
|
|
148
|
-
vars = "<br>".join(
|
|
149
|
-
[
|
|
150
|
-
f"<b>{x}</b>:{str(locals[x])[:100]}"
|
|
151
|
-
for x in locals
|
|
152
|
-
if x not in ("RETURN", "ReturnEvent", "mem", "self", "q2_app")
|
|
153
|
-
]
|
|
154
|
-
)
|
|
155
|
-
if threading.current_thread() is threading.main_thread():
|
|
156
|
-
q2Mess(
|
|
157
|
-
f"""Runtime error:<br><br>{trace}<br><br>{vars}""".replace("\n", "<br>").replace(
|
|
158
|
-
" ", " "
|
|
159
|
-
)
|
|
160
|
-
)
|
|
161
|
-
else:
|
|
162
|
-
print(f"""Runtime error:\n{trace}\n\n{vars}""")
|
|
163
|
-
print("-" * 25)
|
|
142
|
+
explain_error()
|
|
164
143
|
return locals["RETURN"]
|
|
165
144
|
|
|
166
145
|
|
|
146
|
+
def explain_error(tb=None, errtype=None):
|
|
147
|
+
error = {}
|
|
148
|
+
stack = []
|
|
149
|
+
if tb is None:
|
|
150
|
+
tb = sys.exc_info()[2]
|
|
151
|
+
errtype = sys.exc_info()[1]
|
|
152
|
+
while tb.tb_next:
|
|
153
|
+
stack.append([tb.tb_frame.f_lineno, tb.tb_frame.f_code.co_filename])
|
|
154
|
+
tb = tb.tb_next
|
|
155
|
+
line_no = tb.tb_frame.f_lineno
|
|
156
|
+
script = tb.tb_frame.f_code.co_filename[1:-1].split("\n")
|
|
157
|
+
errline = script[line_no - 1]
|
|
158
|
+
script[line_no - 1] = "******" + script[line_no - 1]
|
|
159
|
+
|
|
160
|
+
error["errtype"] = errtype
|
|
161
|
+
error["lineno"] = tb.tb_frame.f_lineno
|
|
162
|
+
error["errline"] = errline
|
|
163
|
+
|
|
164
|
+
error["script"] = "\n".join(script)
|
|
165
|
+
error["locals"] = dict(tb.tb_frame.f_locals)
|
|
166
|
+
stack.reverse()
|
|
167
|
+
error["stack"] = stack
|
|
168
|
+
|
|
169
|
+
msg = []
|
|
170
|
+
msg.append("Runtime error:")
|
|
171
|
+
msg.append(str(error["errtype"]))
|
|
172
|
+
msg.append(f"Line:{error['lineno']}:{errline}")
|
|
173
|
+
msg.append("Code:")
|
|
174
|
+
msg.append("-" * 25)
|
|
175
|
+
msg.append(error["script"])
|
|
176
|
+
msg.append("-" * 25)
|
|
177
|
+
msg.append("Local variables:")
|
|
178
|
+
for x in error["locals"]:
|
|
179
|
+
if x in ("RETURN", "ReturnEvent", "mem", "self", "q2_app", "form", "myapp", "__name__"):
|
|
180
|
+
continue
|
|
181
|
+
value = str(error["locals"][x])[:100]
|
|
182
|
+
msg.append(f"{x}:{value}")
|
|
183
|
+
msg.append("-" * 25)
|
|
184
|
+
msg = "\n".join(msg)
|
|
185
|
+
|
|
186
|
+
print("-" * 25)
|
|
187
|
+
print(f"{msg}")
|
|
188
|
+
print("-" * 25)
|
|
189
|
+
logging.error(msg)
|
|
190
|
+
if threading.current_thread() is threading.main_thread():
|
|
191
|
+
q2Mess(f"""{msg}""".replace("\n", "<br>").replace(" ", " ").replace("\t", " " * 4))
|
|
192
|
+
return msg
|
|
193
|
+
|
|
194
|
+
|
|
167
195
|
class Q2RadApp(Q2App):
|
|
168
196
|
def __init__(self, title=""):
|
|
169
197
|
|
|
@@ -199,6 +227,11 @@ class Q2RadApp(Q2App):
|
|
|
199
227
|
|
|
200
228
|
self.const = const
|
|
201
229
|
|
|
230
|
+
sys.excepthook = self.handle_error
|
|
231
|
+
|
|
232
|
+
def handle_error(self, exc_type, exc_value, exc_traceback):
|
|
233
|
+
explain_error(exc_traceback, exc_value)
|
|
234
|
+
|
|
202
235
|
def clear_app_info(self):
|
|
203
236
|
self.app_url = None
|
|
204
237
|
self.app_title = ""
|
|
@@ -473,20 +506,6 @@ class Q2RadApp(Q2App):
|
|
|
473
506
|
about.append("<b>q2RAD</b>")
|
|
474
507
|
about.append("Versions:")
|
|
475
508
|
about.append(f"<b>Python</b>: {sys.version}<p>")
|
|
476
|
-
# w = Q2WaitShow(len(q2_modules))
|
|
477
|
-
# for package in q2_modules:
|
|
478
|
-
# w.step()
|
|
479
|
-
# latest_version, current_version = self.get_package_versions(package)
|
|
480
|
-
# if latest_version:
|
|
481
|
-
# if current_version != latest_version:
|
|
482
|
-
# latest_version_text = f"({latest_version })"
|
|
483
|
-
# else:
|
|
484
|
-
# latest_version_text = ""
|
|
485
|
-
# else:
|
|
486
|
-
# latest_version_text = _(" (Can't load packacke info)")
|
|
487
|
-
|
|
488
|
-
# about.append(f"<b>{package}</b>: {current_version}{latest_version_text}")
|
|
489
|
-
# w.close()
|
|
490
509
|
|
|
491
510
|
task = Q2Tasker("Checking packages version")
|
|
492
511
|
for package in q2_modules:
|
|
@@ -553,17 +572,6 @@ class Q2RadApp(Q2App):
|
|
|
553
572
|
if rez[x] is False:
|
|
554
573
|
errors.append(x)
|
|
555
574
|
|
|
556
|
-
# w = Q2WaitShow(len(icons))
|
|
557
|
-
# errors = []
|
|
558
|
-
# # q2Mess
|
|
559
|
-
# for x in icons:
|
|
560
|
-
# if x == "":
|
|
561
|
-
# continue
|
|
562
|
-
# w.step(x)
|
|
563
|
-
# if self.asset_file_loader(x) is False:
|
|
564
|
-
# errors.append(x)
|
|
565
|
-
# w.close()
|
|
566
|
-
|
|
567
575
|
if os.path.isfile("assets/q2gui.ico"):
|
|
568
576
|
shutil.copyfile("assets/q2gui.ico", "assets/q2rad.ico")
|
|
569
577
|
|
|
@@ -956,11 +964,8 @@ class Q2RadApp(Q2App):
|
|
|
956
964
|
|
|
957
965
|
return form
|
|
958
966
|
|
|
959
|
-
def code_error(self):
|
|
960
|
-
return traceback.format_exc()
|
|
961
|
-
|
|
962
967
|
def code_compiler(self, script):
|
|
963
|
-
if "return" in script or "?" in script:
|
|
968
|
+
if "return" in script or "?" in script or "import" in script:
|
|
964
969
|
# modify script for
|
|
965
970
|
new_script_lines = []
|
|
966
971
|
in_def = False
|
|
@@ -989,13 +994,23 @@ class Q2RadApp(Q2App):
|
|
|
989
994
|
new_script_lines.append(x)
|
|
990
995
|
script = "\n".join(new_script_lines)
|
|
991
996
|
try:
|
|
992
|
-
code = compile(script, "
|
|
997
|
+
code = compile(script, f"<{script}>", "exec")
|
|
993
998
|
return {"code": code, "error": ""}
|
|
994
999
|
except Exception:
|
|
995
|
-
|
|
1000
|
+
error = sys.exc_info()[1]
|
|
1001
|
+
msg = []
|
|
1002
|
+
msg.append("Compile error:")
|
|
1003
|
+
msg.append(error.msg)
|
|
1004
|
+
msg.append(f"Line:{error.lineno}:{error.text}")
|
|
1005
|
+
msg.append("Code:")
|
|
1006
|
+
msg.append("-" * 25)
|
|
1007
|
+
msg.append(error.filename[1:-1])
|
|
1008
|
+
msg.append("-" * 25)
|
|
1009
|
+
msg = "\n".join(msg)
|
|
1010
|
+
|
|
996
1011
|
return {
|
|
997
1012
|
"code": False,
|
|
998
|
-
"error":
|
|
1013
|
+
"error": msg,
|
|
999
1014
|
}
|
|
1000
1015
|
|
|
1001
1016
|
def code_runner(self, script, form=None, __name__="__main__"):
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.142"
|
q2rad-0.1.141/q2rad/version.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.1.141"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|