summaryrefslogtreecommitdiff
path: root/alot/widgets/namedqueries.py
blob: 6531efbe93d25f11997592d297160247899b8e09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Copyright (C) 2011-2018  Patrick Totzke <patricktotzke@gmail.com>
# This file is released under the GNU GPL, version 3 or a later revision.
# For further details see the COPYING file

"""
Widgets specific to Namedqueries mode
"""
import urwid


class QuerylineWidget(urwid.Columns):
    def __init__(self, key, value, count, count_unread):
        self.query = key

        count_widget = urwid.Text('{0:>7} {1:7}'.
                                  format(count, '({0})'.format(count_unread)))
        key_widget = urwid.Text(key)
        value_widget = urwid.Text(value)

        urwid.Columns.__init__(self, (key_widget, count_widget, value_widget),
                               dividechars=1)

    def selectable(self):
        return True

    def keypress(self, size, key):
        return key

    def get_query(self):
        return self.query