Skip to content

Commit

Permalink
Merge pull request #620 from slarosa/update_sipapiv2_console
Browse files Browse the repository at this point in the history
more update to console for sipapiv2
  • Loading branch information
m-kuhn committed May 29, 2013
2 parents d28d202 + bc726dc commit 9db7ab9
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
10 changes: 5 additions & 5 deletions python/console/console.py
Expand Up @@ -548,7 +548,7 @@ def _findPrev(self):
self.tabEditorWidget.currentWidget().newEditor.findText(False)

def _textFindChanged(self):
if not self.lineEditFind.text():
if self.lineEditFind.text():
self.findNextButton.setEnabled(True)
self.findPrevButton.setEnabled(True)
else:
Expand Down Expand Up @@ -614,7 +614,7 @@ def openScriptFile(self):
openFileTr = QCoreApplication.translate("PythonConsole", "Open File")
fileList = QFileDialog.getOpenFileNames(
self, openFileTr, lastDirPath, "Script file (*.py)")
if not fileList:
if fileList:
for pyFile in fileList:
for i in range(self.tabEditorWidget.count()):
tabWidget = self.tabEditorWidget.widget(i)
Expand All @@ -626,7 +626,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 Down Expand Up @@ -657,7 +657,7 @@ def saveAsScriptFile(self, index=None):
filename = QFileDialog.getSaveFileName(self,
saveAsFileTr,
pathFileName, "Script file (*.py)")
if not filename:
if filename:
try:
tabWidget.save(filename)
except (IOError, OSError), error:
Expand Down Expand Up @@ -701,7 +701,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 Down
6 changes: 3 additions & 3 deletions python/console/console_editor.py
Expand Up @@ -183,7 +183,7 @@ def __init__(self, parent=None):
def settingsEditor(self):
# Set Python lexer
self.setLexers()
threshold = self.settings.value("pythonConsole/autoCompThresholdEditor", 2)
threshold = self.settings.value("pythonConsole/autoCompThresholdEditor", 2, type=int)
radioButtonSource = self.settings.value("pythonConsole/autoCompleteSourceEditor", 'fromAPI')
autoCompEnabled = self.settings.value("pythonConsole/autoCompleteEnabledEditor", True)
self.setAutoCompletionThreshold(threshold)
Expand Down Expand Up @@ -217,7 +217,7 @@ def setLexers(self):
self.lexer.setFoldQuotes(True)

loadFont = self.settings.value("pythonConsole/fontfamilytextEditor", "Monospace")
fontSize = self.settings.value("pythonConsole/fontsizeEditor", 10)
fontSize = self.settings.value("pythonConsole/fontsizeEditor", 10, type=int)

font = QFont(loadFont)
font.setFixedPitch(True)
Expand Down Expand Up @@ -1201,7 +1201,7 @@ def refreshSettingsEditor(self):
def changeLastDirPath(self, tab):
tabWidget = self.widget(tab)
if tabWidget:
self.settings.setValue("pythonConsole/lastDirPath", QVariant(tabWidget.path))
self.settings.setValue("pythonConsole/lastDirPath", tabWidget.path)

def widgetMessageBar(self, iface, text, level, timed=True):
messageLevel = [QgsMessageBar.INFO, QgsMessageBar.WARNING, QgsMessageBar.CRITICAL]
Expand Down
2 changes: 1 addition & 1 deletion python/console/console_output.py
Expand Up @@ -144,7 +144,7 @@ def setLexers(self):
self.lexer = QsciLexerPython()

loadFont = self.settings.value("pythonConsole/fontfamilytext", "Monospace")
fontSize = self.settings.value("pythonConsole/fontsize", 10)
fontSize = self.settings.value("pythonConsole/fontsize", 10, type=int)
font = QFont(loadFont)
font.setFixedPitch(True)
font.setPointSize(fontSize)
Expand Down
10 changes: 5 additions & 5 deletions python/console/console_sci.py
Expand Up @@ -114,7 +114,7 @@ def __init__(self, parent=None):
def settingsShell(self):
# Set Python lexer
self.setLexers()
threshold = self.settings.value("pythonConsole/autoCompThreshold", 2)
threshold = self.settings.value("pythonConsole/autoCompThreshold", 2, type=int)
self.setAutoCompletionThreshold(threshold)
radioButtonSource = self.settings.value("pythonConsole/autoCompleteSource", 'fromAPI')
autoCompEnabled = self.settings.value("pythonConsole/autoCompleteEnabled", True)
Expand Down Expand Up @@ -169,7 +169,7 @@ def setLexers(self):
self.lexer = QsciLexerPython()

loadFont = self.settings.value("pythonConsole/fontfamilytext", "Monospace")
fontSize = self.settings.value("pythonConsole/fontsize", 10)
fontSize = self.settings.value("pythonConsole/fontsize", 10, type=int)

font = QFont(loadFont)
font.setFixedPitch(True)
Expand Down Expand Up @@ -299,7 +299,7 @@ def readHistoryFile(self):

def clearHistory(self, clearSession=False):
if clearSession:
self.history = QStringList()
self.history = []
msgText = QCoreApplication.translate('PythonConsole',
'Session and file history cleared successfully.')
self.parent.callWidgetMessageBar(msgText)
Expand All @@ -320,7 +320,7 @@ def clearHistorySession(self):
self.clearHistory(True)

def showPrevious(self):
if self.historyIndex < len(self.history) and not self.history:
if self.historyIndex < len(self.history) and self.history:
line, pos = self.getCursorPosition()
selCmdLenght = len(self.text(line))
self.setSelection(line, 4, line, selCmdLenght)
Expand All @@ -335,7 +335,7 @@ def showPrevious(self):
#self.SendScintilla(QsciScintilla.SCI_DELETEBACK)

def showNext(self):
if self.historyIndex > 0 and not self.history:
if self.historyIndex > 0 and self.history:
line, pos = self.getCursorPosition()
selCmdLenght = len(self.text(line))
self.setSelection(line, 4, line, selCmdLenght)
Expand Down
8 changes: 4 additions & 4 deletions python/console/console_settings.py
Expand Up @@ -142,8 +142,8 @@ def saveSettings(self):

def restoreSettings(self):
settings = QSettings()
self.spinBox.setValue(settings.value("pythonConsole/fontsize", 10))
self.spinBoxEditor.setValue(settings.value("pythonConsole/fontsizeEditor", 10))
self.spinBox.setValue(settings.value("pythonConsole/fontsize", 10, type=int))
self.spinBoxEditor.setValue(settings.value("pythonConsole/fontsizeEditor", 10, type=int))
self.fontComboBox.setCurrentFont(QFont(settings.value("pythonConsole/fontfamilytext",
"Monospace")))
self.fontComboBoxEditor.setCurrentFont(QFont(settings.value("pythonConsole/fontfamilytextEditor",
Expand All @@ -159,8 +159,8 @@ def restoreSettings(self):
self.tableWidget.setItem(i, 1, QTableWidgetItem(itemTable[i]))
self.autoSaveScript.setChecked(settings.value("pythonConsole/autoSaveScript", False, type=bool))

self.autoCompThreshold.setValue(settings.value("pythonConsole/autoCompThreshold", 2))
self.autoCompThresholdEditor.setValue(settings.value("pythonConsole/autoCompThresholdEditor", 2))
self.autoCompThreshold.setValue(settings.value("pythonConsole/autoCompThreshold", 2, type=int))
self.autoCompThresholdEditor.setValue(settings.value("pythonConsole/autoCompThresholdEditor", 2, type=int))

self.enableObjectInspector.setChecked(settings.value("pythonConsole/enableObjectInsp", False, type=bool))
self.autoCloseBracketEditor.setChecked(settings.value("pythonConsole/autoCloseBracketEditor", True, type=bool))
Expand Down

0 comments on commit 9db7ab9

Please sign in to comment.