blob: 268a860dc7d6fca19e2dcd9aca69955ebf384138 (
plain) (
blame)
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
31
32
|
# -*- python -*-
from plugins.lid import Lid
from common import *
class MyLid(Entry):
COMPACT = 0
LONG = 1
TITLED = 2
FULL = 3
def __init__(self, *args, details = 2, **kwargs):
self.details = details
self.map = [{True : 'o',
False : 'c'},
{True : 'open',
False : 'closed'}]
Entry.__init__(self, *args, **kwargs)
def action(self, col, button, x, y):
if button == MIDDLE_BUTTON:
self.details ^= MyLid.TITLED
self.invalidate()
elif button == RIGHT_BUTTON:
self.details ^= MyLid.LONG
self.invalidate()
def function(self):
prefix = '' if (self.details & MyLid.TITLED) == 0 else 'Lid: '
smap = self.map[self.details & MyLid.LONG]
state = Lid.is_open()
return prefix + ' '.join(smap[state[lid]] for lid in state)
|