QScintilla/Shell.py

changeset 12
1d8dd9706f46
parent 7
c679fb30c8f3
child 13
1af94a91f439
equal deleted inserted replaced
11:b0996e4a289e 12:1d8dd9706f46
14 from PyQt4.QtGui import * 14 from PyQt4.QtGui import *
15 from PyQt4.Qsci import QsciScintilla 15 from PyQt4.Qsci import QsciScintilla
16 16
17 from E4Gui.E4Application import e4App 17 from E4Gui.E4Application import e4App
18 18
19 import Lexers 19 from . import Lexers
20 from QsciScintillaCompat import QsciScintillaCompat, QSCINTILLA_VERSION 20 from .QsciScintillaCompat import QsciScintillaCompat, QSCINTILLA_VERSION
21 21
22 import Preferences 22 import Preferences
23 import UI.PixmapCache 23 import UI.PixmapCache
24 from Utilities import toUnicode 24 from Utilities import toUnicode
25 25
26 from Debugger.DebugClientCapabilities import HasShell, HasCompleter 26 from Debugger.DebugClientCapabilities import HasShell, HasCompleter
27 27
28 from ShellHistoryDialog import ShellHistoryDialog 28 from .ShellHistoryDialog import ShellHistoryDialog
29 29
30 class Shell(QsciScintillaCompat): 30 class Shell(QsciScintillaCompat):
31 """ 31 """
32 Class implementing a graphical Python shell. 32 Class implementing a graphical Python shell.
33 33
216 216
217 def closeShell(self): 217 def closeShell(self):
218 """ 218 """
219 Public method to shutdown the shell. 219 Public method to shutdown the shell.
220 """ 220 """
221 for key in self.historyLists.keys(): 221 for key in list(self.historyLists.keys()):
222 self.saveHistory(key) 222 self.saveHistory(key)
223 223
224 def __bindLexer(self, language = 'Python'): 224 def __bindLexer(self, language = 'Python'):
225 """ 225 """
226 Private slot to set the lexer. 226 Private slot to set the lexer.
409 self.__setAutoCompletion(clType) 409 self.__setAutoCompletion(clType)
410 self.__setCallTips(clType) 410 self.__setCallTips(clType)
411 self.racEnabled = Preferences.getShell("AutoCompletionEnabled") and \ 411 self.racEnabled = Preferences.getShell("AutoCompletionEnabled") and \
412 (cap & HasCompleter) > 0 412 (cap & HasCompleter) > 0
413 413
414 if not self.historyLists.has_key(clType): 414 if clType not in self.historyLists:
415 # load history list 415 # load history list
416 self.loadHistory(clType) 416 self.loadHistory(clType)
417 self.history = self.historyLists[clType] 417 self.history = self.historyLists[clType]
418 self.histidx = -1 418 self.histidx = -1
419 419
441 """ 441 """
442 Public method to save the history for the given client type. 442 Public method to save the history for the given client type.
443 443
444 @param clientType type of the debug client (string) 444 @param clientType type of the debug client (string)
445 """ 445 """
446 if self.historyLists.has_key(clientType): 446 if clientType in self.historyLists:
447 Preferences.Prefs.settings.setValue(\ 447 Preferences.Prefs.settings.setValue(\
448 "Shell/Histories/" + clientType, self.historyLists[clientType]) 448 "Shell/Histories/" + clientType, self.historyLists[clientType])
449 449
450 def getHistory(self, clientType): 450 def getHistory(self, clientType):
451 """ 451 """
1254 self.__setAutoCompletion() 1254 self.__setAutoCompletion()
1255 self.__setCallTips() 1255 self.__setCallTips()
1256 1256
1257 # do the history related stuff 1257 # do the history related stuff
1258 self.maxHistoryEntries = Preferences.getShell("MaxHistoryEntries") 1258 self.maxHistoryEntries = Preferences.getShell("MaxHistoryEntries")
1259 for key in self.historyLists.keys(): 1259 for key in list(self.historyLists.keys()):
1260 self.historyLists[key] = \ 1260 self.historyLists[key] = \
1261 self.historyLists[key][-self.maxHistoryEntries:] 1261 self.historyLists[key][-self.maxHistoryEntries:]
1262 1262
1263 # do stdout /stderr stuff 1263 # do stdout /stderr stuff
1264 showStdOutErr = Preferences.getShell("ShowStdOutErr") 1264 showStdOutErr = Preferences.getShell("ShowStdOutErr")

eric ide

mercurial