blob: 268a860dc7d6fca19e2dcd9aca69955ebf384138 (
plain) (
tree)
|
|
# -*- 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)
|