<?xml version="1.0" encoding="UTF-8"?> <component name="MyPython" version="1.0" type="Interpreter" paradigm="MetaGME"> <iconpath value="Icons/pygme.ico" /> <tooltip value="My Python Component" /> </component>
The attributes on the <component> tag are all mandatory.
name | Gives an identity to the component. This name will be used to form the COM class that implements the component. For example, name="Foo" yields a COM class with the name "MGA.PythonInterpreter.Foo" for an interpreter and "MGA.PythonAddon.Foo" for an addon. |
version | Assigns a version designator to the COM class. |
type | Determines the kind of component generated, "Interpreter" for interpreters and "Addon" for addons. Other values result in a specification error. |
paradigm | Name of the GME paradigm for which the generated Python component will be registered. |
The <iconpath> and <tooltip> tags are optional and only relevant to interpreter components.
iconpath | Path to a component icon presented in the toolbar for the component's paradigm. If a relative path, it is considered relative to the folder containing the XML specification file. (Icons are always registered as absolute paths.) The file must be a .ico (Windows icon) 32x32 file. |
tooltip | A string that is shown when the user mouses over the component's icon in the toolbar, if an icon is defined. |
> PyGME.py [-register[=<system|user>]] [xmlfile]
Switches:
-register | Requests that the component be registered with COM and GME after generation. If the value given the switch is user, or if no value is given, then the component is registered in the current user's registry; otherwise, if the value is system, then the component is registed in the system-wide registry. Administrative priviledges are required for the latter. |
Arguments:
xmlfile | Path to a file that contains an XML specification for the component (see above). The default is the file 'component.xml' in the same folder as PyGME.py. |
To unregister the component after registration, start a Python shell. Enter the following (assuming a component named 'Foo'):
> from Foo import Foo > Foo.UnregisterSelf(systemwide)The systemwide parameter should be 2 (REGACCESS_SYSTEM) if the component was registered in the System registry (LocalMachine) and 1 (REGACCESS_USER) if the component was registered in the user registry (CurrentUser). The constants are defined in MgaUtil.idl.
To re-register the component, from a Python shell enter:
> from Foo import Foo > Foo.RegisterSelf(systemwide, iconfolder)The systemwide parameter is as defined above for UnregisterSelf. The iconfolder parameter is the full path to the folder that contains the component's icon. This parameter should be omitted for addons and interpreters that do not define an icon.