Skip to content

Commit 22133d8

Browse files
committed
Merge SIP v2 update
2 parents 02c29c0 + a939ab1 commit 22133d8

File tree

141 files changed

+1205
-1390
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+1205
-1390
lines changed

python/console/console.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def __init__(self, parent=None):
248248
self.objectListButton = QAction(self)
249249
self.objectListButton.setCheckable(True)
250250
self.objectListButton.setEnabled(self.settings.value("pythonConsole/enableObjectInsp",
251-
False).toBool())
251+
False, type=bool))
252252
self.objectListButton.setIcon(QgsApplication.getThemeIcon("console/iconClassBrowserConsole.png"))
253253
self.objectListButton.setMenuRole(QAction.PreferencesRole)
254254
self.objectListButton.setIconVisibleInMenu(True)
@@ -553,7 +553,7 @@ def _findPrev(self):
553553
self.tabEditorWidget.currentWidget().newEditor.findText(False)
554554

555555
def _textFindChanged(self):
556-
if not self.lineEditFind.text().isEmpty():
556+
if self.lineEditFind.text():
557557
self.findNextButton.setEnabled(True)
558558
self.findPrevButton.setEnabled(True)
559559
else:
@@ -615,11 +615,11 @@ def uncommentCode(self):
615615
self.tabEditorWidget.currentWidget().newEditor.commentEditorCode(False)
616616

617617
def openScriptFile(self):
618-
lastDirPath = self.settings.value("pythonConsole/lastDirPath").toString()
618+
lastDirPath = self.settings.value("pythonConsole/lastDirPath")
619619
openFileTr = QCoreApplication.translate("PythonConsole", "Open File")
620620
fileList = QFileDialog.getOpenFileNames(
621621
self, openFileTr, lastDirPath, "Script file (*.py)")
622-
if not fileList.isEmpty():
622+
if fileList:
623623
for pyFile in fileList:
624624
for i in range(self.tabEditorWidget.count()):
625625
tabWidget = self.tabEditorWidget.widget(i)
@@ -631,7 +631,7 @@ def openScriptFile(self):
631631
self.tabEditorWidget.newTabEditor(tabName, pyFile)
632632

633633
lastDirPath = QFileInfo(pyFile).path()
634-
self.settings.setValue("pythonConsole/lastDirPath", QVariant(pyFile))
634+
self.settings.setValue("pythonConsole/lastDirPath", pyFile)
635635
self.updateTabListScript(pyFile, action='append')
636636

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

648648
def saveAsScriptFile(self, index=None):
@@ -662,14 +662,14 @@ def saveAsScriptFile(self, index=None):
662662
filename = QFileDialog.getSaveFileName(self,
663663
saveAsFileTr,
664664
pathFileName, "Script file (*.py)")
665-
if not filename.isEmpty():
665+
if filename:
666666
try:
667667
tabWidget.save(filename)
668668
except (IOError, OSError), error:
669669
errTr = QCoreApplication.translate("PythonConsole", "Save Error")
670670
msgText = QCoreApplication.translate('PythonConsole',
671-
'The file <b>%1</b> could not be saved. Error: %2') \
672-
.arg(unicode(tabWidget.path)).arg(error.strerror)
671+
'The file <b>{}</b> could not be saved. Error: {}'.format(unicode(tabWidget.path),
672+
error.strerror))
673673
self.callWidgetMessageBarEditor(msgText, 2, False)
674674
if fileNone:
675675
tabWidget.path = None
@@ -706,7 +706,7 @@ def updateTabListScript(self, script, action=None):
706706
else:
707707
self.tabListScript = []
708708
self.settings.setValue("pythonConsole/tabScripts",
709-
QVariant(self.tabListScript))
709+
self.tabListScript)
710710

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

718718
def restoreSettingsConsole(self):
719719
storedTabScripts = self.settings.value("pythonConsole/tabScripts")
720-
self.tabListScript = storedTabScripts.toList()
721-
self.splitter.restoreState(self.settings.value("pythonConsole/splitterConsole").toByteArray())
722-
self.splitterEditor.restoreState(self.settings.value("pythonConsole/splitterEditor").toByteArray())
723-
self.splitterObj.restoreState(self.settings.value("pythonConsole/splitterObj").toByteArray())
720+
self.tabListScript = storedTabScripts
721+
self.splitter.restoreState(self.settings.value("pythonConsole/splitterConsole", QByteArray()))
722+
self.splitterEditor.restoreState(self.settings.value("pythonConsole/splitterEditor", QByteArray()))
723+
self.splitterObj.restoreState(self.settings.value("pythonConsole/splitterObj", QByteArray()))
724724

725725
if __name__ == '__main__':
726726
a = QApplication(sys.argv)

0 commit comments

Comments
 (0)