Example #1
0
 def _dbg_instr(self): # messy input string (intended for debugging)
     curses.echo()
     self.stdscr.nodelay(0)
     curses.halfdelay(100)
     str = self.stdscr.getstr()
     curses.noecho()
     return str
Example #2
0
    def _start(self):
        """
        Initialize the screen and input mode.
        """
        self.stdscr = curses.initscr()
        self.has_color = curses.has_colors()
        if self.has_color:
            curses.start_color()
            if curses_.COLORS < 8:
                # not colourful enough
                self.has_color = False
        if self.has_color:
            try:
                curses.use_default_colors()
                self.has_default_colors=True
            except _curses.error:
                self.has_default_colors=False
        self._setup_colour_pairs()
        curses.noecho()
        # curses.meta(None, 1)
        #todo
        curses.meta( None,1)
        curses.halfdelay(1) # use set_input_timeouts to adjust
        self.stdscr.keypad(True)

        if not self._signal_keys_set:
            self._old_signal_keys = self.tty_signal_keys()
            
        self.set_mouse_tracking(True)

        super(Screen, self)._start()
Example #3
0
 def _getch(self, wait_tenths):
     if wait_tenths==0:
         return self._getch_nodelay()
     if wait_tenths is None:
         curses.cbreak()
     else:
         curses.halfdelay(wait_tenths)
     self.stdscr.nodelay(0)
     return self.stdscr.getch()