aboutsummaryrefslogtreecommitdiff
path: root/python/complex.py
blob: 3a892502e8c60ec68c7033b399452030dd5815a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env python2.5
"""A more complex provider with a horroristic theme."""

from ContextKit.flexiprovider import *
import gobject

count = 0
def there_are_more():
    global count
    count += 1
    fp.set('Zombie.Count', count)
    if count == 2:
        fp.add_and_update(STRING('You.Shout'))
        fp.set('You.Shout', 'omg zombies!')
    if count == 5:
        fp.set('Life.isInDanger', True)
    return True

gobject.timeout_add_seconds(2, there_are_more)
fp = Flexiprovider([INT('Zombie.Count'), TRUTH('Life.isInDanger')],
                   'omg.zombies', 'session')
fp.run()