Book a Demo

Author Topic: Python instance variables and source engineering  (Read 4017 times)

Scott Bowman

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Python instance variables and source engineering
« on: September 25, 2008, 07:10:58 am »
All variables declared in Enterprise Architect classes are written out to python source stubs as 'global' class variables like this...

class MyClass:
    MyVariable = 0

    def __init__(self):
        pass

I want it to write out my variables as class 'instance' variables like this...

class MyClass:

    def __init__(self):
        MyVariable = 1

... how to I get EA to write (and read from) these class attributes to the __init__ function?????
 :-/

jsbueno

  • EA User
  • **
  • Posts: 26
  • Karma: +0/-0
    • View Profile
Re: Python instance variables and source engineeri
« Reply #1 on: September 29, 2008, 11:11:44 pm »
Hi -

The level of python support in EA source dcode engineering is very colose to non-existent,but for it shwoing up on the menus

However, you can write different code templates - check teh docuemtnation on how to gerentae your own templates for code - it should be straightforward to create more usefull python templates.

(I think that if one is to use teh Django framework, a nearly funcitonal system could come out from authomatic EA code generation this way).

If you are allowed to, and willing, it would be  a good idea to share any python templates you got wtritten, both with other users and see if sparx could include then in EA.