From a4d69b5f56470073855f0d2dec52f3c3a131eeee Mon Sep 17 00:00:00 2001 From: chriskiehl Date: Wed, 13 Jul 2016 20:17:46 -0400 Subject: [PATCH] copy-pasta textarea component --- gooey/gui/widgets/components.py | 1 + gooey/gui/widgets/widget_pack.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/gooey/gui/widgets/components.py b/gooey/gui/widgets/components.py index 74f5e25..b93232e 100644 --- a/gooey/gui/widgets/components.py +++ b/gooey/gui/widgets/components.py @@ -229,6 +229,7 @@ DirChooser = build_subclass('DirChooser', widget_pack.DirChooserPayload) FileSaver = build_subclass('FileSaver', widget_pack.FileSaverPayload) DateChooser = build_subclass('DateChooser', widget_pack.DateChooserPayload) TextField = build_subclass('TextField', widget_pack.TextInputPayload) +Textarea = build_subclass('TextField', widget_pack.TextAreaPayload) CommandField = build_subclass('CommandField', widget_pack.TextInputPayload(no_quoting=True)) Dropdown = build_subclass('Dropdown', widget_pack.DropdownPayload) Counter = build_subclass('Counter', widget_pack.CounterPayload) diff --git a/gooey/gui/widgets/widget_pack.py b/gooey/gui/widgets/widget_pack.py index 905614d..9644013 100644 --- a/gooey/gui/widgets/widget_pack.py +++ b/gooey/gui/widgets/widget_pack.py @@ -131,6 +131,25 @@ class TextInputPayload(WidgetPack): def get_value(self): return self.widget.GetValue() + +class TextAreaPayload(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_MULTILINE) + 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() + class DropdownPayload(WidgetPack): default_value = 'Select Option'