tests/gridlayout_rowspan.py
changeset 11 762513aacc87
child 19 5e78d52ebb24
equal deleted inserted replaced
10:ec1d47e6fe09 11:762513aacc87
       
     1 #!/usr/bin/env python3
       
     2 # -*- coding: utf-8 -*-
       
     3 
       
     4 from tuikit import *
       
     5 
       
     6 # +---+---+---+
       
     7 # | 0     | 1 |
       
     8 # +---+---+   +
       
     9 # | 2 | 3 |   |
       
    10 # +---+   +   +
       
    11 # | 4 |   |   |
       
    12 # +---+---+---+
       
    13 #
       
    14 # 0 - colspan = 2
       
    15 # 1 - rowspan = 3
       
    16 # 3 - rowspan = 2
       
    17 
       
    18 if __name__ == '__main__':
       
    19     cont = Container()
       
    20 
       
    21     w = [None] * 6
       
    22     for i in range(6):
       
    23         w[i] = Widget()
       
    24         cont.add(w[i])
       
    25 
       
    26     w[0].layouthints['colspan'] = 2
       
    27 
       
    28     w[1].sizemin = (2,2)
       
    29     w[3].sizemin = (6,1)
       
    30 
       
    31     grid = GridLayout(3)
       
    32     grid.container = cont
       
    33 
       
    34     print('* _fillgrid')
       
    35     grid._fillgrid()
       
    36 
       
    37     print('span:')
       
    38     for row in grid._grid:
       
    39         for col in row:
       
    40             print('[%s,%d,%d]' % (
       
    41                 col['widget'].__class__.__name__[0],
       
    42                 col['colspan'],
       
    43                 col['rowspan']), end=' ')
       
    44         print()
       
    45 
       
    46     print('* _computesizes')
       
    47     grid._computesizes()
       
    48 
       
    49     print('sizemin:')
       
    50     for row in grid._grid:
       
    51         for col in row:
       
    52             w = col['widget']
       
    53             if w is None:
       
    54                 print('[0,0]', end=' ')
       
    55             else:
       
    56                 print('[%d,%d]' % w.sizemin, end=' ')
       
    57         print()
       
    58 
       
    59     print('colminw:')
       
    60     print(grid._colminw)
       
    61 
       
    62     print('rowminh:')
       
    63     print(grid._rowminh)