Skip to content

Commit

Permalink
[pyqgis-console] again more upadte for sip api v2
Browse files Browse the repository at this point in the history
  • Loading branch information
slarosa committed May 29, 2013
1 parent 9db7ab9 commit b1843de
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
16 changes: 8 additions & 8 deletions python/console/console_editor.py
Expand Up @@ -385,7 +385,7 @@ def findText(self, forward):
cs = self.parent.pc.caseSensitive.isChecked()
wo = self.parent.pc.wholeWord.isChecked()
notFound = False
if not text:
if text:
if not forward:
line = lineFrom
index = indexFrom
Expand Down Expand Up @@ -462,7 +462,7 @@ def commentEditorCode(self, commentCheck):
if commentCheck:
self.insertAt('#', line, 0)
else:
if not self.text(line).trimmed().startsWith('#'):
if not self.text(line).strip().startswith('#'):
continue
self.setSelection(line, self.indentation(line),
line, self.indentation(line) + 1)
Expand All @@ -472,7 +472,7 @@ def commentEditorCode(self, commentCheck):
if commentCheck:
self.insertAt('#', line, 0)
else:
if not self.text(line).trimmed().startsWith('#'):
if not self.text(line).strip().startswith('#'):
return
self.setSelection(line, self.indentation(line),
line, self.indentation(line) + 1)
Expand Down Expand Up @@ -908,7 +908,7 @@ def __init__(self, parent):

def _currentWidgetChanged(self, tab):
if self.settings.value("pythonConsole/enableObjectInsp",
False):
False, type=bool):
self.listObject(tab)
self.changeLastDirPath(tab)
self.enableSaveIfModified(tab)
Expand Down Expand Up @@ -1091,11 +1091,11 @@ def showFileTabMenu(self):
self.fileTabMenu.clear()
for index in range(self.count()):
action = self.fileTabMenu.addAction(self.tabIcon(index), self.tabText(index))
action.setData(QVariant(index))
action.setData(index)

def showFileTabMenuTriggered(self, action):
index, ok = action.data().toInt()
if ok:
index = action.data()
if index is not None:
self.setCurrentIndex(index)

def listObject(self, tab):
Expand Down Expand Up @@ -1186,7 +1186,7 @@ def refreshSettingsEditor(self):
self.widget(i).newEditor.settingsEditor()

objInspectorEnabled = self.settings.value("pythonConsole/enableObjectInsp",
False)
False, type=bool)
listObj = self.parent.objectListButton
if self.parent.listClassMethod.isVisible():
listObj.setChecked(objInspectorEnabled)
Expand Down
2 changes: 1 addition & 1 deletion python/console/console_sci.py
Expand Up @@ -194,7 +194,7 @@ def setLexers(self):
else:
apiPath = self.settings.value("pythonConsole/userAPI")
for i in range(0, len(apiPath)):
self.api.load(QString(unicode(apiPath[i])))
self.api.load(unicode(apiPath[i]))
self.api.prepare()
self.lexer.setAPIs(self.api)

Expand Down
40 changes: 20 additions & 20 deletions python/console/console_settings.py
Expand Up @@ -98,47 +98,47 @@ def removeAPI(self):

def saveSettings(self):
settings = QSettings()
settings.setValue("pythonConsole/preloadAPI", QVariant(self.preloadAPI.isChecked()))
settings.setValue("pythonConsole/autoSaveScript", QVariant(self.autoSaveScript.isChecked()))
settings.setValue("pythonConsole/preloadAPI", self.preloadAPI.isChecked())
settings.setValue("pythonConsole/autoSaveScript", self.autoSaveScript.isChecked())

fontFamilyText = self.fontComboBox.currentText()
settings.setValue("pythonConsole/fontfamilytext", QVariant(fontFamilyText))
settings.setValue("pythonConsole/fontfamilytext", fontFamilyText)
fontFamilyTextEditor = self.fontComboBoxEditor.currentText()
settings.setValue("pythonConsole/fontfamilytextEditor", QVariant(fontFamilyTextEditor))
settings.setValue("pythonConsole/fontfamilytextEditor", fontFamilyTextEditor)

fontSize = self.spinBox.value()
fontSizeEditor = self.spinBoxEditor.value()

for i in range(0, self.tableWidget.rowCount()):
text = self.tableWidget.item(i, 1).text()
self.listPath.append(text)
settings.setValue("pythonConsole/fontsize", QVariant(fontSize))
settings.setValue("pythonConsole/fontsizeEditor", QVariant(fontSizeEditor))
settings.setValue("pythonConsole/userAPI", QVariant(self.listPath))
settings.setValue("pythonConsole/fontsize", fontSize)
settings.setValue("pythonConsole/fontsizeEditor", fontSizeEditor)
settings.setValue("pythonConsole/userAPI", self.listPath)

settings.setValue("pythonConsole/autoCompThreshold", QVariant(self.autoCompThreshold.value()))
settings.setValue("pythonConsole/autoCompThresholdEditor", QVariant(self.autoCompThresholdEditor.value()))
settings.setValue("pythonConsole/autoCompThreshold", self.autoCompThreshold.value())
settings.setValue("pythonConsole/autoCompThresholdEditor", self.autoCompThresholdEditor.value())

settings.setValue("pythonConsole/autoCompleteEnabledEditor", QVariant(self.groupBoxAutoCompletionEditor.isChecked()))
settings.setValue("pythonConsole/autoCompleteEnabled", QVariant(self.groupBoxAutoCompletion.isChecked()))
settings.setValue("pythonConsole/autoCompleteEnabledEditor", self.groupBoxAutoCompletionEditor.isChecked())
settings.setValue("pythonConsole/autoCompleteEnabled", self.groupBoxAutoCompletion.isChecked())

if self.autoCompFromAPIEditor.isChecked():
settings.setValue("pythonConsole/autoCompleteSourceEditor", QVariant('fromAPI'))
settings.setValue("pythonConsole/autoCompleteSourceEditor", 'fromAPI')
elif self.autoCompFromDocEditor.isChecked():
settings.setValue("pythonConsole/autoCompleteSourceEditor", QVariant('fromDoc'))
settings.setValue("pythonConsole/autoCompleteSourceEditor", 'fromDoc')
elif self.autoCompFromDocAPIEditor.isChecked():
settings.setValue("pythonConsole/autoCompleteSourceEditor", QVariant('fromDocAPI'))
settings.setValue("pythonConsole/autoCompleteSourceEditor", 'fromDocAPI')

if self.autoCompFromAPI.isChecked():
settings.setValue("pythonConsole/autoCompleteSource", QVariant('fromAPI'))
settings.setValue("pythonConsole/autoCompleteSource", 'fromAPI')
elif self.autoCompFromDoc.isChecked():
settings.setValue("pythonConsole/autoCompleteSource", QVariant('fromDoc'))
settings.setValue("pythonConsole/autoCompleteSource", 'fromDoc')
elif self.autoCompFromDocAPI.isChecked():
settings.setValue("pythonConsole/autoCompleteSource", QVariant('fromDocAPI'))
settings.setValue("pythonConsole/autoCompleteSource", 'fromDocAPI')

settings.setValue("pythonConsole/enableObjectInsp", QVariant(self.enableObjectInspector.isChecked()))
settings.setValue("pythonConsole/autoCloseBracket", QVariant(self.autoCloseBracket.isChecked()))
settings.setValue("pythonConsole/autoCloseBracketEditor", QVariant(self.autoCloseBracketEditor.isChecked()))
settings.setValue("pythonConsole/enableObjectInsp", self.enableObjectInspector.isChecked())
settings.setValue("pythonConsole/autoCloseBracket", self.autoCloseBracket.isChecked())
settings.setValue("pythonConsole/autoCloseBracketEditor", self.autoCloseBracketEditor.isChecked())

def restoreSettings(self):
settings = QSettings()
Expand Down

0 comments on commit b1843de

Please sign in to comment.