本文整理汇总了Python中PyQt5.QtWidgets.QFileDialog.Options方法的典型用法代码示例。如果您正苦于以下问题:Python QFileDialog.Options方法的具体用法?Python QFileDialog.Options怎么用?Python QFileDialog.Options使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QFileDialog
的用法示例。
在下文中一共展示了QFileDialog.Options方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: open_exe_name_dialog
# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import Options [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")
示例2: loadEquations
# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import Options [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()
示例3: choose_folder_dialog
# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import Options [as 别名]
def choose_folder_dialog(parent, title):
options = QFileDialog.Options()
options |= QFileDialog.ShowDirsOnly
dialog = QFileDialog(parent, title, os.path.expanduser("~"), options=options)
dialog.setFileMode(QFileDialog.Directory)
dialog.setParent(parent, QtCore.Qt.Sheet)
return dialog
示例4: AgentIco
# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import Options [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)
示例5: selectPrivate
# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import Options [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)
示例6: attach
# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import Options [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)
示例7: choose_file_dialog
# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import Options [as 别名]
def choose_file_dialog(parent, title, want_folder=True):
options = QFileDialog.Options()
if want_folder:
options |= QFileDialog.ShowDirsOnly
dialog = QFileDialog(parent, title, os.path.expanduser('~'), options=options)
dialog.setFileMode(QFileDialog.Directory if want_folder else QFileDialog.AnyFile)
dialog.setParent(parent, QtCore.Qt.Sheet)
return dialog
示例8: openFileDialog
# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import Options [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
示例9: saveFileDialog
# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import Options [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 ------------------------------
示例10: seleccionarImagen
# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import Options [as 别名]
def seleccionarImagen(self):
imagen, extension = QFileDialog.getOpenFileName(self, "Seleccionar imagen", getcwd(),
"Archivos de imagen (*.png *.jpg)",
options=QFileDialog.Options())
if imagen:
# Adaptar imagen
pixmapImagen = QPixmap(imagen).scaled(112, 128, Qt.KeepAspectRatio,
Qt.SmoothTransformation)
# Mostrar imagen
self.labelImagen.setPixmap(pixmapImagen)
# ================================================================
示例11: setSaveFileName
# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import Options [as 别名]
def setSaveFileName(self, obj):
options = QFileDialog.Options()
fileName, _ = QFileDialog.getOpenFileName(self,
"Select File",
obj.text(),
"All Files (*)", options=options)
if fileName:
obj.setText(fileName)
示例12: loadMNConf
# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import Options [as 别名]
def loadMNConf(self):
options = QFileDialog.Options()
fileName, _ = QFileDialog.getOpenFileName(self, 'Open masternode.conf', 'masternode.conf', 'Text Files (*.conf)', options=options)
if fileName:
self.mainWindow.loadMNConf(fileName)
示例13: openmail
# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import Options [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