def get_selector(selection=u'No'): """ Return yes/no selector """ from x84.bbs import getterminal, Selector term = getterminal() selector = Selector( yloc=term.height - 1, xloc=(term.width / 2) - 25, width=50, left=u'Yes', right=u'No') selector.keyset['left'].extend((u'y', u'Y')) selector.keyset['right'].extend((u'y', u'Y')) selector.selection = selection selector.colors['selected'] = term.bold_white_reverse return selector
def get_selector(selection): """ Instantiate a new selector, dynamicly for the window size. """ from x84.bbs import getterminal, Selector term = getterminal() width = max(30, (term.width / 2) - 10) xloc = max(0, (term.width / 2) - (width / 2)) sel = Selector(yloc=term.height - 1, xloc=xloc, width=width, left='utf8', right='cp437') sel.selection = selection return sel
def get_selector(selection=u'No'): """ Return yes/no selector """ from x84.bbs import getterminal, Selector term = getterminal() selector = Selector(yloc=term.height - 1, xloc=(term.width / 2) - 25, width=50, left=u'Yes', right=u'No') selector.keyset['left'].extend((u'y', u'Y')) selector.keyset['right'].extend((u'y', u'Y')) selector.selection = selection selector.colors['selected'] = term.bold_white_reverse return selector