Changeset 1721

Show
Ignore:
Timestamp:
07/24/07 11:03:30 (1 year ago)
Author:
wrobe..@pld-linux.org
Message:

- create connected lines between boxes in grid

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gaphas/trunk/demo_profile.py

    r1700 r1721  
    136136    view.connect('hover-changed', handle_changed, 'hover') 
    137137    view.connect('selection-changed', handle_changed, 'selection') 
     138    return view 
    138139 
    139140def main(): 
     
    145146    c=Canvas() 
    146147 
    147     create_window(c, 'View created before') 
     148    view = create_window(c, 'View created before') 
    148149 
    149150    # Add stuff to the canvas: 
     
    174175        x = int(i % n) * 20 
    175176        y = int(i / n) * 20 
    176         bb.matrix.translate(x, y) 
     177        bb.matrix.translate(20 + x, y) 
    177178        bb.matrix.rotate(math.pi/4.0 * i / 10.0) 
    178179        c.add(bb, parent=b) 
    179180 
     181    tool = view.tool._tools[1] 
    180182    for i in range(40): 
    181183        bb = MyBox() 
    182         bb.width = bb.height = 15 
    183         x = int(i % 4) * 20 
    184         y = int(i / 4) * 20 
    185         bb.matrix.translate(20 + x, 100 + y
     184        bb.width = bb.height = 20 
     185        x = int(i % 4) 
     186        y = int(i / 4) 
     187        bb.matrix.translate(20 + x * 30, 100 + y * 30
    186188        c.add(bb) 
     189 
     190        if x > 0: 
     191            l = Line() 
     192            l.fyzzyness = 1 
     193            h1, h2 = l.handles() 
     194            h2.pos = (10, 0) 
     195            l.matrix.translate(10 + x * 30, 110 + y * 30) 
     196            c.add(l) 
     197            tool.connect(view, l, h1, 10 + x * 30, 110 + y * 30) 
     198            tool.connect(view, l, h2, 20 + x * 30, 110 + y * 30) 
     199        if y > 0: 
     200            l = Line() 
     201            l.fyzzyness = 1 
     202            h1, h2 = l.handles() 
     203            h2.pos = (0, -10) 
     204            l.matrix.translate(x * 30 + 30, 100 + y * 30) 
     205            c.add(l) 
     206            tool.connect(view, l, h1, x * 30 + 30, 100 + y * 30) 
     207            tool.connect(view, l, h2, x * 30 + 30,  90 + y * 30) 
    187208 
    188209    t=MyText('Single line')