File: gobject.py

package info (click to toggle)
kaa-base 0.6.0%2Bsvn4596-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch, wheezy
  • size: 2,348 kB
  • ctags: 3,068
  • sloc: python: 11,094; ansic: 1,862; makefile: 74
file content (30 lines) | stat: -rw-r--r-- 577 bytes parent folder | download | duplicates (3)
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
import kaa

class Test():
    
    @kaa.threaded(kaa.GOBJECT)
    @kaa.synchronized()
    def foo(self):
        import time
        time.sleep(0.4)
        return kaa.is_mainthread()

    @kaa.coroutine()
    def test(self):
        r = yield self.foo()
        print 'foo', kaa.is_mainthread(), r

    @kaa.synchronized()
    def has_to_wait(self):
        print 'go'
        
if 1:
    kaa.gobject_set_threaded()
else:
    kaa.main.select_notifier('gtk')

t = Test()
kaa.OneShotTimer(t.test).start(0.1)
kaa.OneShotTimer(t.has_to_wait).start(0.2)
kaa.main.run()
print 'done'