psiutils 0.2.32__tar.gz → 0.2.34__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.
Files changed (114) hide show
  1. {psiutils-0.2.32 → psiutils-0.2.34}/PKG-INFO +1 -2
  2. {psiutils-0.2.32 → psiutils-0.2.34}/pyproject.toml +1 -2
  3. psiutils-0.2.34/src/psiutils/_version.py +1 -0
  4. {psiutils-0.2.32 → psiutils-0.2.34}/src/psiutils/buttons.py +103 -98
  5. psiutils-0.2.34/src/psiutils/icons/backup.png +0 -0
  6. psiutils-0.2.34/src/psiutils/icons/build.png +0 -0
  7. psiutils-0.2.34/src/psiutils/icons/cancel.png +0 -0
  8. psiutils-0.2.34/src/psiutils/icons/check.png +0 -0
  9. psiutils-0.2.34/src/psiutils/icons/checkbox_checked.png +0 -0
  10. psiutils-0.2.34/src/psiutils/icons/checkbox_unchecked.png +0 -0
  11. psiutils-0.2.34/src/psiutils/icons/clear.png +0 -0
  12. psiutils-0.2.34/src/psiutils/icons/code.png +0 -0
  13. psiutils-0.2.34/src/psiutils/icons/compare.png +0 -0
  14. psiutils-0.2.34/src/psiutils/icons/copy_clipboard.png +0 -0
  15. psiutils-0.2.34/src/psiutils/icons/copy_docs.png +0 -0
  16. psiutils-0.2.34/src/psiutils/icons/delete.png +0 -0
  17. psiutils-0.2.34/src/psiutils/icons/diff.png +0 -0
  18. psiutils-0.2.34/src/psiutils/icons/done.png +0 -0
  19. psiutils-0.2.34/src/psiutils/icons/download.png +0 -0
  20. psiutils-0.2.34/src/psiutils/icons/edit.png +0 -0
  21. psiutils-0.2.34/src/psiutils/icons/gear.png +0 -0
  22. psiutils-0.2.34/src/psiutils/icons/help.png +0 -0
  23. psiutils-0.2.34/src/psiutils/icons/new.png +0 -0
  24. psiutils-0.2.34/src/psiutils/icons/next.png +0 -0
  25. psiutils-0.2.34/src/psiutils/icons/open.png +0 -0
  26. psiutils-0.2.34/src/psiutils/icons/pause.png +0 -0
  27. psiutils-0.2.34/src/psiutils/icons/preferences.png +0 -0
  28. psiutils-0.2.34/src/psiutils/icons/previous.png +0 -0
  29. psiutils-0.2.34/src/psiutils/icons/process.png +0 -0
  30. psiutils-0.2.34/src/psiutils/icons/redo.png +0 -0
  31. psiutils-0.2.34/src/psiutils/icons/refresh.png +0 -0
  32. psiutils-0.2.34/src/psiutils/icons/rename.png +0 -0
  33. psiutils-0.2.34/src/psiutils/icons/report.png +0 -0
  34. psiutils-0.2.34/src/psiutils/icons/reset.png +0 -0
  35. psiutils-0.2.34/src/psiutils/icons/restore.png +0 -0
  36. psiutils-0.2.34/src/psiutils/icons/restore_database.png +0 -0
  37. psiutils-0.2.34/src/psiutils/icons/restore_page.png +0 -0
  38. psiutils-0.2.34/src/psiutils/icons/revert.png +0 -0
  39. psiutils-0.2.34/src/psiutils/icons/run.png +0 -0
  40. psiutils-0.2.34/src/psiutils/icons/save.png +0 -0
  41. psiutils-0.2.34/src/psiutils/icons/script.png +0 -0
  42. psiutils-0.2.34/src/psiutils/icons/search.png +0 -0
  43. psiutils-0.2.34/src/psiutils/icons/send.png +0 -0
  44. psiutils-0.2.34/src/psiutils/icons/start.png +0 -0
  45. psiutils-0.2.34/src/psiutils/icons/update.png +0 -0
  46. psiutils-0.2.34/src/psiutils/icons/upgrade.png +0 -0
  47. psiutils-0.2.34/src/psiutils/icons/upload.png +0 -0
  48. psiutils-0.2.34/src/psiutils/icons/windows.png +0 -0
  49. psiutils-0.2.34/src/psiutils/text.py +125 -0
  50. {psiutils-0.2.32 → psiutils-0.2.34}/src/psiutils/treeview.py +2 -2
  51. psiutils-0.2.32/src/psiutils/_version.py +0 -1
  52. psiutils-0.2.32/src/psiutils/icons/backup.png +0 -0
  53. psiutils-0.2.32/src/psiutils/icons/build.png +0 -0
  54. psiutils-0.2.32/src/psiutils/icons/cancel.png +0 -0
  55. psiutils-0.2.32/src/psiutils/icons/check.png +0 -0
  56. psiutils-0.2.32/src/psiutils/icons/checkbox_checked.png +0 -0
  57. psiutils-0.2.32/src/psiutils/icons/checkbox_unchecked.png +0 -0
  58. psiutils-0.2.32/src/psiutils/icons/clear.png +0 -0
  59. psiutils-0.2.32/src/psiutils/icons/code.png +0 -0
  60. psiutils-0.2.32/src/psiutils/icons/compare.png +0 -0
  61. psiutils-0.2.32/src/psiutils/icons/copy_clipboard.png +0 -0
  62. psiutils-0.2.32/src/psiutils/icons/copy_docs.png +0 -0
  63. psiutils-0.2.32/src/psiutils/icons/delete.png +0 -0
  64. psiutils-0.2.32/src/psiutils/icons/diff.png +0 -0
  65. psiutils-0.2.32/src/psiutils/icons/done.png +0 -0
  66. psiutils-0.2.32/src/psiutils/icons/download.png +0 -0
  67. psiutils-0.2.32/src/psiutils/icons/edit.png +0 -0
  68. psiutils-0.2.32/src/psiutils/icons/gear.png +0 -0
  69. psiutils-0.2.32/src/psiutils/icons/new.png +0 -0
  70. psiutils-0.2.32/src/psiutils/icons/next.png +0 -0
  71. psiutils-0.2.32/src/psiutils/icons/open.png +0 -0
  72. psiutils-0.2.32/src/psiutils/icons/pause.png +0 -0
  73. psiutils-0.2.32/src/psiutils/icons/preferences.png +0 -0
  74. psiutils-0.2.32/src/psiutils/icons/previous.png +0 -0
  75. psiutils-0.2.32/src/psiutils/icons/process.png +0 -0
  76. psiutils-0.2.32/src/psiutils/icons/redo.png +0 -0
  77. psiutils-0.2.32/src/psiutils/icons/refresh.png +0 -0
  78. psiutils-0.2.32/src/psiutils/icons/rename.png +0 -0
  79. psiutils-0.2.32/src/psiutils/icons/report.png +0 -0
  80. psiutils-0.2.32/src/psiutils/icons/reset.png +0 -0
  81. psiutils-0.2.32/src/psiutils/icons/restore.png +0 -0
  82. psiutils-0.2.32/src/psiutils/icons/restore_database.png +0 -0
  83. psiutils-0.2.32/src/psiutils/icons/restore_page.png +0 -0
  84. psiutils-0.2.32/src/psiutils/icons/revert.png +0 -0
  85. psiutils-0.2.32/src/psiutils/icons/save.png +0 -0
  86. psiutils-0.2.32/src/psiutils/icons/script.png +0 -0
  87. psiutils-0.2.32/src/psiutils/icons/search.png +0 -0
  88. psiutils-0.2.32/src/psiutils/icons/send.png +0 -0
  89. psiutils-0.2.32/src/psiutils/icons/start.png +0 -0
  90. psiutils-0.2.32/src/psiutils/icons/update.png +0 -0
  91. psiutils-0.2.32/src/psiutils/icons/upgrade.png +0 -0
  92. psiutils-0.2.32/src/psiutils/icons/upload.png +0 -0
  93. psiutils-0.2.32/src/psiutils/icons/windows.png +0 -0
  94. psiutils-0.2.32/src/psiutils/text.py +0 -123
  95. {psiutils-0.2.32 → psiutils-0.2.34}/README.md +0 -0
  96. {psiutils-0.2.32 → psiutils-0.2.34}/src/psiutils/__init__.py +0 -0
  97. {psiutils-0.2.32 → psiutils-0.2.34}/src/psiutils/_about_frame.py +0 -0
  98. {psiutils-0.2.32 → psiutils-0.2.34}/src/psiutils/_logger.py +0 -0
  99. {psiutils-0.2.32 → psiutils-0.2.34}/src/psiutils/_notify.py +0 -0
  100. {psiutils-0.2.32 → psiutils-0.2.34}/src/psiutils/_scrolling_canvas.py +0 -0
  101. {psiutils-0.2.32 → psiutils-0.2.34}/src/psiutils/constants.py +0 -0
  102. {psiutils-0.2.32 → psiutils-0.2.34}/src/psiutils/date_picker.py +0 -0
  103. {psiutils-0.2.32 → psiutils-0.2.34}/src/psiutils/drag_manager.py +0 -0
  104. {psiutils-0.2.32 → psiutils-0.2.34}/src/psiutils/errors.py +0 -0
  105. {psiutils-0.2.32 → psiutils-0.2.34}/src/psiutils/icecream_init.py +0 -0
  106. {psiutils-0.2.32 → psiutils-0.2.34}/src/psiutils/icons/convert.png +0 -0
  107. {psiutils-0.2.32 → psiutils-0.2.34}/src/psiutils/images/icon-error.png +0 -0
  108. {psiutils-0.2.32 → psiutils-0.2.34}/src/psiutils/images/icon-info.png +0 -0
  109. {psiutils-0.2.32 → psiutils-0.2.34}/src/psiutils/images/icon-query.png +0 -0
  110. {psiutils-0.2.32 → psiutils-0.2.34}/src/psiutils/known_paths.py +0 -0
  111. {psiutils-0.2.32 → psiutils-0.2.34}/src/psiutils/menus.py +0 -0
  112. {psiutils-0.2.32 → psiutils-0.2.34}/src/psiutils/messagebox.py +0 -0
  113. {psiutils-0.2.32 → psiutils-0.2.34}/src/psiutils/utilities.py +0 -0
  114. {psiutils-0.2.32 → psiutils-0.2.34}/src/psiutils/widgets.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: psiutils
3
- Version: 0.2.32
3
+ Version: 0.2.34
4
4
  Summary: Various TKinter utilities.
5
5
  Author: Jeff
6
6
  Author-email: Jeff <<jeffwatkins2000@gmail.com>>
@@ -14,7 +14,6 @@ Requires-Dist: psi-toml>=0.0.12
14
14
  Requires-Dist: psiconfig>=0.0.14
15
15
  Requires-Dist: pycairo>=1.28.0
16
16
  Requires-Dist: pygments>=2.19.2
17
- Requires-Dist: pygobject>=3.54.2
18
17
  Requires-Dist: pytest>=9.0.2
19
18
  Requires-Dist: structlog>=25.4.0
20
19
  Requires-Dist: tkcalendar>=1.6.1
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "psiutils"
3
- version = "0.2.32"
3
+ version = "0.2.34"
4
4
  description = "Various TKinter utilities."
5
5
  authors = [{name = "Jeff", "email" = "<jeffwatkins2000@gmail.com>"}]
6
6
  requires-python = '>= 3.10, < 3.13'
@@ -19,7 +19,6 @@ dependencies = [
19
19
  "psiconfig>=0.0.14",
20
20
  "pycairo>=1.28.0",
21
21
  "pygments>=2.19.2",
22
- "pygobject>=3.54.2",
23
22
  "pytest>=9.0.2",
24
23
  "structlog>=25.4.0",
25
24
  "tkcalendar>=1.6.1",
@@ -0,0 +1 @@
1
+ __version__ = '0.2.34'
@@ -1,4 +1,5 @@
1
1
  """Button class for Tkinter applications."""
2
+
2
3
  import tkinter as tk
3
4
  from tkinter import ttk
4
5
  from pathlib import Path
@@ -14,16 +15,17 @@ txt = Text()
14
15
 
15
16
  class IconButton(ttk.Frame):
16
17
  def __init__(
17
- self,
18
- master,
19
- button_text,
20
- icon,
21
- command=None,
22
- dimmable: bool = False,
23
- sticky: str = '',
24
- icon_path: str = '',
25
- **kwargs):
26
- super().__init__(master, borderwidth=1, relief='raised', **kwargs)
18
+ self,
19
+ master,
20
+ button_text,
21
+ icon,
22
+ command=None,
23
+ dimmable: bool = False,
24
+ sticky: str = "",
25
+ icon_path: str = "",
26
+ **kwargs,
27
+ ):
28
+ super().__init__(master, borderwidth=1, relief="raised", **kwargs)
27
29
  self.command = command
28
30
  self._state = tk.NORMAL
29
31
  self.text = button_text
@@ -31,12 +33,13 @@ class IconButton(ttk.Frame):
31
33
 
32
34
  # Icon and text
33
35
  if not icon_path:
34
- icon_path = f'{Path(__file__).parent}/icons/'
35
- image = Image.open(f'{icon_path}{icon}.png').resize((16, 16))
36
+ icon_path = f"{Path(__file__).parent}/icons/"
37
+ image = Image.open(f"{icon_path}{icon}.png").resize((16, 16))
36
38
  photo_image = ImageTk.PhotoImage(image)
37
39
 
38
40
  self.button_label = ttk.Label(
39
- self, text=button_text, image=photo_image, compound=tk.LEFT)
41
+ self, text=button_text, image=photo_image, compound=tk.LEFT
42
+ )
40
43
  self.button_label.image = photo_image # Prevent garbage collection
41
44
  self.button_label.pack(padx=(3, 5), pady=5)
42
45
  self.widget = self.button_label
@@ -48,7 +51,7 @@ class IconButton(ttk.Frame):
48
51
  self.dimmable = dimmable
49
52
 
50
53
  def __repr__(self) -> str:
51
- return f'IconButton: {self.text} {self.icon}'
54
+ return f"IconButton: {self.text} {self.icon}"
52
55
 
53
56
  def state(self, *args, **kwargs) -> dict:
54
57
  return self._state
@@ -65,14 +68,14 @@ class IconButton(ttk.Frame):
65
68
 
66
69
  def bind_widgets(self):
67
70
  for widget in (self, self.button_label):
68
- widget.bind('<Button-1>', self._on_click)
69
- widget.bind('<Enter>', self._enter_button)
70
- widget.bind('<Leave>', lambda e: self.config(relief='raised'))
71
+ widget.bind("<Button-1>", self._on_click)
72
+ widget.bind("<Enter>", self._enter_button)
73
+ widget.bind("<Leave>", lambda e: self.config(relief="raised"))
71
74
 
72
75
  def _enter_button(self, event) -> None:
73
76
  if self._state == tk.DISABLED:
74
77
  return
75
- self.config(relief='sunken')
78
+ self.config(relief="sunken")
76
79
  event.widget.winfo_toplevel().config(cursor=HAND)
77
80
 
78
81
  def _on_click(self, *args):
@@ -84,12 +87,12 @@ class IconButton(ttk.Frame):
84
87
 
85
88
  class Button(ttk.Button):
86
89
  def __init__(
87
- self,
88
- *args,
89
- sticky: str = '',
90
- dimmable: bool = False,
91
- **kwargs: dict,
92
- ) -> None:
90
+ self,
91
+ *args,
92
+ sticky: str = "",
93
+ dimmable: bool = False,
94
+ **kwargs: dict,
95
+ ) -> None:
93
96
  super().__init__(*args, **kwargs)
94
97
 
95
98
  self.sticky = sticky
@@ -97,26 +100,24 @@ class Button(ttk.Button):
97
100
 
98
101
  def enable(self, enable: bool = True) -> None:
99
102
  state = tk.NORMAL if enable else tk.DISABLED
100
- self['state'] = state
103
+ self["state"] = state
101
104
 
102
105
  def disable(self, disable: bool = True) -> None:
103
106
  state = tk.DISABLED if disable else tk.NORMAL
104
- self['state'] = state
107
+ self["state"] = state
105
108
 
106
109
 
107
110
  class ButtonFrame(ttk.Frame):
108
111
  def __init__(
109
- self,
110
- master: tk.Frame,
111
- orientation: str = tk.HORIZONTAL,
112
- **kwargs: dict) -> None:
112
+ self, master: tk.Frame, orientation: str = tk.HORIZONTAL, **kwargs: dict
113
+ ) -> None:
113
114
  super().__init__(master, **kwargs)
114
115
  self._buttons = []
115
116
  self._enabled = False
116
117
  self.orientation = orientation
117
118
 
118
- if 'enabled' in kwargs:
119
- self._enabled = kwargs['enabled']
119
+ if "enabled" in kwargs:
120
+ self._enabled = kwargs["enabled"]
120
121
 
121
122
  self.icon_buttons = {
122
123
  name: IconButton(self, button[0], button[1])
@@ -124,10 +125,11 @@ class ButtonFrame(ttk.Frame):
124
125
  }
125
126
 
126
127
  def icon_button(
127
- self,
128
- id_: str,
129
- command: object = None,
130
- dimmable: bool = False,) -> IconButton:
128
+ self,
129
+ id_: str,
130
+ command: object = None,
131
+ dimmable: bool = False,
132
+ ) -> IconButton:
131
133
  button = self.icon_buttons[id_]
132
134
  button.dimmable = dimmable
133
135
  button.command = command
@@ -154,8 +156,8 @@ class ButtonFrame(ttk.Frame):
154
156
  def enabled(self, value: bool) -> None:
155
157
  self._enabled = value
156
158
  state = tk.NORMAL if value else tk.DISABLED
157
- for button in self. buttons:
158
- button.widget['state'] = state
159
+ for button in self.buttons:
160
+ button.widget["state"] = state
159
161
 
160
162
  def enable(self, enable: bool = True) -> None:
161
163
  self._enabled = enable
@@ -166,7 +168,7 @@ class ButtonFrame(ttk.Frame):
166
168
  self._enable_buttons(self.buttons, False)
167
169
 
168
170
  def _vertical_buttons(self) -> None:
169
- self.rowconfigure(len(self.buttons)-1, weight=1)
171
+ self.rowconfigure(len(self.buttons) - 1, weight=1)
170
172
  for row, button in enumerate(self.buttons):
171
173
  pady = PAD
172
174
  if row == 0:
@@ -180,7 +182,7 @@ class ButtonFrame(ttk.Frame):
180
182
  clickable_widget(button)
181
183
 
182
184
  def _horizontal_buttons(self) -> None:
183
- self.columnconfigure(len(self.buttons)-1, weight=1)
185
+ self.columnconfigure(len(self.buttons) - 1, weight=1)
184
186
  for col, button in enumerate(self.buttons):
185
187
  padx = PAD
186
188
  if col == 0:
@@ -199,8 +201,8 @@ class ButtonFrame(ttk.Frame):
199
201
  for button in buttons:
200
202
  if button.dimmable:
201
203
  if isinstance(button, Button):
202
- button['state'] = state
203
- button.bind('<Enter>', enter_widget)
204
+ button["state"] = state
205
+ button.bind("<Enter>", enter_widget)
204
206
  elif isinstance(button, IconButton):
205
207
  if enable:
206
208
  button.enable()
@@ -212,55 +214,57 @@ def enable_buttons(buttons: list[Button], enable: bool = True):
212
214
  state = tk.NORMAL if enable else tk.DISABLED
213
215
  for button in buttons:
214
216
  if button.dimmable:
215
- button['state'] = state
216
- button.bind('<Enter>', enter_widget)
217
+ button["state"] = state
218
+ button.bind("<Enter>", enter_widget)
217
219
 
218
220
 
219
221
  icon_buttons = {
220
- 'backup': (txt.BACKUP, 'backup'),
221
- 'build': (txt.BUILD, 'build'),
222
- 'check': (txt.CHECK, 'check'),
223
- 'clear': (txt.CLEAR, 'clear'),
224
- 'close': (txt.CLOSE, 'cancel'),
225
- 'code': (txt.CODE, 'code'),
226
- 'compare': (txt.COMPARE, 'compare'),
227
- 'config': (txt.CONFIG, 'gear'),
228
- 'convert': (txt.CONVERT, 'convert'),
229
- 'copy_docs': (txt.COPY, 'copy_docs'),
230
- 'copy_clipboard': (txt.COPY, 'copy_clipboard'),
231
- 'delete': (txt.DELETE, 'delete'),
232
- 'download': (txt.DOWNLOAD, 'download'),
233
- 'diff': (txt.DIFF, 'diff'),
234
- 'done': (txt.DONE, 'done'),
235
- 'edit': (txt.EDIT, 'edit'),
236
- 'exit': (txt.EXIT, 'cancel'),
237
- 'new': (txt.NEW, 'new'),
238
- 'next': (txt.NEXT, 'next'),
239
- 'open': (txt.OPEN, 'open'),
240
- 'pause': (txt.PAUSE, 'pause'),
241
- 'preferences': (txt.PREFERENCES, 'preferences'),
242
- 'previous': (txt.PREVIOUS, 'previous'),
243
- 'process': (txt.PROCESS, 'process'),
244
- 'redo': (txt.REDO, 'redo'),
245
- 'refresh': (txt.REFRESH, 'refresh'),
246
- 'rename': (txt.RENAME, 'rename'),
247
- 'report': (txt.REPORT, 'report'),
248
- 'reset': (txt.RESET, 'reset'),
249
- 'restore': (txt.RESTORE, 'restore'),
250
- 'restore_database': (txt.RESTORE, 'restore_database'),
251
- 'restore_page': (txt.RESTORE, 'restore_page'),
252
- 'revert': (txt.REVERT, 'revert'),
253
- 'run': (txt.RUN, 'start'),
254
- 'save': (txt.SAVE, 'save'),
255
- 'script': (txt.SCRIPT, 'script'),
256
- 'search': (txt.SEARCH, 'search'),
257
- 'send': (txt.SEND, 'send'),
258
- 'start': (txt.START, 'start'),
259
- 'update': (txt.UPDATE, 'update'),
260
- 'upgrade': (txt.UPGRADE, 'upgrade'),
261
- 'upload': (txt.UPLOAD, 'upload'),
262
- 'use': (txt.USE, 'done'),
263
- 'windows': (txt.WINDOWS, 'windows'),
222
+ "backup": (txt.BACKUP, "backup"),
223
+ "build": (txt.BUILD, "build"),
224
+ "check": (txt.CHECK, "check"),
225
+ "clear": (txt.CLEAR, "clear"),
226
+ "close": (txt.CLOSE, "cancel"),
227
+ "code": (txt.CODE, "code"),
228
+ "compare": (txt.COMPARE, "compare"),
229
+ "config": (txt.CONFIG, "gear"),
230
+ "convert": (txt.CONVERT, "convert"),
231
+ "copy_docs": (txt.COPY, "copy_docs"),
232
+ "copy_clipboard": (txt.COPY, "copy_clipboard"),
233
+ "delete": (txt.DELETE, "delete"),
234
+ "download": (txt.DOWNLOAD, "download"),
235
+ "diff": (txt.DIFF, "diff"),
236
+ "done": (txt.DONE, "done"),
237
+ "edit": (txt.EDIT, "edit"),
238
+ "exit": (txt.EXIT, "cancel"),
239
+ "help": (txt.HELP, "help"),
240
+ "new": (txt.NEW, "new"),
241
+ "next": (txt.NEXT, "next"),
242
+ "open": (txt.OPEN, "open"),
243
+ "pause": (txt.PAUSE, "pause"),
244
+ "preferences": (txt.PREFERENCES, "preferences"),
245
+ "previous": (txt.PREVIOUS, "previous"),
246
+ "process": (txt.PROCESS, "process"),
247
+ "redo": (txt.REDO, "redo"),
248
+ "refresh": (txt.REFRESH, "refresh"),
249
+ "rename": (txt.RENAME, "rename"),
250
+ "report": (txt.REPORT, "report"),
251
+ "reset": (txt.RESET, "reset"),
252
+ "restore": (txt.RESTORE, "restore"),
253
+ "restore_database": (txt.RESTORE, "restore_database"),
254
+ "restore_page": (txt.RESTORE, "restore_page"),
255
+ "revert": (txt.REVERT, "revert"),
256
+ "run": (txt.RUN, "start"),
257
+ "save": (txt.SAVE, "save"),
258
+ "script": (txt.SCRIPT, "script"),
259
+ "search": (txt.SEARCH, "search"),
260
+ "send": (txt.SEND, "send"),
261
+ "start": (txt.START, "start"),
262
+ "undo": (txt.UNDO, "revert"),
263
+ "update": (txt.UPDATE, "update"),
264
+ "upgrade": (txt.UPGRADE, "upgrade"),
265
+ "upload": (txt.UPLOAD, "upload"),
266
+ "use": (txt.USE, "done"),
267
+ "windows": (txt.WINDOWS, "windows"),
264
268
  }
265
269
 
266
270
 
@@ -268,16 +272,17 @@ def list_icon_buttons() -> None:
268
272
  """List of icon_button."""
269
273
  name_length, text_length, icon_length = 15, 10, 15
270
274
 
271
- print(
272
- (f'{"name":<{name_length}} '
273
- f'{"text":<{text_length}} '
274
- f'{"icon":<{icon_length}}'))
275
+ print((f"{'name':<{name_length}} {'text':<{text_length}} {'icon':<{icon_length}}"))
275
276
 
276
- print(f'{"-"*name_length:<{name_length}} '
277
- f'{"-"*text_length:<{text_length}} '
278
- f'{"-"*icon_length:<{icon_length}}')
277
+ print(
278
+ f"{'-' * name_length:<{name_length}} "
279
+ f"{'-' * text_length:<{text_length}} "
280
+ f"{'-' * icon_length:<{icon_length}}"
281
+ )
279
282
 
280
283
  for name, button in icon_buttons.items():
281
- print(f'{name:<{name_length}} '
282
- f'{button[0]:<{text_length}} '
283
- f'{button[1]:<{icon_length}}')
284
+ print(
285
+ f"{name:<{name_length}} "
286
+ f"{button[0]:<{text_length}} "
287
+ f"{button[1]:<{icon_length}}"
288
+ )
@@ -0,0 +1,125 @@
1
+ """Handle standard text for psiutils."""
2
+
3
+ from copy import copy
4
+
5
+
6
+ psi_strings = {
7
+ "BACKUP": "Backup",
8
+ "BUILD": "Build",
9
+ "CANCEL": "Cancel",
10
+ "CHECK": "Check",
11
+ "CLEAR": "Clear",
12
+ "CLOSE": "Close",
13
+ "CODE": "Code",
14
+ "COMPARE": "Compare",
15
+ "CONFIG": "Config",
16
+ "CONVERT": "Convert",
17
+ "COPY": "Copy",
18
+ "DECREMENT_ARROW": "▼",
19
+ "DELETE": "Delete",
20
+ "DELETE_THESE_ITEMS": "Are you sure you want to delete these item(s)?",
21
+ "DIFF": "Diff",
22
+ "DONE": "Done",
23
+ "DOWNLOAD": "Download",
24
+ "EDIT": "Edit",
25
+ "ELLIPSIS": " ...",
26
+ "EVENT": "Event",
27
+ "EXIT": "Exit",
28
+ "HELP": "Help",
29
+ "INCREMENT_ARROW": "▲",
30
+ "LOGS": "Logs",
31
+ "NEW": "New",
32
+ "NEXT": "Next",
33
+ "NO": "No",
34
+ "NO_SUCH_FILE": "no such file or directory",
35
+ "OK": "OK",
36
+ "OPEN": "Open",
37
+ "PAUSE": "Pause",
38
+ "PREFERENCES": "Preferences",
39
+ "PREVIOUS": "Prev",
40
+ "PROCESS": "Process",
41
+ "QUIT": "Quit",
42
+ "REDO": "Redo",
43
+ "REFRESH": "Refresh",
44
+ "REPORT": "Report",
45
+ "RENAME": "Rename",
46
+ "RESET": "Reset",
47
+ "RESTORE": "Restore",
48
+ "REVERT": "Revert",
49
+ "RUN": "Run",
50
+ "SAVE": "Save",
51
+ "SCRIPT": "Script",
52
+ "SAVE_PDF": "Save as PDF",
53
+ "SEARCH": "Search",
54
+ "SEND": "Send",
55
+ "START": "Start",
56
+ "UNDO": "Undo",
57
+ "UPDATE": "Update",
58
+ "UPGRADE": "Upgrade",
59
+ "UPLOAD": "Upload",
60
+ "USE": "Use",
61
+ "WINDOWS": "Windows",
62
+ "YES": "Yes",
63
+ }
64
+
65
+ strings = copy(psi_strings)
66
+
67
+
68
+ class Text:
69
+ """Combines package level and psiutils strings."""
70
+
71
+ def __init__(self) -> None:
72
+ """
73
+ Initialise the object with attributes based on the key-value pairs
74
+ in the `strings` dictionary.
75
+
76
+ Args:
77
+ self: The instance of the class.
78
+
79
+ Returns:
80
+ None
81
+ """
82
+ self.strings = strings
83
+ for key, string in strings.items():
84
+ setattr(self, key, string)
85
+
86
+ # Optionally display contents of `strings`
87
+
88
+ def display(self, compare: dict = None) -> None:
89
+ """Print out contents of `strings` and compare if
90
+ a dict of strings is provided."""
91
+ duplicates = 0
92
+ overrides = 0
93
+ app_strings = 0
94
+ if not compare:
95
+ compare = {}
96
+
97
+ for key, item in compare.items():
98
+ if key not in strings:
99
+ strings[key] = item
100
+
101
+ for item in sorted(list(strings)):
102
+ output = f"{item:.<20} {strings[item]}"
103
+ if item in compare:
104
+ if strings[item] != compare[item]:
105
+ output = f"{output}, {compare[item]} <{'-' * 10} //override//"
106
+ overrides += 1
107
+ elif item not in psi_strings:
108
+ output = f"{output} <{'=' * 10} //app string//"
109
+ app_strings += 1
110
+ else:
111
+ output = f"{output} <{'=' * 10} //duplicate//"
112
+ duplicates += 1
113
+ print(output)
114
+
115
+ if duplicates:
116
+ print()
117
+ print(f"{duplicates} duplicates found")
118
+
119
+ if overrides:
120
+ print()
121
+ print(f"{overrides} overrides found")
122
+
123
+ if app_strings:
124
+ print()
125
+ print(f"{app_strings} application strings found")
@@ -55,14 +55,14 @@ class Treeview(ttk.Treeview):
55
55
  for column, col_defn in enumerate(self.column_defs)
56
56
  }
57
57
 
58
- def _heading(self, col_id: str, heading: str) -> Treeview.heading:
58
+ def _heading(self, col_id: str, heading: str) -> ttk.Treeview.heading:
59
59
  return self.heading(
60
60
  col_id,
61
61
  text=heading,
62
62
  command=lambda c=col_id: self._sort_columns(c, False)
63
63
  )
64
64
 
65
- def populate(self, values: dict[tuples]) -> None:
65
+ def populate(self, values: dict[tuple]) -> None:
66
66
  self.delete(*self.get_children())
67
67
  for item in values:
68
68
  item = self.insert('', 'end', values=item)
@@ -1 +0,0 @@
1
- __version__ = '0.2.32'
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,123 +0,0 @@
1
- """ Handle standard text for psiutils."""
2
-
3
- from copy import copy
4
-
5
-
6
- psi_strings = {
7
- 'BACKUP': 'Backup',
8
- 'BUILD': 'Build',
9
- 'CANCEL': 'Cancel',
10
- 'CHECK': 'Check',
11
- 'CLEAR': 'Clear',
12
- 'CLOSE': 'Close',
13
- 'CODE': 'Code',
14
- 'COMPARE': 'Compare',
15
- 'CONFIG': 'Config',
16
- 'CONVERT': 'Convert',
17
- 'COPY': 'Copy',
18
- 'DECREMENT_ARROW': '▼',
19
- 'DELETE': 'Delete',
20
- 'DELETE_THESE_ITEMS': 'Are you sure you want to delete these item(s)?',
21
- 'DIFF': 'Diff',
22
- 'DONE': 'Done',
23
- 'DOWNLOAD': 'Download',
24
- 'EDIT': 'Edit',
25
- 'ELLIPSIS': ' ...',
26
- 'EVENT': 'Event',
27
- 'EXIT': 'Exit',
28
- 'HELP': 'Help',
29
- 'INCREMENT_ARROW': '▲',
30
- 'LOGS': 'Logs',
31
- 'NEW': 'New',
32
- 'NEXT': 'Next',
33
- 'NO': 'No',
34
- 'NO_SUCH_FILE': 'no such file or directory',
35
- 'OK': 'OK',
36
- 'OPEN': 'Open',
37
- 'PAUSE': 'Pause',
38
- 'PREFERENCES': 'Preferences',
39
- 'PREVIOUS': 'Prev',
40
- 'PROCESS': 'Process',
41
- 'QUIT': 'Quit',
42
- 'REDO': 'Redo',
43
- 'REFRESH': 'Refresh',
44
- 'REPORT': 'Report',
45
- 'RENAME': 'Rename',
46
- 'RESET': 'Reset',
47
- 'RESTORE': 'Restore',
48
- 'REVERT': 'Revert',
49
- 'RUN': 'Run',
50
- 'SAVE': 'Save',
51
- 'SCRIPT': 'Script',
52
- 'SAVE_PDF': 'Save as PDF',
53
- 'SEARCH': 'Search',
54
- 'SEND': 'Send',
55
- 'START': 'Start',
56
- 'UPDATE': 'Update',
57
- 'UPGRADE': 'Upgrade',
58
- 'UPLOAD': 'Upload',
59
- 'USE': 'Use',
60
- 'WINDOWS': 'Windows',
61
- 'YES': 'Yes',
62
- }
63
-
64
- strings = copy(psi_strings)
65
-
66
-
67
- class Text():
68
- """Combines package level and psiutils strings."""
69
- def __init__(self) -> None:
70
- """
71
- Initialise the object with attributes based on the key-value pairs
72
- in the `strings` dictionary.
73
-
74
- Args:
75
- self: The instance of the class.
76
-
77
- Returns:
78
- None
79
- """
80
- self.strings = strings
81
- for key, string in strings.items():
82
- setattr(self, key, string)
83
-
84
- # Optionally display contents of `strings`
85
- def display(self, compare: dict = None) -> None:
86
- """Print out contents of `strings` and compare if
87
- a dict of strings is provided."""
88
- duplicates = 0
89
- overrides = 0
90
- app_strings = 0
91
- if not compare:
92
- compare = {}
93
-
94
- for key, item in compare.items():
95
- if key not in strings:
96
- strings[key] = item
97
-
98
- for item in sorted(list(strings)):
99
- output = f'{item:.<20} {strings[item]}'
100
- if item in compare:
101
- if strings[item] != compare[item]:
102
- output = (f'{output}, {compare[item]} '
103
- f'<{"-"*10} //override//')
104
- overrides += 1
105
- elif item not in psi_strings:
106
- output = f'{output} <{"="*10} //app string//'
107
- app_strings += 1
108
- else:
109
- output = f'{output} <{"="*10} //duplicate//'
110
- duplicates += 1
111
- print(output)
112
-
113
- if duplicates:
114
- print()
115
- print(f'{duplicates} duplicates found')
116
-
117
- if overrides:
118
- print()
119
- print(f'{overrides} overrides found')
120
-
121
- if app_strings:
122
- print()
123
- print(f'{app_strings} application strings found')
File without changes