275 self.__historyWrap = Preferences.getShell("HistoryWrap") |
275 self.__historyWrap = Preferences.getShell("HistoryWrap") |
276 self.__history = [] |
276 self.__history = [] |
277 self.__setHistoryIndex() |
277 self.__setHistoryIndex() |
278 # remove obsolete shell histories (Python and Ruby) |
278 # remove obsolete shell histories (Python and Ruby) |
279 for clientType in ["Python", "Ruby"]: |
279 for clientType in ["Python", "Ruby"]: |
280 Preferences.Prefs.settings.remove("Shell/Histories/" + clientType) |
280 Preferences.getSettings().remove("Shell/Histories/" + clientType) |
281 |
281 |
282 # clear QScintilla defined keyboard commands |
282 # clear QScintilla defined keyboard commands |
283 # we do our own handling through the view manager |
283 # we do our own handling through the view manager |
284 self.clearAlternateKeys() |
284 self.clearAlternateKeys() |
285 self.clearKeys() |
285 self.clearKeys() |
434 self.monospacedStyles(font) |
434 self.monospacedStyles(font) |
435 return |
435 return |
436 |
436 |
437 # get the font for style 0 and set it as the default font |
437 # get the font for style 0 and set it as the default font |
438 key = 'Scintilla/{0}/style0/font'.format(self.lexer_.language()) |
438 key = 'Scintilla/{0}/style0/font'.format(self.lexer_.language()) |
439 fdesc = Preferences.Prefs.settings.value(key) |
439 fdesc = Preferences.getSettings().value(key) |
440 if fdesc is not None: |
440 if fdesc is not None: |
441 font = QFont([fdesc[0]], int(fdesc[1])) |
441 font = QFont([fdesc[0]], int(fdesc[1])) |
442 self.lexer_.setDefaultFont(font) |
442 self.lexer_.setDefaultFont(font) |
443 self.setLexer(self.lexer_) |
443 self.setLexer(self.lexer_) |
444 self.lexer_.readSettings(Preferences.Prefs.settings, "Scintilla") |
444 self.lexer_.readSettings(Preferences.getSettings(), "Scintilla") |
445 if self.lexer_.hasSubstyles(): |
445 if self.lexer_.hasSubstyles(): |
446 self.lexer_.readSubstyles(self) |
446 self.lexer_.readSubstyles(self) |
447 |
447 |
448 # initialize the lexer APIs settings |
448 # initialize the lexer APIs settings |
449 api = self.vm.getAPIsManager().getAPIs(self.language) |
449 api = self.vm.getAPIsManager().getAPIs(self.language) |
687 # determine based on history style |
687 # determine based on history style |
688 if ( |
688 if ( |
689 self.clientType and |
689 self.clientType and |
690 self.__historyStyle == ShellHistoryStyle.WINDOWSSTYLE |
690 self.__historyStyle == ShellHistoryStyle.WINDOWSSTYLE |
691 ): |
691 ): |
692 idx = int(Preferences.Prefs.settings.value( |
692 idx = int(Preferences.getSettings().value( |
693 "Shell/HistoryIndexes/" + self.clientType, -1)) |
693 "Shell/HistoryIndexes/" + self.clientType, -1)) |
694 if idx >= len(self.__history): |
694 if idx >= len(self.__history): |
695 idx = -1 |
695 idx = -1 |
696 self.__histidx = idx |
696 self.__histidx = idx |
697 else: |
697 else: |
702 self.__histidx = -1 |
702 self.__histidx = -1 |
703 if ( |
703 if ( |
704 self.clientType and |
704 self.clientType and |
705 self.__historyStyle == ShellHistoryStyle.WINDOWSSTYLE |
705 self.__historyStyle == ShellHistoryStyle.WINDOWSSTYLE |
706 ): |
706 ): |
707 Preferences.Prefs.settings.setValue( |
707 Preferences.getSettings().setValue( |
708 "Shell/HistoryIndexes/" + self.clientType, self.__histidx) |
708 "Shell/HistoryIndexes/" + self.clientType, self.__histidx) |
709 |
709 |
710 def __isHistoryIndexValid(self): |
710 def __isHistoryIndexValid(self): |
711 """ |
711 """ |
712 Private method to test, if the history index is valid. |
712 Private method to test, if the history index is valid. |
729 """ |
729 """ |
730 Public method to load the history for the given client type. |
730 Public method to load the history for the given client type. |
731 |
731 |
732 @param clientType type of the debug client (string) |
732 @param clientType type of the debug client (string) |
733 """ |
733 """ |
734 hl = Preferences.Prefs.settings.value("Shell/Histories/" + clientType) |
734 hl = Preferences.getSettings().value("Shell/Histories/" + clientType) |
735 if hl is not None: |
735 if hl is not None: |
736 self.__historyLists[clientType] = hl[-self.__maxHistoryEntries:] |
736 self.__historyLists[clientType] = hl[-self.__maxHistoryEntries:] |
737 else: |
737 else: |
738 self.__historyLists[clientType] = [] |
738 self.__historyLists[clientType] = [] |
739 |
739 |
751 Public method to save the history for the given client type. |
751 Public method to save the history for the given client type. |
752 |
752 |
753 @param clientType type of the debug client (string) |
753 @param clientType type of the debug client (string) |
754 """ |
754 """ |
755 if clientType in self.__historyLists: |
755 if clientType in self.__historyLists: |
756 Preferences.Prefs.settings.setValue( |
756 Preferences.getSettings().setValue( |
757 "Shell/Histories/" + clientType, |
757 "Shell/Histories/" + clientType, |
758 self.__historyLists[clientType]) |
758 self.__historyLists[clientType]) |
759 |
759 |
760 def getHistory(self, clientType): |
760 def getHistory(self, clientType): |
761 """ |
761 """ |
813 |
813 |
814 def clearAllHistories(self): |
814 def clearAllHistories(self): |
815 """ |
815 """ |
816 Public method to clear all available histories and sync them. |
816 Public method to clear all available histories and sync them. |
817 """ |
817 """ |
818 Preferences.Prefs.settings.beginGroup("Shell/Histories") |
818 Preferences.getSettings().beginGroup("Shell/Histories") |
819 for clientType in Preferences.Prefs.settings.childKeys(): |
819 for clientType in Preferences.getSettings().childKeys(): |
820 self.__historyLists[clientType] = [] |
820 self.__historyLists[clientType] = [] |
821 self.saveHistory(clientType) |
821 self.saveHistory(clientType) |
822 Preferences.Prefs.settings.endGroup() |
822 Preferences.getSettings().endGroup() |
823 |
823 |
824 self.clearHistory() |
824 self.clearHistory() |
825 |
825 |
826 def getClientType(self): |
826 def getClientType(self): |
827 """ |
827 """ |