Jack Jansen | 07642c3 | 2000-09-22 23:26:55 +0000 | [diff] [blame] | 1 | import CodeWarrior |
Jack Jansen | 486f138 | 2000-09-24 21:56:43 +0000 | [diff] [blame] | 2 | import aetools |
| 3 | import aetypes |
| 4 | |
| 5 | # There is both a class "project document" and a property "project document". |
| 6 | # We want the class, but the property overrides it. |
| 7 | # |
| 8 | ##class project_document(aetools.ComponentItem): |
| 9 | ## """project document - a project document """ |
| 10 | ## want = 'PRJD' |
| 11 | project_document=aetypes.Type('PRJD') |
Jack Jansen | 07642c3 | 2000-09-22 23:26:55 +0000 | [diff] [blame] | 12 | |
| 13 | class MyCodeWarrior(CodeWarrior.CodeWarrior): |
| 14 | # Bug in the CW OSA dictionary |
| 15 | def export(self, object, _attributes={}, **_arguments): |
| 16 | """export: Export the project file as an XML file |
| 17 | Keyword argument _in: the XML file in which to export the project |
| 18 | Keyword argument _attributes: AppleEvent attribute dictionary |
| 19 | """ |
| 20 | _code = 'CWIE' |
| 21 | _subcode = 'EXPT' |
| 22 | |
| 23 | aetools.keysubst(_arguments, self._argmap_export) |
| 24 | _arguments['----'] = _object |
| 25 | |
| 26 | |
| 27 | _reply, _arguments, _attributes = self.send(_code, _subcode, |
| 28 | _arguments, _attributes) |
| 29 | if _arguments.has_key('errn'): |
| 30 | raise aetools.Error, aetools.decodeerror(_arguments) |
| 31 | # XXXX Optionally decode result |
| 32 | if _arguments.has_key('----'): |
| 33 | return _arguments['----'] |
| 34 | |
| 35 | def my_mkproject(self, prjfile, xmlfile): |
Jack Jansen | 486f138 | 2000-09-24 21:56:43 +0000 | [diff] [blame] | 36 | self.make(new=project_document, with_data=xmlfile, as=prjfile) |