q2rad 0.1.218__py3-none-any.whl → 0.1.220__py3-none-any.whl
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/q2appmanager.py +28 -3
- q2rad/q2appselector.py +2 -2
- q2rad/q2extensions.py +23 -11
- q2rad/q2queries.py +13 -1
- q2rad/q2rad.py +10 -2
- q2rad/q2reports.py +14 -6
- q2rad/version.py +1 -1
- {q2rad-0.1.218.dist-info → q2rad-0.1.220.dist-info}/METADATA +1 -1
- {q2rad-0.1.218.dist-info → q2rad-0.1.220.dist-info}/RECORD +12 -12
- {q2rad-0.1.218.dist-info → q2rad-0.1.220.dist-info}/LICENSE +0 -0
- {q2rad-0.1.218.dist-info → q2rad-0.1.220.dist-info}/WHEEL +0 -0
- {q2rad-0.1.218.dist-info → q2rad-0.1.220.dist-info}/entry_points.txt +0 -0
q2rad/q2appmanager.py
CHANGED
|
@@ -173,10 +173,18 @@ class AppManager(Q2Form):
|
|
|
173
173
|
"load_app",
|
|
174
174
|
"From JSON file",
|
|
175
175
|
control="button",
|
|
176
|
+
mess="Excluding _ prefixes",
|
|
176
177
|
# datalen=10,
|
|
177
178
|
valid=self.import_app,
|
|
178
179
|
)
|
|
179
|
-
|
|
180
|
+
self.add_control(
|
|
181
|
+
"load_app_all",
|
|
182
|
+
"From JSON file *",
|
|
183
|
+
mess="Import all, including _ prefixes",
|
|
184
|
+
control="button",
|
|
185
|
+
# datalen=10,
|
|
186
|
+
valid=self.import_app_all,
|
|
187
|
+
)
|
|
180
188
|
if self.q2_app.app_url:
|
|
181
189
|
self.add_control(
|
|
182
190
|
"load_q2market_app",
|
|
@@ -455,6 +463,19 @@ class AppManager(Q2Form):
|
|
|
455
463
|
# self.q2_app.migrate_db_data()
|
|
456
464
|
self.q2_app.open_selected_app()
|
|
457
465
|
|
|
466
|
+
def import_app_all(self, file=""):
|
|
467
|
+
filetype = "JSON(*.json)"
|
|
468
|
+
if not file:
|
|
469
|
+
file, filetype = q2app.q2_app.get_open_file_dialoq("Import Application", filter=filetype)
|
|
470
|
+
|
|
471
|
+
if not file or not os.path.isfile(file):
|
|
472
|
+
return
|
|
473
|
+
|
|
474
|
+
data = json.load(open(file))
|
|
475
|
+
self.import_json_app(data, prefix="*")
|
|
476
|
+
# self.q2_app.migrate_db_data()
|
|
477
|
+
self.q2_app.open_selected_app()
|
|
478
|
+
|
|
458
479
|
@staticmethod
|
|
459
480
|
def import_json_app(data, db=None, prefix=""):
|
|
460
481
|
if db is None:
|
|
@@ -469,7 +490,9 @@ class AppManager(Q2Form):
|
|
|
469
490
|
continue
|
|
470
491
|
wait_row = Q2WaitShow(len(data[table]))
|
|
471
492
|
if table != "packages":
|
|
472
|
-
if prefix:
|
|
493
|
+
if prefix == "*":
|
|
494
|
+
db.cursor(f"delete from `{table}`")
|
|
495
|
+
elif prefix:
|
|
473
496
|
db.cursor(f'delete from `{table}` where substr(name,1,{len(prefix)}) = "{prefix}"')
|
|
474
497
|
else:
|
|
475
498
|
db.cursor(f'delete from `{table}` where substr(name,1,1) <> "_"')
|
|
@@ -484,7 +507,9 @@ class AppManager(Q2Form):
|
|
|
484
507
|
):
|
|
485
508
|
continue
|
|
486
509
|
else:
|
|
487
|
-
if prefix:
|
|
510
|
+
if prefix == "*":
|
|
511
|
+
pass
|
|
512
|
+
elif prefix:
|
|
488
513
|
if not row.get("name").startswith(prefix):
|
|
489
514
|
continue
|
|
490
515
|
else:
|
q2rad/q2appselector.py
CHANGED
|
@@ -97,7 +97,7 @@ class Q2AppSelect(Q2Form):
|
|
|
97
97
|
"Database",
|
|
98
98
|
gridlabel=_("Data storage"),
|
|
99
99
|
datatype="char",
|
|
100
|
-
datalen=
|
|
100
|
+
datalen=255,
|
|
101
101
|
)
|
|
102
102
|
self.add_control(
|
|
103
103
|
"select_data_storage_file",
|
|
@@ -142,7 +142,7 @@ class Q2AppSelect(Q2Form):
|
|
|
142
142
|
"Database",
|
|
143
143
|
gridlabel="Logic storage",
|
|
144
144
|
datatype="char",
|
|
145
|
-
datalen=
|
|
145
|
+
datalen=255,
|
|
146
146
|
)
|
|
147
147
|
self.add_control(
|
|
148
148
|
"select_app_storage_file",
|
q2rad/q2extensions.py
CHANGED
|
@@ -40,7 +40,9 @@ class Q2Extensions(Q2Form):
|
|
|
40
40
|
self.add_control("prefix", _("Name"), datatype="char", datalen=50, pk="*")
|
|
41
41
|
self.add_control("seq", _("Sequence number"), datatype="int")
|
|
42
42
|
self.add_control("version", _("Version"), datatype="char", datalen=16, readonly=True)
|
|
43
|
-
self.add_control("
|
|
43
|
+
self.add_control("q2market_path", _("q2market folder"), datatype="char", datalen=255)
|
|
44
|
+
self.add_control("q2market_url", _("q2market url"), datatype="char", datalen=255)
|
|
45
|
+
self.add_control("checkupdates", _("Check for updates"), control="check", datatype="char", datalen=1)
|
|
44
46
|
self.add_control("comment", _("Comment"), datatype="text")
|
|
45
47
|
|
|
46
48
|
cursor: Q2Cursor = self.q2_app.db_data.table(table_name="extensions")
|
|
@@ -49,8 +51,8 @@ class Q2Extensions(Q2Form):
|
|
|
49
51
|
self.set_model(model)
|
|
50
52
|
self.add_action("/crud")
|
|
51
53
|
self.add_action("Export|as JSON file", self.export_json, eof_disabled=True)
|
|
52
|
-
if os.path.isdir(self.q2_app.q2market_path):
|
|
53
|
-
|
|
54
|
+
# if os.path.isdir(self.q2_app.q2market_path):
|
|
55
|
+
self.add_action("Export|to q2Market", self.export_q2market, eof_disabled=True)
|
|
54
56
|
self.add_action("Import|from JSON file", self.import_json, eof_disabled=True)
|
|
55
57
|
self.add_action("Import|from q2Market", self.import_q2market, eof_disabled=True)
|
|
56
58
|
|
|
@@ -96,42 +98,48 @@ class Q2Extensions(Q2Form):
|
|
|
96
98
|
|
|
97
99
|
def export_q2market(self):
|
|
98
100
|
prefix = self.r.prefix
|
|
99
|
-
if
|
|
101
|
+
q2market_path = self.r.q2market_path if self.r.q2market_path else self.q2_app.q2market_path
|
|
102
|
+
q2market_url = self.r.q2market_url if self.r.q2market_url else self.q2_app.q2market_url
|
|
103
|
+
if not os.path.isdir(q2market_path):
|
|
104
|
+
q2Mess("No q2market path!")
|
|
105
|
+
return
|
|
106
|
+
if not q2market_url:
|
|
100
107
|
q2Mess("No App URL!")
|
|
101
108
|
return
|
|
102
109
|
if (
|
|
103
110
|
q2AskYN(
|
|
104
111
|
f"<p>You are about to export Extension ({prefix}) "
|
|
105
|
-
f"<p>into folder {os.path.abspath(
|
|
112
|
+
f"<p>into folder {os.path.abspath(q2market_path)}"
|
|
113
|
+
f"<p>and upload into {os.path.abspath(q2market_url)}"
|
|
106
114
|
"<p>Are you sure?"
|
|
107
115
|
)
|
|
108
116
|
!= 2
|
|
109
117
|
):
|
|
110
118
|
return
|
|
111
119
|
|
|
112
|
-
q2market_file = f"{
|
|
120
|
+
q2market_file = f"{q2market_path}/q2market.json"
|
|
113
121
|
if os.path.isfile(q2market_file):
|
|
114
122
|
q2market = json.load(open(q2market_file))
|
|
115
123
|
else:
|
|
116
124
|
q2market = {}
|
|
117
125
|
|
|
118
126
|
version = datetime.now().strftime(r"%Y-%m-%d %H:%M:%S")
|
|
119
|
-
ext_url = f"{
|
|
127
|
+
ext_url = f"{q2market_url}/{prefix}"
|
|
120
128
|
q2market[ext_url] = {
|
|
121
129
|
"ext_title": prefix,
|
|
122
130
|
"ext_version": version,
|
|
123
131
|
"ext_description": self.r.comment,
|
|
124
132
|
}
|
|
125
133
|
json.dump(q2market, open(q2market_file, "w"), indent=2)
|
|
126
|
-
open(f"{
|
|
134
|
+
open(f"{q2market_path}/{prefix}.version", "w").write(version)
|
|
127
135
|
self.db.update("extensions", {"prefix": prefix, "version": version})
|
|
128
136
|
|
|
129
|
-
self.export_json(f"{
|
|
137
|
+
self.export_json(f"{q2market_path}/{prefix}.json")
|
|
130
138
|
|
|
131
139
|
trm = Q2Terminal(callback=print)
|
|
132
140
|
|
|
133
141
|
def worker():
|
|
134
|
-
trm.run(f"cd {
|
|
142
|
+
trm.run(f"cd {q2market_path}")
|
|
135
143
|
trm.run("git add -A")
|
|
136
144
|
trm.run(f"""git commit -a -m"{version}" """)
|
|
137
145
|
|
|
@@ -140,4 +148,8 @@ class Q2Extensions(Q2Form):
|
|
|
140
148
|
trm.close()
|
|
141
149
|
|
|
142
150
|
def import_q2market(self):
|
|
143
|
-
|
|
151
|
+
q2market_url = self.r.q2market_url if self.r.q2market_url else self.q2_app.q2market_url
|
|
152
|
+
if q2market_url:
|
|
153
|
+
q2app.q2_app.check_ext_update(self.r.prefix, force_update=True)
|
|
154
|
+
else:
|
|
155
|
+
q2Mess("No App URL!")
|
q2rad/q2queries.py
CHANGED
|
@@ -17,7 +17,7 @@ from q2db.cursor import Q2Cursor
|
|
|
17
17
|
from q2gui.q2model import Q2CursorModel, Q2Model
|
|
18
18
|
from q2gui.q2widget import Q2Widget
|
|
19
19
|
from q2gui.q2app import Q2Actions
|
|
20
|
-
from q2rad.q2utils import q2cursor, Q2_save_and_run
|
|
20
|
+
from q2rad.q2utils import q2cursor, Q2_save_and_run, num
|
|
21
21
|
from q2gui.q2utils import set_dict_default
|
|
22
22
|
import json
|
|
23
23
|
import gettext
|
|
@@ -245,6 +245,18 @@ class Q2QueryList(Q2Form):
|
|
|
245
245
|
self.model.readonly = False
|
|
246
246
|
self.last_current_row = -1
|
|
247
247
|
|
|
248
|
+
def after_form_show(self):
|
|
249
|
+
if self.crud_mode != "EDIT":
|
|
250
|
+
start_value = self.r.name
|
|
251
|
+
while True:
|
|
252
|
+
_pkvalue_list = re.split(r"([^\d]+)", start_value)
|
|
253
|
+
_base = "".join(_pkvalue_list[:-1])
|
|
254
|
+
_suffix = num(_pkvalue_list[-1]) + 1
|
|
255
|
+
start_value = f"{_base}{_suffix}"
|
|
256
|
+
if start_value not in [row["name"] for row in self.model.records]:
|
|
257
|
+
break
|
|
258
|
+
self.s.name = start_value
|
|
259
|
+
|
|
248
260
|
def set_content(self, content):
|
|
249
261
|
self.model.reset()
|
|
250
262
|
for x in content:
|
q2rad/q2rad.py
CHANGED
|
@@ -926,7 +926,7 @@ class Q2RadApp(Q2App):
|
|
|
926
926
|
AppManager.import_json_app(data)
|
|
927
927
|
self.open_selected_app()
|
|
928
928
|
|
|
929
|
-
def check_ext_update(self, prefix="", force_update=False):
|
|
929
|
+
def check_ext_update(self, prefix="", force_update=False, ext_url=""):
|
|
930
930
|
if self.frozen:
|
|
931
931
|
return
|
|
932
932
|
if prefix:
|
|
@@ -935,7 +935,14 @@ class Q2RadApp(Q2App):
|
|
|
935
935
|
cu = q2cursor(f"select * from extensions where checkupdates<>'' order by seq")
|
|
936
936
|
for row in cu.records():
|
|
937
937
|
_prefix = row["prefix"]
|
|
938
|
-
|
|
938
|
+
|
|
939
|
+
if ext_url:
|
|
940
|
+
ext_url = f"{ext_url}/{_prefix}"
|
|
941
|
+
elif self.app_url:
|
|
942
|
+
ext_url = f"{os.path.dirname(self.app_url)}/{_prefix}"
|
|
943
|
+
else:
|
|
944
|
+
ext_url = f"{self.q2market_url}/{_prefix}"
|
|
945
|
+
|
|
939
946
|
ext_version = row["version"]
|
|
940
947
|
if not os.path.isdir(self.q2market_path) or force_update:
|
|
941
948
|
try:
|
|
@@ -963,6 +970,7 @@ class Q2RadApp(Q2App):
|
|
|
963
970
|
):
|
|
964
971
|
data = json.load(open_url(ext_url + ".json")) # noqa F405
|
|
965
972
|
AppManager.import_json_app(data, prefix=_prefix)
|
|
973
|
+
update("extensions", {"prefix":row["prefix"], "version":market_version})
|
|
966
974
|
self.open_selected_app()
|
|
967
975
|
|
|
968
976
|
def update_app_packages(self):
|
q2rad/q2reports.py
CHANGED
|
@@ -153,12 +153,20 @@ class Q2RadReport(Q2Report):
|
|
|
153
153
|
co = 0
|
|
154
154
|
name, ext = os.path.splitext(rez_name)
|
|
155
155
|
while True:
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
156
|
+
if os.path.isfile(rez_name):
|
|
157
|
+
try:
|
|
158
|
+
os.remove(rez_name)
|
|
159
|
+
except Exception as e:
|
|
160
|
+
co += 1
|
|
161
|
+
rez_name = f"{name}{co:03d}{ext}"
|
|
162
|
+
continue
|
|
163
|
+
# lockfile = f"{os.path.dirname(rez_name)}/.~lock.{os.path.basename(rez_name)}#"
|
|
164
|
+
# if os.path.isfile(lockfile):
|
|
165
|
+
# co += 1
|
|
166
|
+
# rez_name = f"{name}{co:03d}{ext}"
|
|
167
|
+
# else:
|
|
168
|
+
# break
|
|
169
|
+
break
|
|
162
170
|
return rez_name
|
|
163
171
|
|
|
164
172
|
def data_start(self):
|
q2rad/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.1.
|
|
1
|
+
__version__ = "0.1.220"
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
q2rad/__init__.py,sha256=Y0Up-UTXOmCYC9llNmTF10CpDDgF2kv10pyHT3-YwmQ,183
|
|
2
2
|
q2rad/__main__.py,sha256=zP4JARM-FzFHM-vWLehx7c5N4v4m_F-TuMobCdFzr4Q,824
|
|
3
3
|
q2rad/q2actions.py,sha256=eExRvOSyLhT_v1XCR-DmLEhQ9g_LRkrlyXnwDCjT0LM,8258
|
|
4
|
-
q2rad/q2appmanager.py,sha256=
|
|
5
|
-
q2rad/q2appselector.py,sha256
|
|
4
|
+
q2rad/q2appmanager.py,sha256=4c1h5I_7f4S7Ef9nDnDQthRqPC-uyK8v8B8zmhdhtr0,20567
|
|
5
|
+
q2rad/q2appselector.py,sha256=-QazsbpOxRlzuCZZ35QU-p9iiBrF16oDU-Os-5rPIRQ,18811
|
|
6
6
|
q2rad/q2constants.py,sha256=dQtN4OMvZw0FATDAFYjolI7eGMVUnNnbTl6qM-ggZ4I,3416
|
|
7
|
-
q2rad/q2extensions.py,sha256=
|
|
7
|
+
q2rad/q2extensions.py,sha256=V54Xypcucl1-RarLWtH3GGxnAW1m4p3wrTYXFLBdqgk,5929
|
|
8
8
|
q2rad/q2forms.py,sha256=36NriEUquuF97fkHpBBQyw1PDIrBQQlwxb21YVrmtng,11117
|
|
9
9
|
q2rad/q2lines.py,sha256=KQslxn06vypKSFahCDAa7oFPoo_BhvABTKy5iDEOFbc,19133
|
|
10
10
|
q2rad/q2make.py,sha256=wXoyBUwf2zaAl9JjWDCbjAteUElRq0O7ippyaMY9eug,6476
|
|
11
11
|
q2rad/q2market.py,sha256=RNXTNv-fFUgbzBGhHPNXlzGjsAHAtz71BRbTErJarNo,2641
|
|
12
12
|
q2rad/q2modules.py,sha256=FetB84IxsuDzNYKTFM3BdvfH5GrWrFKoi6cV5uW1fKo,4360
|
|
13
13
|
q2rad/q2packages.py,sha256=y72L1RAw1OgtKGaL8lJ1KHIaers5I6kTZSiphwwrY0M,3808
|
|
14
|
-
q2rad/q2queries.py,sha256=
|
|
15
|
-
q2rad/q2rad.py,sha256
|
|
14
|
+
q2rad/q2queries.py,sha256=l9SJ_T5Y38p23xa505EPZocCEmFw_a2y4ck0_-AHVP0,13119
|
|
15
|
+
q2rad/q2rad.py,sha256=qlHORwI_E0rGXT5Moz7ECid_zlRcnAXco4_CTtcWdvw,52142
|
|
16
16
|
q2rad/q2raddb.py,sha256=tMX971d_awTwiWeYLkZGSfdrIs88oiNHBAs2cMFvSbU,4685
|
|
17
|
-
q2rad/q2reports.py,sha256=
|
|
17
|
+
q2rad/q2reports.py,sha256=1fewf1Zlz98raqTIWlRLIg-zTCYA2flGVqyIC120UEU,84802
|
|
18
18
|
q2rad/q2stylesettings.py,sha256=rEJLyLzsffJEXnMbg9bPB3KHLjYfw-49QgrtcYOfGV0,4769
|
|
19
19
|
q2rad/q2utils.py,sha256=Vb5K8Lbb7PzQGDiBEHFrPyDcytVnUSVXy9yIkvWM1Oc,19734
|
|
20
|
-
q2rad/version.py,sha256=
|
|
21
|
-
q2rad-0.1.
|
|
22
|
-
q2rad-0.1.
|
|
23
|
-
q2rad-0.1.
|
|
24
|
-
q2rad-0.1.
|
|
25
|
-
q2rad-0.1.
|
|
20
|
+
q2rad/version.py,sha256=Yg55j5Kpc4j7L2JTOD4XO90GgG_NmOIipe_KjVZ996s,23
|
|
21
|
+
q2rad-0.1.220.dist-info/entry_points.txt,sha256=DmsJQE6f3wYuhdN2h6ARYxSe8_d03paeepfGpdVj5rs,42
|
|
22
|
+
q2rad-0.1.220.dist-info/LICENSE,sha256=JRR3LlR18ghhYXT4G2cWgXmnxRvcuVcKlqncWWK4MRY,10347
|
|
23
|
+
q2rad-0.1.220.dist-info/METADATA,sha256=4D6X3yn1DATbq926bwEaZW_m_qrHlDKPgY4GPDHmoGA,3369
|
|
24
|
+
q2rad-0.1.220.dist-info/WHEEL,sha256=WGfLGfLX43Ei_YORXSnT54hxFygu34kMpcQdmgmEwCQ,88
|
|
25
|
+
q2rad-0.1.220.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|