q2rad 0.1.224__tar.gz → 0.1.226__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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: q2rad
3
- Version: 0.1.224
3
+ Version: 0.1.226
4
4
  Summary: RAD - database, GUI, reports
5
5
  Author: Andrei Puchko
6
6
  Author-email: andrei.puchko@gmx.de
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "q2rad"
3
- version = "0.1.224"
3
+ version = "0.1.226"
4
4
  description = "RAD - database, GUI, reports"
5
5
  authors = ["Andrei Puchko <andrei.puchko@gmx.de>"]
6
6
  readme = "README.md"
@@ -153,6 +153,13 @@ class Q2Forms(Q2Form, Q2_save_and_run):
153
153
  self.add_control("/f")
154
154
  self.add_control("comment", gridlabel=_("Comments"), datatype="longtext")
155
155
 
156
+ if self.add_control("/t", _("After load")):
157
+ self.add_control(
158
+ "after_form_load",
159
+ label=_("After Form load"),
160
+ nogrid="*",
161
+ control="code",
162
+ )
156
163
  if self.add_control("/t", _("Build")):
157
164
  self.add_control("/vs", tag="build")
158
165
  self.add_control("/v")
@@ -123,6 +123,8 @@ def run_module(module_name=None, _globals={}, _locals={}, script="", import_only
123
123
  ext_module_name = row["prefix"] + module_name
124
124
  if get("modules", f"name='{ext_module_name}'", "name", q2app.q2_app.db_logic) == ext_module_name:
125
125
  ext_modules.append(ext_module_name)
126
+ if get("modules", f"name='_{module_name}'", "name", q2app.q2_app.db_logic) == f"_{module_name}":
127
+ ext_modules.append(f"_{module_name}")
126
128
  if script:
127
129
  code = q2app.q2_app.code_compiler(script)
128
130
  if code["code"] is False:
@@ -1206,7 +1208,7 @@ class Q2RadApp(Q2App):
1206
1208
  make_binary(self)
1207
1209
 
1208
1210
  def run_form(self, name, order="", where=""):
1209
- # form = q2working(lambda: self.get_form(name, where=where, order=order), "Loading form...")
1211
+ # print(">>", len(set(self.QApplication.allWidgets())))
1210
1212
  form = self.get_form(name, where=where, order=order)
1211
1213
  form.run()
1212
1214
 
@@ -1316,6 +1318,10 @@ class Q2RadApp(Q2App):
1316
1318
  f"""select * from (select * from actions
1317
1319
  where name = '{ext_name}{name}' order by seq) qq"""
1318
1320
  )
1321
+ ext_actions.append(
1322
+ f"""select * from (select * from actions
1323
+ where name = '_{name}' order by seq) qq"""
1324
+ )
1319
1325
  if ext_actions:
1320
1326
  ext_select = " union all " + " union all ".join(ext_actions)
1321
1327
  else:
@@ -1367,6 +1373,7 @@ class Q2RadApp(Q2App):
1367
1373
  eof_disabled=action["eof_disabled"],
1368
1374
  )
1369
1375
  run_module("_e_action", _locals=locals())
1376
+ self.code_runner(form_dic["after_form_load"], form)()
1370
1377
  return form
1371
1378
 
1372
1379
  def code_compiler(self, script):
@@ -1413,7 +1420,10 @@ class Q2RadApp(Q2App):
1413
1420
  module = x.split("import")[1].strip()
1414
1421
  if self.db_logic.get("modules", f"name='{module}'", "name"):
1415
1422
  # x = x.split("import")[0] + f"run_module('{module}', import_only=True)"
1416
- x = x.split("import")[0] + f"run_module('{module}', _globals=globals(), import_only=True)"
1423
+ x = (
1424
+ x.split("import")[0]
1425
+ + f"run_module('{module}', _globals=globals(), import_only=True)"
1426
+ )
1417
1427
 
1418
1428
  new_script_lines.append(x)
1419
1429
  script = "\n".join(new_script_lines)
@@ -21,7 +21,11 @@ from q2gui.q2model import Q2CursorModel
21
21
  from q2gui.q2utils import int_, num
22
22
  from q2gui import q2app
23
23
  from q2gui.q2dialogs import q2Mess, Q2WaitShow
24
- import html
24
+
25
+ # import html
26
+ import datetime
27
+ import calendar
28
+
25
29
 
26
30
  from q2rad import Q2Form
27
31
  from q2gui.q2form import NEW, COPY
@@ -33,7 +37,6 @@ if "darwin" in sys.platform:
33
37
  import ssl
34
38
 
35
39
  ssl._create_default_https_context = ssl._create_unverified_context
36
- import datetime
37
40
 
38
41
  # import errno
39
42
 
@@ -173,3 +176,44 @@ def today():
173
176
  def ensure_empty_pk(table="", row={}, q2_db=None):
174
177
  q2_db = get_default_db(q2_db)
175
178
  q2_db.ensure_empty_pk(table, row)
179
+
180
+
181
+ def dtoc(date, format_from="%Y-%m-%d", format_to="%d.%m.%Y"):
182
+ return datetime.datetime.strptime(date, format_from).strftime(format_to)
183
+
184
+
185
+ def ctod(date, format_from="%d.%m.%Y", format_to="%Y-%m-%d"):
186
+ return dtoc(date, format_from, format_to)
187
+
188
+
189
+ def first_day_of_month(date):
190
+ _date = datetime.datetime.strptime(date, "%Y-%m-%d")
191
+ _date = _date.replace(day=1)
192
+ return _date.strftime("%Y-%m-%d")
193
+
194
+
195
+ def last_day_of_month(date):
196
+ _date = datetime.datetime.strptime(date, "%Y-%m-%d")
197
+ _date = _date.replace(day=calendar.monthrange(_date.year, _date.month)[1])
198
+ return _date.strftime("%Y-%m-%d")
199
+
200
+
201
+ def ffinder(module_name="module", function_name="fname"):
202
+ from q2rad.q2rad import run_module
203
+ run_module(module_name, import_only=True)
204
+ try:
205
+ is_callable = eval(f"callable({function_name})")
206
+ except Exception:
207
+ is_callable = False
208
+
209
+ if not is_callable:
210
+
211
+ def empty_function(*args, **kwargs):
212
+ pass
213
+
214
+ return empty_function
215
+ else:
216
+ try:
217
+ return locals()[function_name]
218
+ except:
219
+ return globals()[function_name]
@@ -0,0 +1 @@
1
+ __version__ = "0.1.226"
@@ -1 +0,0 @@
1
- __version__ = "0.1.224"
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