|
@ -64,13 +64,24 @@ class Chooser(wx.Panel): |
|
|
class FileChooser(Chooser): |
|
|
class FileChooser(Chooser): |
|
|
""" Retrieve an existing file from the system """ |
|
|
""" Retrieve an existing file from the system """ |
|
|
def getDialog(self): |
|
|
def getDialog(self): |
|
|
return wx.FileDialog(self, _('open_file'), style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) |
|
|
|
|
|
|
|
|
options = self.Parent._options |
|
|
|
|
|
return wx.FileDialog(self, message=options.get('message', _('open_file')), |
|
|
|
|
|
style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST, |
|
|
|
|
|
defaultFile=options.get('defaultFile', _("enter_filename")), |
|
|
|
|
|
defaultDir=options.get('defaultDir', _('')), |
|
|
|
|
|
wildcard=options.get('wildcard', wx.FileSelectorDefaultWildcardStr)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MultiFileChooser(Chooser): |
|
|
class MultiFileChooser(Chooser): |
|
|
""" Retrieve an multiple files from the system """ |
|
|
""" Retrieve an multiple files from the system """ |
|
|
def getDialog(self): |
|
|
def getDialog(self): |
|
|
return wx.FileDialog(self, _('open_files'), style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST | wx.FD_MULTIPLE) |
|
|
|
|
|
|
|
|
options = self.Parent._options |
|
|
|
|
|
return wx.FileDialog(self, message=options.get('message', _('open_files')), |
|
|
|
|
|
style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST | wx.FD_MULTIPLE, |
|
|
|
|
|
defaultFile=options.get('defaultFile', _("enter_filename")), |
|
|
|
|
|
defaultDir=options.get('defaultDir', _('')), |
|
|
|
|
|
wildcard=options.get('wildcard', wx.FileSelectorDefaultWildcardStr)) |
|
|
|
|
|
|
|
|
def getResult(self, dialog): |
|
|
def getResult(self, dialog): |
|
|
return os.pathsep.join(dialog.GetPaths()) |
|
|
return os.pathsep.join(dialog.GetPaths()) |
|
|
|
|
|
|
|
@ -78,26 +89,32 @@ class MultiFileChooser(Chooser): |
|
|
class FileSaver(Chooser): |
|
|
class FileSaver(Chooser): |
|
|
""" Specify the path to save a new file """ |
|
|
""" Specify the path to save a new file """ |
|
|
def getDialog(self): |
|
|
def getDialog(self): |
|
|
|
|
|
options = self.Parent._options |
|
|
return wx.FileDialog( |
|
|
return wx.FileDialog( |
|
|
self, |
|
|
self, |
|
|
style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT, |
|
|
style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT, |
|
|
defaultFile=_("enter_filename"), |
|
|
|
|
|
message=_('choose_file') |
|
|
|
|
|
|
|
|
defaultFile=options.get('defaultFile', _("enter_filename")), |
|
|
|
|
|
defaultDir=options.get('defaultDir', _('')), |
|
|
|
|
|
message=options.get('message', _('choose_file')), |
|
|
|
|
|
wildcard=options.get('wildcard', wx.FileSelectorDefaultWildcardStr) |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class DirChooser(Chooser): |
|
|
class DirChooser(Chooser): |
|
|
""" Retrieve a path to the supplied directory """ |
|
|
""" Retrieve a path to the supplied directory """ |
|
|
def getDialog(self): |
|
|
def getDialog(self): |
|
|
return wx.DirDialog(self, message=_('choose_folder')) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
options = self.Parent._options |
|
|
|
|
|
return wx.DirDialog(self, message=options.get('message', _('choose_folder')), |
|
|
|
|
|
defaultPath=options.get('defaultPath', os.getcwd())) |
|
|
|
|
|
|
|
|
class MultiDirChooser(Chooser): |
|
|
class MultiDirChooser(Chooser): |
|
|
""" Retrieve an multiple directories from the system """ |
|
|
""" Retrieve an multiple directories from the system """ |
|
|
def getDialog(self): |
|
|
def getDialog(self): |
|
|
|
|
|
options = self.Parent._options |
|
|
return MDD.MultiDirDialog(self, |
|
|
return MDD.MultiDirDialog(self, |
|
|
message=_('choose_folders_msg'), |
|
|
|
|
|
|
|
|
message=options.get('message', _('choose_folders')), |
|
|
title=_('choose_folders_title'), |
|
|
title=_('choose_folders_title'), |
|
|
defaultPath=os.getcwd(), |
|
|
|
|
|
|
|
|
defaultPath=options.get('defaultPath', os.getcwd()), |
|
|
agwStyle=MDD.DD_MULTIPLE | MDD.DD_DIR_MUST_EXIST) |
|
|
agwStyle=MDD.DD_MULTIPLE | MDD.DD_DIR_MUST_EXIST) |
|
|
def getResult(self, dialog): |
|
|
def getResult(self, dialog): |
|
|
return os.pathsep.join(dialog.GetPaths()) |
|
|
return os.pathsep.join(dialog.GetPaths()) |
|
|