Changeset 1185

Show
Ignore:
Timestamp:
04/02/07 01:55:58 (2 years ago)
Author:
arj..@yirdis.nl
Message:

added if name statement to demo.py

Files:

Legend:

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

    r1161 r1185  
    272272    view.connect('selection-changed', handle_changed, 'selection') 
    273273 
    274 c=Canvas() 
    275  
    276 create_window(c) 
    277 #create_window(c, zoom=1.3
    278  
    279 # Add stuff to the canvas: 
    280  
    281 b=MyBox() 
    282 b.min_width = 20 
    283 b.min_height = 30 
    284 print 'box', b 
    285 b.matrix=(1.0, 0.0, 0.0, 1, 20,20) 
    286 b.width=b.height = 40 
    287 c.add(b) 
    288  
    289 bb=Box() 
    290 print 'box', bb 
    291 bb.matrix=(1.0, 0.0, 0.0, 1, 10,10) 
    292 c.add(bb, parent=b) 
    293 #v.selected_items = bb 
    294  
    295 bb=Box() 
    296 print 'box', bb 
    297 bb.matrix.rotate(math.pi/4.) 
    298 c.add(bb, parent=b) 
    299  
    300 l=MyLine() 
    301 l.fyzzyness = 1 
    302 l.handles()[1].pos = (30, 30) 
    303 l.split_segment(0, 3) 
    304 l.matrix.translate(30, 60) 
    305 c.add(l) 
    306 l.orthogonal = True 
    307  
    308 t=MyText() 
    309 t.matrix.translate(70,70) 
    310 c.add(t) 
    311  
    312 ## 
    313 ## State handling (a.k.a. undo handlers) 
    314 ## 
    315  
    316 # First, activate the revert handler: 
    317 state.observers.add(state.revert_handler) 
    318  
    319 def print_handler(event): 
    320     print 'event:', event 
    321  
    322 #state.subscribers.add(print_handler) 
    323  
    324  
    325 ## 
    326 ## Start the main application 
    327 ## 
    328  
    329 gtk.main() 
     274if __name__ == '__main__': 
     275    c=Canvas() 
     276 
     277    create_window(c
     278 
     279    # Add stuff to the canvas: 
     280 
     281    b=MyBox() 
     282    b.min_width = 20 
     283    b.min_height = 30 
     284    print 'box', b 
     285    b.matrix=(1.0, 0.0, 0.0, 1, 20,20) 
     286    b.width=b.height = 40 
     287    c.add(b) 
     288 
     289    bb=Box() 
     290    print 'box', bb 
     291    bb.matrix=(1.0, 0.0, 0.0, 1, 10,10) 
     292    c.add(bb, parent=b) 
     293    #v.selected_items = bb 
     294 
     295    bb=Box() 
     296    print 'box', bb 
     297    bb.matrix.rotate(math.pi/4.) 
     298    c.add(bb, parent=b) 
     299 
     300    l=MyLine() 
     301    l.fyzzyness = 1 
     302    l.handles()[1].pos = (30, 30) 
     303    l.split_segment(0, 3) 
     304    l.matrix.translate(30, 60) 
     305    c.add(l) 
     306    l.orthogonal = True 
     307 
     308    t=MyText() 
     309    t.matrix.translate(70,70) 
     310    c.add(t) 
     311 
     312    ## 
     313    ## State handling (a.k.a. undo handlers) 
     314    ## 
     315 
     316    # First, activate the revert handler: 
     317    state.observers.add(state.revert_handler) 
     318 
     319    def print_handler(event): 
     320        print 'event:', event 
     321 
     322    #state.subscribers.add(print_handler) 
     323 
     324 
     325    ## 
     326    ## Start the main application 
     327    ## 
     328 
     329    gtk.main() 
    330330 
    331331