Пример #1
0
    def __initwidgets__(self):
        self.header = urwid.Filler(
            urwid.Text(_('ARA: User Preferences'), align='center'))
        self.header = urwid.AttrWrap(self.header, 'reversed')
        menuitems = [
            widget.Item(" * " + w + "\n", None, 'selected') for w in self.menu
        ]
        self.menulist = urwid.ListBox(urwid.SimpleListWalker(menuitems))

        menudescs = [widget.Item(w, None, 'selected') for w in self.menudesc]
        self.menudesclist = urwid.ListBox(urwid.SimpleListWalker(menudescs))

        self.maincolumn = urwid.Columns([('weight', 40, self.menulist),
                                         ('weight', 60, self.menudesclist)])

        infotext = urwid.Filler(
            urwid.Text(_('  * Use [Tab] or arrow key to move each items')))

        content = [
            ('fixed', 1, self.header),
            ('fixed', 1, widget.blanktext),
            self.maincolumn,
            ('fixed', 1, widget.dash),
            ('fixed', 1, infotext),
        ]
        self.mainpile = urwid.Pile(content)
Пример #2
0
    def __initwidgets__(self):
        self.keymap = {
            'j': 'down',
            'k': 'up',
        }
        self.header = urwid.Filler(
            urwid.Text(_('ARA: Main Menu'), align='center'))
        self.header = urwid.AttrWrap(self.header, 'reversed')
        menuitems = [
            widget.Item(" * " + w + "\n", None, 'selected') for w in self.menu
        ]
        self.menulist = urwid.ListBox(urwid.SimpleListWalker(menuitems))

        tbtext = urwid.Filler(urwid.Text(_('Today Best'), align='center'))
        self.tblist_raw = self.server.article_manager.get_today_best_list(5)
        tbitems = [
            "%(title)s (%(nickname)s, %(date)s)" % {
                "title": text.title,
                'nickname': text.author_nickname,
                'date': date.fromtimestamp(text.date).strftime("%Y/%m/%d")
            } for text in self.tblist_raw
        ]
        tbitems = [widget.Item(w, None, 'selected') for w in tbitems]
        self.tblist = urwid.ListBox(urwid.SimpleListWalker(tbitems))
        self.todaybest = urwid.Pile([('fixed', 1, tbtext), self.tblist])

        wbtext = urwid.Filler(urwid.Text(_('Weekly Best'), align='center'))
        self.wblist_raw = self.server.article_manager.get_weekly_best_list(5)
        wbitems = [
            "%(title)s (%(nickname)s, %(date)s)" % {
                "title": text.title,
                'nickname': text.author_nickname,
                'date': date.fromtimestamp(text.date).strftime("%Y/%m/%d")
            } for text in self.wblist_raw
        ]
        wbitems = [widget.Item(w, None, 'selected') for w in wbitems]
        self.wblist = urwid.ListBox(urwid.SimpleListWalker(wbitems))
        self.weeklybest = urwid.Pile([('fixed', 1, wbtext), self.wblist])

        self.bests = urwid.Pile([self.todaybest, self.weeklybest])
        self.copyrightnotice = urwid.Filler(
            urwid.Text(
                _("""  * Press [Tab] to jump between menu, today best, weekly best
 ARAra Release 1.0                                Copyright (C) 2008, SPARCS"""
                  )))

        self.maincolumn = urwid.Columns([('weight', 40, self.menulist),
                                         ('weight', 60, self.bests)])

        content = [('fixed', 1, self.header), ('fixed', 1, widget.blanktext),
                   self.maincolumn, ('fixed', 1, widget.dash),
                   ('fixed', 2, self.copyrightnotice)]
        self.mainpile = urwid.Pile(content)

        self.keymap = {
            "left": "",
            "right": "",
            "j": "down",
            "k": "up",
        }
Пример #3
0
    def __initwidgets__(self):
        self.header = urwid.Filler(
            urwid.Text(_('ARA: Change Basic Information'), align='center'))
        self.header = urwid.AttrWrap(self.header, 'reversed')
        self.myinfo = self.server.member_manager.get_info(self.session_key)

        idtext = urwid.Filler(urwid.Text(
            _('ID: %s') % self.myinfo['username']))
        iddesc = urwid.Filler(
            urwid.Text(
                _('ID and E-Mail couldn\'t be edited\nDisplayed for your information'
                  )))
        idcolumn = widget.EasyColumn(idtext, iddesc)

        emailtext = urwid.Filler(
            urwid.Text(_('E-Mail: %s') % self.myinfo['email']))
        emailcolumn = widget.EasyColumn(emailtext, widget.blanktext)

        self.nickedit = urwid.Filler(
            urwid.Edit(caption=_('Nickname: '), wrap='clip'))
        self.nickedit.body.set_edit_text(self.myinfo['nickname'])
        nickdesc = urwid.Filler(
            urwid.Text(
                _('You can\'t use duplicated\nnickname or other\'s ID')))
        nickcolumn = widget.EasyColumn(self.nickedit, nickdesc)

        langtext = urwid.Filler(urwid.Text(_('Language:')))
        langitems = ['Korean', 'English', 'Chinese']
        langitems = [widget.Item(text, None, 'selected') for text in langitems]
        self.langlist = widget.Border(
            urwid.ListBox(urwid.SimpleListWalker(langitems)))
        self.lang = urwid.Columns([langtext, self.langlist])
        langdesc = urwid.Filler(
            urwid.Text(_('Select your favorite\ninterface language')))
        langcolumn = widget.EasyColumn(self.lang, langdesc)

        self.contentpile = urwid.Pile([('fixed', 2, idcolumn),
                                       ('fixed', 2, emailcolumn),
                                       ('fixed', 2, nickcolumn), langcolumn])

        self.okbutton = urwid.Filler(
            urwid.Button(_('OK'), self.on_button_clicked))
        self.cancelbutton = urwid.Filler(
            urwid.Button(_('Cancel'), self.on_button_clicked))
        buttoncolumn = widget.EasyColumn(self.okbutton, self.cancelbutton, 50,
                                         50)

        infotext = urwid.Filler(
            urwid.Text(
                _("""  * Press [Enter] to proceed to the next item, [Shift+Enter] - previous item
  * Press [Tab] to directly jump to OK or Cancel button""")))

        content = [('fixed', 1, self.header), ('fixed', 1, widget.blanktext),
                   self.contentpile, ('fixed', 2, infotext),
                   ('fixed', 1, widget.blank), ('fixed', 1, buttoncolumn)]
        self.mainpile = urwid.Pile(content)
Пример #4
0
    def __initwidgets__(self):
        self.message = urwid.Filler(
            urwid.Text(self.get_login_message(), align="center"))
        self.errormessage = urwid.Filler(urwid.Text("", align="center"))
        self.message_ko = urwid.Filler(
            urwid.Text(u"[Tab] 키를 누르면 항목간을 전환할 수 있습니다", align='center'))
        self.message_en = urwid.Filler(
            urwid.Text(u"Press [Tab] key to jump between each items",
                       align='center'))
        count = self.server.login_manager.total_visitor()
        self.counter = urwid.Filler(
            urwid.Text(u"Today: %s Total: %s" %
                       (count.today_visitor_count, count.total_visitor_count),
                       align='center'))

        self.idedit = urwid.Filler(urwid.Edit(caption="ID: ", wrap='clip'))
        self.pwedit = urwid.Filler(
            widget.PasswordEdit(caption="Password: "******"fixed", 1, self.counter),
            ("fixed", 1, self.message_ko), ('fixed', 1, self.message_en),
            ('fixed', 5, self.bottomcolumn)
        ]
        self.mainpile = urwid.Pile(content)

        self.keymap = {'left': '', 'right': ''}
Пример #5
0
    def __initwidgets__(self):
        header = urwid.Filler(urwid.Text(_('ARA: Join'), align='center'))
        header = urwid.AttrWrap(header, 'reversed')

        self.idedit = urwid.Filler(urwid.Edit(caption=_('ID:'), wrap='clip'))
        iddesc = urwid.Filler(
            urwid.Text(_("ID's length should be\nbetween 4 and 10 chars")))
        self.idcolumn = widget.EasyColumn(self.idedit, iddesc)

        self.nickedit = urwid.Filler(
            urwid.Edit(caption=_('Nickname:'), wrap='clip'))
        nickdesc = urwid.Filler(
            urwid.Text(_("You can't use duplicated\nnickname or other's ID")))
        self.nickcolumn = widget.EasyColumn(self.nickedit, nickdesc)

        self.pwedit = urwid.Filler(
            widget.PasswordEdit(caption=_('Password:'******'clip'))
        pwdesc = urwid.Filler(
            urwid.Text(_('Minimum password length\nis 4 characters')))
        self.pwcolumn = widget.EasyColumn(self.pwedit, pwdesc)

        self.confirmedit = urwid.Filler(
            widget.PasswordEdit(caption=_('Confirm\nPassword:'******'clip'))
        confirmdesc = urwid.Filler(
            urwid.Text(_('Type password here\nonce again')))
        self.confirmcolumn = widget.EasyColumn(self.confirmedit, confirmdesc)

        self.emailedit = urwid.Filler(
            urwid.Edit(caption=_('E-Mail:'), wrap='clip'))
        emaildesc = urwid.Filler(
            urwid.Text(_("We'll send confirmation\nmail to this address")))
        self.emailcolumn = widget.EasyColumn(self.emailedit, emaildesc)

        langtext = urwid.Filler(urwid.Text(_('Language:')))
        langitems = ['Korean', 'English', 'Chinese']
        langitems = [widget.Item(w, None, 'selected') for w in langitems]
        self.langlist = widget.Border(
            urwid.ListBox(urwid.SimpleListWalker(langitems)))
        self.lang = urwid.Columns([langtext, self.langlist])
        langdesc = urwid.Filler(
            urwid.Text(_('Select your favorite\ninterface language')))
        self.langcolumn = widget.EasyColumn(self.lang, langdesc)

        self.joinpile = urwid.Pile([('fixed', 2, self.idcolumn),
                                    ('fixed', 2, self.nickcolumn),
                                    ('fixed', 2, self.pwcolumn),
                                    ('fixed', 3, self.confirmcolumn),
                                    ('fixed', 2, self.emailcolumn),
                                    self.langcolumn])

        self.joinbutton = urwid.Filler(
            urwid.Button(_('Join'), self.on_button_clicked))
        self.cancelbutton = urwid.Filler(
            urwid.Button(_('Cancel'), self.on_button_clicked))
        self.buttoncolumn = widget.EasyColumn(self.joinbutton,
                                              self.cancelbutton, 50, 50)

        infotext = urwid.Filler(
            urwid.Text(
                _("""  * Press [Enter] to proceed to the next item, [Shift+Enter] - previous item.
  * Press [Tab] to directly jump to Join or Cancel button.
  * Please be patient after click Join button. We'll send confirmation mail.
  * After join, you should activate your ID via link on the mail.""")))

        content = [('fixed', 1, header), self.joinpile, ('fixed', 4, infotext),
                   ('fixed', 1, widget.blank), ('fixed', 1, self.buttoncolumn)]
        self.mainpile = urwid.Pile(content)