home *** CD-ROM | disk | FTP | other *** search
/ PCNET 2006 October - Disc 2 / PCNET_CD_2006_10_2.iso / apps / k3d-all-in-one-setup-0.5.14.0.exe / k3d-setup-0.5.14.0.exe / share / scripts / innovation.py < prev    next >
Encoding:
Python Source  |  2006-01-24  |  669 b   |  31 lines

  1. #python
  2.  
  3. import k3d
  4.  
  5. def innovate(doc):
  6.     global k3d
  7.  
  8.     # Give folks a chance to bail ...
  9.     if k3d.ui.query_message("Are you sure?  Don't run this script on a real working document!", ["OK", "Cancel"]) == 2:
  10.         return
  11.  
  12.     # Start recording changes for undo-purposes ...
  13.     doc.start_change_set()
  14.     try:
  15.         # Deliver "value" ...
  16.         for node in doc.nodes:
  17.             node.name = "Microsoft " + node.name + " (TM)"
  18.  
  19.         # Finish recording undos ...
  20.         doc.finish_change_set("Innovate!")
  21.  
  22.         # Communicate the good news to our "customer"!
  23.         k3d.ui.message("You have been Innovated ... check your Node List Panel (it's undo-able)")
  24.  
  25.     except:
  26.         doc.cancel_change_set()
  27.         raise
  28.  
  29. innovate(Document)
  30.  
  31.