psiutils 0.2.13__py3-none-any.whl → 0.2.14__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.14'
psiutils/constants.py CHANGED
@@ -82,6 +82,7 @@ class Status(Enum):
82
82
  NULL = 0
83
83
  EXIT = 1
84
84
  OK = 2
85
- UPDATED = 3
86
- ERROR = 4
87
- WARNING = 5
85
+ SUCCESS = 3
86
+ UPDATED = 4
87
+ ERROR = 5
88
+ WARNING = 6
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/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,11 +7,11 @@ 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 psiconfig import TomlConfig
13
+ from psiutils.text import Text
14
+ txt = Text()
14
15
 
15
16
  DEFAULT_GEOMETRY = '500x400'
16
17
 
@@ -28,6 +29,16 @@ def display_icon(root: tk.Tk, icon_file_path: str,
28
29
  print(f'Cannot find icon file: {icon_file_path}')
29
30
 
30
31
 
32
+ def resource_path(base: Path, relative_path: Path):
33
+ """ Get absolute path to resource, works for dev and for PyInstaller."""
34
+ try:
35
+ # PyInstaller creates a temp folder and stores path in _MEIPASS
36
+ base_path = sys._MEIPASS
37
+ except Exception:
38
+ base_path = Path(base).parent
39
+ return Path(base_path, relative_path)
40
+
41
+
31
42
  class Enum():
32
43
  def __init__(self, values: dict) -> None:
33
44
  self.values = invert(values)
@@ -75,6 +86,7 @@ def enable_frame(parent: tk.Frame, enable: bool = True) -> None:
75
86
  else:
76
87
  child.configure(state=state)
77
88
 
89
+
78
90
  def geometry(config: TomlConfig, file: Path, default: str = '') -> str:
79
91
  if not default:
80
92
  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.14
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,10 +1,10 @@
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
5
+ psiutils/_version.py,sha256=r8iWhYU-gaJ9WVJc_-ZLY8sK6iebY4JbvDv_kfd67iA,22
6
6
  psiutils/buttons.py,sha256=oqTNg1IckV1sr5d4-jD3QZW4B_Tz5TWTQUoPnvpDTwU,8618
7
- psiutils/constants.py,sha256=Me3oFf7R3VNsq3rZL9pyjRySLzyPYHOow6mNWivVnwo,1383
7
+ psiutils/constants.py,sha256=jGSfi2tQaJ32RLSBuRocX3UFSpC28BzOGiND0jq9PVs,1399
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
@@ -47,11 +47,11 @@ psiutils/images/icon-info.png,sha256=JFCbGkYfO1BD7VRYQXmTMjOePPRrwjkl-KSFHtKIBE4
47
47
  psiutils/images/icon-query.png,sha256=e18hqkew4eOxABvECKn7BGO2VTHTE-XLMWPSQfSW9dU,2808
48
48
  psiutils/known_paths.py,sha256=Ydhk-Ie_q827ti35Hru8YwUx5awdO2FEG845k1N0hPo,9543
49
49
  psiutils/menus.py,sha256=4pUHb3fEYzLnsftxdKB_NjlPryj_pu7WN5Iy5Quy9-M,1746
50
- psiutils/messagebox.py,sha256=14W4KzEg8Fi1OCiOX9zZvomoSqibAYNipQpa95Tco5M,4969
50
+ psiutils/messagebox.py,sha256=ODFodaDahAm31A8M4MVp9FXdhI0zhW8PZdUbBqbVQEY,4973
51
51
  psiutils/text.py,sha256=2q4whK-DjZZNOlTLt811bbaNGhg0T3MafSSPU2c5PMg,3048
52
52
  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,,
53
+ psiutils/utilities.py,sha256=UMk0qIcdlZjp_fShZwIj_HuWXp5Ur8JzHg-h6W8Tq4o,3369
54
+ psiutils/widgets.py,sha256=TOJKDEdYJetPZxFZohQGJsVX_k3E26-ChgSXqDeJ0Y4,11363
55
+ psiutils-0.2.14.dist-info/WHEEL,sha256=DpNsHFUm_gffZe1FgzmqwuqiuPC6Y-uBCzibcJcdupM,78
56
+ psiutils-0.2.14.dist-info/METADATA,sha256=WgNcA2uzkNkSieH2UQEbpGRsvpyAIe_IW7OTWFfVoEk,2109
57
+ psiutils-0.2.14.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: uv 0.9.7
2
+ Generator: uv 0.9.8
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any