예제 #1
0
파일: blacklist.py 프로젝트: hodduc/arara
    def __initwidgets__(self):
	self.header = urwid.Filler(urwid.Text(u"ARA: My Blacklist",align='center'))
        self.header = urwid.AttrWrap(self.header,'reversed')

        self.blacklist = self.server.blacklist_manager.list(self.session_key)
        userlist = []
        if len(self.blacklist) > 0:
            for user in self.blacklist:
                userlist += [{'id':str(user['id']), 'username':user['blacklisted_user_username'], 'nickname':'Nickname',
                    'block_article':'Yes' if user['block_article'] else 'No',
                    'block_pm':'Yes' if user['block_message'] else 'No',
                    }]
        else:
            userlist = [{'id':' ', 'username':'******', 'nickname':'No users blacklisted.',
                'block_article':' ','block_pm':' '}]

        header = {'id':'#', 'username':'******', 'nickname':'Nickname','block_article':'Block Article','block_pm':'Block Message'}
        self.blacklist_ = listview.get_view(userlist, header, blacklist_rowitem)

        self.savebutton = urwid.Filler(urwid.Button("Save", self.on_button_clicked))
        self.cancelbutton = urwid.Filler(urwid.Button("Cancel", self.on_button_clicked))
        buttoncolumn = widget.EasyColumn(self.savebutton, self.cancelbutton, 50, 50)

        content = [('fixed',1, self.header),self.blacklist_, ('fixed',1,widget.dash),('fixed',1,buttoncolumn)]
        self.mainpile = urwid.Pile(content)
예제 #2
0
    def __initwidgets__(self):
        self.keymap = {
            'j': 'down',
            'k': 'up',
        }
        boardlist = self.server.board_manager.get_board_list()

        self.header = urwid.Filler(
            urwid.Text(_('ARA: List boards'), align='center'))
        self.header = urwid.AttrWrap(self.header, 'reversed')
        self.boardnameedit = urwid.Filler(
            urwid.Edit(caption=_(' * Enter board name: '), wrap='clip'))
        itemlist = []
        if len(boardlist) > 0:
            boardcounttext = urwid.Filler(
                urwid.Text(_(' * There are %s boards.') % len(boardlist)))
            for data in boardlist:
                itemlist += [{
                    'name': data.board_name,
                    'desc': data.board_description
                }]
        else:
            boardcounttext = urwid.Filler(
                urwid.Text(_(' * No boards found. Have a nice day.')))
            itemlist = [{
                'name': '',
                'desc': _('No boards found. Have a nice day.')
            }]

        header = {'name': _('Name'), 'desc': _('Description')}
        self.boardlist = listview.get_view(itemlist, header, boardlist_rowitem)

        content = [('fixed', 1, self.header), ('fixed', 1, self.boardnameedit),
                   ('fixed', 1, boardcounttext), self.boardlist]
        self.mainpile = urwid.Pile(content)
예제 #3
0
파일: blacklist.py 프로젝트: combacsa/arara
    def __initwidgets__(self):
        self.header = urwid.Filler(
            urwid.Text(u"ARA: My Blacklist", align='center'))
        self.header = urwid.AttrWrap(self.header, 'reversed')

        self.blacklist = self.server.blacklist_manager.list(self.session_key)
        userlist = []
        if len(self.blacklist) > 0:
            for user in self.blacklist:
                userlist += [{
                    'id':
                    str(user['id']),
                    'username':
                    user['blacklisted_user_username'],
                    'nickname':
                    'Nickname',
                    'block_article':
                    'Yes' if user['block_article'] else 'No',
                    'block_pm':
                    'Yes' if user['block_message'] else 'No',
                }]
        else:
            userlist = [{
                'id': ' ',
                'username': '******',
                'nickname': 'No users blacklisted.',
                'block_article': ' ',
                'block_pm': ' '
            }]

        header = {
            'id': '#',
            'username': '******',
            'nickname': 'Nickname',
            'block_article': 'Block Article',
            'block_pm': 'Block Message'
        }
        self.blacklist_ = listview.get_view(userlist, header,
                                            blacklist_rowitem)

        self.savebutton = urwid.Filler(
            urwid.Button("Save", self.on_button_clicked))
        self.cancelbutton = urwid.Filler(
            urwid.Button("Cancel", self.on_button_clicked))
        buttoncolumn = widget.EasyColumn(self.savebutton, self.cancelbutton,
                                         50, 50)

        content = [('fixed', 1, self.header), self.blacklist_,
                   ('fixed', 1, widget.dash), ('fixed', 1, buttoncolumn)]
        self.mainpile = urwid.Pile(content)
예제 #4
0
    def __initwidgets__(self):
        self.keymap = {
            'j': 'down',
            'k': 'up',
            'N': 'page down',
            'P': 'page up',
        }
        self.header = urwid.Filler(
            urwid.Text(_('ARA: Private message'), align='center'))
        self.header = urwid.AttrWrap(self.header, 'reversed')
        self.infotext = urwid.Filler(
            urwid.Text(
                _(' (N)ext/(P)revious Page (w)rite (B)lock (h)elp (q)uit')))

        itemlist = [{
            'new': 'N',
            'number': '1',
            'author': 'dummy',
            'title': 'item',
            'date': '1/1'
        }]
        self.list_header = {
            'new': 'N',
            'number': '#',
            'author': _('Author'),
            'title': _('Title'),
            'date': _('Date')
        }

        self.pmlist = listview.get_view(itemlist, self.list_header,
                                        pmlist_rowitem)

        self.inboxbutton = urwid.Filler(
            urwid.Button(_('Inbox'), self.on_button_pressed))
        self.outboxbutton = urwid.Filler(
            urwid.Button(_('Outbox'), self.on_button_pressed))
        self.buttoncolumn = widget.EasyColumn(self.inboxbutton,
                                              self.outboxbutton, 50, 50)

        content = [
            ('fixed', 1, self.header),
            ('fixed', 1, self.infotext),
            ('fixed', 1, self.buttoncolumn),
            self.pmlist,
        ]
        self.mainpile = urwid.Pile(content)

        self.display_inbox()
예제 #5
0
    def __initwidgets__(self):
        self.keymap = {
            'j': 'down',
            'k': 'up',
            'N': 'page down',
            'P': 'page up',
        }
        self.header = urwid.Filler(
            urwid.Text(_('ARA: List connected users'), align='center'))
        self.header = urwid.AttrWrap(self.header, 'reversed')
        self.infotext = urwid.Filler(
            urwid.Text(_('(r)efresh (m)onitoring:start (q)uit (Enter) query')))

        self.userlistitem = [{
            'id': 'dummy',
            'nickname': 'dummy',
            'ip': '0.0.0.0',
            'time': 'local',
            'action': u'dummy'
        }]
        self.userlistheader = {
            'id': _('ID'),
            'nickname': _('Nickname'),
            'ip': _('IP Address'),
            'time': _('Login Time'),
            'action': _('Action')
        }
        self.userlist = listview.get_view(self.userlistitem,
                                          self.userlistheader,
                                          connected_user_rowitem)
        self.refresh_view()

        content = [('fixed', 1, self.header), ('fixed', 1, self.infotext),
                   self.userlist]
        self.mainpile = urwid.Pile(content)

        self.timer = timer.Timer(10.0, self.refresh_view)

        return self.mainpile
예제 #6
0
    def __initwidgets__(self):
        self.keymap = {
            'j': 'down',
            'k': 'up',
            'N': 'page down',
            'P': 'page up',
        }
	self.header = urwid.Filler(urwid.Text(_('ARA: List connected users'),align='center'))
        self.header = urwid.AttrWrap(self.header, 'reversed')
        self.infotext = urwid.Filler(urwid.Text(_('(r)efresh (m)onitoring:start (q)uit (Enter) query')))

        self.userlistitem = [{'id':'dummy','nickname':'dummy', 'ip':'0.0.0.0', 'time':'local','action':u'dummy'}]
        self.userlistheader = {'id':_('ID'), 'nickname':_('Nickname'),'ip':_('IP Address'), 'time':_('Login Time'), 'action':_('Action')}
        self.userlist = listview.get_view(self.userlistitem, self.userlistheader, connected_user_rowitem)
        self.refresh_view()

        content = [('fixed',1, self.header),('fixed',1,self.infotext), self.userlist]
        self.mainpile = urwid.Pile(content)

        self.timer = timer.Timer(10.0, self.refresh_view)

        return self.mainpile
예제 #7
0
파일: list_pm.py 프로젝트: hodduc/arara
    def __initwidgets__(self):
        self.keymap = {
            'j':'down',
            'k':'up',
            'N':'page down',
            'P':'page up',
        }
	self.header = urwid.Filler(urwid.Text(_('ARA: Private message'),align='center'))
        self.header = urwid.AttrWrap(self.header, 'reversed')
        self.infotext = urwid.Filler(urwid.Text(_(' (N)ext/(P)revious Page (w)rite (B)lock (h)elp (q)uit')))

        itemlist = [{'new':'N', 'number':'1', 'author':'dummy','title':'item','date':'1/1'}]
        self.list_header = {'new':'N', 'number':'#', 'author':_('Author'), 'title':_('Title'), 'date':_('Date')}

        self.pmlist = listview.get_view(itemlist, self.list_header, pmlist_rowitem)

        self.inboxbutton = urwid.Filler(urwid.Button(_('Inbox'), self.on_button_pressed))
        self.outboxbutton = urwid.Filler(urwid.Button(_('Outbox'), self.on_button_pressed))
        self.buttoncolumn = widget.EasyColumn(self.inboxbutton, self.outboxbutton, 50, 50)

        content = [('fixed',1, self.header),('fixed',1,self.infotext),('fixed',1,self.buttoncolumn),self.pmlist,]
        self.mainpile = urwid.Pile(content)

        self.display_inbox()
예제 #8
0
파일: list_boards.py 프로젝트: hodduc/arara
    def __initwidgets__(self):
        self.keymap = {
            'j': 'down',
            'k': 'up',
        }
        boardlist = self.server.board_manager.get_board_list()

	self.header = urwid.Filler(urwid.Text(_('ARA: List boards'),align='center'))
        self.header = urwid.AttrWrap(self.header, 'reversed')
        self.boardnameedit = urwid.Filler(urwid.Edit(caption=_(' * Enter board name: '), wrap='clip'))
        itemlist = []
        if len(boardlist) > 0:
            boardcounttext = urwid.Filler(urwid.Text(_(' * There are %s boards.') % len(boardlist)))
            for data in boardlist:
                itemlist += [{'name':data.board_name, 'desc':data.board_description}]
        else:
            boardcounttext = urwid.Filler(urwid.Text(_(' * No boards found. Have a nice day.')))
            itemlist = [{'name':'', 'desc':_('No boards found. Have a nice day.')}]

        header = {'name':_('Name'), 'desc':_('Description')}
        self.boardlist = listview.get_view(itemlist, header, boardlist_rowitem)

        content = [('fixed',1, self.header),('fixed',1,self.boardnameedit),('fixed',1,boardcounttext),self.boardlist]
        self.mainpile = urwid.Pile(content)