author | Radek Brich <radek.brich@devl.cz> |
Wed, 17 Aug 2011 23:43:52 +0200 | |
changeset 11 | 762513aacc87 |
child 19 | 5e78d52ebb24 |
permissions | -rwxr-xr-x |
11
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
1 |
#!/usr/bin/env python3 |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
2 |
# -*- coding: utf-8 -*- |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
3 |
|
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
4 |
from tuikit import * |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
5 |
|
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
6 |
# +---+---+---+ |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
7 |
# | 0 | 1 | |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
8 |
# +---+---+ + |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
9 |
# | 2 | 3 | | |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
10 |
# +---+ + + |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
11 |
# | 4 | | | |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
12 |
# +---+---+---+ |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
13 |
# |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
14 |
# 0 - colspan = 2 |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
15 |
# 1 - rowspan = 3 |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
16 |
# 3 - rowspan = 2 |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
17 |
|
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
18 |
if __name__ == '__main__': |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
19 |
cont = Container() |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
20 |
|
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
21 |
w = [None] * 6 |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
22 |
for i in range(6): |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
23 |
w[i] = Widget() |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
24 |
cont.add(w[i]) |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
25 |
|
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
26 |
w[0].layouthints['colspan'] = 2 |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
27 |
|
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
28 |
w[1].sizemin = (2,2) |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
29 |
w[3].sizemin = (6,1) |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
30 |
|
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
31 |
grid = GridLayout(3) |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
32 |
grid.container = cont |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
33 |
|
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
34 |
print('* _fillgrid') |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
35 |
grid._fillgrid() |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
36 |
|
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
37 |
print('span:') |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
38 |
for row in grid._grid: |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
39 |
for col in row: |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
40 |
print('[%s,%d,%d]' % ( |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
41 |
col['widget'].__class__.__name__[0], |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
42 |
col['colspan'], |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
43 |
col['rowspan']), end=' ') |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
44 |
print() |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
45 |
|
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
46 |
print('* _computesizes') |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
47 |
grid._computesizes() |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
48 |
|
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
49 |
print('sizemin:') |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
50 |
for row in grid._grid: |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
51 |
for col in row: |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
52 |
w = col['widget'] |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
53 |
if w is None: |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
54 |
print('[0,0]', end=' ') |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
55 |
else: |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
56 |
print('[%d,%d]' % w.sizemin, end=' ') |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
57 |
print() |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
58 |
|
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
59 |
print('colminw:') |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
60 |
print(grid._colminw) |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
61 |
|
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
62 |
print('rowminh:') |
762513aacc87
TreeView: Add cursor, node collapse, reworked draw.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
63 |
print(grid._rowminh) |