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( self._attrspec_to_escape(AttrSpec('', '')) + escape.SI + escape.MOUSE_TRACKING_OFF + escape.SHOW_CURSOR + move_cursor + "\n" + escape.SHOW_CURSOR) self._input_iter = None if self._old_signal_keys: self.tty_signal_keys(*self._old_signal_keys) 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) self._term_output_file.write(self._attrspec_to_escape(AttrSpec('','')) + escape.SI + escape.MOUSE_TRACKING_OFF + escape.SHOW_CURSOR + move_cursor + "\n" + escape.SHOW_CURSOR ) self._input_iter = self._fake_input_iter() if self._old_signal_keys: self.tty_signal_keys(*self._old_signal_keys) 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 set_cursor_position(x, y): if not partial_display(): return escape.set_cursor_position(x, y) if cy > y: return ('\b' + escape.CURSOR_HOME_COL + escape.move_cursor_up(cy - y) + escape.move_cursor_right(x)) return ('\b' + escape.CURSOR_HOME_COL + escape.move_cursor_down(y - cy) + escape.move_cursor_right(x))
def set_cursor_row(y): if not partial_display(): return escape.set_cursor_position(0, y) return escape.move_cursor_down(y - cy)
def set_cursor_home(): if not partial_display(): return escape.set_cursor_position(0, 0) return (escape.CURSOR_HOME_COL + escape.move_cursor_up(cy))
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 sb.append(row) #if cy != y: o.append( escape.set_cursor_position(0,y) ) #cy = y+1 # will be here after updating this line if y == maxrow-1: row, back, ins = self._last_row(row) first = True lasta = lastcs = None for (a,cs, run) in row: run = run.translate( _trans_table ) assert self.palette.has_key(a), `a` if first or lasta != a: o.append( self.palette[a][0] ) lasta = a if first or lastcs != cs: assert cs in [None, "0"], `cs`
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 sb.append(row) #if cy != y: o.append(escape.set_cursor_position(0, y)) #cy = y+1 # will be here after updating this line if y == maxrow - 1: row, back, ins = self._last_row(row) first = True lasta = lastcs = None for (a, cs, run) in row: run = run.translate(_trans_table) assert self.palette.has_key(a), ` a ` if first or lasta != a: o.append(self.palette[a][0]) lasta = a if first or lastcs != cs: assert cs in [None, "0"], ` cs `