1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# 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
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()
return data
|