psiutils 0.2.13__py3-none-any.whl → 0.2.15__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.
psiutils/_about_frame.py CHANGED
@@ -8,7 +8,9 @@ import markdown
8
8
  from psiutils.constants import PAD, Pad
9
9
  from psiutils.utilities import window_resize
10
10
 
11
- from psiutils import text as txt
11
+ from psiutils.text import Text
12
+
13
+ txt = Text()
12
14
 
13
15
  DEFAULT_GEOMETRY = '400x200'
14
16
  HISTORY_GEOMETRY = '800x750'
psiutils/_version.py CHANGED
@@ -1 +1 @@
1
- __version__ = '0.2.13'
1
+ __version__ = '0.2.15'
psiutils/buttons.py CHANGED
@@ -217,6 +217,7 @@ def enable_buttons(buttons: list[Button], enable: bool = True):
217
217
 
218
218
 
219
219
  icon_buttons = {
220
+ 'backup': (txt.BACKUP, 'backup'),
220
221
  'build': (txt.BUILD, 'build'),
221
222
  'check': (txt.CHECK, 'check'),
222
223
  'clear': (txt.CLEAR, 'clear'),
@@ -243,6 +244,9 @@ icon_buttons = {
243
244
  'rename': (txt.RENAME, 'rename'),
244
245
  'report': (txt.REPORT, 'report'),
245
246
  'reset': (txt.RESET, 'reset'),
247
+ 'restore': (txt.RESTORE, 'restore'),
248
+ 'restore_database': (txt.RESTORE, 'restore_database'),
249
+ 'restore_page': (txt.RESTORE, 'restore_page'),
246
250
  'revert': (txt.REVERT, 'revert'),
247
251
  'run': (txt.RUN, 'start'),
248
252
  'save': (txt.SAVE, 'save'),
psiutils/constants.py CHANGED
@@ -4,6 +4,9 @@ from enum import Enum, auto
4
4
  from .utilities import invert
5
5
  from .known_paths import get_documents_dir, get_downloads_dir
6
6
 
7
+ DEFAULT_GEOMETRY = '500x400'
8
+
9
+ # TODO is this needed with Status?
7
10
  DIALOG_STATUS: dict = {
8
11
  'yes': True,
9
12
  'no': False,
@@ -17,6 +20,7 @@ DIALOG_STATUS: dict = {
17
20
  }
18
21
  DIALOG_STATUS = invert(DIALOG_STATUS)
19
22
 
23
+ # TODO is this needed with Mode?
20
24
  MODES: dict[int, str] | dict[str, int] = {
21
25
  0: 'view',
22
26
  1: 'new',
@@ -25,6 +29,8 @@ MODES: dict[int, str] | dict[str, int] = {
25
29
  }
26
30
  MODES = invert(MODES)
27
31
 
32
+ DEFAULT_GEOMETRY = '500x400'
33
+
28
34
  # GUI
29
35
  PAD = 5
30
36
  PADR = (0, PAD)
@@ -82,6 +88,7 @@ class Status(Enum):
82
88
  NULL = 0
83
89
  EXIT = 1
84
90
  OK = 2
85
- UPDATED = 3
86
- ERROR = 4
87
- WARNING = 5
91
+ SUCCESS = 3
92
+ UPDATED = 4
93
+ ERROR = 5
94
+ WARNING = 6
Binary file
Binary file
Binary file
Binary file
psiutils/messagebox.py CHANGED
@@ -5,9 +5,11 @@ from tkinter import font
5
5
  from pathlib import Path
6
6
  from PIL import ImageTk, Image
7
7
 
8
- from psiutils.constants import PAD
8
+ from psiutils.constants import PAD, Status
9
9
 
10
- import psiutils.text as text
10
+ from psiutils.text import Text
11
+
12
+ txt = Text()
11
13
 
12
14
  icons = {
13
15
  'info': 'icon-info.png',
@@ -113,29 +115,29 @@ class MessageBox():
113
115
  def _get_buttons(self, frame: ttk.Frame) -> dict[str, ttk.Button]:
114
116
  return {
115
117
  'ok': ttk.Button(
116
- frame, text=text.OK, command=self._ok, underline=0),
118
+ frame, text=txt.OK, command=self._ok, underline=0),
117
119
  'yes': ttk.Button(
118
- frame, text=text.YES, command=self._yes, underline=0),
120
+ frame, text=txt.YES, command=self._yes, underline=0),
119
121
  'no': ttk.Button(
120
- frame, text=text.NO, command=self._no, underline=0),
122
+ frame, text=txt.NO, command=self._no, underline=0),
121
123
  'cancel': ttk.Button(
122
- frame, text=text.CANCEL, command=self._cancel, underline=0),
124
+ frame, text=txt.CANCEL, command=self._cancel, underline=0),
123
125
  }
124
126
 
125
127
  def _ok(self, *args) -> None:
126
- self.status = STATUS['cancel']
128
+ self.status = Status.OK
127
129
  self._dismiss()
128
130
 
129
131
  def _yes(self, *args) -> None:
130
- self.status = STATUS['yes']
132
+ self.status = Status.YES
131
133
  self._dismiss()
132
134
 
133
135
  def _no(self, *args) -> None:
134
- self.status = STATUS['no']
136
+ self.status = Status.NO
135
137
  self._dismiss()
136
138
 
137
139
  def _cancel(self, *args) -> None:
138
- self.status = STATUS['cancel']
140
+ self.status = Status.CANCEL
139
141
  self._dismiss()
140
142
 
141
143
  def _dismiss(self, *args) -> None:
psiutils/text.py CHANGED
@@ -38,6 +38,7 @@ psi_strings = {
38
38
  'REPORT': 'Report',
39
39
  'RENAME': 'Rename',
40
40
  'RESET': 'Reset',
41
+ 'RESTORE': 'Restore',
41
42
  'REVERT': 'Revert',
42
43
  'RUN': 'Run',
43
44
  'SAVE': 'Save',
psiutils/utilities.py CHANGED
@@ -1,4 +1,5 @@
1
1
  """Common methods for psiutils."""
2
+ import sys
2
3
  from pathlib import Path
3
4
  import tkinter as tk
4
5
  import ctypes
@@ -6,13 +7,12 @@ from typing import Any
6
7
  import platform
7
8
 
8
9
  from psiconfig import TomlConfig
9
- import psiutils.text as txt
10
-
11
- # Exposes psi_logger to other applications
12
10
  from psiutils._logger import psi_logger
13
11
  from psiutils._notify import _notify as notify
12
+ from psiutils.constants import DEFAULT_GEOMETRY
13
+ from psiutils.text import Text
14
14
 
15
- DEFAULT_GEOMETRY = '500x400'
15
+ txt = Text()
16
16
 
17
17
 
18
18
  def display_icon(root: tk.Tk, icon_file_path: str,
@@ -28,6 +28,16 @@ def display_icon(root: tk.Tk, icon_file_path: str,
28
28
  print(f'Cannot find icon file: {icon_file_path}')
29
29
 
30
30
 
31
+ def resource_path(base: Path, relative_path: Path):
32
+ """ Get absolute path to resource, works for dev and for PyInstaller."""
33
+ try:
34
+ # PyInstaller creates a temp folder and stores path in _MEIPASS
35
+ base_path = sys._MEIPASS
36
+ except Exception:
37
+ base_path = Path(base).parent
38
+ return Path(base_path, relative_path)
39
+
40
+
31
41
  class Enum():
32
42
  def __init__(self, values: dict) -> None:
33
43
  self.values = invert(values)
@@ -75,6 +85,7 @@ def enable_frame(parent: tk.Frame, enable: bool = True) -> None:
75
85
  else:
76
86
  child.configure(state=state)
77
87
 
88
+
78
89
  def geometry(config: TomlConfig, file: Path, default: str = '') -> str:
79
90
  if not default:
80
91
  default = DEFAULT_GEOMETRY
psiutils/widgets.py CHANGED
@@ -62,6 +62,7 @@ def get_styles() -> ttk.Style:
62
62
 
63
63
  style.configure('red-bg.TEntry', fieldbackground='red')
64
64
  style.configure('green-bg.TEntry', fieldbackground='green')
65
+ style.configure('blue-bg.TEntry', fieldbackground='blue')
65
66
  style.configure('orange-bg.TEntry', fieldbackground='orange')
66
67
  style.configure(
67
68
  'pale-umber-bg.TEntry', fieldbackground=COLOURS['pale-umber'])
@@ -71,6 +72,7 @@ def get_styles() -> ttk.Style:
71
72
  # Entries - foreground
72
73
  style.configure('red-fg.TEntry', foreground='red')
73
74
  style.configure('green-fg.TEntry', foreground='green')
75
+ style.configure('blue-fg.TEntry', foreground='blue')
74
76
  style.configure('orange-fg.TEntry', foreground='orange')
75
77
 
76
78
  # Frames
@@ -83,6 +85,8 @@ def get_styles() -> ttk.Style:
83
85
  # radiobuttons
84
86
  style.configure('red-fg.TRadiobutton', foreground='red')
85
87
  style.configure('green-fg.TRadiobutton', foreground='green')
88
+ style.configure('blue-fg.TRadiobutton', foreground='blue')
89
+ style.configure('orange-fg.TRadiobutton', foreground='orange')
86
90
 
87
91
  # Tree view
88
92
  style.map('Treeview',
@@ -1,17 +1,21 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: psiutils
3
- Version: 0.2.13
3
+ Version: 0.2.15
4
4
  Summary: Various TKinter utilities.
5
5
  Author: Jeff
6
6
  Author-email: Jeff <<jeffwatkins2000@gmail.com>>
7
+ Requires-Dist: appdirs>=1.4.4
7
8
  Requires-Dist: iniconfig>=2.1.0
8
9
  Requires-Dist: markdown>=3.8.2
9
10
  Requires-Dist: packaging>=25.0
10
11
  Requires-Dist: pillow>=11.3.0
11
12
  Requires-Dist: pluggy>=1.6.0
12
- Requires-Dist: psi-toml>=0.0.21
13
- Requires-Dist: psiconfig>=0.0.15
13
+ Requires-Dist: psi-toml>=0.0.12
14
+ Requires-Dist: psiconfig>=0.0.14
15
+ Requires-Dist: pycairo>=1.28.0
14
16
  Requires-Dist: pygments>=2.19.2
17
+ Requires-Dist: pygobject>=3.54.2
18
+ Requires-Dist: structlog>=25.4.0
15
19
  Requires-Dist: tkinterweb>=4.4.4
16
20
  Requires-Dist: tkinterweb-tkhtml>=1.1.1
17
21
  Requires-Dist: tomli>=2.2.1
@@ -1,13 +1,14 @@
1
1
  psiutils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- psiutils/_about_frame.py,sha256=xZQivwvZc-k8C-SkwQne-dBr4gavDAL_32fv8E-7Wt0,7644
2
+ psiutils/_about_frame.py,sha256=Ei9RMja36x2Xc9SecCXnqXd9EzDe1LIHq4ZDDbKtc_I,7656
3
3
  psiutils/_logger.py,sha256=9nXxKWUyu4xqIILjTSUKRAMOG4cFy_EGJTTo0FtUAGU,2859
4
4
  psiutils/_notify.py,sha256=rQfYxPxsSwAEJBNXaAZSNlRmZLWB1sah1E1Oja9y-mw,437
5
- psiutils/_version.py,sha256=BzaUqLuMDa5m8WXD6rxGwHtx-G5rl0QutUD88ULNrkQ,22
6
- psiutils/buttons.py,sha256=oqTNg1IckV1sr5d4-jD3QZW4B_Tz5TWTQUoPnvpDTwU,8618
7
- psiutils/constants.py,sha256=Me3oFf7R3VNsq3rZL9pyjRySLzyPYHOow6mNWivVnwo,1383
5
+ psiutils/_version.py,sha256=n8L-CG7GwxdcaK3gVXpLPrQnpjUiTjhwgxpdZpr4XUY,22
6
+ psiutils/buttons.py,sha256=vj-RCKKl4_kYisrMqPi8w56eXfRkbx1zze8oqgS4GjM,8807
7
+ psiutils/constants.py,sha256=-jgP8_QCw91o0F4hS5CzUpPfupqsYrQ8K-Q_NdORvyg,1527
8
8
  psiutils/drag_manager.py,sha256=L04GzKIinWXzGCawvTnn18F1AEt8PUPS1U-HqCVrh48,3470
9
9
  psiutils/errors.py,sha256=tAypFkpzpbeOppO9zKQimlnRVyr3sMPoiwh0yK3Yc88,562
10
10
  psiutils/icecream_init.py,sha256=ArKnRHGCyMfEwSykiHGdhBmX4JPhrgcpShii_GAPWLI,739
11
+ psiutils/icons/backup.png,sha256=kKL5xewG83RQMTr4piNf8SEPNlhHUUtqqcizBuwWU2U,717
11
12
  psiutils/icons/build.png,sha256=MgQS4yPxfa5EBXCF5gXu2S6vqjUsRBhR4S6vCzOtrzQ,1169
12
13
  psiutils/icons/cancel.png,sha256=O2YSv7wxSV5rhT1WiZ9McqO3pilCKNfZdJNwQceH87E,2168
13
14
  psiutils/icons/check.png,sha256=8KqO0lWJvhcbSx1KI8QKfCkwLsszzotL9iBrXfwyf1Q,748
@@ -33,6 +34,9 @@ psiutils/icons/refresh.png,sha256=r-WkScAbDbB15mXzZqEXgys-V1UkDDxRZHrssgTRh1c,21
33
34
  psiutils/icons/rename.png,sha256=nEBej5-3BaFi-y1oIgDXCVHkKXndwxu5RW-eCEgu5UY,549
34
35
  psiutils/icons/report.png,sha256=gyMzrZkl4QyVd9XsOpAdFZlw-al9J4PTpIBM3EssAyg,979
35
36
  psiutils/icons/reset.png,sha256=UJHvnseHeMJoPNCn-WydTnfX-Lrlp9tgSlcIq6jWUBg,1296
37
+ psiutils/icons/restore-database.png,sha256=ezBRAMVbAo9lbs_yPpWpdLxqUFOudiC7mlwNklOKR3A,625
38
+ psiutils/icons/restore-page.png,sha256=WiYVxAHFq0iV_PsCt_5meInbAGAOGOfoYsHM_bWILlY,621
39
+ psiutils/icons/restore.png,sha256=8XAPT_nD3yi5hUQG3OEW1QRQNKRKOdFV7nNIz4jO0RE,986
36
40
  psiutils/icons/revert.png,sha256=vWIyLx7dQfTOkI8igLmVtmV8hnBfIh089QmKRRobVmk,1268
37
41
  psiutils/icons/save.png,sha256=RSIfWkVE537tMgchS5VFmHughVQqkKMyjMLY0ccDy98,613
38
42
  psiutils/icons/script.png,sha256=CG5MYayO1X5O7q40byfMwya1_52rp8BYq-FWUDBG5fg,803
@@ -47,11 +51,11 @@ psiutils/images/icon-info.png,sha256=JFCbGkYfO1BD7VRYQXmTMjOePPRrwjkl-KSFHtKIBE4
47
51
  psiutils/images/icon-query.png,sha256=e18hqkew4eOxABvECKn7BGO2VTHTE-XLMWPSQfSW9dU,2808
48
52
  psiutils/known_paths.py,sha256=Ydhk-Ie_q827ti35Hru8YwUx5awdO2FEG845k1N0hPo,9543
49
53
  psiutils/menus.py,sha256=4pUHb3fEYzLnsftxdKB_NjlPryj_pu7WN5Iy5Quy9-M,1746
50
- psiutils/messagebox.py,sha256=14W4KzEg8Fi1OCiOX9zZvomoSqibAYNipQpa95Tco5M,4969
51
- psiutils/text.py,sha256=2q4whK-DjZZNOlTLt811bbaNGhg0T3MafSSPU2c5PMg,3048
54
+ psiutils/messagebox.py,sha256=ODFodaDahAm31A8M4MVp9FXdhI0zhW8PZdUbBqbVQEY,4973
55
+ psiutils/text.py,sha256=Q8f3k-2Op0erGW0AqXptVErGBUaFl9nFNYwmYnp3a3c,3074
52
56
  psiutils/treeview.py,sha256=jtSzLWrnFIBDWV5YhWNRoZwgW-Kj8_7XVqZyusr-riQ,2826
53
- psiutils/utilities.py,sha256=bAoaYMumo0U8kz4pcPThYOY5Z3tPFe-a76Nhbwsd4lk,3005
54
- psiutils/widgets.py,sha256=ooGAy0IU3ct9aeqnBqMUr2AVyqg_zKHG8Fm9Gm-Wn5Y,11114
55
- psiutils-0.2.13.dist-info/WHEEL,sha256=5w2T7AS2mz1-rW9CNagNYWRCaB0iQqBMYLwKdlgiR4Q,78
56
- psiutils-0.2.13.dist-info/METADATA,sha256=Cm932l43m8MzC-KboOHPzqpxupHS7ZJDrXeU156BN2U,1982
57
- psiutils-0.2.13.dist-info/RECORD,,
57
+ psiutils/utilities.py,sha256=hBntrigp7WiuzRoGGhS96QVE-7pF2OdYT882jwMTrlQ,3355
58
+ psiutils/widgets.py,sha256=TOJKDEdYJetPZxFZohQGJsVX_k3E26-ChgSXqDeJ0Y4,11363
59
+ psiutils-0.2.15.dist-info/WHEEL,sha256=YUH1mBqsx8Dh2cQG2rlcuRYUhJddG9iClegy4IgnHik,79
60
+ psiutils-0.2.15.dist-info/METADATA,sha256=ja3DXZwdpSkhTKERDJ3vEq_OXKaddvq_-JRdrKNmtYU,2109
61
+ psiutils-0.2.15.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: uv 0.9.7
2
+ Generator: uv 0.9.11
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any