q2rad 0.1.207__tar.gz → 0.1.208__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.207 → q2rad-0.1.208}/PKG-INFO +1 -1
- {q2rad-0.1.207 → q2rad-0.1.208}/pyproject.toml +1 -1
- {q2rad-0.1.207 → q2rad-0.1.208}/q2rad/q2lines.py +5 -5
- {q2rad-0.1.207 → q2rad-0.1.208}/q2rad/q2packages.py +11 -5
- {q2rad-0.1.207 → q2rad-0.1.208}/q2rad/q2rad.py +58 -24
- q2rad-0.1.208/q2rad/version.py +1 -0
- q2rad-0.1.207/q2rad/version.py +0 -1
- {q2rad-0.1.207 → q2rad-0.1.208}/LICENSE +0 -0
- {q2rad-0.1.207 → q2rad-0.1.208}/README.md +0 -0
- {q2rad-0.1.207 → q2rad-0.1.208}/q2rad/__init__.py +0 -0
- {q2rad-0.1.207 → q2rad-0.1.208}/q2rad/__main__.py +0 -0
- {q2rad-0.1.207 → q2rad-0.1.208}/q2rad/q2actions.py +0 -0
- {q2rad-0.1.207 → q2rad-0.1.208}/q2rad/q2appmanager.py +0 -0
- {q2rad-0.1.207 → q2rad-0.1.208}/q2rad/q2appselector.py +0 -0
- {q2rad-0.1.207 → q2rad-0.1.208}/q2rad/q2constants.py +0 -0
- {q2rad-0.1.207 → q2rad-0.1.208}/q2rad/q2forms.py +0 -0
- {q2rad-0.1.207 → q2rad-0.1.208}/q2rad/q2make.py +0 -0
- {q2rad-0.1.207 → q2rad-0.1.208}/q2rad/q2market.py +0 -0
- {q2rad-0.1.207 → q2rad-0.1.208}/q2rad/q2modules.py +0 -0
- {q2rad-0.1.207 → q2rad-0.1.208}/q2rad/q2queries.py +0 -0
- {q2rad-0.1.207 → q2rad-0.1.208}/q2rad/q2raddb.py +0 -0
- {q2rad-0.1.207 → q2rad-0.1.208}/q2rad/q2reports.py +0 -0
- {q2rad-0.1.207 → q2rad-0.1.208}/q2rad/q2stylesettings.py +0 -0
- {q2rad-0.1.207 → q2rad-0.1.208}/q2rad/q2utils.py +0 -0
|
@@ -188,7 +188,7 @@ class Q2Lines(Q2Form, Q2_save_and_run):
|
|
|
188
188
|
_("?"),
|
|
189
189
|
mess=_("Open list of existing tables"),
|
|
190
190
|
control="button",
|
|
191
|
-
datalen=
|
|
191
|
+
datalen=3,
|
|
192
192
|
valid=self.select_linked_table,
|
|
193
193
|
)
|
|
194
194
|
self.add_control("to_table", gridlabel=_("To table"), datatype="char", datalen=100)
|
|
@@ -199,7 +199,7 @@ class Q2Lines(Q2Form, Q2_save_and_run):
|
|
|
199
199
|
_("?"),
|
|
200
200
|
mess=_("Open list of existing tables"),
|
|
201
201
|
control="button",
|
|
202
|
-
datalen=
|
|
202
|
+
datalen=3,
|
|
203
203
|
valid=self.select_linked_table_pk,
|
|
204
204
|
)
|
|
205
205
|
self.add_control("to_column", gridlabel=_("To field"), datatype="char", datalen=100)
|
|
@@ -211,7 +211,7 @@ class Q2Lines(Q2Form, Q2_save_and_run):
|
|
|
211
211
|
_("?"),
|
|
212
212
|
mess=_("Open list of existing columns"),
|
|
213
213
|
control="button",
|
|
214
|
-
datalen=
|
|
214
|
+
datalen=3,
|
|
215
215
|
valid=self.select_linked_table_column,
|
|
216
216
|
)
|
|
217
217
|
self.add_control("/")
|
|
@@ -225,7 +225,7 @@ class Q2Lines(Q2Form, Q2_save_and_run):
|
|
|
225
225
|
_("?"),
|
|
226
226
|
mess=_("Open list of existing forms"),
|
|
227
227
|
control="button",
|
|
228
|
-
datalen=
|
|
228
|
+
datalen=3,
|
|
229
229
|
valid=self.select_linked_form,
|
|
230
230
|
)
|
|
231
231
|
self.add_control("to_form", gridlabel=_("Form to open"), datatype="char", datalen=100)
|
|
@@ -402,7 +402,7 @@ class Q2Lines(Q2Form, Q2_save_and_run):
|
|
|
402
402
|
|
|
403
403
|
cols = self.q2_app.db_data.db_schema.get_schema_columns(self.prev_form.r.form_table)
|
|
404
404
|
for x in cols:
|
|
405
|
-
if self.db.get("lines", f"name = '{self.prev_form.r.name}' and column = '{x}'") == {}:
|
|
405
|
+
if self.db.get("lines", f"name = '{self.prev_form.r.name}' and `column` = '{x}'") == {}:
|
|
406
406
|
insert(
|
|
407
407
|
"lines",
|
|
408
408
|
{
|
|
@@ -31,7 +31,7 @@ class Q2Packages(Q2Form):
|
|
|
31
31
|
|
|
32
32
|
def on_init(self):
|
|
33
33
|
self.add_control("package_name", _("Name"), datatype="char", datalen=100, pk="*")
|
|
34
|
-
self.add_control("
|
|
34
|
+
self.add_control("package_pipname", _("Pip name"), datatype="char", datalen=100)
|
|
35
35
|
self.add_control("package_version", _("Version"), datatype="char", datalen=10)
|
|
36
36
|
self.add_control("comment", _("Comment"), datatype="text")
|
|
37
37
|
|
|
@@ -53,17 +53,21 @@ class Q2Packages(Q2Form):
|
|
|
53
53
|
|
|
54
54
|
def uninstall(self):
|
|
55
55
|
if q2AskYN(f"You are about tu uninstall package: {self.r.package_name}") == 2:
|
|
56
|
-
self.q2_app.pip_uninstall(
|
|
56
|
+
self.q2_app.pip_uninstall(
|
|
57
|
+
self.r.package_name if self.r.package_pipname == "" else self.r.package_pipname
|
|
58
|
+
)
|
|
57
59
|
|
|
58
60
|
def install(self):
|
|
59
61
|
version = (
|
|
60
62
|
self.r.package_version
|
|
61
63
|
if self.r.package_version
|
|
62
|
-
else self.q2_app.get_package_versions(self.r.package_name)[0]
|
|
64
|
+
else self.q2_app.get_package_versions(self.r.package_name, self.r.package_pipname)[0]
|
|
63
65
|
)
|
|
64
66
|
if version:
|
|
65
67
|
try:
|
|
66
|
-
self.q2_app.pip_install(
|
|
68
|
+
self.q2_app.pip_install(
|
|
69
|
+
self.r.package_name if self.r.package_pipname == "" else self.r.package_pipname, version
|
|
70
|
+
)
|
|
67
71
|
except Exception:
|
|
68
72
|
q2Mess(_(f"pip install <b>{self.r.package_name}</b> error!"))
|
|
69
73
|
finally:
|
|
@@ -72,7 +76,9 @@ class Q2Packages(Q2Form):
|
|
|
72
76
|
q2Mess(f"Package <b>{self.r.package_name}</b> not found!")
|
|
73
77
|
|
|
74
78
|
def info(self):
|
|
75
|
-
latest_version, current_version = self.q2_app.get_package_versions(
|
|
79
|
+
latest_version, current_version = self.q2_app.get_package_versions(
|
|
80
|
+
self.r.package_name, self.r.package_pipname
|
|
81
|
+
)
|
|
76
82
|
# if not current_version:
|
|
77
83
|
# current_version = "Was not imported; "
|
|
78
84
|
# _cv = self.q2_app.code_runner(
|
|
@@ -60,7 +60,7 @@ from q2rad.q2packages import Q2Packages
|
|
|
60
60
|
from q2rad.q2constants import Q2Constants, q2const
|
|
61
61
|
from q2rad.q2queries import Q2Queries
|
|
62
62
|
from q2rad.q2reports import Q2Reports, Q2RadReport
|
|
63
|
-
from q2rad.q2utils import Q2Tasker, Q2Form, auto_filter, set_logging, open_folder # noqa F401
|
|
63
|
+
from q2rad.q2utils import Q2Tasker, Q2Form, auto_filter, set_logging, open_folder, open_document # noqa F401
|
|
64
64
|
from q2rad.q2utils import q2choice
|
|
65
65
|
from q2rad.q2make import make_binary
|
|
66
66
|
|
|
@@ -110,7 +110,7 @@ def run_form(form_name, order="", where=""):
|
|
|
110
110
|
return q2app.q2_app.run_form(form_name, order=order, where=where)
|
|
111
111
|
|
|
112
112
|
|
|
113
|
-
def run_module(module_name=None,
|
|
113
|
+
def run_module(module_name=None, _globals={}, _locals=locals(), script="", import_only=False):
|
|
114
114
|
if module_name is not None:
|
|
115
115
|
script = q2app.q2_app.db_logic.get("modules", f"name = '{module_name}'", "script")
|
|
116
116
|
if not script:
|
|
@@ -130,7 +130,7 @@ def run_module(module_name=None, globals=globals(), locals=locals(), script="",
|
|
|
130
130
|
else:
|
|
131
131
|
__name__ = "__main__"
|
|
132
132
|
|
|
133
|
-
|
|
133
|
+
_locals.update(
|
|
134
134
|
{
|
|
135
135
|
"RETURN": None,
|
|
136
136
|
"ReturnEvent": ReturnEvent,
|
|
@@ -140,13 +140,15 @@ def run_module(module_name=None, globals=globals(), locals=locals(), script="",
|
|
|
140
140
|
"__name__": __name__,
|
|
141
141
|
}
|
|
142
142
|
)
|
|
143
|
+
_globals.update(globals())
|
|
144
|
+
_globals.update(_locals)
|
|
143
145
|
try:
|
|
144
|
-
exec(code["code"],
|
|
146
|
+
exec(code["code"], _globals)
|
|
145
147
|
except ReturnEvent as error:
|
|
146
148
|
pass
|
|
147
149
|
except Exception as error:
|
|
148
150
|
explain_error()
|
|
149
|
-
return
|
|
151
|
+
return _globals["RETURN"]
|
|
150
152
|
|
|
151
153
|
|
|
152
154
|
def explain_error(tb=None, errtype=None):
|
|
@@ -193,8 +195,10 @@ def explain_error(tb=None, errtype=None):
|
|
|
193
195
|
for x in error["locals"]:
|
|
194
196
|
if x in ("RETURN", "ReturnEvent", "mem", "self", "q2_app", "form", "myapp", "__name__"):
|
|
195
197
|
continue
|
|
198
|
+
# if x in globals():
|
|
199
|
+
# continue
|
|
196
200
|
value = str(error["locals"][x])[:100]
|
|
197
|
-
msg.append(f"{x}:{value}")
|
|
201
|
+
msg.append(f"{x}: {value}")
|
|
198
202
|
msg.append("-" * 25)
|
|
199
203
|
msg = "\n".join(msg)
|
|
200
204
|
|
|
@@ -695,8 +699,13 @@ class Q2RadApp(Q2App):
|
|
|
695
699
|
+ f"&&{pip_command} pip install --upgrade --force-reinstall q2rad",
|
|
696
700
|
)
|
|
697
701
|
|
|
698
|
-
def get_package_versions(self, package):
|
|
699
|
-
|
|
702
|
+
def get_package_versions(self, package, pipname=None):
|
|
703
|
+
if not isinstance(package, str):
|
|
704
|
+
pipname = package[1]
|
|
705
|
+
package = package[0]
|
|
706
|
+
response = open_url(
|
|
707
|
+
f"https://pypi.python.org/pypi/{pipname if pipname else package}/json"
|
|
708
|
+
) # noqa F405
|
|
700
709
|
if response:
|
|
701
710
|
latest_version = json.load(response)["info"]["version"]
|
|
702
711
|
else:
|
|
@@ -716,7 +725,7 @@ class Q2RadApp(Q2App):
|
|
|
716
725
|
except Exception as error:
|
|
717
726
|
_logger.error(f"Error checking version of {package}: {error}")
|
|
718
727
|
if current_version is None:
|
|
719
|
-
q2mess(f"Error
|
|
728
|
+
q2mess(f"Error checking curent version of {package}!")
|
|
720
729
|
else:
|
|
721
730
|
current_version = None
|
|
722
731
|
|
|
@@ -731,8 +740,14 @@ class Q2RadApp(Q2App):
|
|
|
731
740
|
if w.step(package):
|
|
732
741
|
break
|
|
733
742
|
latest_version, current_version = self.get_package_versions(package)
|
|
743
|
+
# q2mess([package, latest_version, current_version])
|
|
734
744
|
if self.db_logic is not None and package not in q2_modules:
|
|
735
|
-
pkg_ver = get(
|
|
745
|
+
pkg_ver = get(
|
|
746
|
+
"packages",
|
|
747
|
+
f"package_name='{package if isinstance(package, str) else package[0]}'",
|
|
748
|
+
"package_version",
|
|
749
|
+
q2_db=self.db_logic,
|
|
750
|
+
)
|
|
736
751
|
if pkg_ver != "":
|
|
737
752
|
try:
|
|
738
753
|
latest_version = version.parse(pkg_ver)
|
|
@@ -745,9 +760,10 @@ class Q2RadApp(Q2App):
|
|
|
745
760
|
continue
|
|
746
761
|
self.process_events()
|
|
747
762
|
if force or latest_version != current_version and latest_version:
|
|
763
|
+
self.pip_install(package, latest_version)
|
|
748
764
|
try:
|
|
749
765
|
self.pip_install(package, latest_version)
|
|
750
|
-
except Exception:
|
|
766
|
+
except Exception as error:
|
|
751
767
|
try:
|
|
752
768
|
self.pip_install(package, latest_version)
|
|
753
769
|
except Exception:
|
|
@@ -756,10 +772,15 @@ class Q2RadApp(Q2App):
|
|
|
756
772
|
latest_version, new_current_version = self.get_package_versions(package)
|
|
757
773
|
if latest_version:
|
|
758
774
|
upgraded.append(
|
|
759
|
-
f"{package
|
|
775
|
+
f"{package if isinstance(package, str) else package[0]} - "
|
|
776
|
+
f"<b>{current_version}</b> => "
|
|
777
|
+
f"<b>{latest_version}</b>"
|
|
760
778
|
)
|
|
761
779
|
else:
|
|
762
|
-
upgraded.append(
|
|
780
|
+
upgraded.append(
|
|
781
|
+
"Error occured while updating package "
|
|
782
|
+
f"<b>{package if isinstance(package, str) else package[0]}</b>!"
|
|
783
|
+
)
|
|
763
784
|
w.close()
|
|
764
785
|
if upgraded:
|
|
765
786
|
mess = ("Upgrading complete!<p>" "The program will be restarted!" "<p><p>") + "<p>".join(upgraded)
|
|
@@ -815,15 +836,24 @@ class Q2RadApp(Q2App):
|
|
|
815
836
|
if self.frozen:
|
|
816
837
|
return
|
|
817
838
|
|
|
839
|
+
q2mess(
|
|
840
|
+
f'"{sys.executable.replace("w.exe", ".exe")}" -m pip install '
|
|
841
|
+
f"--upgrade --no-cache-dir {package if isinstance(package, str) else package[1]} "
|
|
842
|
+
f"=={latest_version}"
|
|
843
|
+
)
|
|
844
|
+
|
|
818
845
|
def pip_runner():
|
|
819
846
|
trm = Q2Terminal(callback=print)
|
|
820
847
|
trm.run(
|
|
821
848
|
f'"{sys.executable.replace("w.exe", ".exe")}" -m pip install '
|
|
822
|
-
f"--upgrade --no-cache-dir {package}
|
|
849
|
+
f"--upgrade --no-cache-dir {package if isinstance(package, str) else package[1]}"
|
|
850
|
+
f"=={latest_version}"
|
|
823
851
|
)
|
|
824
852
|
trm.close()
|
|
825
853
|
|
|
826
|
-
q2working(
|
|
854
|
+
q2working(
|
|
855
|
+
pip_runner, _("Installing package %s...") % package if isinstance(package, str) else package[1]
|
|
856
|
+
)
|
|
827
857
|
|
|
828
858
|
def pip_uninstall(self, package):
|
|
829
859
|
if self.frozen:
|
|
@@ -869,7 +899,8 @@ class Q2RadApp(Q2App):
|
|
|
869
899
|
if self.frozen:
|
|
870
900
|
return
|
|
871
901
|
extra_packages = [
|
|
872
|
-
x["package_name"]
|
|
902
|
+
(x["package_name"], x["package_pipname"])
|
|
903
|
+
for x in q2cursor("select * from packages", self.db_logic).records()
|
|
873
904
|
]
|
|
874
905
|
self.check_packages_update(extra_packages)
|
|
875
906
|
|
|
@@ -900,13 +931,16 @@ class Q2RadApp(Q2App):
|
|
|
900
931
|
continue
|
|
901
932
|
except Exception as error:
|
|
902
933
|
q2mess(
|
|
903
|
-
f"Error
|
|
934
|
+
f"Error parsing version for <b>{package}</b>:"
|
|
904
935
|
f"<br> {error}<br>"
|
|
905
936
|
f"<b>{package}</b> packages update skipped"
|
|
906
937
|
)
|
|
907
938
|
continue
|
|
908
939
|
if latest_version != current_version and latest_version:
|
|
909
|
-
list_2_upgrade_message.append(
|
|
940
|
+
list_2_upgrade_message.append(
|
|
941
|
+
f"<b>{package if isinstance(package, str) else package[0]}</b>: "
|
|
942
|
+
f"{current_version} > {latest_version}"
|
|
943
|
+
)
|
|
910
944
|
list_2_upgrade.append(package)
|
|
911
945
|
if not can_upgrade:
|
|
912
946
|
can_upgrade = True
|
|
@@ -1150,12 +1184,14 @@ class Q2RadApp(Q2App):
|
|
|
1150
1184
|
in_def_indent = -1
|
|
1151
1185
|
for x in script.split("\n"):
|
|
1152
1186
|
if x.strip() == "":
|
|
1187
|
+
new_script_lines.append("")
|
|
1153
1188
|
continue
|
|
1154
1189
|
spaces_count = count_leading_spaces(x)
|
|
1155
1190
|
# when in_def is True - do not modify return
|
|
1156
|
-
if
|
|
1157
|
-
in_def
|
|
1158
|
-
|
|
1191
|
+
if re.findall(r"^\s*def|^\s*class", x):
|
|
1192
|
+
if in_def is False:
|
|
1193
|
+
in_def = True
|
|
1194
|
+
in_def_indent = spaces_count
|
|
1159
1195
|
elif spaces_count <= in_def_indent:
|
|
1160
1196
|
in_def = False
|
|
1161
1197
|
in_def_indent = -1
|
|
@@ -1164,8 +1200,6 @@ class Q2RadApp(Q2App):
|
|
|
1164
1200
|
if x.strip() == "return":
|
|
1165
1201
|
x = x.replace("return", "raise ReturnEvent")
|
|
1166
1202
|
else:
|
|
1167
|
-
# x = x.replace("return", "RETURN = ") + ";raise ReturnEvent"
|
|
1168
|
-
# x = x.replace("\n", "").replace("\r", "") + ";raise ReturnEvent"
|
|
1169
1203
|
x = x.replace("\n", "").replace("\r", "")
|
|
1170
1204
|
x = x.replace("return", "RETURN =")
|
|
1171
1205
|
x += ";raise ReturnEvent"
|
|
@@ -1218,7 +1252,7 @@ class Q2RadApp(Q2App):
|
|
|
1218
1252
|
for x in args:
|
|
1219
1253
|
__locals_dict[x] = args[x]
|
|
1220
1254
|
globals()["q2_app"] = self
|
|
1221
|
-
return run_module(script=script,
|
|
1255
|
+
return run_module(script=script, _locals=__locals_dict)
|
|
1222
1256
|
|
|
1223
1257
|
return real_runner
|
|
1224
1258
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.208"
|
q2rad-0.1.207/q2rad/version.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.1.207"
|
|
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
|
|
File without changes
|