psiutils 0.2.12__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.11'
1
+ __version__ = '0.2.14'
psiutils/buttons.py CHANGED
@@ -4,10 +4,12 @@ from tkinter import ttk
4
4
  from pathlib import Path
5
5
  from PIL import Image, ImageTk
6
6
 
7
- import psiutils.text as txt
7
+ from psiutils.text import Text
8
8
 
9
- from .constants import PAD, Pad
10
- from .widgets import enter_widget, clickable_widget, HAND
9
+ from psiutils.constants import PAD, Pad
10
+ from psiutils.widgets import enter_widget, clickable_widget, HAND
11
+
12
+ txt = Text()
11
13
 
12
14
 
13
15
  class IconButton(ttk.Frame):
psiutils/constants.py CHANGED
@@ -74,6 +74,7 @@ class Mode(Enum):
74
74
  EDIT = auto()
75
75
  DELETE = auto()
76
76
 
77
+
77
78
  class Status(Enum):
78
79
  YES = True
79
80
  NO = False
@@ -81,5 +82,7 @@ class Status(Enum):
81
82
  NULL = 0
82
83
  EXIT = 1
83
84
  OK = 2
84
- UPDATED = 3
85
- ERROR = 4
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/text.py CHANGED
@@ -1,52 +1,9 @@
1
- BUILD = 'Build'
2
- CANCEL = 'Cancel'
3
- CHECK = 'Check'
4
- CLEAR = 'Clear'
5
- CLOSE = 'Close'
6
- CODE = 'Code'
7
- COMPARE = 'Compare'
8
- CONFIG = 'Config'
9
- COPY = 'Copy'
10
- DELETE = 'Delete'
11
- DELETE_THESE_ITEMS = 'Are you sure you want to delete these item(s)?'
12
- DIFF = 'Diff'
13
- DONE = 'Done'
14
- EDIT = 'Edit'
15
- EVENT = 'Event'
16
- EXIT = 'Exit'
17
- HELP = 'Help'
18
- NEW = 'New'
19
- NEXT = 'Next'
20
- NO = 'No'
21
- NO_SUCH_FILE = 'no such file or directory'
22
- OK = 'OK'
23
- OPEN = 'Open'
24
- PAUSE = 'Pause'
25
- PREFERENCES = 'Preferences'
26
- PREVIOUS = 'Prev'
27
- PROCESS = 'Process'
28
- QUIT = 'Quit'
29
- REDO = 'Redo'
30
- REFRESH = 'Refresh'
31
- REPORT = 'Report'
32
- RENAME = 'Rename'
33
- RESET = 'Reset'
34
- REVERT = 'Revert'
35
- RUN = 'Run'
36
- SAVE = 'Save'
37
- SCRIPT = 'Script'
38
- SAVE_PDF = 'Save as PDF'
39
- SEARCH = 'Search'
40
- SEND = 'Send'
41
- START = 'Start'
42
- UPDATE = 'Update'
43
- UPGRADE = 'Upgrade'
44
- USE = 'Use'
45
- WINDOWS = 'Windows'
46
- YES = 'Yes'
1
+ """ Handle standard text for psiutils."""
47
2
 
3
+ from copy import copy
48
4
 
49
- strings = {
5
+
6
+ psi_strings = {
50
7
  'BUILD': 'Build',
51
8
  'CANCEL': 'Cancel',
52
9
  'CHECK': 'Check',
@@ -96,6 +53,8 @@ strings = {
96
53
  'YES': 'Yes',
97
54
  }
98
55
 
56
+ strings = copy(psi_strings)
57
+
99
58
 
100
59
  class Text():
101
60
  """Combines package level and psiutils strings."""
@@ -119,9 +78,15 @@ class Text():
119
78
  """Print out contents of `strings` and compare if
120
79
  a dict of strings is provided."""
121
80
  duplicates = 0
122
- overrides =0
81
+ overrides = 0
82
+ app_strings = 0
123
83
  if not compare:
124
84
  compare = {}
85
+
86
+ for key, item in compare.items():
87
+ if key not in strings:
88
+ strings[key] = item
89
+
125
90
  for item in sorted(list(strings)):
126
91
  output = f'{item:.<20} {strings[item]}'
127
92
  if item in compare:
@@ -129,6 +94,9 @@ class Text():
129
94
  output = (f'{output}, {compare[item]} '
130
95
  f'<{"-"*10} //override//')
131
96
  overrides += 1
97
+ elif item not in psi_strings:
98
+ output = f'{output} <{"="*10} //app string//'
99
+ app_strings += 1
132
100
  else:
133
101
  output = f'{output} <{"="*10} //duplicate//'
134
102
  duplicates += 1
@@ -141,3 +109,7 @@ class Text():
141
109
  if overrides:
142
110
  print()
143
111
  print(f'{overrides} overrides found')
112
+
113
+ if app_strings:
114
+ print()
115
+ print(f'{app_strings} application strings found')
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.12
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=MDWVRBs0IWHig-yP3jl_AM0VvBpaMmDN0nBK4Hl8Idk,22
6
- psiutils/buttons.py,sha256=gnrEn8qk42SGf7dpdFqWlnxQFivBULlCAdeUIBeQZgE,8585
7
- psiutils/constants.py,sha256=HUXNOy-V9zGkvWRfOFNttQlq9exFLPoRvPSAfSCeuIg,1366
5
+ psiutils/_version.py,sha256=r8iWhYU-gaJ9WVJc_-ZLY8sK6iebY4JbvDv_kfd67iA,22
6
+ psiutils/buttons.py,sha256=oqTNg1IckV1sr5d4-jD3QZW4B_Tz5TWTQUoPnvpDTwU,8618
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
51
- psiutils/text.py,sha256=HVJME2oUqeLZXCp2KaHg21vlp3CuhoP2T4T7ArqIxLs,3378
50
+ psiutils/messagebox.py,sha256=ODFodaDahAm31A8M4MVp9FXdhI0zhW8PZdUbBqbVQEY,4973
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.12.dist-info/WHEEL,sha256=pFCy50wRV2h7SjJ35YOsQUupaV45rMdgpNIvnXbG5bE,79
56
- psiutils-0.2.12.dist-info/METADATA,sha256=yOG5ZW3MhjSDhwwXtga_znea2tNVXE0jyPPjhrS_-6s,1982
57
- psiutils-0.2.12.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.8.19
2
+ Generator: uv 0.9.8
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any