QScintilla/Shell.py

changeset 7
c679fb30c8f3
parent 0
de9c2efb9d02
child 12
1d8dd9706f46
equal deleted inserted replaced
6:52e8c820d0dd 7:c679fb30c8f3
141 self.lmenu = QMenu(self.trUtf8('Start')) 141 self.lmenu = QMenu(self.trUtf8('Start'))
142 self.clientLanguages = self.dbs.getSupportedLanguages(shellOnly = True) 142 self.clientLanguages = self.dbs.getSupportedLanguages(shellOnly = True)
143 self.clientLanguages.sort() 143 self.clientLanguages.sort()
144 for language in self.clientLanguages: 144 for language in self.clientLanguages:
145 act = self.lmenu.addAction(language) 145 act = self.lmenu.addAction(language)
146 act.setData(QVariant(language)) 146 act.setData(language)
147 self.connect(self.lmenu, SIGNAL("triggered(QAction *)"), self.__startDebugClient) 147 self.connect(self.lmenu, SIGNAL("triggered(QAction *)"), self.__startDebugClient)
148 148
149 # Create the history context menu 149 # Create the history context menu
150 self.hmenu = QMenu(self.trUtf8('History')) 150 self.hmenu = QMenu(self.trUtf8('History'))
151 self.hmenu.addAction(self.trUtf8('Select entry'), self.__selectHistory) 151 self.hmenu.addAction(self.trUtf8('Select entry'), self.__selectHistory)
239 self.monospacedStyles(font) 239 self.monospacedStyles(font)
240 return 240 return
241 241
242 # get the font for style 0 and set it as the default font 242 # get the font for style 0 and set it as the default font
243 key = 'Scintilla/%s/style0/font' % self.lexer_.language() 243 key = 'Scintilla/%s/style0/font' % self.lexer_.language()
244 fontVariant = Preferences.Prefs.settings.value(key) 244 fdesc = Preferences.Prefs.settings.value(key)
245 if fontVariant.isValid(): 245 if fdesc is not None:
246 fdesc = fontVariant.toStringList()
247 font = QFont(fdesc[0], int(fdesc[1])) 246 font = QFont(fdesc[0], int(fdesc[1]))
248 self.lexer_.setDefaultFont(font) 247 self.lexer_.setDefaultFont(font)
249 self.setLexer(self.lexer_) 248 self.setLexer(self.lexer_)
250 self.lexer_.readSettings(Preferences.Prefs.settings, "Scintilla") 249 self.lexer_.readSettings(Preferences.Prefs.settings, "Scintilla")
251 250
422 """ 421 """
423 Public method to load the history for the given client type. 422 Public method to load the history for the given client type.
424 423
425 @param clientType type of the debug client (string) 424 @param clientType type of the debug client (string)
426 """ 425 """
427 hVariant = Preferences.Prefs.settings.value("Shell/Histories/" + clientType) 426 hl = Preferences.Prefs.settings.value("Shell/Histories/" + clientType)
428 if hVariant.isValid(): 427 if hl is not None:
429 hl = hVariant.toStringList()
430 self.historyLists[clientType] = hl[-self.maxHistoryEntries:] 428 self.historyLists[clientType] = hl[-self.maxHistoryEntries:]
431 else: 429 else:
432 self.historyLists[clientType] = [] 430 self.historyLists[clientType] = []
433 431
434 def reloadHistory(self): 432 def reloadHistory(self):
445 443
446 @param clientType type of the debug client (string) 444 @param clientType type of the debug client (string)
447 """ 445 """
448 if self.historyLists.has_key(clientType): 446 if self.historyLists.has_key(clientType):
449 Preferences.Prefs.settings.setValue(\ 447 Preferences.Prefs.settings.setValue(\
450 "Shell/Histories/" + clientType, QVariant(self.historyLists[clientType])) 448 "Shell/Histories/" + clientType, self.historyLists[clientType])
451 449
452 def getHistory(self, clientType): 450 def getHistory(self, clientType):
453 """ 451 """
454 Public method to get the history for the given client type. 452 Public method to get the history for the given client type.
455 453
1235 """ 1233 """
1236 Private slot to start a debug client accoding to the action triggered. 1234 Private slot to start a debug client accoding to the action triggered.
1237 1235
1238 @param action context menu action that was triggered (QAction) 1236 @param action context menu action that was triggered (QAction)
1239 """ 1237 """
1240 language = action.data().toString() 1238 language = action.data()
1241 self.dbs.startClient(False, language) 1239 self.dbs.startClient(False, language)
1242 1240
1243 def handlePreferencesChanged(self): 1241 def handlePreferencesChanged(self):
1244 """ 1242 """
1245 Public slot to handle the preferencesChanged signal. 1243 Public slot to handle the preferencesChanged signal.

eric ide

mercurial