q2rad 0.1.236__tar.gz → 0.1.238__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.236 → q2rad-0.1.238}/PKG-INFO +1 -1
- {q2rad-0.1.236 → q2rad-0.1.238}/pyproject.toml +1 -1
- {q2rad-0.1.236 → q2rad-0.1.238}/q2rad/q2queries.py +63 -6
- {q2rad-0.1.236 → q2rad-0.1.238}/q2rad/q2reports.py +304 -34
- {q2rad-0.1.236 → q2rad-0.1.238}/q2rad/q2utils.py +2 -0
- q2rad-0.1.238/q2rad/version.py +1 -0
- q2rad-0.1.236/q2rad/version.py +0 -1
- {q2rad-0.1.236 → q2rad-0.1.238}/LICENSE +0 -0
- {q2rad-0.1.236 → q2rad-0.1.238}/README.md +0 -0
- {q2rad-0.1.236 → q2rad-0.1.238}/q2rad/__init__.py +0 -0
- {q2rad-0.1.236 → q2rad-0.1.238}/q2rad/__main__.py +0 -0
- {q2rad-0.1.236 → q2rad-0.1.238}/q2rad/q2actions.py +0 -0
- {q2rad-0.1.236 → q2rad-0.1.238}/q2rad/q2appmanager.py +0 -0
- {q2rad-0.1.236 → q2rad-0.1.238}/q2rad/q2appselector.py +0 -0
- {q2rad-0.1.236 → q2rad-0.1.238}/q2rad/q2constants.py +0 -0
- {q2rad-0.1.236 → q2rad-0.1.238}/q2rad/q2extensions.py +0 -0
- {q2rad-0.1.236 → q2rad-0.1.238}/q2rad/q2forms.py +0 -0
- {q2rad-0.1.236 → q2rad-0.1.238}/q2rad/q2lines.py +0 -0
- {q2rad-0.1.236 → q2rad-0.1.238}/q2rad/q2make.py +0 -0
- {q2rad-0.1.236 → q2rad-0.1.238}/q2rad/q2market.py +0 -0
- {q2rad-0.1.236 → q2rad-0.1.238}/q2rad/q2modules.py +0 -0
- {q2rad-0.1.236 → q2rad-0.1.238}/q2rad/q2packages.py +0 -0
- {q2rad-0.1.236 → q2rad-0.1.238}/q2rad/q2rad.py +0 -0
- {q2rad-0.1.236 → q2rad-0.1.238}/q2rad/q2raddb.py +0 -0
- {q2rad-0.1.236 → q2rad-0.1.238}/q2rad/q2stylesettings.py +0 -0
|
@@ -176,6 +176,8 @@ class Q2QueryEdit(Q2Form):
|
|
|
176
176
|
self.actions = Q2Actions()
|
|
177
177
|
self._db = None
|
|
178
178
|
self.actions.add_action("Run F4", self.query_list.sql_runner, hotkey="F4")
|
|
179
|
+
self.actions.add_action("Dataset|Show as JSON", self.query_list.show_dataset_json)
|
|
180
|
+
self.actions.add_action("Dataset|Save as JSON", self.query_list.save_dataset_json)
|
|
179
181
|
|
|
180
182
|
self.actions.show_main_button = 0
|
|
181
183
|
self.actions.show_actions = 0
|
|
@@ -183,12 +185,30 @@ class Q2QueryEdit(Q2Form):
|
|
|
183
185
|
self.add_control("hot_key_action", actions=self.actions, control="toolbar")
|
|
184
186
|
if self.add_control("/vs", tag="qev"):
|
|
185
187
|
self.add_control("ql", "", widget=self.query_list, nogrid=1, migrate=0)
|
|
186
|
-
self.add_control(
|
|
187
|
-
"
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
188
|
+
if self.add_control("/h"):
|
|
189
|
+
self.add_control("/s")
|
|
190
|
+
self.add_control(
|
|
191
|
+
"run_query_button",
|
|
192
|
+
"Run (F4)",
|
|
193
|
+
valid=self.query_list.sql_runner,
|
|
194
|
+
control="button",
|
|
195
|
+
)
|
|
196
|
+
self.add_control("/s")
|
|
197
|
+
self.add_control(
|
|
198
|
+
"show_json",
|
|
199
|
+
"Show as JSON",
|
|
200
|
+
valid=self.query_list.show_dataset_json,
|
|
201
|
+
control="button",
|
|
202
|
+
)
|
|
203
|
+
self.add_control("/s")
|
|
204
|
+
self.add_control(
|
|
205
|
+
"save_json",
|
|
206
|
+
"Save as JSON",
|
|
207
|
+
valid=self.query_list.save_dataset_json,
|
|
208
|
+
control="button",
|
|
209
|
+
)
|
|
210
|
+
self.add_control("/s")
|
|
211
|
+
self.add_control("/")
|
|
192
212
|
self.add_control("pl", "", widget=self.param_list, nogrid=1, migrate=0)
|
|
193
213
|
self.add_control("/")
|
|
194
214
|
self.add_control("code", control="codesql", nogrid=1, valid=self.sql_changed)
|
|
@@ -275,6 +295,43 @@ class Q2QueryList(Q2Form):
|
|
|
275
295
|
sql = sql.replace(x, f"'{value}'")
|
|
276
296
|
q2cursor(sql, q2_db=self.query_editor_form._db).browse()
|
|
277
297
|
|
|
298
|
+
def prepare_dataset_json(self):
|
|
299
|
+
dataset_json = {"params": {}}
|
|
300
|
+
for query in self.model.get_records():
|
|
301
|
+
sql = query["sql"]
|
|
302
|
+
params = re_find_param.findall(sql)
|
|
303
|
+
for x in params:
|
|
304
|
+
value = self.query_editor_form.param_list.get_param(x)
|
|
305
|
+
dataset_json["params"][x] = value
|
|
306
|
+
if x[1] == "_":
|
|
307
|
+
sql = sql.replace(x, f"{value}")
|
|
308
|
+
else:
|
|
309
|
+
sql = sql.replace(x, f"'{value}'")
|
|
310
|
+
cu = q2cursor(sql, q2_db=self.query_editor_form._db)
|
|
311
|
+
rez = []
|
|
312
|
+
for x in cu.records():
|
|
313
|
+
rez.append(x)
|
|
314
|
+
dataset_json[query["name"]] = rez
|
|
315
|
+
return dataset_json
|
|
316
|
+
|
|
317
|
+
def show_dataset_json(self):
|
|
318
|
+
dataset_json = self.prepare_dataset_json()
|
|
319
|
+
|
|
320
|
+
if dataset_json:
|
|
321
|
+
json_form = Q2Form()
|
|
322
|
+
json_form.add_control("json", "", control="codejson", data=json.dumps(dataset_json, indent=2))
|
|
323
|
+
json_form.ok_button = True
|
|
324
|
+
json_form.show_form("JSON datasets")
|
|
325
|
+
|
|
326
|
+
def save_dataset_json(self):
|
|
327
|
+
dataset_json = self.prepare_dataset_json()
|
|
328
|
+
|
|
329
|
+
if dataset_json:
|
|
330
|
+
json_file_name = self.q2_app.get_save_file_dialoq(filter="JSON(*.json)")[0]
|
|
331
|
+
if json_file_name:
|
|
332
|
+
json_file_name = self.validate_impexp_file_name(json_file_name, "json")
|
|
333
|
+
open(json_file_name, "w", encoding="utf8").write(json.dumps(dataset_json, indent=2))
|
|
334
|
+
|
|
278
335
|
def sql_to_model(self, sql):
|
|
279
336
|
self.model.update({"sql": sql}, self.current_row, refresh=False)
|
|
280
337
|
|
|
@@ -191,11 +191,13 @@ class Q2RadReport(Q2Report):
|
|
|
191
191
|
if self.waitbar:
|
|
192
192
|
self.waitbar.close()
|
|
193
193
|
self.waitbar = None
|
|
194
|
-
self.last_focus_widget
|
|
194
|
+
if hasattr(self.last_focus_widget, "set_focus"):
|
|
195
|
+
self.last_focus_widget.set_focus()
|
|
195
196
|
q2app.q2_app.process_events()
|
|
196
197
|
|
|
197
198
|
def run(self, output_file="temp/repo.html"):
|
|
198
|
-
from q2rad.q2rad import run_module, run_form, get_form
|
|
199
|
+
from q2rad.q2rad import run_module, run_form, get_form, get_report
|
|
200
|
+
|
|
199
201
|
_globals = {}
|
|
200
202
|
_globals.update(locals())
|
|
201
203
|
|
|
@@ -219,7 +221,6 @@ class Q2RadReport(Q2Report):
|
|
|
219
221
|
self.data_cursors[x] = q2cursor(sql)
|
|
220
222
|
data[x] = self.data_cursors[x].records()
|
|
221
223
|
data[x] = [row for row in self.data_cursors[x].records()]
|
|
222
|
-
# print(q2app.q2_app.db_data.last_sql_error)
|
|
223
224
|
|
|
224
225
|
return real_worker
|
|
225
226
|
|
|
@@ -233,6 +234,7 @@ class Q2RadReport(Q2Report):
|
|
|
233
234
|
self.set_data(value, key)
|
|
234
235
|
except Exception as error:
|
|
235
236
|
from q2rad.q2rad import explain_error
|
|
237
|
+
|
|
236
238
|
_logger.error(f"{error}")
|
|
237
239
|
explain_error()
|
|
238
240
|
else:
|
|
@@ -426,12 +428,146 @@ class Q2ReportEdit(Q2Form):
|
|
|
426
428
|
pass
|
|
427
429
|
|
|
428
430
|
|
|
431
|
+
class Q2ContentEditor(Q2Form):
|
|
432
|
+
def __init__(self, title=""):
|
|
433
|
+
super().__init__(title)
|
|
434
|
+
self.add_control("/h", tag="root")
|
|
435
|
+
if self.add_control("/h", tag="blank_panel", alignment="7"):
|
|
436
|
+
self.add_control("blank", "", control="label")
|
|
437
|
+
self.add_control("/")
|
|
438
|
+
if self.add_control("/h", tag="rows_panel", alignment="7"):
|
|
439
|
+
roles = "free;table;header;footer"
|
|
440
|
+
self.add_control("role", "Role", pic=roles, control="combo", datalen=10)
|
|
441
|
+
self.add_control("groupby", "GroupBy", datalen=10)
|
|
442
|
+
self.add_control("data_source", "Source", pic="1;2;3", control="combo", datalen=10)
|
|
443
|
+
self.add_control("print_when", "Print when")
|
|
444
|
+
self.add_control("print_after", "calc after")
|
|
445
|
+
self.add_control("print_after", "calc after")
|
|
446
|
+
self.add_control("new_page_before", "On new page", control="check")
|
|
447
|
+
self.add_control("new_page_after", "New page after", control="check")
|
|
448
|
+
self.add_control("/s")
|
|
449
|
+
self.add_control("/")
|
|
450
|
+
if self.add_control("/h", tag="width_panel", alignment="7"):
|
|
451
|
+
self.add_control(
|
|
452
|
+
"width",
|
|
453
|
+
"Width",
|
|
454
|
+
datalen=6,
|
|
455
|
+
datadec=2,
|
|
456
|
+
datatype="num",
|
|
457
|
+
control="doublespin",
|
|
458
|
+
changed=self.changed_width,
|
|
459
|
+
)
|
|
460
|
+
self.add_control("pz", "%", control="check", changed=self.changed_width)
|
|
461
|
+
self.add_control("/s")
|
|
462
|
+
self.add_control("/")
|
|
463
|
+
if self.add_control("/h", tag="height_panel", alignment="7"):
|
|
464
|
+
self.add_control("h", "Height", control="label")
|
|
465
|
+
self.add_control(
|
|
466
|
+
"h0",
|
|
467
|
+
"minimal",
|
|
468
|
+
datalen=6,
|
|
469
|
+
datadec=2,
|
|
470
|
+
datatype="num",
|
|
471
|
+
control="doublespin",
|
|
472
|
+
changed=self.changed_height,
|
|
473
|
+
)
|
|
474
|
+
self.add_control(
|
|
475
|
+
"h1",
|
|
476
|
+
"maximal",
|
|
477
|
+
datalen=6,
|
|
478
|
+
datadec=2,
|
|
479
|
+
datatype="num",
|
|
480
|
+
control="doublespin",
|
|
481
|
+
changed=self.changed_height,
|
|
482
|
+
)
|
|
483
|
+
self.add_control("/s")
|
|
484
|
+
self.add_control("/")
|
|
485
|
+
if self.add_control("/h", tag="cell_panel", alignment="7"):
|
|
486
|
+
self.add_control("data", "Cell content", stretch=10, changed=self.changed_cell)
|
|
487
|
+
self.add_control("format", "Format", stretch=1, changed=self.changed_cell)
|
|
488
|
+
self.add_control("name", "Name", stretch=1, changed=self.changed_cell)
|
|
489
|
+
self.add_control("/s")
|
|
490
|
+
self.add_control("/")
|
|
491
|
+
self.add_control("/")
|
|
492
|
+
self.width_callback = None
|
|
493
|
+
self.height_callback = None
|
|
494
|
+
self.cell_callback = None
|
|
495
|
+
self.first_run = True
|
|
496
|
+
|
|
497
|
+
def hide_all(self):
|
|
498
|
+
if self.first_run and self.w.root:
|
|
499
|
+
self.first_run = None
|
|
500
|
+
print()
|
|
501
|
+
self.w.root.setFixedHeight(self.w.root.height())
|
|
502
|
+
self.hide_rows()
|
|
503
|
+
self.hide_width()
|
|
504
|
+
self.hide_height()
|
|
505
|
+
self.hide_cell()
|
|
506
|
+
|
|
507
|
+
def hide_blank(self):
|
|
508
|
+
self.w.blan_panel.hide()
|
|
509
|
+
|
|
510
|
+
def hide_rows(self):
|
|
511
|
+
if self.w.rows_panel:
|
|
512
|
+
self.w.rows_panel.hide()
|
|
513
|
+
|
|
514
|
+
def hide_width(self):
|
|
515
|
+
if self.w.width_panel:
|
|
516
|
+
self.w.width_panel.hide()
|
|
517
|
+
self.width_callback = None
|
|
518
|
+
|
|
519
|
+
def show_width(self, width, callback):
|
|
520
|
+
self.hide_all()
|
|
521
|
+
self.width_callback = callback
|
|
522
|
+
self.w.width_panel.show()
|
|
523
|
+
self.s.width = num(width.replace("%", ""))
|
|
524
|
+
self.s.pz = "*" if "%" in width else ""
|
|
525
|
+
|
|
526
|
+
def changed_width(self):
|
|
527
|
+
if self.width_callback:
|
|
528
|
+
self.width_callback(self.s.width, self.s.pz)
|
|
529
|
+
|
|
530
|
+
def hide_height(self):
|
|
531
|
+
if self.w.height_panel:
|
|
532
|
+
self.w.height_panel.hide()
|
|
533
|
+
self.width_callback = None
|
|
534
|
+
|
|
535
|
+
def show_height(self, height, callback):
|
|
536
|
+
self.hide_all()
|
|
537
|
+
self.height_callback = callback
|
|
538
|
+
self.w.height_panel.show()
|
|
539
|
+
self.s.h0 = num(height.split("-")[0])
|
|
540
|
+
self.s.h1 = num(height.split("-")[1])
|
|
541
|
+
|
|
542
|
+
def changed_height(self, text):
|
|
543
|
+
if self.height_callback:
|
|
544
|
+
self.height_callback(self.s.h0, self.s.h1)
|
|
545
|
+
|
|
546
|
+
def hide_cell(self):
|
|
547
|
+
if self.w.cell_panel:
|
|
548
|
+
self.w.cell_panel.hide()
|
|
549
|
+
self.cell_callback = None
|
|
550
|
+
|
|
551
|
+
def show_cell(self, data, format, name, callback):
|
|
552
|
+
self.hide_all()
|
|
553
|
+
self.cell_callback = callback
|
|
554
|
+
self.w.cell_panel.show()
|
|
555
|
+
self.s.data = data
|
|
556
|
+
self.s.format = format
|
|
557
|
+
self.s.name = name
|
|
558
|
+
|
|
559
|
+
def changed_cell(self, text):
|
|
560
|
+
if self.cell_callback:
|
|
561
|
+
self.cell_callback(self.s.data, self.s.format, self.s.name)
|
|
562
|
+
|
|
563
|
+
|
|
429
564
|
class Q2ReportReport(Q2Form):
|
|
430
565
|
def __init__(self, report_edit_form_form):
|
|
431
566
|
super().__init__("Report Layout")
|
|
432
567
|
self.i_am_child = True
|
|
433
568
|
self.report_edit_form = report_edit_form_form
|
|
434
569
|
self.anchor = None
|
|
570
|
+
self.anchor2 = None
|
|
435
571
|
self.ratio = 45
|
|
436
572
|
self.report_report_form = self
|
|
437
573
|
self.current_propertys = {}
|
|
@@ -459,6 +595,7 @@ class Q2ReportReport(Q2Form):
|
|
|
459
595
|
"""
|
|
460
596
|
|
|
461
597
|
self.current_focus = None
|
|
598
|
+
self.content_editor = None
|
|
462
599
|
|
|
463
600
|
if 1: # Actions
|
|
464
601
|
actions = Q2Actions()
|
|
@@ -467,6 +604,9 @@ class Q2ReportReport(Q2Form):
|
|
|
467
604
|
actions.add_action("XLSX", lambda: self.run_report("xlsx"))
|
|
468
605
|
actions.show_main_button = 0
|
|
469
606
|
|
|
607
|
+
if self.add_control("/h"):
|
|
608
|
+
self.add_control("anchor2", "**", control="label", nogrid=1)
|
|
609
|
+
self.add_control("/")
|
|
470
610
|
if self.add_control("/h"):
|
|
471
611
|
if self.add_control("/v"):
|
|
472
612
|
self.add_control("/h")
|
|
@@ -516,11 +656,30 @@ class Q2ReportReport(Q2Form):
|
|
|
516
656
|
)
|
|
517
657
|
self.add_control(
|
|
518
658
|
"font_weight",
|
|
519
|
-
"
|
|
659
|
+
"Weight",
|
|
520
660
|
control="check",
|
|
521
661
|
check=1,
|
|
522
662
|
valid=self.prop_font_weight,
|
|
523
663
|
when=self.prop_font_weight,
|
|
664
|
+
changed=self.prop_font_weight,
|
|
665
|
+
)
|
|
666
|
+
self.add_control(
|
|
667
|
+
"font_style",
|
|
668
|
+
"Italic",
|
|
669
|
+
control="check",
|
|
670
|
+
check=1,
|
|
671
|
+
valid=self.prop_font_style,
|
|
672
|
+
when=self.prop_font_style,
|
|
673
|
+
changed=self.prop_font_style,
|
|
674
|
+
)
|
|
675
|
+
self.add_control(
|
|
676
|
+
"text_decoration",
|
|
677
|
+
"Underline",
|
|
678
|
+
control="check",
|
|
679
|
+
check=1,
|
|
680
|
+
valid=self.prop_text_decoration,
|
|
681
|
+
when=self.prop_text_decoration,
|
|
682
|
+
changed=self.prop_text_decoration,
|
|
524
683
|
)
|
|
525
684
|
self.add_control("/")
|
|
526
685
|
if self.add_control("/v", "-"):
|
|
@@ -636,15 +795,44 @@ class Q2ReportReport(Q2Form):
|
|
|
636
795
|
when=self.prop_vertical_align,
|
|
637
796
|
)
|
|
638
797
|
self.add_control("/")
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
798
|
+
if self.add_control("/f", "Colors"): # Colors
|
|
799
|
+
self.add_control(
|
|
800
|
+
"color",
|
|
801
|
+
_("Font"),
|
|
802
|
+
control="color",
|
|
803
|
+
check="*",
|
|
804
|
+
valid=self.prop_color,
|
|
805
|
+
when=self.prop_color,
|
|
806
|
+
changed=self.prop_color,
|
|
807
|
+
)
|
|
808
|
+
self.add_control(
|
|
809
|
+
"background",
|
|
810
|
+
_("Background"),
|
|
811
|
+
control="color",
|
|
812
|
+
check="*",
|
|
813
|
+
valid=self.prop_background,
|
|
814
|
+
when=self.prop_background,
|
|
815
|
+
changed=self.prop_background,
|
|
816
|
+
)
|
|
817
|
+
self.add_control(
|
|
818
|
+
"border_color",
|
|
819
|
+
_("Borders"),
|
|
820
|
+
control="color",
|
|
821
|
+
check="*",
|
|
822
|
+
valid=self.prop_border_color,
|
|
823
|
+
when=self.prop_border_color,
|
|
824
|
+
changed=self.prop_border_color,
|
|
825
|
+
)
|
|
646
826
|
self.add_control("/")
|
|
647
|
-
|
|
827
|
+
|
|
828
|
+
# if self.add_control("/f", "Cell"):
|
|
829
|
+
# # self.add_control("", _("Name"))
|
|
830
|
+
# # self.add_control("", _("Format"))
|
|
831
|
+
# self.add_control("name", _("Name"), control="line", disabled=1)
|
|
832
|
+
# self.add_control("format", _("Format"), control="line", disabled=1)
|
|
833
|
+
# self.add_control("data", _("Data"), control="text", disabled=1)
|
|
834
|
+
# self.add_control("/")
|
|
835
|
+
# self.add_control("/s")
|
|
648
836
|
|
|
649
837
|
self.set_content()
|
|
650
838
|
|
|
@@ -668,12 +856,15 @@ class Q2ReportReport(Q2Form):
|
|
|
668
856
|
set_dict_default(self.report_data.style, "font-family", "Arial")
|
|
669
857
|
set_dict_default(self.report_data.style, "font-size", "8pt")
|
|
670
858
|
set_dict_default(self.report_data.style, "font-weight", "normal")
|
|
859
|
+
set_dict_default(self.report_data.style, "font-style", "")
|
|
860
|
+
set_dict_default(self.report_data.style, "text-decoration", "")
|
|
671
861
|
|
|
672
862
|
set_dict_default(self.report_data.style, "border-width", "0 0 0 0")
|
|
673
863
|
set_dict_default(self.report_data.style, "padding", "0.05cm 0.05cm 0.05cm 0.05cm")
|
|
674
864
|
|
|
675
|
-
|
|
676
|
-
|
|
865
|
+
set_dict_default(self.report_data.style, "background", "#FFFFFF")
|
|
866
|
+
set_dict_default(self.report_data.style, "color", "#000000")
|
|
867
|
+
set_dict_default(self.report_data.style, "border-color", "#000000")
|
|
677
868
|
|
|
678
869
|
set_dict_default(self.report_data.style, "text-align", "left")
|
|
679
870
|
set_dict_default(self.report_data.style, "vertical-align", "top")
|
|
@@ -684,9 +875,15 @@ class Q2ReportReport(Q2Form):
|
|
|
684
875
|
def prop_font_family(self):
|
|
685
876
|
self.property_changed("font_family", f"{self.s.font_family}")
|
|
686
877
|
|
|
687
|
-
def prop_font_weight(self):
|
|
878
|
+
def prop_font_weight(self, _=""):
|
|
688
879
|
self.property_changed("font_weight", f"{'bold' if self.s.font_weight else 'normal'}")
|
|
689
880
|
|
|
881
|
+
def prop_font_style(self):
|
|
882
|
+
self.property_changed("font_style", f"{'italic' if self.s.font_style else ''}")
|
|
883
|
+
|
|
884
|
+
def prop_text_decoration(self):
|
|
885
|
+
self.property_changed("text_decoration", f"{'underline' if self.s.text_decoration else ''}")
|
|
886
|
+
|
|
690
887
|
def prop_border(self):
|
|
691
888
|
self.property_changed(
|
|
692
889
|
"border_width",
|
|
@@ -719,6 +916,15 @@ class Q2ReportReport(Q2Form):
|
|
|
719
916
|
def prop_vertical_align(self):
|
|
720
917
|
self.property_changed("vertical_align", f"{self.s.vertical_align}")
|
|
721
918
|
|
|
919
|
+
def prop_color(self):
|
|
920
|
+
self.property_changed("color", f"{self.s.color}")
|
|
921
|
+
|
|
922
|
+
def prop_background(self):
|
|
923
|
+
self.property_changed("background", f"{self.s.background}")
|
|
924
|
+
|
|
925
|
+
def prop_border_color(self):
|
|
926
|
+
self.property_changed("border_color", f"{self.s.border_color}")
|
|
927
|
+
|
|
722
928
|
def property_changed(self, prop_name, prop_value):
|
|
723
929
|
if self.lock_status_bar:
|
|
724
930
|
return
|
|
@@ -752,8 +958,8 @@ class Q2ReportReport(Q2Form):
|
|
|
752
958
|
return []
|
|
753
959
|
|
|
754
960
|
def style_button_pressed(self):
|
|
961
|
+
self.report_report_form.content_editor.hide_all()
|
|
755
962
|
self.focus_changed(self.w.style_button)
|
|
756
|
-
|
|
757
963
|
self.report_report_form.update_style_bar(self.get_style(), self.report_data.style)
|
|
758
964
|
|
|
759
965
|
def focus_changed(self, widget):
|
|
@@ -782,12 +988,17 @@ class Q2ReportReport(Q2Form):
|
|
|
782
988
|
self.lock_status_bar = True
|
|
783
989
|
self.current_propertys = selected_style
|
|
784
990
|
for x in parent_style:
|
|
785
|
-
|
|
991
|
+
widget_name = x.replace("-", "_")
|
|
992
|
+
w = self.widgets().get(widget_name)
|
|
786
993
|
if w:
|
|
787
994
|
w.check.set_enabled(self.current_focus.meta["form"] != self)
|
|
788
995
|
w.check.set_text("")
|
|
789
996
|
if x == "font-weight":
|
|
790
997
|
w.set_text("*" if parent_style[x] == "bold" else "")
|
|
998
|
+
elif x == "font-style":
|
|
999
|
+
w.set_text("*" if parent_style[x] == "italic" else "")
|
|
1000
|
+
elif x == "text-decoration":
|
|
1001
|
+
w.set_text("*" if parent_style[x] == "underline" else "")
|
|
791
1002
|
elif x == "border-width":
|
|
792
1003
|
style_value = self.make_4(parent_style[x])
|
|
793
1004
|
self.s.border_top = style_value[0]
|
|
@@ -813,18 +1024,18 @@ class Q2ReportReport(Q2Form):
|
|
|
813
1024
|
w = self.widgets().get(x.replace("-", "_"))
|
|
814
1025
|
if w:
|
|
815
1026
|
w.check.set_text(True)
|
|
816
|
-
self.show_cell_content(cell_data)
|
|
1027
|
+
# self.show_cell_content(cell_data)
|
|
817
1028
|
self.lock_status_bar = False
|
|
818
1029
|
|
|
819
|
-
def show_cell_content(self, cell_data):
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
1030
|
+
# def show_cell_content(self, cell_data):
|
|
1031
|
+
# if cell_data:
|
|
1032
|
+
# self.s.data = cell_data.get("data", "")
|
|
1033
|
+
# self.s.format = cell_data.get("format", "")
|
|
1034
|
+
# self.s.name = cell_data.get("name", "")
|
|
1035
|
+
# else:
|
|
1036
|
+
# self.s.data = ""
|
|
1037
|
+
# self.s.format = ""
|
|
1038
|
+
# self.s.name = ""
|
|
828
1039
|
|
|
829
1040
|
def set_style_button_text(self, text):
|
|
830
1041
|
ReportForm.set_style_button_text(self, text)
|
|
@@ -856,7 +1067,20 @@ class Q2ReportReport(Q2Form):
|
|
|
856
1067
|
return content
|
|
857
1068
|
|
|
858
1069
|
def after_form_show(self):
|
|
859
|
-
self.w.
|
|
1070
|
+
self.anchor2: Q2Widget = self.w.anchor2
|
|
1071
|
+
if self.anchor2 is not None:
|
|
1072
|
+
self.anchor2.set_visible(False)
|
|
1073
|
+
|
|
1074
|
+
self.content_editor = Q2ContentEditor()
|
|
1075
|
+
w = self.content_editor.get_widget()
|
|
1076
|
+
self.widgets()["report_report"] = w
|
|
1077
|
+
self.content_editor.form_stack = [w]
|
|
1078
|
+
self.anchor2.add_widget_below(w)
|
|
1079
|
+
w.show()
|
|
1080
|
+
self.content_editor.hide_all()
|
|
1081
|
+
self.w.style_panel.set_size_policy("maximum", "preffered")
|
|
1082
|
+
# self.style_button_pressed()
|
|
1083
|
+
|
|
860
1084
|
self.w.font_weight.set_title("Bold")
|
|
861
1085
|
ReportForm.set_style_button(self, "Report")
|
|
862
1086
|
self.w.style_button.set_focus()
|
|
@@ -883,6 +1107,7 @@ class Q2ReportReport(Q2Form):
|
|
|
883
1107
|
self.anchor.set_visible(False)
|
|
884
1108
|
for page in self.report_data["pages"]:
|
|
885
1109
|
self.anchor.add_widget_below(Q2ReportPage(self, page).get_widget(), -1)
|
|
1110
|
+
self.style_button_pressed()
|
|
886
1111
|
|
|
887
1112
|
|
|
888
1113
|
class Q2ReportPage(Q2Form, ReportForm):
|
|
@@ -996,6 +1221,7 @@ class Q2ReportPage(Q2Form, ReportForm):
|
|
|
996
1221
|
self._repaint()
|
|
997
1222
|
|
|
998
1223
|
def style_button_pressed(self):
|
|
1224
|
+
self.report_report_form.content_editor.hide_all()
|
|
999
1225
|
self.report_report_form.focus_changed(self.w.style_button)
|
|
1000
1226
|
self.report_report_form.update_style_bar(self.get_style(), self.page_data.style)
|
|
1001
1227
|
|
|
@@ -1129,7 +1355,7 @@ class Q2ReportColumns(Q2Form, ReportForm):
|
|
|
1129
1355
|
"columns_sheet",
|
|
1130
1356
|
control="sheet",
|
|
1131
1357
|
actions=self.col_actions,
|
|
1132
|
-
valid=self.column_sheet_focus_changed,
|
|
1358
|
+
# valid=self.column_sheet_focus_changed,
|
|
1133
1359
|
when=self.column_sheet_focus_changed,
|
|
1134
1360
|
dblclick=self.cell_double_clicked,
|
|
1135
1361
|
eat_enter=1,
|
|
@@ -1237,13 +1463,21 @@ class Q2ReportColumns(Q2Form, ReportForm):
|
|
|
1237
1463
|
self._repaint()
|
|
1238
1464
|
|
|
1239
1465
|
def style_button_pressed(self):
|
|
1466
|
+
self.report_report_form.content_editor.hide_all()
|
|
1240
1467
|
self.report_report_form.focus_changed(self.w.style_button)
|
|
1241
1468
|
self.report_report_form.update_style_bar(self.get_style(), self.columns_data.style)
|
|
1242
1469
|
|
|
1243
1470
|
def column_sheet_focus_changed(self):
|
|
1244
1471
|
# self.report_report_form.focus_changed(self.columns_sheet.get_current_widget())
|
|
1472
|
+
self.report_report_form.content_editor.show_width(
|
|
1473
|
+
self.columns_sheet.get_text(), self.update_column_width
|
|
1474
|
+
)
|
|
1245
1475
|
self.report_report_form.focus_changed(self.columns_sheet)
|
|
1246
1476
|
|
|
1477
|
+
def update_column_width(self, width, pz):
|
|
1478
|
+
self.columns_data.widths[self.columns_sheet.current_column()] = f"{width}{'%' if pz == '*' else ''}"
|
|
1479
|
+
self._repaint()
|
|
1480
|
+
|
|
1247
1481
|
def get_column_count(self):
|
|
1248
1482
|
return len(self.columns_data.widths)
|
|
1249
1483
|
|
|
@@ -1449,7 +1683,7 @@ class Q2ReportRows(Q2Form, ReportForm):
|
|
|
1449
1683
|
control="sheet",
|
|
1450
1684
|
actions=self.row_actions,
|
|
1451
1685
|
when=self.rows_sheet_focus_in,
|
|
1452
|
-
valid=self.rows_sheet_focus_out,
|
|
1686
|
+
# valid=self.rows_sheet_focus_out,
|
|
1453
1687
|
dblclick=self.cell_double_clicked,
|
|
1454
1688
|
eat_enter=1,
|
|
1455
1689
|
)
|
|
@@ -1687,7 +1921,7 @@ class Q2ReportRows(Q2Form, ReportForm):
|
|
|
1687
1921
|
cell_data["name"] = form.s.name
|
|
1688
1922
|
self.rows_sheet.set_text(form.s.content)
|
|
1689
1923
|
self._repaint()
|
|
1690
|
-
self.report_report_form.show_cell_content(cell_data)
|
|
1924
|
+
# self.report_report_form.show_cell_content(cell_data)
|
|
1691
1925
|
|
|
1692
1926
|
def edit_row_height(self):
|
|
1693
1927
|
height = self.rows_sheet.get_cell_text(
|
|
@@ -1923,6 +2157,42 @@ class Q2ReportRows(Q2Form, ReportForm):
|
|
|
1923
2157
|
all_style, self.rows_data.cells[cell_key]["style"], self.rows_data.cells[cell_key]
|
|
1924
2158
|
)
|
|
1925
2159
|
|
|
2160
|
+
if self.focus_widget() == self.w.style_button:
|
|
2161
|
+
self.report_report_form.content_editor.hide_all()
|
|
2162
|
+
# self.edit_data_role()
|
|
2163
|
+
elif column == self.report_columns_form.get_column_count():
|
|
2164
|
+
self.report_report_form.content_editor.show_height(
|
|
2165
|
+
self.rows_sheet.get_cell_text(
|
|
2166
|
+
row=self.rows_sheet.current_row(),
|
|
2167
|
+
column=self.report_columns_form.get_column_count(),
|
|
2168
|
+
),
|
|
2169
|
+
self.update_row_height,
|
|
2170
|
+
)
|
|
2171
|
+
else:
|
|
2172
|
+
key = f"{self.rows_sheet.current_row()},{self.rows_sheet.current_column()}"
|
|
2173
|
+
cell_data = self.rows_data.cells.get(key, {})
|
|
2174
|
+
self.report_report_form.content_editor.show_cell(
|
|
2175
|
+
self.rows_sheet.get_text(),
|
|
2176
|
+
cell_data.get("format", ""),
|
|
2177
|
+
cell_data.get("name", ""),
|
|
2178
|
+
self.update_cell,
|
|
2179
|
+
)
|
|
2180
|
+
|
|
2181
|
+
def update_row_height(self, h0, h1):
|
|
2182
|
+
h0 = 0 if num(h0) == 0 else num(h0)
|
|
2183
|
+
h1 = 0 if num(h1) == 0 else num(h1)
|
|
2184
|
+
self.rows_data.heights[self.rows_sheet.current_row()] = f"{h0}-{h1}"
|
|
2185
|
+
self._repaint()
|
|
2186
|
+
|
|
2187
|
+
def update_cell(self, data, format, name):
|
|
2188
|
+
key = f"{self.rows_sheet.current_row()},{self.rows_sheet.current_column()}"
|
|
2189
|
+
cell_data = self.rows_data.cells.get(key, {})
|
|
2190
|
+
cell_data["data"] = data
|
|
2191
|
+
cell_data["format"] = format
|
|
2192
|
+
cell_data["name"] = name
|
|
2193
|
+
self.rows_sheet.set_text(data)
|
|
2194
|
+
self._repaint()
|
|
2195
|
+
|
|
1926
2196
|
def rows_sheet_focus_out(self):
|
|
1927
2197
|
pass
|
|
1928
2198
|
|
|
@@ -2051,9 +2321,9 @@ class Q2ReportRows(Q2Form, ReportForm):
|
|
|
2051
2321
|
cell_data = self.rows_data.cells.get(f"{row},{column}", {})
|
|
2052
2322
|
|
|
2053
2323
|
self.rows_sheet.cell_styles[f"{row},{column}"] = cell_data.get("style", {})
|
|
2054
|
-
self.rows_sheet.cell_styles[f"{row},{column}"]["border-color"] = (
|
|
2055
|
-
|
|
2056
|
-
)
|
|
2324
|
+
# self.rows_sheet.cell_styles[f"{row},{column}"]["border-color"] = (
|
|
2325
|
+
# "white" if self.q2_app.q2style.color_mode == "dark" else "black"
|
|
2326
|
+
# )
|
|
2057
2327
|
rowspan = cell_data.get("rowspan", 1)
|
|
2058
2328
|
colspan = cell_data.get("colspan", 1)
|
|
2059
2329
|
if rowspan > 1 or colspan > 1:
|
|
@@ -71,6 +71,7 @@ class Q2Form(_Q2Form):
|
|
|
71
71
|
when=None,
|
|
72
72
|
show=None,
|
|
73
73
|
valid=None,
|
|
74
|
+
changed=None,
|
|
74
75
|
dblclick=None,
|
|
75
76
|
readonly=None,
|
|
76
77
|
disabled=None,
|
|
@@ -114,6 +115,7 @@ class Q2Form(_Q2Form):
|
|
|
114
115
|
when,
|
|
115
116
|
show,
|
|
116
117
|
valid,
|
|
118
|
+
changed,
|
|
117
119
|
dblclick,
|
|
118
120
|
readonly,
|
|
119
121
|
disabled,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.238"
|
q2rad-0.1.236/q2rad/version.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.1.236"
|
|
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
|
|
File without changes
|