summaryrefslogtreecommitdiffstats
path: root/Lib/plat-mac/lib-scriptpackages/Finder/Finder_items.py
blob: 6f5266769159a1350af117064375166359337336 (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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
"""Suite Finder items: Commands used with file system items, and basic item definition
Level 1, version 1

Generated from /System/Library/CoreServices/Finder.app
AETE/AEUT resource version 0/144, language 0, script 0
"""

import aetools
import MacOS

_code = 'fndr'

class Finder_items_Events:

	def add_to_favorites(self, _object, _attributes={}, **_arguments):
		"""add to favorites: (NOT AVAILABLE YET) Add the items to the user\xd5s Favorites
		Required argument: the items to add to the collection of Favorites
		Keyword argument _attributes: AppleEvent attribute dictionary
		"""
		_code = 'fndr'
		_subcode = 'ffav'

		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_clean_up = {
		'by' : 'by  ',
	}

	def clean_up(self, _object, _attributes={}, **_arguments):
		"""clean up: (NOT AVAILABLE YET) Arrange items in window nicely (only applies to open windows in icon view that are not kept arranged)
		Required argument: the window to clean up
		Keyword argument by: the order in which to clean up the objects (name, index, date, etc.)
		Keyword argument _attributes: AppleEvent attribute dictionary
		"""
		_code = 'fndr'
		_subcode = 'fclu'

		aetools.keysubst(_arguments, self._argmap_clean_up)
		_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['----']

	def eject(self, _object=None, _attributes={}, **_arguments):
		"""eject: Eject the specified disk(s)
		Required argument: the disk(s) to eject
		Keyword argument _attributes: AppleEvent attribute dictionary
		"""
		_code = 'fndr'
		_subcode = 'ejct'

		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['----']

	def empty(self, _object=None, _attributes={}, **_arguments):
		"""empty: Empty the trash
		Required argument: \xd2empty\xd3 and \xd2empty trash\xd3 both do the same thing
		Keyword argument _attributes: AppleEvent attribute dictionary
		"""
		_code = 'fndr'
		_subcode = 'empt'

		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['----']

	def erase(self, _object, _attributes={}, **_arguments):
		"""erase: (NOT AVAILABLE) Erase the specified disk(s)
		Required argument: the items to erase
		Keyword argument _attributes: AppleEvent attribute dictionary
		"""
		_code = 'fndr'
		_subcode = 'fera'

		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['----']

	def reveal(self, _object, _attributes={}, **_arguments):
		"""reveal: Bring the specified object(s) into view
		Required argument: the object to be made visible
		Keyword argument _attributes: AppleEvent attribute dictionary
		"""
		_code = 'misc'
		_subcode = 'mvis'

		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_update = {
		'necessity' : 'nec?',
		'registering_applications' : 'reg?',
	}

	def update(self, _object, _attributes={}, **_arguments):
		"""update: Update the display of the specified object(s) to match their on-disk representation
		Required argument: the item to update
		Keyword argument necessity: only update if necessary (i.e. a finder window is open).  default is false
		Keyword argument registering_applications: register applications. default is true
		Keyword argument _attributes: AppleEvent attribute dictionary
		"""
		_code = 'fndr'
		_subcode = 'fupd'

		aetools.keysubst(_arguments, self._argmap_update)
		_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 item(aetools.ComponentItem):
	"""item - An item """
	want = 'cobj'
class _Prop_bounds(aetools.NProperty):
	"""bounds - the bounding rectangle of the item (can only be set for an item in a window viewed as icons or buttons) """
	which = 'pbnd'
	want = 'qdrt'
class _Prop_comment(aetools.NProperty):
	"""comment - the comment of the item, displayed in the \xd2Get Info\xd3 window """
	which = 'comt'
	want = 'utxt'
class _Prop_container(aetools.NProperty):
	"""container - the container of the item """
	which = 'ctnr'
	want = 'obj '
class _Prop_creation_date(aetools.NProperty):
	"""creation date - the date on which the item was created """
	which = 'ascd'
	want = 'ldt '
class _Prop_description(aetools.NProperty):
	"""description - a description of the item """
	which = 'dscr'
	want = 'utxt'
class _Prop_disk(aetools.NProperty):
	"""disk - the disk on which the item is stored """
	which = 'cdis'
	want = 'obj '
class _Prop_displayed_name(aetools.NProperty):
	"""displayed name - the user-visible name of the item """
	which = 'dnam'
	want = 'utxt'
class _Prop_everyones_privileges(aetools.NProperty):
	"""everyones privileges -  """
	which = 'gstp'
	want = 'priv'
class _Prop_extension_hidden(aetools.NProperty):
	"""extension hidden - Is the item's extension hidden from the user? """
	which = 'hidx'
	want = 'bool'
class _Prop_group(aetools.NProperty):
	"""group - the user or group that has special access to the container """
	which = 'sgrp'
	want = 'utxt'
class _Prop_group_privileges(aetools.NProperty):
	"""group privileges -  """
	which = 'gppr'
	want = 'priv'
class _Prop_icon(aetools.NProperty):
	"""icon - the icon bitmap of the item """
	which = 'iimg'
	want = 'ifam'
class _Prop_index(aetools.NProperty):
	"""index - the index in the front-to-back ordering within its container """
	which = 'pidx'
	want = 'long'
class _Prop_information_window(aetools.NProperty):
	"""information window - the information window for the item """
	which = 'iwnd'
	want = 'obj '
class _Prop_kind(aetools.NProperty):
	"""kind - the kind of the item """
	which = 'kind'
	want = 'utxt'
class _Prop_label_index(aetools.NProperty):
	"""label index - the label of the item """
	which = 'labi'
	want = 'long'
class _Prop_locked(aetools.NProperty):
	"""locked - Is the file locked? """
	which = 'aslk'
	want = 'bool'
class _Prop_modification_date(aetools.NProperty):
	"""modification date - the date on which the item was last modified """
	which = 'asmo'
	want = 'ldt '
class _Prop_name(aetools.NProperty):
	"""name - the name of the item """
	which = 'pnam'
	want = 'utxt'
class _Prop_name_extension(aetools.NProperty):
	"""name extension - the name extension of the item (such as \xd2txt\xd3) """
	which = 'nmxt'
	want = 'utxt'
class _Prop_owner(aetools.NProperty):
	"""owner - the user that owns the container """
	which = 'sown'
	want = 'utxt'
class _Prop_owner_privileges(aetools.NProperty):
	"""owner privileges -  """
	which = 'ownr'
	want = 'priv'
class _Prop_physical_size(aetools.NProperty):
	"""physical size - the actual space used by the item on disk """
	which = 'phys'
	want = 'comp'
class _Prop_position(aetools.NProperty):
	"""position - the position of the item within its parent window (can only be set for an item in a window viewed as icons or buttons) """
	which = 'posn'
	want = 'QDpt'
class _Prop_properties(aetools.NProperty):
	"""properties - every property of an item """
	which = 'pALL'
	want = 'reco'
class _Prop_size(aetools.NProperty):
	"""size - the logical size of the item """
	which = 'ptsz'
	want = 'comp'
class _Prop_url(aetools.NProperty):
	"""url - the url of the item """
	which = 'pURL'
	want = 'utxt'

items = item
item._superclassnames = []
item._privpropdict = {
	'bounds' : _Prop_bounds,
	'comment' : _Prop_comment,
	'container' : _Prop_container,
	'creation_date' : _Prop_creation_date,
	'description' : _Prop_description,
	'disk' : _Prop_disk,
	'displayed_name' : _Prop_displayed_name,
	'everyones_privileges' : _Prop_everyones_privileges,
	'extension_hidden' : _Prop_extension_hidden,
	'group' : _Prop_group,
	'group_privileges' : _Prop_group_privileges,
	'icon' : _Prop_icon,
	'index' : _Prop_index,
	'information_window' : _Prop_information_window,
	'kind' : _Prop_kind,
	'label_index' : _Prop_label_index,
	'locked' : _Prop_locked,
	'modification_date' : _Prop_modification_date,
	'name' : _Prop_name,
	'name_extension' : _Prop_name_extension,
	'owner' : _Prop_owner,
	'owner_privileges' : _Prop_owner_privileges,
	'physical_size' : _Prop_physical_size,
	'position' : _Prop_position,
	'properties' : _Prop_properties,
	'size' : _Prop_size,
	'url' : _Prop_url,
}
item._privelemdict = {
}

#
# Indices of types declared in this module
#
_classdeclarations = {
	'cobj' : item,
}