Skip to content

Commit

Permalink
[pyqgis-console] enables to select multiple files to load in the file…
Browse files Browse the repository at this point in the history
… editor
  • Loading branch information
slarosa committed May 22, 2013
1 parent 75896d9 commit 2a9e0ae
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions python/console/console.py
Expand Up @@ -612,21 +612,22 @@ def uncommentCode(self):
def openScriptFile(self):
lastDirPath = self.settings.value("pythonConsole/lastDirPath").toString()
openFileTr = QCoreApplication.translate("PythonConsole", "Open File")
filename = QFileDialog.getOpenFileName(
fileList = QFileDialog.getOpenFileNames(
self, openFileTr, lastDirPath, "Script file (*.py)")
if not filename.isEmpty():
for i in range(self.tabEditorWidget.count()):
tabWidget = self.tabEditorWidget.widget(i)
if tabWidget.path == filename:
self.tabEditorWidget.setCurrentWidget(tabWidget)
break
else:
tabName = filename.split('/')[-1]
self.tabEditorWidget.newTabEditor(tabName, filename)

lastDirPath = QFileInfo(filename).path()
self.settings.setValue("pythonConsole/lastDirPath", QVariant(filename))
self.updateTabListScript(filename, action='append')
if not fileList.isEmpty():
for pyFile in fileList:
for i in range(self.tabEditorWidget.count()):
tabWidget = self.tabEditorWidget.widget(i)
if tabWidget.path == pyFile:
self.tabEditorWidget.setCurrentWidget(tabWidget)
break
else:
tabName = QFileInfo(pyFile).fileName()
self.tabEditorWidget.newTabEditor(tabName, pyFile)

lastDirPath = QFileInfo(pyFile).path()
self.settings.setValue("pythonConsole/lastDirPath", QVariant(pyFile))
self.updateTabListScript(pyFile, action='append')

def saveScriptFile(self):
tabWidget = self.tabEditorWidget.currentWidget()
Expand Down

0 comments on commit 2a9e0ae

Please sign in to comment.