home *** CD-ROM | disk | FTP | other *** search
/ Hackers Magazine 57 / CdHackersMagazineNr57.iso / Software / Multimedia / k3d-setup-0.7.11.0.exe / share / k3d / scripts / innovation.py < prev    next >
Text File  |  2008-01-23  |  675b  |  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.