示例#1
0
    def __initwidgets__(self):
        self.keymap = {
            'n': 'down',
            'j': 'down',
            'p': 'up',
            'k': 'up',
            'N': 'page down',
            'P': 'page up',
            ' ': 'enter',
            'ctrl p': 'w',
        }

        boardinfo = self.server.board_manager.get_board(self.board_name)
        self.readonly = boardinfo.read_only

	self.header = urwid.Filler(urwid.Text(_('ARA: Article list'),align='center'))
        self.header = urwid.AttrWrap(self.header, 'reversed')
        self.infotext1 = urwid.Filler(urwid.Text(_('(N)ext/(P)revious Page (Number+Enter) Jump to article')))
        if self.session_key == 'guest':
            self.infotext2 = urwid.Filler(urwid.Text(_('(h)elp (q)uit')))
        else:
            if self.readonly:
                self.infotext2 = urwid.Filler(urwid.Text(_('(Enter,space) Read (f)ind (h)elp (q)uit')))
            else:
                self.infotext2 = urwid.Filler(urwid.Text(_('(Enter,space) Read (w)rite (f)ind (h)elp (q)uit')))
        
        # ArticleListWalker
        # TODO: 검색 시 ArticleSearchWalker를 사용하도록 변경.
        if self.session_key == 'guest':
            body = urwid.ListBox(ArticleListWalker(self.session_key, self.board_name, self.make_widget_guest))
            header = {'number':'#', 'author':_('Author'), 'title':_('Title'), 'date':_('Date'), 'hit':_('Hit'), 'vote':_('Vote')}
            header = listview.make_header(header, articlelist_rowitem_guest)
        else:
            body = urwid.ListBox(ArticleListWalker(self.session_key, self.board_name, self.make_widget))
            header = {'new':'N', 'number':'#', 'author':_('Author'), 'title':_('Title'), 'date':_('Date'), 'hit':_('Hit'), 'vote':_('Vote')}
            header = listview.make_header(header, articlelist_rowitem)
        self.articlelist = urwid.Frame(body, header)

        content = [('fixed',1, self.header),('fixed',1,self.infotext1),('fixed',1,self.infotext2),self.articlelist,]
        self.mainpile = urwid.Pile(content)
示例#2
0
文件: list_pm.py 项目: hodduc/arara
    def display_outbox(self):
        self.list_header = {'new':'N', 'number':'#', 'author':_('Recepient'), 'title':_('Title'), 'date':_('Date')}
        self.pmlist.set_header(listview.make_header(self.list_header, pmlist_rowitem))

        # Acquire messages
        sent_list = self.server.messaging_manager.sent_list(self.session_key, 1, 10)
        message_list = sent_list.hit
        
        # Generate message_item
        message_item = []
        if len(message_list) < 1:
            # If no message...
            self.hasmessage = False
            message_item = [{'new':'', 'number':'', 'author':'','title':_('No private messages. Have a nice day.'),'date':''}]
        else:
            # Otherwise...
            self.hasmessage = True
            for msg in message_list:
                message_item += [{'new':str(msg['read_status']), 'number':str(msg['id']), 'author':msg['to'], 'title':msg['message'], 'date':msg['sent_time'].strftime("%m/%d")}]
        self.pmlist.set_body(listview.make_body(message_item, pmlist_rowitem))
示例#3
0
    def display_outbox(self):
        self.list_header = {
            'new': 'N',
            'number': '#',
            'author': _('Recepient'),
            'title': _('Title'),
            'date': _('Date')
        }
        self.pmlist.set_header(
            listview.make_header(self.list_header, pmlist_rowitem))

        # Acquire messages
        sent_list = self.server.messaging_manager.sent_list(
            self.session_key, 1, 10)
        message_list = sent_list.hit

        # Generate message_item
        message_item = []
        if len(message_list) < 1:
            # If no message...
            self.hasmessage = False
            message_item = [{
                'new': '',
                'number': '',
                'author': '',
                'title': _('No private messages. Have a nice day.'),
                'date': ''
            }]
        else:
            # Otherwise...
            self.hasmessage = True
            for msg in message_list:
                message_item += [{
                    'new': str(msg['read_status']),
                    'number': str(msg['id']),
                    'author': msg['to'],
                    'title': msg['message'],
                    'date': msg['sent_time'].strftime("%m/%d")
                }]
        self.pmlist.set_body(listview.make_body(message_item, pmlist_rowitem))
示例#4
0
    def __initwidgets__(self):
        self.keymap = {
            'n': 'down',
            'j': 'down',
            'p': 'up',
            'k': 'up',
            'N': 'page down',
            'P': 'page up',
            ' ': 'enter',
            'ctrl p': 'w',
        }

        boardinfo = self.server.board_manager.get_board(self.board_name)
        self.readonly = boardinfo.read_only

        self.header = urwid.Filler(
            urwid.Text(_('ARA: Article list'), align='center'))
        self.header = urwid.AttrWrap(self.header, 'reversed')
        self.infotext1 = urwid.Filler(
            urwid.Text(
                _('(N)ext/(P)revious Page (Number+Enter) Jump to article')))
        if self.session_key == 'guest':
            self.infotext2 = urwid.Filler(urwid.Text(_('(h)elp (q)uit')))
        else:
            if self.readonly:
                self.infotext2 = urwid.Filler(
                    urwid.Text(_('(Enter,space) Read (f)ind (h)elp (q)uit')))
            else:
                self.infotext2 = urwid.Filler(
                    urwid.Text(
                        _('(Enter,space) Read (w)rite (f)ind (h)elp (q)uit')))

        # ArticleListWalker
        # TODO: 검색 시 ArticleSearchWalker를 사용하도록 변경.
        if self.session_key == 'guest':
            body = urwid.ListBox(
                ArticleListWalker(self.session_key, self.board_name,
                                  self.make_widget_guest))
            header = {
                'number': '#',
                'author': _('Author'),
                'title': _('Title'),
                'date': _('Date'),
                'hit': _('Hit'),
                'vote': _('Vote')
            }
            header = listview.make_header(header, articlelist_rowitem_guest)
        else:
            body = urwid.ListBox(
                ArticleListWalker(self.session_key, self.board_name,
                                  self.make_widget))
            header = {
                'new': 'N',
                'number': '#',
                'author': _('Author'),
                'title': _('Title'),
                'date': _('Date'),
                'hit': _('Hit'),
                'vote': _('Vote')
            }
            header = listview.make_header(header, articlelist_rowitem)
        self.articlelist = urwid.Frame(body, header)

        content = [
            ('fixed', 1, self.header),
            ('fixed', 1, self.infotext1),
            ('fixed', 1, self.infotext2),
            self.articlelist,
        ]
        self.mainpile = urwid.Pile(content)