more update to console for sipapiv2

This commit is contained in:
Salvatore Larosa 2013-05-29 17:30:12 +02:00
parent d28d2023b6
commit bc726dcbb5
5 changed files with 18 additions and 18 deletions

View File

@ -548,7 +548,7 @@ class PythonConsoleWidget(QWidget):
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 @@ class PythonConsoleWidget(QWidget):
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 @@ class PythonConsoleWidget(QWidget):
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 @@ class PythonConsoleWidget(QWidget):
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 @@ class PythonConsoleWidget(QWidget):
else:
self.tabListScript = []
self.settings.setValue("pythonConsole/tabScripts",
QVariant(self.tabListScript))
self.tabListScript)
def saveSettingsConsole(self):
self.settings.setValue("pythonConsole/splitterConsole", self.splitter.saveState())

View File

@ -183,7 +183,7 @@ class Editor(QsciScintilla):
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 @@ class Editor(QsciScintilla):
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 @@ class EditorTabWidget(QTabWidget):
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]

View File

@ -144,7 +144,7 @@ class ShellOutputScintilla(QsciScintilla):
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)

View File

@ -114,7 +114,7 @@ class ShellScintilla(QsciScintilla, code.InteractiveInterpreter):
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 @@ class ShellScintilla(QsciScintilla, code.InteractiveInterpreter):
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 @@ class ShellScintilla(QsciScintilla, code.InteractiveInterpreter):
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 @@ class ShellScintilla(QsciScintilla, code.InteractiveInterpreter):
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 @@ class ShellScintilla(QsciScintilla, code.InteractiveInterpreter):
#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)

View File

@ -142,8 +142,8 @@ class optionsDialog(QDialog, Ui_SettingsDialogPythonConsole):
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 @@ class optionsDialog(QDialog, Ui_SettingsDialogPythonConsole):
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))