def file_upload(self, path=""): method = "Media.upload" f_ext = file_extension(path) f_ext = f_ext.replace(".", "") content = "{'field_name':'my','file_name':'normal','file_ext':'%s','module_sn':'011001'}" % f_ext debug = 1 (status, content) = lib_post_file(method, content, debug, path) if status: return (True, content) return (False, content)
def file_down(self): if '' != self.lab.text(): #打开保存对话框 save_path = '' f_ext = file_extension(self.filename) f_ext = f_ext.replace('.','') save_path = QtGui.QFileDialog.getSaveFileName(self, "文件保存", u"./未命名.%s"%f_ext, "All Files (%s.*)"%f_ext) print save_path file_down(self.filename,save_path) self.parent.parent.set_message(u'提示',u'成功下载') return True pass