Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/pynxc/waxy/filedialog.py
diff options
context:
space:
mode:
Diffstat (limited to 'pynxc/waxy/filedialog.py')
-rw-r--r--pynxc/waxy/filedialog.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/pynxc/waxy/filedialog.py b/pynxc/waxy/filedialog.py
new file mode 100644
index 0000000..a11141e
--- /dev/null
+++ b/pynxc/waxy/filedialog.py
@@ -0,0 +1,40 @@
+# filedialog.py
+
+import wx
+import waxyobject
+
+class FileDialog(wx.FileDialog, waxyobject.WaxyObject):
+
+ def __init__(self, parent, title="Choose a file", default_dir="",
+ default_file="", wildcard="*.*", open=0, save=0, multiple=0):
+ style = 0
+ if open:
+ style |= wx.OPEN
+ elif save:
+ style |= wx.SAVE
+ style |= wx.OVERWRITE_PROMPT
+ if multiple:
+ style |= wx.MULTIPLE
+
+ self.multiple=multiple
+
+ wx.FileDialog.__init__(self, parent, title, default_dir, default_file,
+ wildcard, style)
+
+ def ShowModal(self):
+ """ Simplified ShowModal(), returning strings 'ok' or 'cancel'. """
+ result = wx.FileDialog.ShowModal(self)
+ if result == wx.ID_OK:
+ return 'ok'
+ else:
+ return 'cancel'
+
+
+ def GetChosenFile(self):
+ """ Shorthand... """
+ data = self.GetPaths()
+
+ if not self.multiple:
+ data=data[0]
+
+ return data