예제 #1
0
    def __init__(self, screen, desktops):
        EventDispatcher.__init__(self)

        self.screen = screen
        self.desktops = desktops
        self.active_desktop = desktops[0]
        self.active_desktop_idx = 0
        self.update_hints()

        self.screen.push_handlers(self)
        self.install_handlers()
예제 #2
0
파일: base.py 프로젝트: samurai-x/samurai-x
 def __init__(self):
     EventDispatcher.__init__(self)
     self.data = {} # key: data
예제 #3
0
파일: term.py 프로젝트: samurai-x/samurai-x
    def __init__(self):
        EventDispatcher.__init__(self)

        self.char_handlers = {
            ASCII_NUL  : self.on_char_ignore,
            ASCII_BK  : self.on_char_ignore,
            ASCII_BS   : self.on_char_BS,
            ASCII_HT   : self.on_char_HT,
            ASCII_VT   : self.on_char_LF,
            ASCII_FF   : self.on_char_LF,
            ASCII_CR   : self.on_char_CR,
            ASCII_LF   : self.on_char_LF,
            ASCII_XON  : self.on_char_ignore,
            ASCII_XOFF : self.on_char_ignore,
            ASCII_ESC  : self.on_char_ESC,
            ASCII_CSI  : self.on_char_ESC,
        }

        self.escape_seq_handlers = {
            'A' : self.on_esc_seq_A,
            'B' : self.on_esc_seq_B,
            'C' : self.on_esc_seq_C,
            'D' : self.on_esc_seq_D,
            'G' : self.on_esc_seq_G,
            'H' : self.on_esc_seq_H,
            'J' : self.on_esc_seq_J,
            'K' : self.on_esc_seq_K,
            'd' : self.on_esc_seq_d,
            'm' : self.on_esc_seq_m,
            'h' : self.on_esc_seq_h,
            'l' : self.on_esc_seq_l,
            'c' : self.on_esc_seq_c,
            'r' : self.on_esc_seq_r,
            'f' : self.on_esc_seq_f,
        }

        self.esc_seq_hl_handlers = {
            # Lock keyboard (set); Unlock keyboard (reset)
            #'2': self.on_esc_seq_hl_2, 
            # Insert mode (set); Replace mode (reset)
            #'4': self.on_esc_seq_hl_4, 
            # Echo on (set); Echo off (reset)
            #'12': self.on_esc_seq_hl_12, 
            # Return = CR+LF (set); Return = CR (reset)
            #'20': self.on_esc_seq_hl_20, 
            # Cursorkeys application (set); Cursorkeys normal (reset)
            #'?1': self.on_esc_seq_hl_q1, 
            # Ansi (set); VT52 (reset)
            #'?2': self.on_esc_seq_hl_q2, 
            # 132 char/row (set); 80 char/row (reset)
            #'?3': self.on_esc_seq_hl_q3, 
            # Jump scroll (set); Smooth scroll (reset)
            #'?4': self.on_esc_seq_hl_q4, 
            # Reverse screen (set); Normal screen (reset)
            #'?5': self.on_esc_seq_hl_q5, 
            # Sets relative coordinates (set); Sets absolute coordinates (reset)
            #'?6': self.on_esc_seq_hl_q6, 
            # Auto wrap (set); Auto wrap off (reset)
            #'?7': self.on_esc_seq_hl_q7, 
            # Auto repeat on (set); Auto repeat off (reset)
            #'?8': self.on_esc_seq_hl_q8, 
            # Send FF to printer after print screen (set); No char after PS (reset)
            #'?18': self.on_esc_seq_hl_q18, 
            # Print screen prints full screen (set); PS prints scroll region (reset)
            #'?19': self.on_esc_seq_hl_q19, 
            # Cursor on (set); Cursor off (reset) 
            '?25': self.on_esc_seq_hl_q25, 
            # ?47 save/restore screen
            '?47': self.on_esq_seq_hl_q47,
        }

        # used to save partial data in .write()
        self._saved_data = None

        # size of the scrollback buffer
        self.buffer_size = 1000

        # stack of saved screens
        self.saved_screens = []
        
        # the screen object 
        self.screen = TermScreen(self)