def addTecFiles(self): simFolder = os.path.join(self.settings.value('projFolder'), 'sim') TecFiles = QFileDialog().getOpenFileNames(directory=simFolder) if TecFiles: for file in TecFiles: item = TECfile(self.tecList, QListWidgetItem.Type, file, self.iface) item.readTEC(file) item.readVariables(item.dat) self.tecList.addItem(item) self.addAttribute()
def setOutput(self, presetFolder): outputFolder = QFileDialog().getExistingDirectory( directory=presetFolder) for i in range(0, self.dlg.tecList.count()): item = self.dlg.tecList.item(i) if not item.outDir: item.outDir = outputFolder item.genNodeLayer() vlayer = self.registry.addMapLayer(item.nodeLayer) if item.xAttr: xAttr = item.xAttr else: xAttr = self.xAttr if item.yAttr: yAttr = item.yAttr else: yAttr = self.yAttr self.addAttributeToLayer(item.nodeLayer, xAttr, yAttr) renderer = self.buildRenderer(xAttr, yAttr) vlayer.setRendererV2(renderer)
def setItemFolder(self): item = self.dlg.tecList.currentItem() fileFolder = os.path.dirname(item.filePath) outputFolder = QFileDialog().getExistingDirectory(directory=fileFolder) if outputFolder: item.outDir = outputFolder
from qgis.PyQt import uic, QtCore, QtGui try: from qgis.PyQt.QtGui import QDockWidget, QFileDialog except: from qgis.PyQt.QtWidgets import QDockWidget, QFileDialog if False: filedlg = QFileDialog() filedlg.setNameFilters(["Text files (*.txt)", "Images (*.png *.jpg)"]) filedlg.selectNameFilter("Images (*.png *.jpg)") temp = filedlg.exec_() print(temp, filedlg.selectedFiles(), filedlg.selectedNameFilter()) if True: filedlg = QFileDialog() #tempname,extension = filedlg.getOpenFileName(None,'Choose the file',None, "Text files (*.txt) ;; Images (*.png *.jpg)", options = QFileDialog.DontUseNativeDialog) tempname = filedlg.getOpenFileName( None, 'Choose the file', None, "Text files (*.txt);; Images (*.png *.jpg)") print('tempname', tempname) print(filedlg.selectedNameFilter()) print(filedlg.selectedFilter())