本文整理汇总了Python中PyQt5.QtWidgets.QFileDialog.DontUseNativeDialog方法的典型用法代码示例。如果您正苦于以下问题:Python QFileDialog.DontUseNativeDialog方法的具体用法?Python QFileDialog.DontUseNativeDialog怎么用?Python QFileDialog.DontUseNativeDialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QFileDialog
的用法示例。
在下文中一共展示了QFileDialog.DontUseNativeDialog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: dialog_save_lattice
# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import DontUseNativeDialog [as 别名]
def dialog_save_lattice(self):
"""Save lattice to file"""
filename = QFileDialog.getSaveFileName(self.mw, 'Save Lattice', '', "Python Files (*.py);;All Files (*)", options=QFileDialog.DontUseNativeDialog)
if filename[0] == '':
return 0
lp = Parser()
lines = lp.gui_lattice2input(self.mw.lattice, split=True)
if filename[1] == 'Python Files (*.py)' and filename[0][-3:] != '.py':
filename = filename[0] + '.py'
else:
filename = filename[0]
with open(filename, 'w') as fp:
fp.writelines(lines)
示例2: open_exe_name_dialog
# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import DontUseNativeDialog [as 别名]
def open_exe_name_dialog(parent, appname):
options = QFileDialog.Options()
options |= QFileDialog.DontUseNativeDialog
file_name, _ = \
QFileDialog.getOpenFileName(
parent,
"{} could not be found. Please locate it manually".format(appname),
"",
"Valid {} executable (*);;".format(appname),
options=options
)
if file_name:
print(file_name)
return file_name
else:
print("No file is selected. guiscrcpy is likely to fail")
示例3: loadEquations
# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import DontUseNativeDialog [as 别名]
def loadEquations(self):
options = QFileDialog.Options()
options |= QFileDialog.DontUseNativeDialog
fileName, _ = QFileDialog.getOpenFileName(self, "Add Custom Equations", "", "All Files (*);;Visma Files (*.vis)", options=options)
if os.path.isfile(fileName):
if os.path.getsize(fileName) == 0:
return self.workSpace.warning("Input equations file is empty!")
if self.workSpace.equations[0][0] == "No equations stored":
self.workSpace.equations.pop(0)
with open(fileName) as fileobj:
for line in fileobj:
line = line.replace(' ', '').replace('\n', '')
if not any(line in item for item in self.workSpace.equations) and not (line.isspace() or line == ''):
self.workSpace.equations.insert(0, ('Equation No.' + str(len(self.workSpace.equations) + 1), line))
self.workSpace.addEquation()
示例4: dialog_open_lattice
# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import DontUseNativeDialog [as 别名]
def dialog_open_lattice(self):
"""Read lattice from file"""
filename = QFileDialog.getOpenFileName(self.mw, 'Open Lattice', '', "Python Files (*.py);;All Files (*)", options=QFileDialog.DontUseNativeDialog)[0]
if filename == '':
return 0
self.mw.lattice = GUILattice()
# executing opened file
loc_dict = {}
try:
exec(open(filename).read(), globals(), loc_dict)
except Exception as err:
self.mw.error_window('Open Lattice File Error', str(err))
# parsing sequences and create elements list from cell
if 'cell' in loc_dict:
self.mw.lattice.cell = deepcopy(loc_dict['cell'])
lp = Parser()
self.mw.lattice.elements = lp.get_elements(self.mw.lattice.cell)
else:
self.mw.error_window('Open Lattice File Error', 'NO secuence named "cell"')
# parsing method
if 'method' in loc_dict:
self.mw.lattice.method = deepcopy(loc_dict['method'])
# parsing beam
if 'beam' in loc_dict:
self.mw.lattice.beam = deepcopy(loc_dict['beam'])
# parsing tws0
if 'tws0' in loc_dict:
self.mw.lattice.tws0 = deepcopy(loc_dict['tws0'])
self.mw.menu_edit.edit_lattice()
示例5: _export2JqkaAct
# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import DontUseNativeDialog [as 别名]
def _export2JqkaAct(self):
data = {}
if not DyStockTableSelectDlg(data, '{0}导出到同花顺'.format(self.getUniqueName())).exec_():
return
defaultFileName = '{0}.sel' if data['all'] else '{0}_高亮.sel'
defaultFileName = defaultFileName.format(self.getUniqueName())
defaultDir = DyCommon.createPath('Stock/User/Save/Strategy/同花顺')
fileName, _ = QFileDialog.getSaveFileName(None, '导出到同花顺', os.path.join(defaultDir, defaultFileName), "同花顺files (*.sel);;all files(*.*)", options=QFileDialog.DontUseNativeDialog)
if fileName:
self.export2Jqka(fileName)
示例6: _saveAsAct
# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import DontUseNativeDialog [as 别名]
def _saveAsAct(self):
data = {}
if not DyStockTableSelectDlg(data, '{0}保存'.format(self.getUniqueName())).exec_():
return
defaultFileName = '{0}.json' if data['all'] else '{0}_高亮.json'
defaultFileName = defaultFileName.format(self.getUniqueName())
defaultDir = DyCommon.createPath('Stock/User/Save/Strategy')
fileName, _ = QFileDialog.getSaveFileName(None, '保存股票表', os.path.join(defaultDir, defaultFileName), "JSON files (*.json);;all files(*.*)", options=QFileDialog.DontUseNativeDialog)
if fileName:
self._saveAs(fileName, data['all'])
示例7: AgentIco
# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import DontUseNativeDialog [as 别名]
def AgentIco(self):
try:
options = QFileDialog.Options()
options |= QFileDialog.DontUseNativeDialog
fileName, _ = QFileDialog.getOpenFileName(self, options=options)
icodir = fileName.replace('/',"\\\\")
self.fileico.setText(icodir)
except Exception as f:
t, o, tb = sys.exc_info()
print(f, tb.tb_lineno)
示例8: selectPrivate
# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import DontUseNativeDialog [as 别名]
def selectPrivate(self):
try:
options = QFileDialog.Options()
options |= QFileDialog.DontUseNativeDialog
fileName, _ = QFileDialog.getOpenFileName(self, options=options)
icodir = fileName.replace('/',"\\\\")
self.privatekey.setText(icodir)
except Exception as f:
t, o, tb = sys.exc_info()
print(f, tb.tb_lineno)
示例9: attach
# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import DontUseNativeDialog [as 别名]
def attach(self):
try:
options = QFileDialog.Options()
options |= QFileDialog.DontUseNativeDialog
fileName, _ = QFileDialog.getOpenFileName(self, options=options)
osrep = fileName.replace("/","\\\\")
self.attachment.setText(osrep)
except Exception as f:
t, o, tb = sys.exc_info()
print(f,tb.tb_lineno)
示例10: openFileDialog
# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import DontUseNativeDialog [as 别名]
def openFileDialog(fileSpec="CSV Files (*.csv);;All Files (*)"):
options = QFileDialog.Options()
options |= QFileDialog.DontUseNativeDialog
fileName, _ = QFileDialog.getOpenFileName(None,"QFileDialog.getOpenFileName()", "",fileSpec, options=options)
if fileName:
return fileName
else:
return None
示例11: saveFileDialog
# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import DontUseNativeDialog [as 别名]
def saveFileDialog(fileSpec="CSV Files (*.csv);;All Files (*)"):
options = QFileDialog.Options()
options |= QFileDialog.DontUseNativeDialog
fileName, _ = QFileDialog.getSaveFileName(None,"QFileDialog.getSaveFileName()","",fileSpec, options=options)
if fileName:
return fileName
else:
return None
# ------------------ Global functions for agent HTTP requests ------------------------------
示例12: _get_save_name
# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import DontUseNativeDialog [as 别名]
def _get_save_name(self, ext):
fullname = '{}_{}{}'.format(self.root_file, self.save_postfix ,ext)
dialog = QFileDialog()
dialog.selectFile(fullname)
dialog.setOptions(QFileDialog.DontUseNativeDialog)
dialog.setFileMode(QFileDialog.AnyFile)
dialog.setAcceptMode(QFileDialog.AcceptSave)
dialog.setNameFilters(['*' + ext])
ret = dialog.exec();
if (ret == QDialog.Accepted):
fullname = dialog.selectedFiles()[0]
return fullname
示例13: UploadImagem
# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import DontUseNativeDialog [as 别名]
def UploadImagem(self):
Dialog = QFileDialog()
Dialog.setOption(QFileDialog.DontUseNativeDialog, True)
fname = Dialog.getOpenFileName(
self, "Selecionar Imagem", "", "Image files (*.jpg *.png)")[0]
self.lb_FotoProduto.setPixmap(QPixmap(fname).scaledToWidth(
150, Qt.TransformationMode(Qt.FastTransformation)))
# self.lb_FotoProduto.setScaledContents(True)
self.bt_AddImagem.setHidden(True)
self.bt_DelImagem.setVisible(True)
示例14: UploadLogo
# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import DontUseNativeDialog [as 别名]
def UploadLogo(self):
Dialog = QFileDialog()
Dialog.setOption(QFileDialog.DontUseNativeDialog, True)
fname = Dialog.getOpenFileName(
self, "Selecionar Logo", "", "Image files (*.jpg *.png)")[0]
self.lb_LogoEmpresa.setPixmap(QPixmap(fname).scaledToWidth(
300, Qt.TransformationMode(Qt.FastTransformation)))
# self.lb_LogoEmpresa.setScaledContents(True)
self.bt_AddLogo.setHidden(True)
self.bt_DelLogo.setVisible(True)
示例15: openmail
# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import DontUseNativeDialog [as 别名]
def openmail(self):
try:
self.mail = list()
options = QFileDialog.Options()
options |= QFileDialog.DontUseNativeDialog
fileName, _ = QFileDialog.getOpenFileName(self, options=options)
say = 0
nagato = ""
notlist = list()
yeslist = list()
with open(fileName, 'r') as g:
for k999 in g:
notlist.append(k999)
with open(fileName, 'r') as f:
if not fileName.endswith(".txt"):
self.ThreadMessage("Mail List Error", "Please Select '.txt' File" , "Info")
else:
self.maillist.setText(fileName)
for _ in f:
mailReg = re.search(r"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)", _)
if mailReg:
yeslist.append(_)
itemsTextList = [str(self.maillistWidget.item(i).text()) for i in
range(self.maillistWidget.count())]
say += 1
if _ in itemsTextList:
pass
else:
self.maillistWidget.addItem(_)
self.mailliststatus.setText(" " * 21 + str(say) + " Email Added")
self.mail.append(_)
else:
ka = list(set(notlist)-set(yeslist))
count = 0
for ningendo in ka:
count += 1
nagato += "{}".format(count)+"- "+ningendo+"\n"
self.ThreadMessage("Mail Attach Error", "Not Email Adress;\n\n {}".format(nagato), "Info")
except:
pass