Skip to content
Permalink
Browse files

more update to console for sipapiv2

  • Loading branch information
slarosa committed May 29, 2013
1 parent d28d202 commit bc726dcbb56d33b254aec227ad6720441c82f628
@@ -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:
@@ -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)
@@ -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):
@@ -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:
@@ -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())
@@ -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)
@@ -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)
@@ -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]
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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",
@@ -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))

0 comments on commit bc726dc

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