equal
deleted
inserted
replaced
|
1 #!/usr/bin/env python3 |
|
2 # -*- coding: utf-8 -*- |
|
3 |
|
4 import locale |
|
5 locale.setlocale(locale.LC_ALL, '') |
|
6 |
|
7 from tuikit import * |
|
8 |
|
9 |
|
10 class MyApplication(Application): |
|
11 def __init__(self): |
|
12 Application.__init__(self) |
|
13 self.top.connect('keypress', self.globalkeypress) |
|
14 |
|
15 model = TreeModel() |
|
16 model.add('/', ['a', 'b']) |
|
17 model.add('/a', ['c', 'd']) |
|
18 model.add((0,1), ['e', 'f']) |
|
19 model.add('/0/1/0', 'g') |
|
20 model.add('/a/d/f', 'h') |
|
21 |
|
22 view = TreeView(model) |
|
23 view.collapse('/a/d') |
|
24 self.top.add(view) |
|
25 |
|
26 vert = VerticalLayout() |
|
27 self.top.layout(vert) |
|
28 |
|
29 def globalkeypress(self, keyname, char): |
|
30 if keyname == 'escape': |
|
31 self.terminate() |
|
32 |
|
33 |
|
34 if __name__ == '__main__': |
|
35 app = MyApplication() |
|
36 app.start() |
|
37 |