Skip to content

Commit

Permalink
Merge SIP v2 update
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanW2 committed Jun 8, 2013
2 parents 02c29c0 + a939ab1 commit 22133d8
Show file tree
Hide file tree
Showing 141 changed files with 1,205 additions and 1,390 deletions.
30 changes: 15 additions & 15 deletions python/console/console.py
Expand Up @@ -248,7 +248,7 @@ def __init__(self, parent=None):
self.objectListButton = QAction(self)
self.objectListButton.setCheckable(True)
self.objectListButton.setEnabled(self.settings.value("pythonConsole/enableObjectInsp",
False).toBool())
False, type=bool))
self.objectListButton.setIcon(QgsApplication.getThemeIcon("console/iconClassBrowserConsole.png"))
self.objectListButton.setMenuRole(QAction.PreferencesRole)
self.objectListButton.setIconVisibleInMenu(True)
Expand Down Expand Up @@ -553,7 +553,7 @@ def _findPrev(self):
self.tabEditorWidget.currentWidget().newEditor.findText(False)

def _textFindChanged(self):
if not self.lineEditFind.text().isEmpty():
if self.lineEditFind.text():
self.findNextButton.setEnabled(True)
self.findPrevButton.setEnabled(True)
else:
Expand Down Expand Up @@ -615,11 +615,11 @@ def uncommentCode(self):
self.tabEditorWidget.currentWidget().newEditor.commentEditorCode(False)

def openScriptFile(self):
lastDirPath = self.settings.value("pythonConsole/lastDirPath").toString()
lastDirPath = self.settings.value("pythonConsole/lastDirPath")
openFileTr = QCoreApplication.translate("PythonConsole", "Open File")
fileList = QFileDialog.getOpenFileNames(
self, openFileTr, lastDirPath, "Script file (*.py)")
if not fileList.isEmpty():
if fileList:
for pyFile in fileList:
for i in range(self.tabEditorWidget.count()):
tabWidget = self.tabEditorWidget.widget(i)
Expand All @@ -631,7 +631,7 @@ def openScriptFile(self):
self.tabEditorWidget.newTabEditor(tabName, pyFile)

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

def saveScriptFile(self):
Expand All @@ -641,8 +641,8 @@ def saveScriptFile(self):
except (IOError, OSError), error:
errTr = QCoreApplication.translate("PythonConsole", "Save Error")
msgText = QCoreApplication.translate('PythonConsole',
'The file <b>%1</b> could not be saved. Error: %2') \
.arg(unicode(tabWidget.path)).arg(error.strerror)
'The file <b>{}</b> could not be saved. Error: {}'.format(unicode(tabWidget.path),
error.strerror))
self.callWidgetMessageBarEditor(msgText, 2, False)

def saveAsScriptFile(self, index=None):
Expand All @@ -662,14 +662,14 @@ def saveAsScriptFile(self, index=None):
filename = QFileDialog.getSaveFileName(self,
saveAsFileTr,
pathFileName, "Script file (*.py)")
if not filename.isEmpty():
if filename:
try:
tabWidget.save(filename)
except (IOError, OSError), error:
errTr = QCoreApplication.translate("PythonConsole", "Save Error")
msgText = QCoreApplication.translate('PythonConsole',
'The file <b>%1</b> could not be saved. Error: %2') \
.arg(unicode(tabWidget.path)).arg(error.strerror)
'The file <b>{}</b> could not be saved. Error: {}'.format(unicode(tabWidget.path),
error.strerror))
self.callWidgetMessageBarEditor(msgText, 2, False)
if fileNone:
tabWidget.path = None
Expand Down Expand Up @@ -706,7 +706,7 @@ def updateTabListScript(self, script, action=None):
else:
self.tabListScript = []
self.settings.setValue("pythonConsole/tabScripts",
QVariant(self.tabListScript))
self.tabListScript)

def saveSettingsConsole(self):
self.settings.setValue("pythonConsole/splitterConsole", self.splitter.saveState())
Expand All @@ -717,10 +717,10 @@ def saveSettingsConsole(self):

def restoreSettingsConsole(self):
storedTabScripts = self.settings.value("pythonConsole/tabScripts")
self.tabListScript = storedTabScripts.toList()
self.splitter.restoreState(self.settings.value("pythonConsole/splitterConsole").toByteArray())
self.splitterEditor.restoreState(self.settings.value("pythonConsole/splitterEditor").toByteArray())
self.splitterObj.restoreState(self.settings.value("pythonConsole/splitterObj").toByteArray())
self.tabListScript = storedTabScripts
self.splitter.restoreState(self.settings.value("pythonConsole/splitterConsole", QByteArray()))
self.splitterEditor.restoreState(self.settings.value("pythonConsole/splitterEditor", QByteArray()))
self.splitterObj.restoreState(self.settings.value("pythonConsole/splitterObj", QByteArray()))

if __name__ == '__main__':
a = QApplication(sys.argv)
Expand Down

0 comments on commit 22133d8

Please sign in to comment.