chgksuite_tk 0.0.3b0__tar.gz → 0.0.5__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chgksuite_tk
3
- Version: 0.0.3b0
3
+ Version: 0.0.5
4
4
  Summary: A GUI wrapper for chgksuite using tkinter
5
5
  Author-email: Alexander Pecheny <ap@pecheny.me>
6
6
  License-Expression: MIT
@@ -13,6 +13,7 @@ try:
13
13
  import tkinter.filedialog as filedialog
14
14
  import tkinter.messagebox as messagebox
15
15
  import tkinter.simpledialog as simpledialog
16
+ from tkinter import ttk
16
17
 
17
18
  TKINTER = True
18
19
  except ImportError:
@@ -34,6 +35,13 @@ from chgksuite.version import __version__
34
35
  from chgksuite.cli import ArgparseBuilder, single_action
35
36
 
36
37
 
38
+ def is_app_translocated(path):
39
+ """Check if the app is running from macOS App Translocation."""
40
+ if sys.platform == "darwin" and path:
41
+ return "/AppTranslocation/" in path
42
+ return False
43
+
44
+
37
45
  def get_pyapp_executable():
38
46
  """Return the pyapp executable path if running inside pyapp, else None."""
39
47
  pyapp_env = os.environ.get("PYAPP", "")
@@ -231,8 +239,10 @@ class ParserWrapper(object):
231
239
  def worker():
232
240
  old_stdout, old_stderr = sys.stdout, sys.stderr
233
241
  old_input = builtins.input
242
+ old_no_color = os.environ.get("NO_COLOR")
234
243
  sys.stdout = sys.stderr = self.output_buffer
235
244
  builtins.input = self.input_requester.request_input
245
+ os.environ["NO_COLOR"] = "1" # Disable ANSI colors in output
236
246
  try:
237
247
  _, resourcedir = get_source_dirs()
238
248
  args = DefaultNamespace(self.parser.parse_args(self.cmdline_call))
@@ -242,6 +252,10 @@ class ParserWrapper(object):
242
252
  finally:
243
253
  sys.stdout, sys.stderr = old_stdout, old_stderr
244
254
  builtins.input = old_input
255
+ if old_no_color is None:
256
+ os.environ.pop("NO_COLOR", None)
257
+ else:
258
+ os.environ["NO_COLOR"] = old_no_color
245
259
  self.worker_done = True
246
260
 
247
261
  self.worker_thread = threading.Thread(target=worker, daemon=True)
@@ -314,6 +328,18 @@ class ParserWrapper(object):
314
328
 
315
329
  def _run_self_update(self):
316
330
  """Run pyapp self-update command and close the application."""
331
+ # Check for macOS App Translocation
332
+ if is_app_translocated(self.pyapp_executable):
333
+ messagebox.showwarning(
334
+ "Обновление невозможно",
335
+ "Приложение запущено из временной папки (App Translocation).\n\n"
336
+ "Чтобы обновить приложение:\n"
337
+ "1. Закройте приложение\n"
338
+ "2. Переместите его в папку «Программы» (Applications)\n"
339
+ "3. Запустите приложение снова и нажмите «Обновить»",
340
+ )
341
+ return
342
+
317
343
  try:
318
344
  # Start the update process detached from current process
319
345
  if sys.platform == "win32":
@@ -405,6 +431,7 @@ class ParserWrapper(object):
405
431
  caption = kwargs.pop("caption", None) or args[0]
406
432
  argtype = kwargs.pop("argtype", None)
407
433
  filetypes = kwargs.pop("filetypes", None)
434
+ combobox_values = kwargs.pop("combobox_values", None) or []
408
435
  if not argtype:
409
436
  if kwargs.get("action") == "store_true":
410
437
  argtype = "checkbutton"
@@ -468,6 +495,24 @@ class ParserWrapper(object):
468
495
  entry = tk.Entry(innerframe, textvariable=var, show=entry_show)
469
496
  entry.pack(side="left")
470
497
  self.vars.append(VarWrapper(name=args[0], var=var))
498
+
499
+ elif argtype == "combobox":
500
+ var = tk.StringVar()
501
+ default_val = kwargs.get("default") or ""
502
+ innerframe = tk.Frame(frame)
503
+ innerframe.pack(side="top")
504
+ tk.Label(innerframe, text=caption).pack(side="left")
505
+ combobox = ttk.Combobox(
506
+ innerframe, textvariable=var, values=combobox_values
507
+ )
508
+ combobox.pack(side="left")
509
+ # Initialize with default or first item if available
510
+ if default_val:
511
+ var.set(default_val)
512
+ elif combobox_values:
513
+ var.set(combobox_values[0])
514
+ self.vars.append(VarWrapper(name=args[0], var=var))
515
+
471
516
  self.parser.add_argument(*args, **kwargs)
472
517
 
473
518
  def add_subparsers(self, *args, **kwargs):
@@ -0,0 +1 @@
1
+ __version__ = "0.0.5"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chgksuite_tk
3
- Version: 0.0.3b0
3
+ Version: 0.0.5
4
4
  Summary: A GUI wrapper for chgksuite using tkinter
5
5
  Author-email: Alexander Pecheny <ap@pecheny.me>
6
6
  License-Expression: MIT
@@ -3,12 +3,6 @@ pyproject.toml
3
3
  chgksuite_tk/__main__.py
4
4
  chgksuite_tk/gui.py
5
5
  chgksuite_tk/version.py
6
- chgksuite_tk.egg-info/._PKG-INFO
7
- chgksuite_tk.egg-info/._SOURCES.txt
8
- chgksuite_tk.egg-info/._dependency_links.txt
9
- chgksuite_tk.egg-info/._entry_points.txt
10
- chgksuite_tk.egg-info/._requires.txt
11
- chgksuite_tk.egg-info/._top_level.txt
12
6
  chgksuite_tk.egg-info/PKG-INFO
13
7
  chgksuite_tk.egg-info/SOURCES.txt
14
8
  chgksuite_tk.egg-info/dependency_links.txt
@@ -1 +0,0 @@
1
- __version__ = "0.0.3b0"
File without changes
File without changes