q2rad 0.1.199__tar.gz → 0.1.201__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.199 → q2rad-0.1.201}/PKG-INFO +1 -1
- {q2rad-0.1.199 → q2rad-0.1.201}/pyproject.toml +1 -1
- {q2rad-0.1.199 → q2rad-0.1.201}/q2rad/q2appmanager.py +31 -12
- {q2rad-0.1.199 → q2rad-0.1.201}/q2rad/q2lines.py +25 -16
- {q2rad-0.1.199 → q2rad-0.1.201}/q2rad/q2rad.py +4 -4
- {q2rad-0.1.199 → q2rad-0.1.201}/q2rad/q2reports.py +12 -1
- {q2rad-0.1.199 → q2rad-0.1.201}/q2rad/q2utils.py +4 -3
- q2rad-0.1.201/q2rad/version.py +1 -0
- q2rad-0.1.199/q2rad/version.py +0 -1
- {q2rad-0.1.199 → q2rad-0.1.201}/LICENSE +0 -0
- {q2rad-0.1.199 → q2rad-0.1.201}/README.md +0 -0
- {q2rad-0.1.199 → q2rad-0.1.201}/q2rad/__init__.py +0 -0
- {q2rad-0.1.199 → q2rad-0.1.201}/q2rad/__main__.py +0 -0
- {q2rad-0.1.199 → q2rad-0.1.201}/q2rad/q2actions.py +0 -0
- {q2rad-0.1.199 → q2rad-0.1.201}/q2rad/q2appselector.py +0 -0
- {q2rad-0.1.199 → q2rad-0.1.201}/q2rad/q2constants.py +0 -0
- {q2rad-0.1.199 → q2rad-0.1.201}/q2rad/q2forms.py +0 -0
- {q2rad-0.1.199 → q2rad-0.1.201}/q2rad/q2make.py +0 -0
- {q2rad-0.1.199 → q2rad-0.1.201}/q2rad/q2market.py +0 -0
- {q2rad-0.1.199 → q2rad-0.1.201}/q2rad/q2modules.py +0 -0
- {q2rad-0.1.199 → q2rad-0.1.201}/q2rad/q2packages.py +0 -0
- {q2rad-0.1.199 → q2rad-0.1.201}/q2rad/q2queries.py +0 -0
- {q2rad-0.1.199 → q2rad-0.1.201}/q2rad/q2raddb.py +0 -0
- {q2rad-0.1.199 → q2rad-0.1.201}/q2rad/q2stylesettings.py +0 -0
|
@@ -26,6 +26,16 @@ from datetime import datetime
|
|
|
26
26
|
import json
|
|
27
27
|
import os
|
|
28
28
|
|
|
29
|
+
app_tables = [
|
|
30
|
+
"forms",
|
|
31
|
+
"lines",
|
|
32
|
+
"actions",
|
|
33
|
+
"reports",
|
|
34
|
+
"modules",
|
|
35
|
+
"queries",
|
|
36
|
+
"packages",
|
|
37
|
+
]
|
|
38
|
+
|
|
29
39
|
|
|
30
40
|
class AppManager(Q2Form):
|
|
31
41
|
def __init__(self, title=""):
|
|
@@ -307,7 +317,7 @@ class AppManager(Q2Form):
|
|
|
307
317
|
file = self.validate_impexp_file_name(file, filetype)
|
|
308
318
|
if file:
|
|
309
319
|
if app_json is None:
|
|
310
|
-
app_json = self.get_app_json
|
|
320
|
+
app_json = q2working(self.get_app_json, "Prepare data...")
|
|
311
321
|
if app_json:
|
|
312
322
|
json.dump(app_json, open(file, "w"), indent=1)
|
|
313
323
|
|
|
@@ -315,6 +325,8 @@ class AppManager(Q2Form):
|
|
|
315
325
|
db: Q2Db = q2app.q2_app.db_logic
|
|
316
326
|
rez = {}
|
|
317
327
|
for x in db.get_tables():
|
|
328
|
+
if x not in app_tables:
|
|
329
|
+
continue
|
|
318
330
|
if x.startswith("log_") or x == "sqlite_sequence":
|
|
319
331
|
continue
|
|
320
332
|
rez[x] = []
|
|
@@ -332,18 +344,23 @@ class AppManager(Q2Form):
|
|
|
332
344
|
|
|
333
345
|
file = self.validate_impexp_file_name(file, filetype)
|
|
334
346
|
if file:
|
|
335
|
-
|
|
336
|
-
rez = {}
|
|
337
|
-
for x in db.get_tables():
|
|
338
|
-
if x.startswith("log_") or x == "sqlite_sequence":
|
|
339
|
-
continue
|
|
340
|
-
rez[x] = []
|
|
341
|
-
for row in db.table(x).records():
|
|
342
|
-
rez[x].append(row)
|
|
343
|
-
|
|
347
|
+
rez = q2working(self.get_data_json, "Prepare data...")
|
|
344
348
|
if rez:
|
|
345
349
|
json.dump(rez, open(file, "w"), indent=1)
|
|
346
350
|
|
|
351
|
+
def get_data_json(self):
|
|
352
|
+
db: Q2Db = q2app.q2_app.db_data
|
|
353
|
+
rez = {}
|
|
354
|
+
for x in db.get_tables():
|
|
355
|
+
if x in app_tables:
|
|
356
|
+
continue
|
|
357
|
+
if x.startswith("log_") or x == "sqlite_sequence":
|
|
358
|
+
continue
|
|
359
|
+
rez[x] = []
|
|
360
|
+
for row in db.table(x).records():
|
|
361
|
+
rez[x].append(row)
|
|
362
|
+
return rez
|
|
363
|
+
|
|
347
364
|
def import_q2market(self):
|
|
348
365
|
self.q2_app.check_app_update(force_update=True)
|
|
349
366
|
|
|
@@ -373,9 +390,9 @@ class AppManager(Q2Form):
|
|
|
373
390
|
continue
|
|
374
391
|
wait_row = Q2WaitShow(len(data[table]))
|
|
375
392
|
if table != "packages":
|
|
376
|
-
db.cursor(f'delete from `{table}` where name not like "
|
|
393
|
+
db.cursor(f'delete from `{table}` where name not like "\\_%"')
|
|
377
394
|
if db.last_sql_error:
|
|
378
|
-
|
|
395
|
+
errors.append(db.last_sql_error)
|
|
379
396
|
for row in data[table]:
|
|
380
397
|
wait_row.step()
|
|
381
398
|
if table == "packages":
|
|
@@ -384,6 +401,8 @@ class AppManager(Q2Form):
|
|
|
384
401
|
== row["package_name"]
|
|
385
402
|
):
|
|
386
403
|
continue
|
|
404
|
+
if row.get("name", "").startswith("_"):
|
|
405
|
+
continue
|
|
387
406
|
if not db.insert(table, row):
|
|
388
407
|
errors.append(db.last_sql_error)
|
|
389
408
|
errors.append(db.last_record)
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
from q2gui.q2model import Q2CursorModel
|
|
17
17
|
from q2rad.q2raddb import Q2Cursor, insert
|
|
18
|
-
from q2gui.q2dialogs import q2AskYN
|
|
18
|
+
from q2gui.q2dialogs import q2AskYN, q2mess
|
|
19
19
|
from q2rad.q2utils import q2cursor, choice_table, choice_column, choice_form, Q2_save_and_run
|
|
20
20
|
from q2rad.q2raddb import last_error
|
|
21
21
|
|
|
@@ -99,6 +99,7 @@ class Q2Lines(Q2Form, Q2_save_and_run):
|
|
|
99
99
|
self.add_action("Layout|Form", icon="☆", worker=lambda: self.add_layout("/f"))
|
|
100
100
|
self.add_action("Layout|Horizontally", worker=lambda: self.add_layout("/h"))
|
|
101
101
|
self.add_action("Layout|Vertically", worker=lambda: self.add_layout("/v"))
|
|
102
|
+
self.add_action("Alter column", icon="🔧", worker=self.alter_column)
|
|
102
103
|
|
|
103
104
|
def create_form(self):
|
|
104
105
|
self.add_control("id", "", datatype="int", pk="*", ai="*", noform=1, nogrid=1)
|
|
@@ -130,7 +131,7 @@ class Q2Lines(Q2Form, Q2_save_and_run):
|
|
|
130
131
|
self.add_control("/")
|
|
131
132
|
if self.add_control("/h"):
|
|
132
133
|
self.add_control("stretch", _("Stretch factor"), datatype="int")
|
|
133
|
-
self.add_control("alignment", _("Alignment"), datatype="int",datalen=3)
|
|
134
|
+
self.add_control("alignment", _("Alignment"), datatype="int", datalen=3)
|
|
134
135
|
self.add_control("tag", _("Tag"), datatype="char", datalen=100)
|
|
135
136
|
self.add_control("/")
|
|
136
137
|
if self.add_control("/h", _("Control type")):
|
|
@@ -277,6 +278,13 @@ class Q2Lines(Q2Form, Q2_save_and_run):
|
|
|
277
278
|
self.controls.delete("save_and_run_actions_visible")
|
|
278
279
|
self.system_controls.insert(2, self._save_and_run_control)
|
|
279
280
|
|
|
281
|
+
def alter_column(self):
|
|
282
|
+
if self.r.migrate and q2AskYN(f"Alter column {self.r.column}?") == 2:
|
|
283
|
+
record = self.get_current_record()
|
|
284
|
+
record["table"] = self.db.get("forms", f"name = '{self.prev_form.r.name}'", "form_table")
|
|
285
|
+
if not q2app.q2_app.db_data.alter_column(record):
|
|
286
|
+
q2mess(self.db_data.migrate_error_list)
|
|
287
|
+
|
|
280
288
|
def copy_to(self):
|
|
281
289
|
rows = self.get_grid_selected_rows()
|
|
282
290
|
choice = choice_form()
|
|
@@ -374,20 +382,21 @@ class Q2Lines(Q2Form, Q2_save_and_run):
|
|
|
374
382
|
|
|
375
383
|
cols = self.q2_app.db_data.db_schema.get_schema_columns(self.prev_form.r.form_table)
|
|
376
384
|
for x in cols:
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
385
|
+
if self.db.get("lines", f"name = '{self.prev_form.r.name}' and column = '{x}'") == {}:
|
|
386
|
+
insert(
|
|
387
|
+
"lines",
|
|
388
|
+
{
|
|
389
|
+
"name": self.prev_form.r.name,
|
|
390
|
+
"column": x,
|
|
391
|
+
"label": x,
|
|
392
|
+
"datatype": cols[x]["datatype"],
|
|
393
|
+
"datalen": cols[x]["datalen"],
|
|
394
|
+
"pk": cols[x]["pk"],
|
|
395
|
+
"ai": cols[x]["ai"],
|
|
396
|
+
"migrate": "*",
|
|
397
|
+
},
|
|
398
|
+
self.db,
|
|
399
|
+
)
|
|
391
400
|
self.refresh()
|
|
392
401
|
|
|
393
402
|
def before_crud_save(self):
|
|
@@ -421,7 +421,6 @@ class Q2RadApp(Q2App):
|
|
|
421
421
|
def _open_database(self, database_name, db_engine_name, host, port, password, user, guest_mode=None):
|
|
422
422
|
db = None
|
|
423
423
|
first_pass = 0
|
|
424
|
-
|
|
425
424
|
while True:
|
|
426
425
|
try:
|
|
427
426
|
db = q2working(
|
|
@@ -465,7 +464,8 @@ class Q2RadApp(Q2App):
|
|
|
465
464
|
),
|
|
466
465
|
mess=_("Creating database"),
|
|
467
466
|
)
|
|
468
|
-
except Exception:
|
|
467
|
+
except Exception as error:
|
|
468
|
+
q2mess(f"Error occured while creating the database:<br>{error}")
|
|
469
469
|
return None
|
|
470
470
|
|
|
471
471
|
def open_databases(self):
|
|
@@ -491,7 +491,7 @@ class Q2RadApp(Q2App):
|
|
|
491
491
|
self.last_root_password = ""
|
|
492
492
|
if self.db_data is None or self.db_logic is None:
|
|
493
493
|
self.selected_application = {}
|
|
494
|
-
q2Mess(_("Can not open database"))
|
|
494
|
+
# q2Mess(_("Can not open database"))
|
|
495
495
|
self.open_application()
|
|
496
496
|
|
|
497
497
|
def create_menu(self):
|
|
@@ -799,7 +799,7 @@ class Q2RadApp(Q2App):
|
|
|
799
799
|
f" {_source_suffix}{package}{_source_postfix}"
|
|
800
800
|
)
|
|
801
801
|
if trm.exit_code != 0:
|
|
802
|
-
q2mess(f"Error occured while
|
|
802
|
+
q2mess(f"Error occured while updating <b>{package}</b>! See output for details.")
|
|
803
803
|
w.close()
|
|
804
804
|
q2Mess("Finished!<p>The program will be restarted!")
|
|
805
805
|
self.restart()
|
|
@@ -90,6 +90,7 @@ class Q2RadReport(Q2Report):
|
|
|
90
90
|
def repo_valid(mode):
|
|
91
91
|
form.heap.mode = mode
|
|
92
92
|
form.close()
|
|
93
|
+
|
|
93
94
|
form.add_control("/s")
|
|
94
95
|
form.add_control("/h")
|
|
95
96
|
form.add_control("/s")
|
|
@@ -125,6 +126,8 @@ class Q2RadReport(Q2Report):
|
|
|
125
126
|
def repo_edit():
|
|
126
127
|
report_edit_form = Q2ReportEdit()
|
|
127
128
|
report_edit_form.after_form_show = lambda: report_edit_form.set_content(self.report_content)
|
|
129
|
+
report_edit_form.data.update(self.data)
|
|
130
|
+
report_edit_form.data_sets.update(self.data_sets)
|
|
128
131
|
report_edit_form.run()
|
|
129
132
|
form.close()
|
|
130
133
|
|
|
@@ -341,6 +344,8 @@ class ReportForm:
|
|
|
341
344
|
class Q2ReportEdit(Q2Form):
|
|
342
345
|
def __init__(self):
|
|
343
346
|
super().__init__("Report Edit")
|
|
347
|
+
self.data = {}
|
|
348
|
+
self.data_sets = {}
|
|
344
349
|
|
|
345
350
|
def on_init(self):
|
|
346
351
|
self.query_edit = Q2QueryEdit()
|
|
@@ -610,6 +615,8 @@ class Q2ReportReport(Q2Form):
|
|
|
610
615
|
|
|
611
616
|
def run_report(self, output_file="html"):
|
|
612
617
|
rep = Q2RadReport(self.report_edit_form.get_content())
|
|
618
|
+
rep.data.update(self.report_edit_form.data)
|
|
619
|
+
rep.data_sets.update(self.report_edit_form.data_sets)
|
|
613
620
|
rep.run(output_file)
|
|
614
621
|
|
|
615
622
|
def set_default_report_content(self):
|
|
@@ -679,7 +686,8 @@ class Q2ReportReport(Q2Form):
|
|
|
679
686
|
prop_key = prop_name.replace("_", "-")
|
|
680
687
|
|
|
681
688
|
if not self.w.__getattr__(prop_name).check.is_checked():
|
|
682
|
-
|
|
689
|
+
if prop_key in self.current_propertys:
|
|
690
|
+
del self.current_propertys[prop_key]
|
|
683
691
|
else:
|
|
684
692
|
self.current_propertys[prop_key] = prop_value
|
|
685
693
|
self.style_changed()
|
|
@@ -2001,6 +2009,9 @@ class Q2ReportRows(Q2Form, ReportForm):
|
|
|
2001
2009
|
cell_data = self.rows_data.cells.get(f"{row},{column}", {})
|
|
2002
2010
|
|
|
2003
2011
|
self.rows_sheet.cell_styles[f"{row},{column}"] = cell_data.get("style", {})
|
|
2012
|
+
self.rows_sheet.cell_styles[f"{row},{column}"]["border-color"] = (
|
|
2013
|
+
"white" if self.q2_app.q2style.color_mode == "dark" else "black"
|
|
2014
|
+
)
|
|
2004
2015
|
rowspan = cell_data.get("rowspan", 1)
|
|
2005
2016
|
colspan = cell_data.get("colspan", 1)
|
|
2006
2017
|
if rowspan > 1 or colspan > 1:
|
|
@@ -226,7 +226,8 @@ class Q2Form(_Q2Form):
|
|
|
226
226
|
f"""select *
|
|
227
227
|
from log_{self.model.get_table_name()}
|
|
228
228
|
{where}
|
|
229
|
-
"""
|
|
229
|
+
""",
|
|
230
|
+
self.db,
|
|
230
231
|
)
|
|
231
232
|
form = Q2Form(f"Changelog ({self.title})")
|
|
232
233
|
form.add_control("/")
|
|
@@ -282,10 +283,10 @@ class Q2Form(_Q2Form):
|
|
|
282
283
|
|
|
283
284
|
|
|
284
285
|
class q2cursor(Q2Cursor):
|
|
285
|
-
def __init__(self, sql="", q2_db=None):
|
|
286
|
+
def __init__(self, sql="", q2_db=None, data=[]):
|
|
286
287
|
if q2_db is None:
|
|
287
288
|
q2_db = q2app.q2_app.db_data
|
|
288
|
-
super().__init__(q2_db, sql)
|
|
289
|
+
super().__init__(q2_db, sql, data=data)
|
|
289
290
|
if q2_db.last_sql_error:
|
|
290
291
|
print(q2_db.last_sql_error)
|
|
291
292
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.201"
|
q2rad-0.1.199/q2rad/version.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.1.199"
|
|
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
|