Advertisement
nux95

Creating a description programatically

May 28th, 2011
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.59 KB | None | 0 0
  1. def main():
  2.     globalidspace   = GLOBALIDSPACE()
  3.     container = CONTAINER(
  4.         globalidspace,
  5.         "Tpytag",
  6.         "global",
  7.         "Python Tag Example",
  8.         [],
  9.         ["NAME Tpytag;","INCLUDE Tbase;"]
  10.     )
  11.     group = GROUP(
  12.         globalidspace,
  13.         "ID_TAGPROPERTIES",
  14.         "global",
  15.         "First Group",
  16.         [],
  17.         ["COLUMNS 1;","DEFAULT 1;"]
  18.     )
  19.     element = ELEMENT(
  20.         globalidspace,
  21.         "IN_EXCLUDE",
  22.         "PYTAG_OBJECTS",
  23.         "global",
  24.         "Objects",
  25.         ["ACCEPT { Obase; }"]
  26.     )
  27.     long    = ELEMENT(
  28.         globalidspace,
  29.         "LONG",
  30.         "PYTAG_MODE",
  31.         "global",
  32.         "Editing Mode",
  33.         ["FIT_H;"]
  34.     )
  35.     id1     = ID(globalidspace, "PYTAG_MODE_DELETE", "global", "Delete")
  36.     id2     = ID(globalidspace, "PYTAG_MODE_REMOVE", 1005, "Remove")
  37.     id3     = ID(globalidspace, "PYTAG_MODE_APPEND", "global", "Append")
  38.     id4     = ID(globalidspace, "PYTAG_MODE_SWITCH", "global", "Switch")
  39.     cycle   = CYCLE( (id1, id2, id3, id4) )
  40.     long.AddArgument(cycle)
  41.  
  42.  
  43.     for i in (group,):
  44.         container.AddElement(i)
  45.  
  46.     for i in (element, long):
  47.         group.AddElement(i)
  48.  
  49.  
  50.     from os.path import join, split
  51.     path    = join(split(__file__)[0], container.GetIdentifier())
  52.     fres    = open( path+".res", "w" )
  53.     fh      = open( path+".h", "w" )
  54.     fstr    = open( path+".str", "w" )
  55.  
  56.     fres.write(container.Format_res())
  57.     fh.write(container.Format_h())
  58.     fstr.write(container.Format_str())
  59.  
  60.     fres.close()
  61.     fh.close()
  62.     fstr.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement