summaryrefslogtreecommitdiffstats
path: root/Lib/plat-mac/lib-scriptpackages/Terminal/Terminal_Suite.py
blob: 29a95dbf55881d114d820234d5faff8ad1b36e81 (plain)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
"""Suite Terminal Suite: Terms and Events for controlling the Terminal application
Level 1, version 1

Generated from /Applications/Utilities/Terminal.app
AETE/AEUT resource version 1/0, language 0, script 0
"""

import aetools
import MacOS

_code = 'trmx'

class Terminal_Suite_Events:

	def GetURL(self, _object, _attributes={}, **_arguments):
		"""GetURL: Opens a telnet: URL
		Required argument: the object for the command
		Keyword argument _attributes: AppleEvent attribute dictionary
		"""
		_code = 'GURL'
		_subcode = 'GURL'

		if _arguments: raise TypeError, 'No optional args expected'
		_arguments['----'] = _object


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

	_argmap_do_script = {
		'in_' : 'kfil',
		'with_command' : 'cmnd',
	}

	def do_script(self, _object, _attributes={}, **_arguments):
		"""do script: Run a UNIX shell script or command
		Required argument: the object for the command
		Keyword argument in_: the window in which to execute the command
		Keyword argument with_command: data to be passed to the Terminal application as the command line, deprecated, use direct parameter
		Keyword argument _attributes: AppleEvent attribute dictionary
		Returns: the reply for the command
		"""
		_code = 'core'
		_subcode = 'dosc'

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


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


class application(aetools.ComponentItem):
	"""application - The Terminal program """
	want = 'capp'
class _Prop__3c_Inheritance_3e_(aetools.NProperty):
	"""<Inheritance> - All of the properties of the superclass. """
	which = 'c@#^'
	want = 'capp'
class _Prop_properties(aetools.NProperty):
	"""properties - every property of the Terminal program """
	which = 'pALL'
	want = '****'
#        element 'cwin' as ['name', 'indx', 'rele', 'rang', 'test', 'ID  ']
#        element 'docu' as ['name', 'indx', 'rele', 'rang', 'test']

applications = application

class window(aetools.ComponentItem):
	"""window - A Terminal window """
	want = 'cwin'
class _Prop_background_color(aetools.NProperty):
	"""background color - the background color for the window """
	which = 'pbcl'
	want = '****'
class _Prop_bold_text_color(aetools.NProperty):
	"""bold text color - the bold text color for the window """
	which = 'pbtc'
	want = '****'
class _Prop_bounds(aetools.NProperty):
	"""bounds - the boundary rectangle for the window, relative to the upper left corner of the screen """
	which = 'pbnd'
	want = '****'
class _Prop_busy(aetools.NProperty):
	"""busy - Is the window busy running a process? """
	which = 'busy'
	want = 'bool'
class _Prop_contents(aetools.NProperty):
	"""contents - the currently visible contents of the window """
	which = 'pcnt'
	want = 'utxt'
class _Prop_cursor_color(aetools.NProperty):
	"""cursor color - the cursor color for the window """
	which = 'pcuc'
	want = '****'
class _Prop_custom_title(aetools.NProperty):
	"""custom title - the custom title for the window """
	which = 'titl'
	want = 'utxt'
class _Prop_frame(aetools.NProperty):
	"""frame - the origin and size of the window """
	which = 'pfra'
	want = '****'
class _Prop_frontmost(aetools.NProperty):
	"""frontmost - Is the window in front of the other Terminal windows? """
	which = 'pisf'
	want = 'bool'
class _Prop_history(aetools.NProperty):
	"""history - the contents of the entire scrolling buffer of the window """
	which = 'hist'
	want = 'utxt'
class _Prop_normal_text_color(aetools.NProperty):
	"""normal text color - the normal text color for the window """
	which = 'ptxc'
	want = '****'
class _Prop_number_of_columns(aetools.NProperty):
	"""number of columns - the number of columns in the window """
	which = 'ccol'
	want = 'long'
class _Prop_number_of_rows(aetools.NProperty):
	"""number of rows - the number of rows in the window """
	which = 'crow'
	want = 'long'
class _Prop_origin(aetools.NProperty):
	"""origin - the lower left coordinates of the window, relative to the lower left corner of the screen """
	which = 'pori'
	want = '****'
class _Prop_position(aetools.NProperty):
	"""position - the upper left coordinates of the window, relative to the upper left corner of the screen """
	which = 'ppos'
	want = '****'
class _Prop_processes(aetools.NProperty):
	"""processes - a list of the currently running processes """
	which = 'prcs'
	want = 'utxt'
class _Prop_size(aetools.NProperty):
	"""size - the width and height of the window """
	which = 'psiz'
	want = '****'
class _Prop_title_displays_custom_title(aetools.NProperty):
	"""title displays custom title - Does the title for the window contain a custom title? """
	which = 'tdct'
	want = 'bool'
class _Prop_title_displays_device_name(aetools.NProperty):
	"""title displays device name - Does the title for the window contain the device name? """
	which = 'tddn'
	want = 'bool'
class _Prop_title_displays_file_name(aetools.NProperty):
	"""title displays file name - Does the title for the window contain the file name? """
	which = 'tdfn'
	want = 'bool'
class _Prop_title_displays_shell_path(aetools.NProperty):
	"""title displays shell path - Does the title for the window contain the shell path? """
	which = 'tdsp'
	want = 'bool'
class _Prop_title_displays_window_size(aetools.NProperty):
	"""title displays window size - Does the title for the window contain the window size? """
	which = 'tdws'
	want = 'bool'

windows = window
application._superclassnames = []
import Standard_Suite
application._privpropdict = {
	'_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_,
	'properties' : _Prop_properties,
}
application._privelemdict = {
	'document' : Standard_Suite.document,
	'window' : window,
}
window._superclassnames = []
window._privpropdict = {
	'_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_,
	'background_color' : _Prop_background_color,
	'bold_text_color' : _Prop_bold_text_color,
	'bounds' : _Prop_bounds,
	'busy' : _Prop_busy,
	'contents' : _Prop_contents,
	'cursor_color' : _Prop_cursor_color,
	'custom_title' : _Prop_custom_title,
	'frame' : _Prop_frame,
	'frontmost' : _Prop_frontmost,
	'history' : _Prop_history,
	'normal_text_color' : _Prop_normal_text_color,
	'number_of_columns' : _Prop_number_of_columns,
	'number_of_rows' : _Prop_number_of_rows,
	'origin' : _Prop_origin,
	'position' : _Prop_position,
	'processes' : _Prop_processes,
	'properties' : _Prop_properties,
	'size' : _Prop_size,
	'title_displays_custom_title' : _Prop_title_displays_custom_title,
	'title_displays_device_name' : _Prop_title_displays_device_name,
	'title_displays_file_name' : _Prop_title_displays_file_name,
	'title_displays_shell_path' : _Prop_title_displays_shell_path,
	'title_displays_window_size' : _Prop_title_displays_window_size,
}
window._privelemdict = {
}

#
# Indices of types declared in this module
#
_classdeclarations = {
	'capp' : application,
	'cwin' : window,
}