File: cwtalker.py

package info (click to toggle)
python2.2 2.2.3dfsg-2sarge1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 36,920 kB
  • ctags: 69,127
  • sloc: ansic: 219,839; python: 203,969; sh: 9,690; makefile: 3,468; perl: 3,454; lisp: 3,248; xml: 2,262; cpp: 106; sed: 2
file content (36 lines) | stat: -rw-r--r-- 1,169 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import CodeWarrior
import aetools
import aetypes

# There is both a class "project document" and a property "project document".
# We want the class, but the property overrides it.
#
##class project_document(aetools.ComponentItem):
##	"""project document - a project document """
##	want = 'PRJD'
project_document=aetypes.Type('PRJD')

class MyCodeWarrior(CodeWarrior.CodeWarrior):
	# Bug in the CW OSA dictionary
	def export(self, object, _attributes={}, **_arguments):
		"""export: Export the project file as an XML file
		Keyword argument _in: the XML file in which to export the project
		Keyword argument _attributes: AppleEvent attribute dictionary
		"""
		_code = 'CWIE'
		_subcode = 'EXPT'

		aetools.keysubst(_arguments, self._argmap_export)
		_arguments['----'] = _object


		_reply, _arguments, _attributes = self.send(_code, _subcode,
				_arguments, _attributes)
		if _arguments.has_key('errn'):
			raise aetools.Error, aetools.decodeerror(_arguments)
		# XXXX Optionally decode result
		if _arguments.has_key('----'):
			return _arguments['----']

	def my_mkproject(self, prjfile, xmlfile):
		self.make(new=project_document, with_data=xmlfile, as=prjfile)