def onUploadFileEvent(self, event): wildcard = u"所有文件 (*.*) | *.*" result = dialogs.fileDialog(parent=self._uploadify, title=u'选择文件', filename='', wildcard=wildcard, style=wx.OPEN) if result.accepted: for file_path in result.paths: if os.path.isdir(file_path) : continue self.uploadFile(file_path) event.Skip()
def save_file(title="Save", directory='', filename='', wildcard='All Files (*.*)|*.*', overwrite=False, parent=None): "Show a dialog to select file to save, return path(s) if accepted" style = wx.SAVE if not overwrite: style |= wx.OVERWRITE_PROMPT result = dialogs.fileDialog(parent, title, directory, filename, wildcard, style) return result.paths
def open_file(title="Open", directory='', filename='', wildcard='All Files (*.*)|*.*', multiple=False, parent=None): "Show a dialog to select files to open, return path(s) if accepted" style = wx.OPEN if multiple: style |= wx.MULTIPLE result = dialogs.fileDialog(parent, title, directory, filename, wildcard, style) if result.paths and not multiple: return result.paths[0] else: return result.paths
def onUploadFileEvent(self, event): wildcard = u"所有文件 (*.*) | *.*" result = dialogs.fileDialog(parent=self._uploadify, title=u'选择文件', filename='', wildcard=wildcard, style=wx.OPEN) if result.accepted: for file_path in result.paths: if os.path.isdir(file_path): continue self.uploadFile(file_path) event.Skip()