Skip to content
Permalink
Browse files

[pyqgis-console] enables to select multiple files to load in the file…

… editor
  • Loading branch information
slarosa committed May 22, 2013
1 parent 75896d9 commit 2a9e0aee918dd4de67ac4fa11be784e8cbfaf91e
Showing with 15 additions and 14 deletions.
  1. +15 −14 python/console/console.py
@@ -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()

0 comments on commit 2a9e0ae

Please sign in to comment.
You can’t perform that action at this time.