q2rad 0.1.167__tar.gz → 0.1.169__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.167
3
+ Version: 0.1.169
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.167"
3
+ version = "0.1.169"
4
4
  description = "RAD - database, GUI, reports"
5
5
  authors = ["Andrei Puchko <andrei.puchko@gmx.de>"]
6
6
  readme = "README.md"
@@ -228,17 +228,17 @@ class Q2AppSelect(Q2Form):
228
228
  if self.q2_app.keyboard_modifiers() != "":
229
229
  return
230
230
  if self.db.table("applications").row_count() <= 0:
231
- if not os.path.isdir("q2rad_sqlite_databases"):
232
- os.mkdir("q2rad_sqlite_databases")
231
+ if not os.path.isdir("databases"):
232
+ os.mkdir("databases")
233
233
  insert(
234
234
  "applications",
235
235
  {
236
236
  "ordnum": 1,
237
237
  "name": "My first app",
238
238
  "driver_data": "Sqlite",
239
- "database_data": "q2rad_sqlite_databases/my_first_app_data_storage.sqlite",
239
+ "database_data": "databases/my_first_app_data_storage.sqlite",
240
240
  "driver_logic": "Sqlite",
241
- "database_logic": "q2rad_sqlite_databases/my_first_app_logic_storage.sqlite",
241
+ "database_logic": "databases/my_first_app_logic_storage.sqlite",
242
242
  "dev_mode": "*",
243
243
  },
244
244
  self.db,
@@ -45,7 +45,20 @@ SQL_DATATYPES = (
45
45
  )
46
46
  HAS_DATADEC = ("dec", "numeric", "num")
47
47
  HAS_DATALEN = ("char", "varchar") + HAS_DATADEC
48
- WIDGETS = ("line", "text", "code", "button", "check", "radio", "combo", "list", "spin", "image", "widget")
48
+ WIDGETS = (
49
+ "line",
50
+ "text",
51
+ "code",
52
+ "button",
53
+ "check",
54
+ "radio",
55
+ "combo",
56
+ "list",
57
+ "spin",
58
+ "image",
59
+ "widget",
60
+ "label",
61
+ )
49
62
  # "date;"
50
63
  # "frame;"
51
64
  # "grid;"
@@ -78,6 +91,8 @@ class Q2Lines(Q2Form, Q2_save_and_run):
78
91
 
79
92
  self.add_action("Run", self.form_runner, hotkey="F4")
80
93
  self.add_action("Fill", self.filler)
94
+ self.add_action("-")
95
+ self.add_action("Select panel", icon="⭥", worker=self.select_panel, hotkey="Ctrl+F3")
81
96
 
82
97
  def create_form(self):
83
98
  self.add_control("id", "", datatype="int", pk="*", ai="*", noform=1, nogrid=1)
@@ -89,7 +104,7 @@ class Q2Lines(Q2Form, Q2_save_and_run):
89
104
  to_column="name",
90
105
  related="name",
91
106
  datatype="char",
92
- datalen=100
107
+ datalen=100,
93
108
  )
94
109
  self.add_control("column", _("Column name"), datalen=50)
95
110
  self.add_control("/")
@@ -124,7 +139,6 @@ class Q2Lines(Q2Form, Q2_save_and_run):
124
139
  self.add_control("/")
125
140
 
126
141
  if self.add_control("/h", _("Data type")):
127
-
128
142
  self.add_control(
129
143
  "datatype",
130
144
  gridlabel=_("Data type"),
@@ -140,7 +154,6 @@ class Q2Lines(Q2Form, Q2_save_and_run):
140
154
  self.add_control("/")
141
155
 
142
156
  if self.add_control("/h"): # Db
143
-
144
157
  self.add_control(
145
158
  "migrate",
146
159
  _("Migrate"),
@@ -256,6 +269,45 @@ class Q2Lines(Q2Form, Q2_save_and_run):
256
269
  self.controls.delete("save_and_run_actions_visible")
257
270
  self.system_controls.insert(2, self._save_and_run_control)
258
271
 
272
+ def select_panel(self):
273
+ first_row = last_row = self.current_row
274
+
275
+ def is_panel_start():
276
+ return self.r.column in ("/f", "/h", "/v")
277
+
278
+ def is_panel_end():
279
+ return self.r.column == "/"
280
+
281
+ def seek_end():
282
+ nonlocal last_row
283
+ while last_row < self.model.row_count():
284
+ self.set_grid_index(last_row)
285
+ # if is_panel_start():
286
+ # break
287
+ if is_panel_end():
288
+ break
289
+ last_row += 1
290
+
291
+ def seek_start():
292
+ in_panel = -1 if is_panel_end() else 0
293
+ nonlocal first_row
294
+ while first_row > 0:
295
+ self.set_grid_index(first_row)
296
+ if is_panel_start():
297
+ if in_panel == 0:
298
+ break
299
+ else:
300
+ in_panel -= 1
301
+ elif is_panel_end():
302
+ in_panel += 1
303
+ first_row -= 1
304
+
305
+ if not is_panel_start():
306
+ seek_start()
307
+ if not is_panel_end():
308
+ seek_end()
309
+ self.set_grid_selected_rows([x for x in range(first_row, last_row + 1)])
310
+
259
311
  def filler(self):
260
312
  if self.model.row_count() > 0:
261
313
  if q2AskYN("Lines list is not empty! Are you sure") != 2:
@@ -25,7 +25,7 @@ from q2rad.q2appmanager import AppManager
25
25
 
26
26
 
27
27
  def create_q2apps_sqlite(dist_folder):
28
- database_folder_name = "database"
28
+ database_folder_name = "databases"
29
29
  database_name_prefix = "app1"
30
30
  appsel = Q2AppSelect(f"{dist_folder}/q2apps.sqlite")
31
31
  appsel.db.insert(
@@ -613,18 +613,17 @@ class Q2RadApp(Q2App):
613
613
 
614
614
  if not self.frozen:
615
615
  # create update_q2rad.sh
616
- self.write_restore_file(
617
- "update_q2rad",
618
- ("" if "win32" in sys.platform else "#!/bin/bash\n")
619
- + ("q2rad\\scripts\\activate " if "win32" in sys.platform else "source q2rad/bin/activate")
620
- + "&& pip install --upgrade --force-reinstall q2gui"
621
- + "&& pip install --upgrade --force-reinstall q2db"
622
- + "&& pip install --upgrade --force-reinstall q2report"
623
- + "&& pip install --upgrade --force-reinstall q2terminal"
624
- + "&& pip install --upgrade --force-reinstall q2rad",
625
- )
616
+ self.write_reinstall_files()
626
617
 
627
618
  # create run_q2rad
619
+ self.write_run_files()
620
+ if sys.platform != "darwin":
621
+ if q2AskYN("Should I make a desktop shortcut?") == 2:
622
+ self.make_desktop_shortcut()
623
+ self.process_events()
624
+
625
+ def write_run_files(self):
626
+ if sys.prefix != sys.base_prefix: # in virtualenv
628
627
  self.write_restore_file(
629
628
  "run_q2rad",
630
629
  ("" if "win32" in sys.platform else "#!/bin/bash\n")
@@ -634,27 +633,56 @@ class Q2RadApp(Q2App):
634
633
  else "q2rad/bin/q2rad\n"
635
634
  ),
636
635
  )
637
- if "win32" in sys.platform:
638
- open("run_q2rad.vbs", "w").write(
639
- 'WScript.CreateObject("WScript.Shell").Run '
640
- '"q2rad\\scripts\\pythonw.exe -m q2rad", 0, false'
641
- )
636
+ elif os.path.isdir("python.loc"):
637
+ self.write_restore_file(
638
+ "run_q2rad",
639
+ ("" if "win32" in sys.platform else "#!/bin/bash\n")
640
+ + ("python.loc\\scripts\\q2rad" if "win32" in sys.platform else "python.loc/bin/q2rad\n"),
641
+ )
642
+ else:
643
+ self.write_restore_file(
644
+ "run_q2rad",
645
+ ("" if "win32" in sys.platform else "#!/bin/bash\n")
646
+ + ("pythonw.exe -m q2rad" if "win32" in sys.platform else "python -m q2rad\n"),
647
+ )
642
648
 
643
- open("make_shortcut.vbs", "w").write(
644
- 'Set oWS = WScript.CreateObject("WScript.Shell")\n'
645
- 'Set oLink = oWS.CreateShortcut(oWS.SpecialFolders("Desktop") & "\\q2RAD.lnk")\n'
646
- 'cu = WScript.CreateObject("Scripting.FileSystemObject").'
647
- "GetParentFolderName(WScript.ScriptFullName)\n"
648
- 'oLink.TargetPath = cu & "\\run_q2rad.vbs"\n'
649
- 'oLink.WorkingDirectory = cu & ""\n'
650
- 'oLink.Description = "q2RAD"\n'
651
- 'oLink.IconLocation = cu & "\\assets\\q2rad.ico"\n'
652
- "oLink.Save\n"
653
- )
654
- if sys.platform != "darwin":
655
- if q2AskYN("Should I make a desktop shortcut?") == 2:
656
- self.make_desktop_shortcut()
657
- self.process_events()
649
+ if "win32" in sys.platform:
650
+ open("run_q2rad.vbs", "w").write(
651
+ 'WScript.CreateObject("WScript.Shell").Run '
652
+ '"q2rad\\scripts\\pythonw.exe -m q2rad", 0, false'
653
+ )
654
+
655
+ open("make_shortcut.vbs", "w").write(
656
+ 'Set oWS = WScript.CreateObject("WScript.Shell")\n'
657
+ 'Set oLink = oWS.CreateShortcut(oWS.SpecialFolders("Desktop") & "\\q2RAD.lnk")\n'
658
+ 'cu = WScript.CreateObject("Scripting.FileSystemObject").'
659
+ "GetParentFolderName(WScript.ScriptFullName)\n"
660
+ 'oLink.TargetPath = cu & "\\run_q2rad.vbs"\n'
661
+ 'oLink.WorkingDirectory = cu & ""\n'
662
+ 'oLink.Description = "q2RAD"\n'
663
+ 'oLink.IconLocation = cu & "\\assets\\q2rad.ico"\n'
664
+ "oLink.Save\n"
665
+ )
666
+
667
+ def write_reinstall_files(self):
668
+ if sys.prefix != sys.base_prefix: # in virtualenv
669
+ pip_command = (
670
+ "q2rad\\scripts\\python -m " if "win32" in sys.platform else "q2rad/script/python -m "
671
+ )
672
+ elif os.path.isdir("python.loc"):
673
+ pip_command = "python.loc\\python -m " if "win32" in sys.platform else "python.loc/python -m "
674
+ else:
675
+ pip_command = "python -m " if "win32" in sys.platform else "python -m "
676
+
677
+ self.write_restore_file(
678
+ "update_q2rad",
679
+ ("" if "win32" in sys.platform else "#!/bin/bash\n")
680
+ + f"{pip_command} pip install --upgrade --force-reinstall q2gui"
681
+ + f"&&{pip_command} pip install --upgrade --force-reinstall q2db"
682
+ + f"&&{pip_command} pip install --upgrade --force-reinstall q2report"
683
+ + f"&&{pip_command} pip install --upgrade --force-reinstall q2terminal"
684
+ + f"&&{pip_command} pip install --upgrade --force-reinstall q2rad",
685
+ )
658
686
 
659
687
  def get_package_versions(self, package):
660
688
  response = open_url(f"https://pypi.python.org/pypi/{package}/json") # noqa F405
@@ -0,0 +1 @@
1
+ __version__ = "0.1.169"
@@ -1 +0,0 @@
1
- __version__ = "0.1.167"
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