當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。