本文整理汇总了Python中KdeQt.KQFileDialog.getOpenFileNames方法的典型用法代码示例。如果您正苦于以下问题:Python KQFileDialog.getOpenFileNames方法的具体用法?Python KQFileDialog.getOpenFileNames怎么用?Python KQFileDialog.getOpenFileNames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KdeQt.KQFileDialog
的用法示例。
在下文中一共展示了KQFileDialog.getOpenFileNames方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_addButton_clicked
# 需要导入模块: from KdeQt import KQFileDialog [as 别名]
# 或者: from KdeQt.KQFileDialog import getOpenFileNames [as 别名]
def on_addButton_clicked(self):
"""
Private slot to add a new search engine.
"""
fileNames = KQFileDialog.getOpenFileNames(\
self,
self.trUtf8("Add search engine"),
QString(),
self.trUtf8("OpenSearch (*.xml);;All Files (*)"),
None)
osm = self.__mw.openSearchManager()
for fileName in fileNames:
if not osm.addEngine(fileName):
KQMessageBox.critical(self,
self.trUtf8("Add search engine"),
self.trUtf8("""%1 is not a valid OpenSearch 1.1 description or"""
""" is already on your list.""").arg(fileName))
示例2: on_addButton_clicked
# 需要导入模块: from KdeQt import KQFileDialog [as 别名]
# 或者: from KdeQt.KQFileDialog import getOpenFileNames [as 别名]
def on_addButton_clicked(self):
"""
Private slot to add documents to the help database.
"""
fileNames = KQFileDialog.getOpenFileNames(\
self,
self.trUtf8("Add Documentation"),
QString(),
self.trUtf8("Qt Compressed Help Files (*.qch)"),
None)
if fileNames.isEmpty():
return
for fileName in fileNames:
ns = QHelpEngineCore.namespaceName(fileName)
if ns.isEmpty():
KQMessageBox.warning(self,
self.trUtf8("Add Documentation"),
self.trUtf8("""The file <b>%1</b> is not a valid Qt Help File.""")\
.arg(fileName)
)
continue
if len(self.documentsList.findItems(ns, Qt.MatchFixedString)):
KQMessageBox.warning(self,
self.trUtf8("Add Documentation"),
self.trUtf8("""The namespace <b>%1</b> is already registered.""")\
.arg(ns)
)
continue
self.__engine.registerDocumentation(fileName)
self.documentsList.addItem(ns)
self.__registeredDocs.append(ns)
if ns in self.__unregisteredDocs:
self.__unregisteredDocs.remove(ns)
示例3: on_sourceFileButton_clicked
# 需要导入模块: from KdeQt import KQFileDialog [as 别名]
# 或者: from KdeQt.KQFileDialog import getOpenFileNames [as 别名]
def on_sourceFileButton_clicked(self):
"""
Private slot to display a file selection dialog.
"""
dir = self.sourceFileEdit.text().section(os.pathsep, 0, 0,
QString.SectionFlags(QString.SectionSkipEmpty))
if dir.isEmpty():
if self.startdir is not None:
dir = self.startdir
else:
dir = self.targetDirEdit.text()
if self.filter is None:
patterns = {
"SOURCES" : QStringList(),
"FORMS" : QStringList(),
"RESOURCES" : QStringList(),
"INTERFACES" : QStringList(),
"TRANSLATIONS" : QStringList(),
}
for pattern, filetype in self.filetypes.items():
if patterns.has_key(filetype):
patterns[filetype].append(QString(pattern))
dfilter = self.trUtf8(\
"Source Files (%1);;"
"Forms Files (%2);;"
"Resource Files (%3);;"
"Interface Files (%4);;"
"Translation Files (%5);;"
"All Files (*)")\
.arg(patterns["SOURCES"].join(" "))\
.arg(patterns["FORMS"].join(" "))\
.arg(patterns["RESOURCES"].join(" "))\
.arg(patterns["INTERFACES"].join(" "))\
.arg(patterns["TRANSLATIONS"].join(" "))
caption = self.trUtf8("Select Files")
elif self.filter == 'form':
patterns = QStringList()
for pattern, filetype in self.filetypes.items():
if filetype == "FORMS":
patterns.append(QString(pattern))
dfilter = self.trUtf8("Forms Files (%1)")\
.arg(patterns.join(" "))
caption = self.trUtf8("Select user-interface files")
elif self.filter == "resource":
patterns = QStringList()
for pattern, filetype in self.filetypes.items():
if filetype == "RESOURCES":
patterns.append(QString(pattern))
dfilter = self.trUtf8("Resource Files (%1)")\
.arg(patterns.join(" "))
caption = self.trUtf8("Select resource files")
elif self.filter == 'source':
patterns = QStringList()
for pattern, filetype in self.filetypes.items():
if filetype == "SOURCES":
patterns.append(QString(pattern))
dfilter = self.trUtf8("Source Files (%1);;All Files (*)")\
.arg(patterns.join(" "))
caption = self.trUtf8("Select source files")
elif self.filter == 'interface':
patterns = QStringList()
for pattern, filetype in self.filetypes.items():
if filetype == "INTERFACES":
patterns.append(QString(pattern))
dfilter = self.trUtf8("Interface Files (%1)")\
.arg(patterns.join(" "))
caption = self.trUtf8("Select interface files")
elif self.filter == 'translation':
patterns = QStringList()
for pattern, filetype in self.filetypes.items():
if filetype == "TRANSLATIONS":
patterns.append(QString(pattern))
dfilter = self.trUtf8("Translation Files (%1)")\
.arg(patterns.join(" "))
caption = self.trUtf8("Select translation files")
elif self.filter == 'others':
dfilter = self.trUtf8("All Files (*)")
caption = self.trUtf8("Select files")
else:
return
fnames = KQFileDialog.getOpenFileNames(\
self, caption, dir, dfilter)
if len(fnames):
self.sourceFileEdit.setText(Utilities.toNativeSeparators(\
fnames.join(os.pathsep)))