Ejemplo n.º 1
0
    def __init__(self, master=None, histfile=HISTFILE, current_session=False, **kw):
        """ Crée un historique vide """
        kw.setdefault('width', 1)
        RichText.__init__(self, master, **kw)

        self.histfile = histfile
        self.maxsize = CONFIG.getint('History', 'max_size', fallback=10000)
        self.history = []
        self.current_session = current_session

        # --- bindings
        self.bind('<1>', lambda e: self.focus_set())
        self.bind('<Control-a>', self.select_all)

        # --- load previous session history
        try:
            with open(histfile, 'rb') as file:
                dp = pickle.Unpickler(file)
                self.history = dp.load()
            self._session_start = len(self.history)
        except (FileNotFoundError, pickle.UnpicklingError, EOFError):
            self._session_start = 0
        self.reset_text(init=True)
Ejemplo n.º 2
0
 def update_style(self):
     RichText.update_style(self)
     self.maxsize = CONFIG.getint('History', 'max_size', fallback=10000)