本文整理汇总了Python中KdeQt.KQFileDialog.getOpenFileName方法的典型用法代码示例。如果您正苦于以下问题:Python KQFileDialog.getOpenFileName方法的具体用法?Python KQFileDialog.getOpenFileName怎么用?Python KQFileDialog.getOpenFileName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KdeQt.KQFileDialog
的用法示例。
在下文中一共展示了KQFileDialog.getOpenFileName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_mainscriptButton_clicked
# 需要导入模块: from KdeQt import KQFileDialog [as 别名]
# 或者: from KdeQt.KQFileDialog import getOpenFileName [as 别名]
def on_mainscriptButton_clicked(self):
"""
Private slot to display a file selection dialog.
"""
dir = self.dirEdit.text()
if dir.isEmpty():
dir = QDir.currentPath()
patterns = QStringList()
for pattern, filetype in self.project.pdata["FILETYPES"].items():
if filetype == "SOURCES":
patterns.append(QString(pattern))
filters = self.trUtf8("Source Files (%1);;All Files (*)")\
.arg(patterns.join(" "))
fn = KQFileDialog.getOpenFileName(\
self,
self.trUtf8("Select main script file"),
dir,
filters)
if not fn.isEmpty():
ppath = self.dirEdit.text()
if not ppath.isEmpty():
ppath = QDir(ppath).absolutePath()
ppath.append(QDir.separator())
fn.replace(QRegExp(ppath), "")
self.mainscriptEdit.setText(Utilities.toNativeSeparators(fn))
示例2: __importStyles
# 需要导入模块: from KdeQt import KQFileDialog [as 别名]
# 或者: from KdeQt.KQFileDialog import getOpenFileName [as 别名]
def __importStyles(self, lexers):
"""
Private method to import the styles of the given lexers.
@param lexers dictionary of lexer objects for which to import the styles
"""
fn = KQFileDialog.getOpenFileName(\
self,
self.trUtf8("Import Highlighting Styles"),
QString(),
self.trUtf8("eric4 highlighting styles file (*.e4h)"),
None)
if fn.isEmpty():
return
fn = unicode(fn)
try:
f = open(fn, "rb")
try:
line = f.readline()
dtdLine = f.readline()
finally:
f.close()
except IOError, err:
KQMessageBox.critical(self,
self.trUtf8("Import Highlighting Styles"),
self.trUtf8("""<p>The highlighting styles could not be read"""
""" from file <b>%1</b>.</p><p>Reason: %2</p>""")\
.arg(fn)\
.arg(str(err))
)
return
示例3: on_styleSheetButton_clicked
# 需要导入模块: from KdeQt import KQFileDialog [as 别名]
# 或者: from KdeQt.KQFileDialog import getOpenFileName [as 别名]
def on_styleSheetButton_clicked(self):
"""
Private slot to handle the user style sheet selection.
"""
file = KQFileDialog.getOpenFileName(\
self,
self.trUtf8("Select Style Sheet"),
self.styleSheetEdit.text(),
QString())
if not file.isNull():
self.styleSheetEdit.setText(Utilities.toNativeSeparators(file))
示例4: on_qt4DocDirButton_clicked
# 需要导入模块: from KdeQt import KQFileDialog [as 别名]
# 或者: from KdeQt.KQFileDialog import getOpenFileName [as 别名]
def on_qt4DocDirButton_clicked(self):
"""
Private slot to select the Qt4 documentation directory.
"""
entry = KQFileDialog.getOpenFileName(\
self,
self.trUtf8("Select Qt4 documentation entry"),
QUrl(self.qt4DocDirEdit.text()).path(),
self.trUtf8("HTML Files (*.html *.htm);;All Files (*)"))
if entry:
self.qt4DocDirEdit.setText(Utilities.toNativeSeparators(entry))
示例5: on_fileButton_clicked
# 需要导入模块: from KdeQt import KQFileDialog [as 别名]
# 或者: from KdeQt.KQFileDialog import getOpenFileName [as 别名]
def on_fileButton_clicked(self):
"""
Private slot called by pressing the file selection button.
"""
fn = KQFileDialog.getOpenFileName(\
self,
self.trUtf8("Select file for property"),
self.propFileEdit.text(),
QString())
if not fn.isEmpty():
self.propFileEdit.setText(Utilities.toNativeSeparators(fn))
示例6: on_idlButton_clicked
# 需要导入模块: from KdeQt import KQFileDialog [as 别名]
# 或者: from KdeQt.KQFileDialog import getOpenFileName [as 别名]
def on_idlButton_clicked(self):
"""
Private slot to handle the IDL compiler selection.
"""
file = KQFileDialog.getOpenFileName(\
self,
self.trUtf8("Select IDL compiler"),
self.idlEdit.text(),
QString())
if not file.isNull():
self.idlEdit.setText(Utilities.toNativeSeparators(file))
示例7: on_iconButton_clicked
# 需要导入模块: from KdeQt import KQFileDialog [as 别名]
# 或者: from KdeQt.KQFileDialog import getOpenFileName [as 别名]
def on_iconButton_clicked(self):
"""
Private slot to handle the icon selection via a file selection dialog.
"""
icon = KQFileDialog.getOpenFileName(\
self,
self.trUtf8("Select icon file"),
self.iconEdit.text(),
self.trUtf8("Icon files (*.png)"),
None)
if not icon.isEmpty():
self.iconEdit.setText(icon)
示例8: on_fileButton_clicked
# 需要导入模块: from KdeQt import KQFileDialog [as 别名]
# 或者: from KdeQt.KQFileDialog import getOpenFileName [as 别名]
def on_fileButton_clicked(self):
"""
Private slot to select a file via a file selection dialog.
"""
file = KQFileDialog.getOpenFileName(\
self,
self.trUtf8("Select filename of the breakpoint"),
self.filenameCombo.currentText(),
QString())
if not file.isNull():
self.filenameCombo.setEditText(Utilities.toNativeSeparators(file))
示例9: on_customViewerSelectionButton_clicked
# 需要导入模块: from KdeQt import KQFileDialog [as 别名]
# 或者: from KdeQt.KQFileDialog import getOpenFileName [as 别名]
def on_customViewerSelectionButton_clicked(self):
"""
Private slot to handle the custom viewer selection.
"""
file = KQFileDialog.getOpenFileName(\
self,
self.trUtf8("Select Custom Viewer"),
self.customViewerEdit.text(),
QString())
if not file.isNull():
self.customViewerEdit.setText(Utilities.toNativeSeparators(file))
示例10: __import
# 需要导入模块: from KdeQt import KQFileDialog [as 别名]
# 或者: from KdeQt.KQFileDialog import getOpenFileName [as 别名]
def __import(self):
"""
Private slot to handle the Import context menu action.
"""
fn = KQFileDialog.getOpenFileName(\
self,
self.trUtf8("Import Templates"),
QString(),
self.trUtf8("Templates Files (*.e3c *.e4c);; All Files (*)"))
if not fn.isEmpty():
self.readTemplates(fn)
示例11: on_exceptFileButton_clicked
# 需要导入模块: from KdeQt import KQFileDialog [as 别名]
# 或者: from KdeQt.KQFileDialog import getOpenFileName [as 别名]
def on_exceptFileButton_clicked(self):
"""
Private slot to select a file to exempt from translation.
"""
texcept = KQFileDialog.getOpenFileName(\
self,
self.trUtf8("Exempt file from translation"),
self.project.ppath,
self.filters,
None)
if not texcept.isEmpty():
self.exceptionEdit.setText(Utilities.toNativeSeparators(texcept))
示例12: on_pelButton_clicked
# 需要导入模块: from KdeQt import KQFileDialog [as 别名]
# 或者: from KdeQt.KQFileDialog import getOpenFileName [as 别名]
def on_pelButton_clicked(self):
"""
Private method to select the personal exclude list file.
"""
file = KQFileDialog.getOpenFileName(\
self,
self.trUtf8("Select personal exclude list"),
self.pelEdit.text(),
self.trUtf8("Dictionary File (*.dic);;All Files (*)"))
if not file.isEmpty():
self.pelEdit.setText(Utilities.toNativeSeparators(file))
示例13: importBookmarks
# 需要导入模块: from KdeQt import KQFileDialog [as 别名]
# 或者: from KdeQt.KQFileDialog import getOpenFileName [as 别名]
def importBookmarks(self):
"""
Public method to import bookmarks.
"""
supportedFormats = QStringList() \
<< self.trUtf8("XBEL bookmarks").append(" (*.xbel *.xml)") \
<< self.trUtf8("HTML Netscape bookmarks").append(" (*.html *.htm)")
fileName = KQFileDialog.getOpenFileName(\
None,
self.trUtf8("Import Bookmarks"),
QString(),
supportedFormats.join(";;"),
None)
if fileName.isEmpty():
return
reader = XbelReader()
importRootNode = None
if fileName.endsWith(".html"):
inFile = QFile(fileName)
inFile.open(QIODevice.ReadOnly)
if inFile.openMode == QIODevice.NotOpen:
KQMessageBox.warning(None,
self.trUtf8("Import Bookmarks"),
self.trUtf8("""Error opening bookmarks file <b>%1</b>.""")\
.arg(fileName))
return
webpage = QWebPage()
webpage.mainFrame().setHtml(QString(inFile.readAll()))
result = webpage.mainFrame().evaluateJavaScript(extract_js).toByteArray()
buffer_ = QBuffer(result)
buffer_.open(QIODevice.ReadOnly)
importRootNode = reader.read(buffer_)
else:
importRootNode = reader.read(fileName)
if reader.error() != QXmlStreamReader.NoError:
KQMessageBox.warning(None,
self.trUtf8("Import Bookmarks"),
self.trUtf8("""Error when importing bookmarks on line %1, column %2:\n"""
"""%3""")\
.arg(reader.lineNumber())\
.arg(reader.columnNumber())\
.arg(reader.errorString()))
return
importRootNode.setType(BookmarkNode.Folder)
importRootNode.title = self.trUtf8("Imported %1")\
.arg(QDate.currentDate().toString(Qt.SystemLocaleShortDate))
self.addBookmark(self.menu(), importRootNode)
示例14: on_debugClientButton_clicked
# 需要导入模块: from KdeQt import KQFileDialog [as 别名]
# 或者: from KdeQt.KQFileDialog import getOpenFileName [as 别名]
def on_debugClientButton_clicked(self):
"""
Private slot to handle the Debug Client selection.
"""
file = KQFileDialog.getOpenFileName(\
None,
self.trUtf8("Select Debug Client"),
self.debugClientEdit.text(),
self.trUtf8("Python Files (*.py)"))
if not file.isEmpty():
self.debugClientEdit.setText(\
Utilities.toNativeSeparators(file))
示例15: on_styleSheetButton_clicked
# 需要导入模块: from KdeQt import KQFileDialog [as 别名]
# 或者: from KdeQt.KQFileDialog import getOpenFileName [as 别名]
def on_styleSheetButton_clicked(self):
"""
Private method to select the style sheet file via a dialog.
"""
file = KQFileDialog.getOpenFileName(\
self,
self.trUtf8("Select style sheet file"),
self.styleSheetEdit.text(),
self.trUtf8("Qt Style Sheets (*.qss);;Cascading Style Sheets (*.css);;"
"All files (*)"),
None)
if not file.isEmpty():
self.styleSheetEdit.setText(Utilities.toNativeSeparators(file))