Browse Source

Implementation of PasswordField custom widget

pull/196/merge
leo 7 years ago
committed by Chris
parent
commit
897189b7fd
3 changed files with 20 additions and 2 deletions
  1. 2
      gooey/gui/widgets/components.py
  2. 17
      gooey/gui/widgets/widget_pack.py
  3. 3
      gooey/python_bindings/argparse_to_json.py

2
gooey/gui/widgets/components.py

@ -234,4 +234,4 @@ CommandField = build_subclass('CommandField', widget_pack.TextInputPayload(
Dropdown = build_subclass('Dropdown', widget_pack.DropdownPayload)
Counter = build_subclass('Counter', widget_pack.CounterPayload)
MultiDirChooser = build_subclass('MultiDirChooser', widget_pack.MultiDirChooserPayload)
PasswordField = build_subclass('PasswordField', widget_pack.PasswordInputPayload)

17
gooey/gui/widgets/widget_pack.py

@ -196,6 +196,23 @@ class DirDialog(wx.DirDialog):
def __init__(self, parent, *args, **kwargs):
wx.DirDialog.__init__(self, parent, 'Select Directory', style=wx.DD_DEFAULT_STYLE)
class PasswordInputPayload(WidgetPack):
def __init__(self, no_quoting=False):
self.widget = None
self.option_string = None
self.no_quoting = no_quoting
def build(self, parent, data, choices=None):
self.widget = wx.TextCtrl(parent, style=wx.TE_PASSWORD)
dt = FileDrop(self.widget)
self.widget.SetDropTarget(dt)
self.widget.SetMinSize((0, -1))
self.widget.SetDoubleBuffered(True)
self.widget.AppendText('')
return self.widget
def get_value(self):
return self.widget.GetValue()
def safe_default(data, default):
return ''

3
gooey/python_bindings/argparse_to_json.py

@ -31,7 +31,8 @@ VALID_WIDGETS = (
'RadioGroup',
'CheckBox',
'MultiDirChooser',
'Textarea'
'Textarea',
'PasswordField'
)

Loading…
Cancel
Save