aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/python/src/Lib/plat-mac/lib-scriptpackages/Finder/Finder_Basics.py
blob: 4e3928c37992d762d637c63866b1aa592c43e18c (plain) (blame)
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
"""Suite Finder Basics: Commonly-used Finder commands and object classes
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_Basics_Events:

    def copy(self, _no_object=None, _attributes={}, **_arguments):
        """copy: (NOT AVAILABLE YET) Copy the selected items to the clipboard (the Finder must be the front application)
        Keyword argument _attributes: AppleEvent attribute dictionary
        """
        _code = 'misc'
        _subcode = 'copy'

        if _arguments: raise TypeError, 'No optional args expected'
        if _no_object is not None: raise TypeError, 'No direct arg expected'


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

    def sort(self, _object, _attributes={}, **_arguments):
        """sort: (NOT AVAILABLE YET) Return the specified object(s) in a sorted list
        Required argument: a list of finder objects to sort
        Keyword argument by: the property to sort the items by (name, index, date, etc.)
        Keyword argument _attributes: AppleEvent attribute dictionary
        Returns: the sorted items in their new order
        """
        _code = 'DATA'
        _subcode = 'SORT'

        aetools.keysubst(_arguments, self._argmap_sort)
        _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 Finder """
    want = 'capp'
class _Prop_Finder_preferences(aetools.NProperty):
    """Finder preferences - (NOT AVAILABLE YET) Various preferences that apply to the Finder as a whole """
    which = 'pfrp'
    want = 'cprf'
Finder_preferences = _Prop_Finder_preferences()
class _Prop_clipboard(aetools.NProperty):
    """clipboard - (NOT AVAILABLE YET) the Finder\xd5s clipboard window """
    which = 'pcli'
    want = 'obj '
clipboard = _Prop_clipboard()
class _Prop_desktop(aetools.NProperty):
    """desktop - the desktop """
    which = 'desk'
    want = 'cdsk'
desktop = _Prop_desktop()
class _Prop_frontmost(aetools.NProperty):
    """frontmost - Is the Finder the frontmost process? """
    which = 'pisf'
    want = 'bool'
frontmost = _Prop_frontmost()
class _Prop_home(aetools.NProperty):
    """home - the home directory """
    which = 'home'
    want = 'cfol'
home = _Prop_home()
class _Prop_insertion_location(aetools.NProperty):
    """insertion location - the container in which a new folder would appear if \xd2New Folder\xd3 was selected """
    which = 'pins'
    want = 'obj '
insertion_location = _Prop_insertion_location()
class _Prop_name(aetools.NProperty):
    """name - the Finder\xd5s name """
    which = 'pnam'
    want = 'itxt'
name = _Prop_name()
class _Prop_product_version(aetools.NProperty):
    """product version - the version of the System software running on this computer """
    which = 'ver2'
    want = 'utxt'
product_version = _Prop_product_version()
class _Prop_selection(aetools.NProperty):
    """selection - the selection in the frontmost Finder window """
    which = 'sele'
    want = 'obj '
selection = _Prop_selection()
class _Prop_startup_disk(aetools.NProperty):
    """startup disk - the startup disk """
    which = 'sdsk'
    want = 'cdis'
startup_disk = _Prop_startup_disk()
class _Prop_trash(aetools.NProperty):
    """trash - the trash """
    which = 'trsh'
    want = 'ctrs'
trash = _Prop_trash()
class _Prop_version(aetools.NProperty):
    """version - the version of the Finder """
    which = 'vers'
    want = 'utxt'
version = _Prop_version()
class _Prop_visible(aetools.NProperty):
    """visible - Is the Finder\xd5s layer visible? """
    which = 'pvis'
    want = 'bool'
visible = _Prop_visible()
#        element 'alia' as ['indx', 'name']
#        element 'appf' as ['indx', 'name', 'ID  ']
#        element 'brow' as ['indx', 'ID  ']
#        element 'cdis' as ['indx', 'name', 'ID  ']
#        element 'cfol' as ['indx', 'name', 'ID  ']
#        element 'clpf' as ['indx', 'name']
#        element 'cobj' as ['indx', 'rele', 'name', 'rang', 'test']
#        element 'ctnr' as ['indx', 'name']
#        element 'cwin' as ['indx', 'name']
#        element 'docf' as ['indx', 'name']
#        element 'file' as ['indx', 'name']
#        element 'inlf' as ['indx', 'name']
#        element 'lwnd' as ['indx', 'name']
#        element 'pack' as ['indx', 'name']
application._superclassnames = []
import Files
import Window_classes
import Containers_and_folders
import Finder_items
application._privpropdict = {
    'Finder_preferences' : _Prop_Finder_preferences,
    'clipboard' : _Prop_clipboard,
    'desktop' : _Prop_desktop,
    'frontmost' : _Prop_frontmost,
    'home' : _Prop_home,
    'insertion_location' : _Prop_insertion_location,
    'name' : _Prop_name,
    'product_version' : _Prop_product_version,
    'selection' : _Prop_selection,
    'startup_disk' : _Prop_startup_disk,
    'trash' : _Prop_trash,
    'version' : _Prop_version,
    'visible' : _Prop_visible,
}
application._privelemdict = {
    'Finder_window' : Window_classes.Finder_window,
    'alias_file' : Files.alias_file,
    'application_file' : Files.application_file,
    'clipping' : Files.clipping,
    'clipping_window' : Window_classes.clipping_window,
    'container' : Containers_and_folders.container,
    'disk' : Containers_and_folders.disk,
    'document_file' : Files.document_file,
    'file' : Files.file,
    'folder' : Containers_and_folders.folder,
    'internet_location_file' : Files.internet_location_file,
    'item' : Finder_items.item,
    'package' : Files.package,
    'window' : Window_classes.window,
}

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

_propdeclarations = {
    'desk' : _Prop_desktop,
    'home' : _Prop_home,
    'pcli' : _Prop_clipboard,
    'pfrp' : _Prop_Finder_preferences,
    'pins' : _Prop_insertion_location,
    'pisf' : _Prop_frontmost,
    'pnam' : _Prop_name,
    'pvis' : _Prop_visible,
    'sdsk' : _Prop_startup_disk,
    'sele' : _Prop_selection,
    'trsh' : _Prop_trash,
    'ver2' : _Prop_product_version,
    'vers' : _Prop_version,
}

_compdeclarations = {
}

_enumdeclarations = {
}