diff --git a/gooey/gui/widgets/components.py b/gooey/gui/widgets/components.py index b93232e6..31de615e 100644 --- a/gooey/gui/widgets/components.py +++ b/gooey/gui/widgets/components.py @@ -234,4 +234,4 @@ def build_subclass(name, widget_class): 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) diff --git a/gooey/gui/widgets/widget_pack.py b/gooey/gui/widgets/widget_pack.py index 9644013f..3fff3bb0 100644 --- a/gooey/gui/widgets/widget_pack.py +++ b/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 '' diff --git a/gooey/python_bindings/argparse_to_json.py b/gooey/python_bindings/argparse_to_json.py index 78945a4a..7b13a30c 100644 --- a/gooey/python_bindings/argparse_to_json.py +++ b/gooey/python_bindings/argparse_to_json.py @@ -31,7 +31,8 @@ 'RadioGroup', 'CheckBox', 'MultiDirChooser', - 'Textarea' + 'Textarea', + 'PasswordField' )