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


Python QtGui.QFileDialog方法代码示例

本文整理汇总了Python中PyQt4.QtGui.QFileDialog方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QFileDialog方法的具体用法?Python QtGui.QFileDialog怎么用?Python QtGui.QFileDialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt4.QtGui的用法示例。


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

示例1: openProject

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QFileDialog [as 别名]
def openProject(self):
    """
    Open an existing project
    """

    # Check if the current project has changed before continue operation
    if self.__checkCurrentConfigChanges() != QtGui.QMessageBox.Cancel:

      # Ask user for an existing file
      selectedFile = str(QtGui.QFileDialog().getOpenFileName(self, "Open Project", Global.appPath + '/projects', "NuPIC project files (*.nuproj)"))

      # If file exists, continue operation
      if selectedFile != '':
        # Open the selected project
        Global.project.open(selectedFile)

        # Initialize project state
        self.setWindowTitle(Global.project.name + " - [" + Global.project.fileName + "] - NuPIC Studio")
        self.markProjectChanges(False)
        self.__cleanUp()

        return True

    return False 
开发者ID:htm-community,项目名称:nupic.studio,代码行数:26,代码来源:main_form.py

示例2: selectPwFile

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QFileDialog [as 别名]
def selectPwFile(self):
        """
        Show file dialog and return file user chose to store the
        encrypted password database.
        """
        path = QtCore.QDir.currentPath()
        dialog = QtGui.QFileDialog(self, "Select password database file",
            path, "(*.pwdb)")
        dialog.setAcceptMode(QtGui.QFileDialog.AcceptSave)

        res = dialog.exec_()
        if not res:
            return

        fname = dialog.selectedFiles()[0]
        self.pwFileEdit.setText(fname) 
开发者ID:1deos,项目名称:deosorg,代码行数:18,代码来源:dialogs.py

示例3: saveProject

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QFileDialog [as 别名]
def saveProject(self):
    """
    Save the current project
    """

    # If current project is new, ask user for valid file
    fileName = Global.project.fileName
    if fileName == '':
      # Ask user for valid file
      selectedFile = str(QtGui.QFileDialog().getSaveFileName(self, "Save Project", Global.appPath + '/projects', "NuPIC project files (*.nuproj)"))

      # If file exists, continue operation
      if selectedFile != '':
        fileName = selectedFile

    # If file is Ok, continue operation
    if fileName != '':
      # Save to the selected location
      Global.project.save(fileName)

      # Initialize project state
      self.setWindowTitle(Global.project.name + " - [" + Global.project.fileName + "] - NuPIC Studio")
      self.markProjectChanges(False)

      return True

    return False 
开发者ID:htm-community,项目名称:nupic.studio,代码行数:29,代码来源:main_form.py

示例4: __buttonBrowseFile_Click

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QFileDialog [as 别名]
def __buttonBrowseFile_Click(self, event):
    # Ask user for an existing file
    selectedFile = QtGui.QFileDialog().getOpenFileName(self, "Open File", Global.appPath + '/projects', "Input files (*.csv)")

    # If file exists, set data source file
    if selectedFile != '':
      # Set file
      self.textBoxFile.setText(selectedFile) 
开发者ID:htm-community,项目名称:nupic.studio,代码行数:10,代码来源:node_sensor_form.py

示例5: file_dialog

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QFileDialog [as 别名]
def file_dialog(self, title):
        dialog = qg.QFileDialog()
        dialog.setWindowTitle(title)
        dialog.setFileMode(qg.QFileDialog.AnyFile)
        filenames = qc.QStringList()
        if dialog.exec_():
            filenames = dialog.selectedFiles()
            return filenames[0]
        raise Exception('Failed to open dialog') 
开发者ID:orppra,项目名称:ropa,代码行数:11,代码来源:dialog_service.py

示例6: saveBackup

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QFileDialog [as 别名]
def saveBackup(self):
        """
        Uses backup key encrypted by Trezor to decrypt all
        passwords at once and export them. Export format is
        CSV: group, key, password
        """
        dialog = QtGui.QFileDialog(self,
                                   "Select backup export file",
                                   "", "CVS files (*.csv)")
        dialog.setAcceptMode(QtGui.QFileDialog.AcceptSave)
        res = dialog.exec_()
        if not res:
            return
        fname = q2s(dialog.selectedFiles()[0])
        backupKey = self.pwMap.backupKey
        try:
            privateKey = backupKey.unwrapPrivateKey()
        except CallException:
            return
        with file(fname, "w") as f:
            csv.register_dialect("escaped", doublequote=False, escapechar='\\')
            writer = csv.writer(f, dialect="escaped")
            sortedGroupNames = sorted(self.pwMap.groups.keys())
            for groupName in sortedGroupNames:
                group = self.pwMap.groups[groupName]
                for entry in group.entries:
                    key, _, bkupPw = entry
                    password = backupKey.decryptPassword(bkupPw, privateKey)
                    csvEntry = (groupName, key, password)
                    writer.writerow(csvEntry) 
开发者ID:1deos,项目名称:deosorg,代码行数:32,代码来源:vault.py

示例7: event_show_select_file_dialog

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QFileDialog [as 别名]
def event_show_select_file_dialog(self):
        file_dialog = QtGui.QFileDialog()
        file_dialog.setAcceptMode(QtGui.QFileDialog.AcceptOpen)
        filters = [ "PEM Files (*.pem)", "Any files (*)" ]
        #        file_dialog.fileSelected.connect(self.event_file_selected)
        file_dialog.filesSelected.connect(self.event_files_selected)
        file_dialog.setFileMode(QtGui.QFileDialog.ExistingFiles)
        file_dialog.exec() 
开发者ID:dmayer,项目名称:time_trial,代码行数:10,代码来源:plotter_tab.py

示例8: save_as_pdf

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QFileDialog [as 别名]
def save_as_pdf(self):
        dialog = QtGui.QFileDialog(self)
        dialog.setDefaultSuffix("pdf")
        dialog.setWindowTitle("Save Figure as PDF...")
        dialog.setAcceptMode(QtGui.QFileDialog.AcceptSave)
        dialog.setFileMode(QtGui.QFileDialog.AnyFile)
        dialog.fileSelected.connect(self.save_as_pdf_to_file)
        dialog.exec() 
开发者ID:dmayer,项目名称:time_trial,代码行数:10,代码来源:plotter_widget.py


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