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


Python QtGui.QFileDialog方法代码示例

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


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

示例1: brdIn

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QFileDialog [as 别名]
def brdIn():
  board=qg.QFileDialog().getOpenFileName() [0]
  try:
		radice=et.parse(board).getroot()
		el=[]
		pos=[]
		for ramo in radice.iter('element'):
			el.append(ramo)
		for e in el:
			x=float(e.attrib['x'])
			y=float(e.attrib['y'])
			if ('rot' in e.attrib) and (e.attrib['rot'].lstrip('R').isdigit()):
				rot=float(e.attrib['rot'].lstrip('R'))
			else:
				rot=0.0
			pos.append([e.attrib['name'],[x,y,rot]])
		dpos=dict(pos)
		for k in dpos.keys():
			App.Console.PrintMessage(str(k)+'\t'+str(dpos[k])+'\n')
		return dpos
  except:
		App.Console.PrintMessage('no such file\n') 
开发者ID:oddtopus,项目名称:flamingo,代码行数:24,代码来源:eagleCmd.py

示例2: getfile

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QFileDialog [as 别名]
def getfile(file_ext='', text='', button_caption='', button_type=0, title=''):
    filter = {
        '': '',
        'txt': 'File (*.txt)',
        'dbf': 'Table/DBF (*.dbf)',
    }.get(file_ext, '*.' + file_ext)
    t = QtGui.QFileDialog()
    t.setFilter('All Files (*.*);;' + filter)
    t.selectFilter(filter or 'All Files (*.*);;')
    if text:
        (next(x for x in t.findChildren(QtGui.QLabel) if x.text() == 'File &name:')).setText(text)
    if button_caption:
        t.setLabelText(QtGui.QFileDialog.Accept, button_caption)
    if title:
        t.setWindowTitle(title)
    t.exec_()
    return t.selectedFiles()[0] 
开发者ID:mwisslead,项目名称:vfp2py,代码行数:19,代码来源:vfpfunc.py

示例3: download_button_clicked

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QFileDialog [as 别名]
def download_button_clicked(self):

        directory = QtGui.QFileDialog().getExistingDirectory()
        if not directory or len(directory) == 0 or not os.path.exists(directory):
            return
        self.download_button.setVisible(False)
        self.download_progress.setVisible(True)
        filename = os.path.basename(self.link())
        self.full_filename = os.path.join(directory, filename)

        url = QtCore.QUrl(self.link())
        request = QtNetwork.QNetworkRequest(url)
        self.current_download = self.manager.get(request)
        self.current_download.setReadBufferSize(1048576)
        self.connect(self.current_download, QtCore.SIGNAL("downloadProgress(qint64, qint64)"),
                     self.download_hook)
        self.current_download.downloadProgress.connect(self.download_hook)
        self.current_download.finished.connect(self.download_finished)
        self.current_download.readyRead.connect(self.download_ready_read)
        self.current_f = open(self.full_filename, 'wb')
        self.parent.exiting.connect(self.closing) 
开发者ID:glamrock,项目名称:Satori,代码行数:23,代码来源:utils.py

示例4: Activated

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QFileDialog [as 别名]
def Activated(self):
        selection = [s for s in FreeCADGui.Selection.getSelection() if s.Document == FreeCAD.ActiveDocument ]
        obj = selection[0]
        filename, filetype = QtGui.QFileDialog.getSaveFileName(
            QtGui.QApplication.activeWindow(),
            "Specify the filename for the fork of '%s'" % obj.Label[:obj.Label.find('_import')],
            os.path.dirname(FreeCAD.ActiveDocument.FileName),
            "FreeCAD Document (*.fcstd)"
            )
        if filename == '':
            return
        if not os.path.exists(filename):
            debugPrint(2, 'copying %s -> %s' % (obj.sourceFile, filename))
            shutil.copyfile(obj.sourceFile, filename)
            obj.sourceFile = filename
            FreeCAD.open(obj.sourceFile)
        else:
            QtGui.QMessageBox.critical(  QtGui.QApplication.activeWindow(), "Bad filename", "Specify a new filename!") 
开发者ID:hamish2014,项目名称:FreeCAD_assembly2,代码行数:20,代码来源:__init__.py

示例5: getFromFile

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QFileDialog [as 别名]
def getFromFile():
  '''Input polar coord. from .csv: returns a list of (x,y,0).
  The file must be ";" separated: column A = radius, column B = angle'''
  from PySide import QtGui
  fileIn=open(QtGui.QFileDialog().getOpenFileName()[0],'r')
  lines=fileIn.readlines()
  fileIn.close()
  xyCoord=[]
  for line in lines:
    polarCoord=line.split(';')
    xyCoord.append(polar2xy(float(polarCoord[0]),float(polarCoord[1])*math.pi/180))
  return xyCoord 
开发者ID:oddtopus,项目名称:flamingo,代码行数:14,代码来源:polarUtilsCmd.py

示例6: getdir

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QFileDialog [as 别名]
def getdir(dir='.', text='', caption='Select Text', flags=0, root_only=False):
    return QtGui.QFileDialog.getExistingDirectory(parent=S['_screen'], caption=caption, dir=dir) 
开发者ID:mwisslead,项目名称:vfp2py,代码行数:4,代码来源:vfpfunc.py

示例7: select_folder_button_clicked

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QFileDialog [as 别名]
def select_folder_button_clicked(self):
        directory = QtGui.QFileDialog().getExistingDirectory()
        if not directory or len(directory) == 0 or not os.path.exists(directory):
            return
        file_list = list(filter(lambda x: os.path.isfile(x), map(lambda x: os.path.join(directory, x), os.listdir(directory))))
        if len(file_list) > 0:
            self.check_sha_sums(file_list) 
开发者ID:glamrock,项目名称:Satori,代码行数:9,代码来源:mainform.py

示例8: select_file_button_clicked

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QFileDialog [as 别名]
def select_file_button_clicked(self):
        file_path = QtGui.QFileDialog().getOpenFileName()[0]
        if not file_path or len(file_path) == 0 or not os.path.exists(file_path):
            return
        self.check_sha_sums([file_path]) 
开发者ID:glamrock,项目名称:Satori,代码行数:7,代码来源:mainform.py

示例9: saveFigure

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QFileDialog [as 别名]
def saveFigure(self):
        ''' Exports the current window to an image '''
        if self.activePlotContainer and self.activePlot:
            rast = "Rasterized Images (*.png *.tiff *.bmp *.jpg *.jpeg *.gif)"
            pdf = "Portable Document Format (*.pdf)"
            svg = "Scalable Vector Graphics (*.svg *.html)"
            # (fileName, extension) = QtGui.QFileDialog().getSaveFileName(self, 'Save Plot as image', os.getcwd(), rast + ";;" + pdf + ";;" + svg)
            (fileName, extension) = QtGui.QFileDialog().getSaveFileName(self, 'Save Plot as Image', os.getcwd(), rast)
            if not fileName:
                return
            if extension == rast:
                gc = chaco.plot_graphics_context.PlotGraphicsContext((self.activePlotContainer.activeWidget.width(), self.activePlotContainer.activeWidget.height()))
                gc.render_component(self.activePlotContainer.activeWidget.component)
                gc.save(fileName)
                print "Saved rasterized image to: ", fileName
                '''
                elif extension == pdf:
                    print "PDF rendering is currently in a unfinished state!"
                    __import__("chaco.pdf_graphics_context", globals(), locals(), [], -1)
                    gc = chaco.pdf_graphics_context.PdfPlotGraphicsContext(None, fileName, "A4")
                    gc.render_component(self.activePlotContainer.activeWidget.component)
                    gc.save()
                    print "Saved PDF to: ", fileName
                elif extension == svg:
                    __import__("chaco.svg_graphics_context", globals(), locals(), [], -1)
                    gc = chaco.svg_graphics_context.SVGGraphicsContext((self.activePlotContainer.activeWidget.width(), self.activePlotContainer.activeWidget.height()))
                    gc.render_component(self.activePlotContainer.activeWidget.component)
                    gc.save(fileName)
                    print "Saved SVG to: ", fileName
                '''
            else:
                print "File extension error. Unable to save image."
        else:
            print "Error saving plot. Plot type unknown or invalid" 
开发者ID:PySimulator,项目名称:PySimulator,代码行数:36,代码来源:PySimulator.py

示例10: _openFileMenu

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QFileDialog [as 别名]
def _openFileMenu(self, loaderplugin):
        extensionStr = ''
        for ex in loaderplugin.modelExtension:
            extensionStr += u'*.' + ex + u';'
        if len(extensionStr) > 0:
            extensionStr = extensionStr[:-1]
        ''' Load a model '''
        (fileName, trash) = QtGui.QFileDialog().getOpenFileName(self, 'Open Model', os.getcwd(), extensionStr)
        if fileName == '':
            return
        split = unicode.rsplit(fileName, '.', 1)
        if len(split) > 1:
            suffix = split[1]
        else:
            suffix = u''
        modelName = None
        if suffix in [u'mo', u'moe']:
            if len(split[0]) > 0:
                split = unicode.rsplit(split[0], u'/', 1)
                defaultModelName = split[1]
            else:
                defaultModelName = u''
            modelName, ok = QtGui.QInputDialog().getText(self, 'Modelica model', 'Full Modelica model name / ident, e.g. Modelica.Blocks.Examples.PID_Controller', text=defaultModelName)
            if not ok:
                return


        self.setEnabled(False)
        self._loadingFileInfo()
        self.openModelFile(loaderplugin, fileName, modelName)
        self.setEnabled(True) 
开发者ID:PySimulator,项目名称:PySimulator,代码行数:33,代码来源:PySimulator.py

示例11: _openResultFileMenu

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QFileDialog [as 别名]
def _openResultFileMenu(self):
        ''' Load a Result file '''
        formats = 'All formats ('
        formats2 = ''
        for i, ext in enumerate(Plugins.SimulationResult.fileExtension):
            formats += ' *.' + ext
            formats2 += Plugins.SimulationResult.description[i] + ' (*.' + ext + ')'
            if i + 1 < len(Plugins.SimulationResult.fileExtension):
                formats2 += ';;'
        formats += ');;' + formats2
        (fileNames, trash) = QtGui.QFileDialog().getOpenFileNames(self, 'Open Result File', os.getcwd(), formats)
        import locale
        for fileName in fileNames:
            self.openResultFile(unicode(fileName.encode(locale.getpreferredencoding()), locale.getpreferredencoding()).replace(u'\\', u'/')) 
开发者ID:PySimulator,项目名称:PySimulator,代码行数:16,代码来源:PySimulator.py

示例12: _convertResultFileMenu

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QFileDialog [as 别名]
def _convertResultFileMenu(self):
        ''' Select a result file '''
        (fileName, trash) = QtGui.QFileDialog().getOpenFileName(self, 'Select Result File', os.getcwd(), 'Dymola Result File (*.mat)')
        if fileName == '':
            return
        print("Convert " + fileName + " ...")
        mtsfFileName = Plugins.SimulationResult.Mtsf.Mtsf.convertFromDymolaMatFile(fileName)
        print(" done: " + mtsfFileName + "\n") 
开发者ID:PySimulator,项目名称:PySimulator,代码行数:10,代码来源:PySimulator.py

示例13: _changeDirectoryMenu

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QFileDialog [as 别名]
def _changeDirectoryMenu(self):
        ''' Select a working directory '''
        dirName = QtGui.QFileDialog().getExistingDirectory(self, 'Select Working Directory', os.getcwd())
        if dirName == '':
            return
        self._chDir(dirName) 
开发者ID:PySimulator,项目名称:PySimulator,代码行数:8,代码来源:PySimulator.py

示例14: __init__

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QFileDialog [as 别名]
def __init__(self, modelName, modelFileName, config):

        SimulatorBase.Model.__init__(self, modelName, modelFileName, config)
        self.modelType = 'Modelica model in Wolfram'

        self.onlyResultFile = False
        self.integrationSettings.resultFileExtension = 'mat'

        self._availableIntegrationAlgorithms = ['DASSL', 'CVODES', 'Euler', 'RungeKutta', 'Heun']
        self.integrationSettings.algorithmName = self._availableIntegrationAlgorithms[0]

        self._IntegrationAlgorithmHasFixedStepSize = [False, False, True, True, True]
        self._IntegrationAlgorithmCanProvideStepSizeResults = [False, False, True, True, True]

        if not config['Plugins']['Wolfram'].has_key('mathLinkPath'):
            config['Plugins']['Wolfram']['mathLinkPath'] = ''
        mathLinkPath = config['Plugins']['Wolfram']['mathLinkPath']

        if mathLinkPath == '' or not os.path.exists(mathLinkPath):
            ''' Ask for MathLink executable '''
            print "No MathLink executable (math.exe or MathKernel.exe) found to run Wolfram. Please select one ..."
            (mathLinkPath, trash) = QtGui.QFileDialog().getOpenFileName(None, 'Select MathLink executable file', os.getcwd(), 'Executable file (*.exe)')
        if mathLinkPath == '':
            print "failed. No MathLink executable (math.exe or MathKernel.exe) specified."
            return None
        else:
            config['Plugins']['Wolfram']['mathLinkPath'] = mathLinkPath
            config.write()

        #Creates a link to a Mathematica Kernel and stores information needed for communication
        self.mathLink = pythonica.Pythonica(path= "" + mathLinkPath + "" )
        self.compileModel()

        self._initialResult = loadResultFileInit(os.path.join(os.getcwd(), self.name + ".sim")) 
开发者ID:PySimulator,项目名称:PySimulator,代码行数:36,代码来源:Wolfram.py


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