def register_palette_entry( self, name, foreground, background, mono=None): """Register a single palette entry. name -- new entry/attribute name foreground -- foreground colour, one of: 'black', 'dark red', 'dark green', 'brown', 'dark blue', 'dark magenta', 'dark cyan', 'light gray', 'dark gray', 'light red', 'light green', 'yellow', 'light blue', 'light magenta', 'light cyan', 'white', 'default' (black if unable to use terminal's default) background -- background colour, one of: 'black', 'dark red', 'dark green', 'brown', 'dark blue', 'dark magenta', 'dark cyan', 'light gray', 'default' (light gray if unable to use terminal's default) mono -- monochrome terminal attribute, one of: None (default), 'bold', 'underline', 'standout', or a tuple containing a combination eg. ('bold','underline') """ assert (mono is None or mono in (None, 'bold', 'underline', 'standout') or type(mono)==type(())) self.palette[name] = (escape.set_attributes( foreground, background), mono)
def stop(self): """ Restore the screen. """ self.clear() if not self._started: return self.signal_restore() termios.tcsetattr(0, termios.TCSADRAIN, self._old_termios_settings) move_cursor = "" if self.gpm_mev: self._stop_gpm_tracking() if self._alternate_buffer: move_cursor = escape.RESTORE_NORMAL_BUFFER elif self.maxrow is not None: move_cursor = escape.set_cursor_position( 0, self.maxrow) sys.stdout.write( escape.set_attributes( 'default', 'default') + escape.SI + escape.SHOW_CURSOR + escape.MOUSE_TRACKING_OFF + move_cursor + "\n" + escape.SHOW_CURSOR ) self._input_iter = None self._started = False
def stop(self): """ Restore the screen. """ self.clear() if not self._started: return self.signal_restore() termios.tcsetattr(0, termios.TCSADRAIN, self._old_termios_settings) move_cursor = "" if self.gpm_mev: self._stop_gpm_tracking() if self._alternate_buffer: move_cursor = escape.RESTORE_NORMAL_BUFFER elif self.maxrow is not None: move_cursor = escape.set_cursor_position(0, self.maxrow) sys.stdout.write( escape.set_attributes('default', 'default') + escape.SI + escape.SHOW_CURSOR + escape.MOUSE_TRACKING_OFF + move_cursor + "\n" + escape.SHOW_CURSOR) self._input_iter = None self._started = False
def register_palette_entry(self, name, foreground, background, mono=None): """Register a single palette entry. name -- new entry/attribute name foreground -- foreground colour, one of: 'black', 'dark red', 'dark green', 'brown', 'dark blue', 'dark magenta', 'dark cyan', 'light gray', 'dark gray', 'light red', 'light green', 'yellow', 'light blue', 'light magenta', 'light cyan', 'white', 'default' (black if unable to use terminal's default) background -- background colour, one of: 'black', 'dark red', 'dark green', 'brown', 'dark blue', 'dark magenta', 'dark cyan', 'light gray', 'default' (light gray if unable to use terminal's default) mono -- monochrome terminal attribute, one of: None (default), 'bold', 'underline', 'standout', or a tuple containing a combination eg. ('bold','underline') """ assert (mono is None or mono in (None, 'bold', 'underline', 'standout') or type(mono) == type(())) self.palette[name] = (escape.set_attributes(foreground, background), mono)
if self.setup_G1: try: if util._use_dec_special: sys.stdout.write( escape.DESIGNATE_G1_SPECIAL) sys.stdout.flush() self.setup_G1 = False except IOError, e: pass if self.resized: # handle resize before trying to draw screen return o = [ escape.HIDE_CURSOR, escape.CURSOR_HOME, escape.set_attributes('default','default') ] if self.screen_buf: osb = self.screen_buf else: osb = [] sb = [] ins = None #cy = 0 y = -1 for row in r.content(): y += 1 if osb and osb[y] == row: sb.append( osb[y] ) continue
if self.setup_G1: try: if util._use_dec_special: sys.stdout.write(escape.DESIGNATE_G1_SPECIAL) sys.stdout.flush() self.setup_G1 = False except IOError, e: pass if self.resized: # handle resize before trying to draw screen return o = [ escape.HIDE_CURSOR, escape.CURSOR_HOME, escape.set_attributes('default', 'default') ] if self.screen_buf: osb = self.screen_buf else: osb = [] sb = [] ins = None #cy = 0 y = -1 for row in r.content(): y += 1 if osb and osb[y] == row: sb.append(osb[y])