def __init__(self, *args, **kwargs): """ Class initializer. Initialize a lightbar of height, width, y and x, and position. :param int width: width of window. :param int height: height of window. :param int yloc: y-location of window. :param int xloc: x-location of window. :param dict colors: color theme, only key value of ``highlight`` is used. :param dict glyphs: bordering window character glyphs. :param dict keyset: command keys, global ``NETHACK_KEYSET`` is used by default, augmented by application keys such as home, end, pgup, etc. :param list content: Lightbar content as list of tuples, an empty list is used by default. Tuples must be in form of ``(key, str)``. ``key`` may have any suitable significance for the caller. ``str``, however, must be of a unicode terminal sequence. """ self._selected = False self._quit = False self._vitem_idx = self._vitem_shift = -1 self.content = kwargs.pop('content', list()) pos = kwargs.pop('position', (0, 0)) or (0, 0) self.init_keystrokes( keyset=kwargs.pop('keyset', NETHACK_KEYSET.copy())) AnsiWindow.__init__(self, *args, **kwargs) self.position = pos
def __init__(self, yloc, xloc, width, left, right, **kwargs): """ Class initializer. Initialize a selector of width, y x, and left/right values. :param int width: width of window. :param int yloc: y-location of selector. :param int xloc: x-location of selector. :param dict colors: color theme, only key value of ``selected`` and ``unselected`` is used. :param dict keyset: command keys, global ``VI_KEYSET`` is used by default, augmented by application keys such as home, end, pgup, etc. :param str left: text string of left-side selection. :param str right: text string of right-side selection. """ self._left = self._selection = left self._right = right self._moved = False self._quit = False self._selected = False self.init_keystrokes(keyset=kwargs.pop('keyset', VI_KEYSET.copy())) AnsiWindow.__init__(self, height=1, width=width, yloc=yloc, xloc=xloc, **kwargs)
def __init__(self, *args, **kwargs): """ Class constructor. :param int width: width of window. :param int yloc: y-location of window. :param int xloc: x-location of window. :param int max_length: maximum length of input (may be larger than width). :param dict colors: color theme, only key value of ``highlight`` is used. :param dict glyphs: bordering window character glyphs. :param dict keyset: command keys, global ``PC_KEYSET`` is used by default. """ self._term = getterminal() self._horiz_shift = 0 self._horiz_pos = 0 # self._enable_scrolling = False self._horiz_lastshift = 0 self._scroll_pct = kwargs.pop('scroll_pct', 25.0) self._margin_pct = kwargs.pop('margin_pct', 10.0) self._carriage_returned = False self._max_length = kwargs.pop('max_length', 0) self._quit = False self._bell = False self.content = kwargs.pop('content', u'') self._input_length = self._term.length(self.content) # there are some flaws about how a 'height' of a window must be # '3', even though we only want 1; we must also offset (y, x) by # 1 and width by 2: issue #161. kwargs['height'] = 3 self.init_keystrokes(keyset=kwargs.pop('keyset', PC_KEYSET.copy())) AnsiWindow.__init__(self, *args, **kwargs)
def __init__(self, *args, **kwargs): """ Class initializer. :param int width: width of window. :param int yloc: y-location of window. :param int xloc: x-location of window. :param int max_length: maximum length of input (even when scrolled). :param dict colors: color theme. :param dict glyphs: bordering window character glyphs. :param dict keyset: command keys, global ``PC_KEYSET`` is default. """ self._term = getterminal() self._horiz_shift = 0 self._horiz_pos = 0 # self._enable_scrolling = False self._horiz_lastshift = 0 self._scroll_pct = kwargs.pop('scroll_pct', 25.0) self._margin_pct = kwargs.pop('margin_pct', 10.0) self._carriage_returned = False self._max_length = kwargs.pop('max_length', 0) self._quit = False self._bell = False self.content = kwargs.pop('content', u'') self._input_length = self._term.length(self.content) # there are some flaws about how a 'height' of a window must be # '3', even though we only want 1; we must also offset (y, x) by # 1 and width by 2: issue #161. kwargs['height'] = 3 self.init_keystrokes(keyset=kwargs.pop('keyset', PC_KEYSET.copy())) AnsiWindow.__init__(self, *args, **kwargs)
def __init__(self, height, width, yloc, xloc): """ Initialize a pager of height, width, y, and x position. """ AnsiWindow.__init__(self, height, width, yloc, xloc) self._position = self._position_last = 0 self._quit = False self.content = list() self.keyset = VI_KEYSET.copy() self.init_keystrokes()
def __init__(self, *args, **kwargs): """ Initialize a lightbar of height, width, y and x, and position. """ self._selected = False self._quit = False pos = kwargs.pop('position', (0, 0)) or (0, 0) self.init_keystrokes( keyset=kwargs.pop('keyset', NETHACK_KEYSET.copy())) AnsiWindow.__init__(self, *args, **kwargs) self.position = pos
def __init__(self, height, width, yloc, xloc): """ Initialize a lightbar of height, width, y and x position. """ AnsiWindow.__init__(self, height, width, yloc, xloc) self._vitem_idx = 0 self._vitem_shift = 0 self._vitem_lastidx = 0 self._vitem_lastshift = 0 self._selected = False self._quit = False self.keyset = NETHACK_KEYSET self.init_keystrokes() self.init_theme()
def __init__(self, yloc, xloc, width, left, right): """ Set screen position of Selector UI and display width of both. The highlighted selection is displayed using the self.highlight attribute, in order (left, right). The default selection is left. """ self._left = self._selection = left self._right = right self._moved = False self._quit = False self._selected = False AnsiWindow.__init__(self, 1, width, yloc, xloc) # height is 1 self.init_theme() self.keyset = VI_KEYSET self.init_keystrokes()
def __init__(self, *args, **kwargs): """ Initialize a pager of height, width, y, and x position. """ self._quit = False self.init_keystrokes(keyset=kwargs.pop('keyset', VI_KEYSET.copy())) content = kwargs.pop('content', u'') or u'' position = kwargs.pop('position', 0) or 0 AnsiWindow.__init__(self, *args, **kwargs) self.position = position self.content = content
def __init__(self, yloc, xloc, width, left, right, **kwargs): """ Set screen position of Selector UI and display width of both. The highlighted selection is displayed using the self.highlight attribute, in order (left, right). The default selection is left. """ self._left = self._selection = left self._right = right self._moved = False self._quit = False self._selected = False self.init_keystrokes(keyset=kwargs.pop('keyset', VI_KEYSET.copy())) AnsiWindow.__init__(self, height=1, width=width, yloc=yloc, xloc=xloc, **kwargs)
def __init__(self, *args, **kwargs): """ Class initializer. :param int width: width of window. :param int height: height of window. :param int yloc: y-location of window. :param int xloc: x-location of window. :param str content: initial pager contents. :param dict colors: color theme. :param dict glyphs: bordering window character glyphs. :param dict keyset: command keys, global ``VI_KEYSET`` is default. """ self._quit = False self.init_keystrokes(keyset=kwargs.pop('keyset', VI_KEYSET.copy())) _content = kwargs.pop('content', u'') or u'' AnsiWindow.__init__(self, *args, **kwargs) self.content = _content self._position = self.position = kwargs.pop('position', 0) or 0
def __init__(self, width, yloc, xloc): """ Construct a Line editor at (y,x) location of width (n). """ self._horiz_shift = 0 self._horiz_pos = 0 self._enable_scrolling = False self._horiz_lastshift = 0 self._scroll_pct = 35.0 self._margin_pct = 20.0 self._carriage_returned = False self._max_length = 0 self._quit = False self._bell = False self.content = u'' self.keyset = PC_KEYSET height = 3 # TODO: 2 of 3 for top and bottom border # (optionaly displayed .. is this best x/y coord? # once working, lets set default as borderless!) AnsiWindow.__init__(self, height, width, yloc, xloc) self.init_keystrokes() self.init_theme()
def __init__(self, width, yloc, xloc): """ Construct a Line editor at (y,x) location of width (n). """ self._horiz_shift = 0 self._horiz_pos = 0 self._enable_scrolling = False self._horiz_lastshift = 0 self._scroll_pct = 35.0 self._margin_pct = 20.0 self._carriage_returned = False self._max_length = 0 self._quit = False self._bell = False self.content = u"" self.keyset = PC_KEYSET height = 3 # TODO: 2 of 3 for top and bottom border # (optionaly displayed .. is this best x/y coord? # once working, lets set default as borderless!) AnsiWindow.__init__(self, height, width, yloc, xloc) self.init_keystrokes() self.init_theme()
def __init__(self, *args, **kwargs): """ Construct a Line editor at (y,x) location of width (n). """ self._horiz_shift = 0 self._horiz_pos = 0 self._enable_scrolling = False self._horiz_lastshift = 0 self._scroll_pct = 35.0 self._margin_pct = 20.0 self._carriage_returned = False self._max_length = 0 self._quit = False self._bell = False self.content = u'' kwargs['height'] = 3 self.init_keystrokes(keyset=kwargs.pop('keyset', PC_KEYSET.copy())) #height = 3 # TODO: 2 of 3 for top and bottom border # (optionally displayed .. is this best x/y coord? # once working, lets set default as borderless!) AnsiWindow.__init__(self, *args, **kwargs)