Figure 1: Structure of ASG objects.
Figure 2: Editing the model properties
If you click on Generate Code, several Python files are generated:
def createNewaTest(self, wherex, wherey, screenCoordinates = 1):where wherex and wherey are the coordinates where the object is to be created. If they are already converted into canvas coordinated, then the screenCoordinates parameter must be 0, else it must be 1.
In this same file there's another method (fillTypesInformation) which is used to provide ATOM3 with the allowed types that can be used when the meta-model is loaded. More about this in the ATOM3 class section.
A Python file which contains a model of the user interface to be loaded with the formalism. This file is named in our case myTest.py. Indeed this file can be loaded in AToM3 as a model (it's a model in the Buttons formalism) or as a meta-model (and then the model in the Buttons formalism will get interpreted by AToM3 , which will create the actual buttons in the user interface). By default the Buttons model is populated with a button for each object defined in the meta-model (in our case two buttons: one to create aTest objects and another to create aRel objects). If you open myTest.py as a model, and you inspect the Python code that is executed when the Button is pressed you will see that there are invokations to the methods created in myTest_MM.py : createNewaTest() and createNewaRel(). You can of course modify this Buttons model to add new buttons, or delete those you don't want, but beware!: if you save this model with the same name, and later you re-generate code for the meta-model, you'll loose your changes, as this file will get overwritten. So if you are going modify your meta-model later, save the modified Buttons model with another name!. In section Debugging and common programming patterns, we'll show some examples of creating buttons to execute graph grammars.