File: Toolbox%20Assistant...

package info (click to toggle)
python2.1 2.1.3dfsg-1sarge1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 38,028 kB
  • ctags: 64,228
  • sloc: python: 186,023; ansic: 184,754; xml: 43,435; sh: 12,381; makefile: 3,523; perl: 3,108; lisp: 2,460; cpp: 106; sed: 2
file content (45 lines) | stat: -rw-r--r-- 1,164 bytes parent folder | download | duplicates (9)
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
37
38
39
40
41
42
43
44
45
import aetools
import Standard_Suite
import Required_Suite
import MacOS
import W


class Toolbox(aetools.TalkTo, Standard_Suite.Standard_Suite):
	
	def LookupTopic(self, _object, _attributes={}, **_arguments):
		_code = 'DanR'
		_subcode = 'REF '

		_arguments['----'] = _object
		
		_reply, _arguments, _attributes = self.send(_code, _subcode,
				_arguments, _attributes)
		if _arguments.has_key('errn'):
			raise MacOS.Error, aetools.decodeerror(_arguments)
	

class ToolboxAssi:
	
	def __init__(self):
		self.talker = None
		self.w = W.Window((200, 100), "Toolbox Assistant")
		self.w.button = W.Button((-94, -32, 80, 16), "Lookup", self.lookup)
		self.w.prompt = W.TextBox((10, 8, -10, 15), "Enter topic:")
		self.w.edit = W.EditText((10, 24, -10, 20))
		self.w.setdefaultbutton(self.w.button)
		self.w.open()
	
	def lookup(self):
		if self.talker is None:
			try:
				self.talker = Toolbox('ALTV', start = 1)
			except:
				raise W.AlertError, "Cant find Toolbox Assistant"
		lookup = self.w.edit.get()
		try:
			self.talker.LookupTopic(lookup)
		except MacOS.Error, detail:
			W.Message("Requested topic not found.\r(%d)" % detail[0])

t = ToolboxAssi()