예제 #1
0
파일: editor.py 프로젝트: tehmaze/x84
    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)
예제 #2
0
파일: selector.py 프로젝트: jquast/x84
    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)
예제 #3
0
파일: lightbar.py 프로젝트: adammendoza/x84
    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
예제 #4
0
파일: editor.py 프로젝트: tehmaze/x84
 def init_theme(self, colors=None, glyphs=None):
     """ Set color and bordering glyphs theme. """
     AnsiWindow.init_theme(self, colors, glyphs)
     if 'highlight' not in self.colors:
         self.colors['highlight'] = self._term.yellow_reverse
     if 'strip' not in self.glyphs:
         self.glyphs['strip'] = u'$ '
예제 #5
0
파일: selector.py 프로젝트: splaice/x84
    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)
예제 #6
0
파일: editor.py 프로젝트: jmederos/x84
    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)
예제 #7
0
파일: editor.py 프로젝트: jmederos/x84
 def init_theme(self, colors=None, glyphs=None):
     """ Set color and bordering glyphs theme. """
     AnsiWindow.init_theme(self, colors, glyphs)
     if 'highlight' not in self.colors:
         self.colors['highlight'] = self._term.yellow_reverse
     if 'strip' not in self.glyphs:
         self.glyphs['strip'] = u'$ '
예제 #8
0
파일: lightbar.py 프로젝트: splaice/x84
    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
예제 #9
0
 def init_theme(self, colors=None, glyphs=None):
     """
     Initialize color['highlight'].
     """
     from x84.bbs.session import getterminal
     colors = colors or {'highlight': getterminal().reverse_yellow}
     glyphs = glyphs or {'strip': u' $'}
     AnsiWindow.init_theme(self, colors, glyphs)
예제 #10
0
파일: lightbar.py 프로젝트: hick/x84
 def init_theme(self, colors=None, glyphs=None):
     """
     Initialize color['highlight'].
     """
     from x84.bbs.session import getterminal
     colors = colors or {'highlight': getterminal().reverse_yellow}
     glyphs = glyphs or {'strip': u' $'}
     AnsiWindow.init_theme(self, colors, glyphs)
예제 #11
0
파일: editor.py 프로젝트: hick/x84
 def init_theme(self, colors=None, glyphs=None):
     AnsiWindow.init_theme(self, colors, glyphs)
     if 'highlight' not in self.colors:
         from x84.bbs.session import getterminal
         term = getterminal()
         self.colors['highlight'] = term.yellow_reverse
     if 'strip' not in self.glyphs:
         self.glyphs['strip'] = u'$ '
예제 #12
0
 def init_theme(self):
     """
     Initialize color['highlight'].
     """
     from x84.bbs.session import getterminal
     self.colors['highlight'] = getterminal().reverse_green
     self.glyphs['strip'] = u' $'  # indicates content was stripped
     AnsiWindow.init_theme(self)
예제 #13
0
파일: selector.py 프로젝트: splaice/x84
 def init_theme(self, colors=None, glyphs=None):
     from x84.bbs.session import getterminal
     term = getterminal()
     colors = colors or {
         'selected': term.reverse_yellow,
         'unselected': term.bold_black,
     }
     AnsiWindow.init_theme(self, colors=colors, glyphs=glyphs)
예제 #14
0
파일: lightbar.py 프로젝트: donfanning/x84
 def init_theme(self):
     """
     Initialize color['highlight'].
     """
     from x84.bbs.session import getterminal
     self.colors['highlight'] = getterminal().reverse_green
     self.glyphs['strip'] = u' $'  # indicates content was stripped
     AnsiWindow.init_theme(self)
예제 #15
0
파일: selector.py 프로젝트: hick/x84
 def init_theme(self, colors=None, glyphs=None):
     from x84.bbs.session import getterminal
     term = getterminal()
     colors = colors or {
         'selected': term.reverse_yellow,
         'unselected': term.bold_black,
     }
     AnsiWindow.init_theme(self, colors=colors, glyphs=glyphs)
예제 #16
0
파일: editor.py 프로젝트: hick/x84
 def init_theme(self, colors=None, glyphs=None):
     AnsiWindow.init_theme(self, colors, glyphs)
     if 'highlight' not in self.colors:
         from x84.bbs.session import getterminal
         term = getterminal()
         self.colors['highlight'] = term.yellow_reverse
     if 'strip' not in self.glyphs:
         self.glyphs['strip'] = u'$ '
예제 #17
0
파일: editor.py 프로젝트: jonny290/yos-x84
 def init_theme(self):
     """
     Initialize colors['highlight'] as REVERSE and glyphs['strip'] as '$ '.
     """
     import x84.bbs.session
     term = x84.bbs.session.getterminal()
     AnsiWindow.init_theme(self)
     self.colors['highlight'] = term.yellow_reverse
     self.glyphs['strip'] = '$ '
예제 #18
0
 def init_theme(self):
     """
     Initialize colors['selected'] and colors['unselected'].
     """
     from x84.bbs.session import getterminal
     term = getterminal()
     AnsiWindow.init_theme(self)
     self.colors['selected'] = term.reverse
     self.colors['unselected'] = term.normal
예제 #19
0
파일: pager.py 프로젝트: quastdog/x84
 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()
예제 #20
0
 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()
예제 #21
0
파일: editor.py 프로젝트: sweenzor/x84
    def init_theme(self):
        """
        Initialize colors['highlight'] as REVERSE and glyphs['strip'] as '$ '.
        """
        import x84.bbs.session

        term = x84.bbs.session.getterminal()
        AnsiWindow.init_theme(self)
        self.colors["highlight"] = term.yellow_reverse
        self.glyphs["strip"] = "$ "
예제 #22
0
    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
예제 #23
0
파일: lightbar.py 프로젝트: hick/x84
    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
예제 #24
0
파일: lightbar.py 프로젝트: donfanning/x84
 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()
예제 #25
0
 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()
예제 #26
0
 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()
예제 #27
0
파일: pager.py 프로젝트: hick/x84
    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
예제 #28
0
    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)
예제 #29
0
파일: pager.py 프로젝트: tcummings19/3x84
    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
예제 #30
0
파일: editor.py 프로젝트: jonny290/yos-x84
 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()
예제 #31
0
파일: editor.py 프로젝트: sweenzor/x84
 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()
예제 #32
0
파일: editor.py 프로젝트: hick/x84
    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)
예제 #33
0
파일: editor.py 프로젝트: hick/x84
    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)
예제 #34
0
파일: lightbar.py 프로젝트: splaice/x84
 def init_theme(self, colors=None, glyphs=None):
     """ Set color and bordering glyphs theme. """
     colors = colors or {'highlight': getterminal().reverse_yellow}
     glyphs = glyphs or {'strip': u' $'}
     AnsiWindow.init_theme(self, colors, glyphs)
예제 #35
0
파일: lightbar.py 프로젝트: adammendoza/x84
 def init_theme(self, colors=None, glyphs=None):
     """ Set color and bordering glyphs theme. """
     colors = colors or {'highlight': getterminal().reverse_yellow}
     glyphs = glyphs or {'strip': u' $'}
     AnsiWindow.init_theme(self, colors, glyphs)