From 7add1bdce9e15f9dc1e57cb4dfb42a2618d0ad6f Mon Sep 17 00:00:00 2001 From: chriskiehl Date: Thu, 28 May 2015 21:22:08 -0400 Subject: [PATCH] Bug fix: MultiFileChooser returning single results --- gooey/gui/widgets/widget_pack.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gooey/gui/widgets/widget_pack.py b/gooey/gui/widgets/widget_pack.py index 47d259a..b4ac96d 100644 --- a/gooey/gui/widgets/widget_pack.py +++ b/gooey/gui/widgets/widget_pack.py @@ -78,7 +78,7 @@ class BaseFileChooser(BaseChooser): def onButton(self, evt): dlg = self.dialog(self.parent) - result = (dlg.GetPath() + result = (self.get_path(dlg) if dlg.ShowModal() == wx.ID_OK else None) if result: @@ -86,6 +86,13 @@ class BaseFileChooser(BaseChooser): # kinda hacky, but avoided a buncha boilerplate self.text_box.SetValue(result) + def get_path(self, dlg): + if isinstance(dlg, wx.DirDialog): + return dlg.GetPath() + else: + paths = dlg.GetPaths() + return paths[0] if len(paths) < 2 else ' '.join(paths) + def build_dialog(style, exist_constraint=True, **kwargs): if exist_constraint: