当前位置: 首页>>代码示例>>Python>>正文


Python KdeQt.KQFileDialog类代码示例

本文整理汇总了Python中KdeQt.KQFileDialog的典型用法代码示例。如果您正苦于以下问题:Python KQFileDialog类的具体用法?Python KQFileDialog怎么用?Python KQFileDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了KQFileDialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: on_mainscriptButton_clicked

 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))
开发者ID:usc-bbdl,项目名称:R01_HSC_cadaver_system,代码行数:26,代码来源:PropertiesDialog.py

示例2: __importStyles

 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
开发者ID:usc-bbdl,项目名称:R01_HSC_cadaver_system,代码行数:34,代码来源:EditorHighlightingStylesPage.py

示例3: __getFileName

 def __getFileName(self):
     """
     Private method to get the filename to save to from the user.
     
     @return flag indicating success (boolean)
     """
     downloadDirectory = Preferences.getUI("DownloadPath")
     if downloadDirectory.isEmpty():
         downloadDirectory = \
             QDesktopServices.storageLocation(QDesktopServices.DocumentsLocation)
     if not downloadDirectory.isEmpty():
         downloadDirectory += '/'
     
     defaultFileName = self.__saveFileName(downloadDirectory)
     fileName = defaultFileName
     baseName = QFileInfo(fileName).completeBaseName()
     self.__autoOpen = False
     if not self.__toDownload:
         res = KQMessageBox.question(None,
             self.trUtf8("Downloading"),
             self.trUtf8("""<p>You are about to download the file <b>%1</b>.</p>"""
                         """<p>What do you want to do?</p>""").arg(fileName),
             QMessageBox.StandardButtons(\
                 QMessageBox.Open | \
                 QMessageBox.Save | \
                 QMessageBox.Cancel))
         if res == QMessageBox.Cancel:
             self.__stop()
             self.close()
             return False
         
         self.__autoOpen = res == QMessageBox.Open
         fileName = QDesktopServices.storageLocation(QDesktopServices.TempLocation) + \
                     '/' + QFileInfo(fileName).completeBaseName()
     
     if not self.__autoOpen and self.__requestFilename:
         fileName = KQFileDialog.getSaveFileName(\
             None,
             self.trUtf8("Save File"),
             defaultFileName,
             QString(),
             None)
         if fileName.isEmpty():
             self.__reply.close()
             if not self.keepOpenCheckBox.isChecked():
                 self.close()
                 return False
             else:
                 self.filenameLabel.setText(self.trUtf8("Download canceled: %1")\
                     .arg(QFileInfo(defaultFileName).fileName()))
                 self.__stop()
                 return True
     
     self.__output.setFileName(fileName)
     self.filenameLabel.setText(QFileInfo(self.__output.fileName()).fileName())
     if self.__requestFilename:
         self.__readyRead()
     
     return True
开发者ID:usc-bbdl,项目名称:R01_HSC_cadaver_system,代码行数:59,代码来源:DownloadDialog.py

示例4: on_saveButton_clicked

 def on_saveButton_clicked(self):
     """
     Private slot to handle the Save button press.
     
     It saves the diff shown in the dialog to a file in the local
     filesystem.
     """
     if type(self.filename) is types.ListType:
         if len(self.filename) > 1:
             fname = self.vcs.splitPathList(self.filename)[0]
         else:
             dname, fname = self.vcs.splitPath(self.filename[0])
             if fname != '.':
                 fname = "%s.diff" % self.filename[0]
             else:
                 fname = dname
     else:
         fname = self.vcs.splitPath(self.filename)[0]
     
     selectedFilter = QString("")
     fname = KQFileDialog.getSaveFileName(\
         self,
         self.trUtf8("Save Diff"),
         fname,
         self.trUtf8("Patch Files (*.diff)"),
         selectedFilter,
         QFileDialog.Options(QFileDialog.DontConfirmOverwrite))
     
     if fname.isEmpty():
         return
     
     ext = QFileInfo(fname).suffix()
     if ext.isEmpty():
         ex = selectedFilter.section('(*',1,1).section(')',0,0)
         if not ex.isEmpty():
             fname.append(ex)
     if QFileInfo(fname).exists():
         res = KQMessageBox.warning(self,
             self.trUtf8("Save Diff"),
             self.trUtf8("<p>The patch file <b>%1</b> already exists.</p>")
                 .arg(fname),
             QMessageBox.StandardButtons(\
                 QMessageBox.Abort | \
                 QMessageBox.Save),
             QMessageBox.Abort)
         if res != QMessageBox.Save:
             return
     fname = unicode(Utilities.toNativeSeparators(fname))
     
     try:
         f = open(fname, "wb")
         f.write(unicode(self.contents.toPlainText()))
         f.close()
     except IOError, why:
         KQMessageBox.critical(self, self.trUtf8('Save Diff'),
             self.trUtf8('<p>The patch file <b>%1</b> could not be saved.'
                 '<br>Reason: %2</p>')
                 .arg(unicode(fname)).arg(str(why)))
开发者ID:usc-bbdl,项目名称:R01_HSC_cadaver_system,代码行数:58,代码来源:SvnDiffDialog.py

示例5: on_exceptDirButton_clicked

 def on_exceptDirButton_clicked(self):
     """
     Private slot to select a file to exempt from translation.
     """
     texcept = KQFileDialog.getExistingDirectory(\
         self,
         self.trUtf8("Exempt directory from translation"),
         self.project.ppath,
         QFileDialog.Options(QFileDialog.ShowDirsOnly))
     if not texcept.isEmpty():
         self.exceptionEdit.setText(Utilities.toNativeSeparators(texcept))
开发者ID:usc-bbdl,项目名称:R01_HSC_cadaver_system,代码行数:11,代码来源:TranslationPropertiesDialog.py

示例6: on_pathButton_clicked

 def on_pathButton_clicked(self):
     """
     Private slot called to open a directory selection dialog.
     """
     path = KQFileDialog.getExistingDirectory(\
         self,
         self.trUtf8("Select source directory"),
         QDir.fromNativeSeparators(self.pathnameEdit.text()),
         QFileDialog.Options(QFileDialog.Option(0)))
     if not path.isEmpty():
         self.pathnameEdit.setText(QDir.toNativeSeparators(path))
开发者ID:usc-bbdl,项目名称:R01_HSC_cadaver_system,代码行数:11,代码来源:NewDialogClassDialog.py

示例7: on_pelButton_clicked

 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))
开发者ID:usc-bbdl,项目名称:R01_HSC_cadaver_system,代码行数:12,代码来源:EditorSpellCheckingPage.py

示例8: on_iconButton_clicked

 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)
开发者ID:usc-bbdl,项目名称:R01_HSC_cadaver_system,代码行数:12,代码来源:ToolConfigurationDialog.py

示例9: on_styleSheetButton_clicked

 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))
开发者ID:usc-bbdl,项目名称:R01_HSC_cadaver_system,代码行数:12,代码来源:HelpAppearancePage.py

示例10: on_fileButton_clicked

 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))
开发者ID:usc-bbdl,项目名称:R01_HSC_cadaver_system,代码行数:12,代码来源:SvnPropSetDialog.py

示例11: on_exceptFileButton_clicked

 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))
开发者ID:usc-bbdl,项目名称:R01_HSC_cadaver_system,代码行数:12,代码来源:TranslationPropertiesDialog.py

示例12: on_qt4DocDirButton_clicked

 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))
开发者ID:usc-bbdl,项目名称:R01_HSC_cadaver_system,代码行数:12,代码来源:HelpDocumentationPage.py

示例13: on_qt4TransButton_clicked

 def on_qt4TransButton_clicked(self):
     """
     Private slot to handle the Qt4 translations directory selection.
     """
     dir = KQFileDialog.getExistingDirectory(\
         self,
         self.trUtf8("Select Qt4 Translations Directory"),
         self.qt4TransEdit.text(),
         QFileDialog.Options(QFileDialog.ShowDirsOnly))
         
     if not dir.isNull():
         self.qt4TransEdit.setText(Utilities.toNativeSeparators(dir))
开发者ID:usc-bbdl,项目名称:R01_HSC_cadaver_system,代码行数:12,代码来源:QtPage.py

示例14: on_customViewerSelectionButton_clicked

 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))
开发者ID:usc-bbdl,项目名称:R01_HSC_cadaver_system,代码行数:12,代码来源:HelpViewersPage.py

示例15: on_iconDirectoryButton_clicked

 def on_iconDirectoryButton_clicked(self):
     """
     Private slot to select an icon directory.
     """
     dir = KQFileDialog.getExistingDirectory(\
         None,
         self.trUtf8("Select icon directory"),
         QString(),
         QFileDialog.Options(QFileDialog.ShowDirsOnly))
         
     if not dir.isEmpty():
         self.iconDirectoryEdit.setText(Utilities.toNativeSeparators(dir))
开发者ID:usc-bbdl,项目名称:R01_HSC_cadaver_system,代码行数:12,代码来源:IconsPage.py


注:本文中的KdeQt.KQFileDialog类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。