chgksuite_tk 0.0.4__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.4
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:
@@ -238,8 +239,10 @@ class ParserWrapper(object):
238
239
  def worker():
239
240
  old_stdout, old_stderr = sys.stdout, sys.stderr
240
241
  old_input = builtins.input
242
+ old_no_color = os.environ.get("NO_COLOR")
241
243
  sys.stdout = sys.stderr = self.output_buffer
242
244
  builtins.input = self.input_requester.request_input
245
+ os.environ["NO_COLOR"] = "1" # Disable ANSI colors in output
243
246
  try:
244
247
  _, resourcedir = get_source_dirs()
245
248
  args = DefaultNamespace(self.parser.parse_args(self.cmdline_call))
@@ -249,6 +252,10 @@ class ParserWrapper(object):
249
252
  finally:
250
253
  sys.stdout, sys.stderr = old_stdout, old_stderr
251
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
252
259
  self.worker_done = True
253
260
 
254
261
  self.worker_thread = threading.Thread(target=worker, daemon=True)
@@ -424,6 +431,7 @@ class ParserWrapper(object):
424
431
  caption = kwargs.pop("caption", None) or args[0]
425
432
  argtype = kwargs.pop("argtype", None)
426
433
  filetypes = kwargs.pop("filetypes", None)
434
+ combobox_values = kwargs.pop("combobox_values", None) or []
427
435
  if not argtype:
428
436
  if kwargs.get("action") == "store_true":
429
437
  argtype = "checkbutton"
@@ -487,6 +495,24 @@ class ParserWrapper(object):
487
495
  entry = tk.Entry(innerframe, textvariable=var, show=entry_show)
488
496
  entry.pack(side="left")
489
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
+
490
516
  self.parser.add_argument(*args, **kwargs)
491
517
 
492
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.4
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
@@ -1 +0,0 @@
1
- __version__ = "0.0.4"
File without changes
File without changes