1 """Suite Finder Basics: Commonly-used Finder commands and object classes 2 Level 1, version 1 3 4 Generated from /System/Library/CoreServices/Finder.app 5 AETE/AEUT resource version 0/144, language 0, script 0 6 """ 7 8 import aetools 9 import MacOS 10 11 _code = 'fndr' 12 13 class Finder_Basics_Events: 14 15 def copy(self, _no_object=None, _attributes={}, **_arguments): 16 """copy: (NOT AVAILABLE YET) Copy the selected items to the clipboard (the Finder must be the front application) 17 Keyword argument _attributes: AppleEvent attribute dictionary 18 """ 19 _code = 'misc' 20 _subcode = 'copy' 21 22 if _arguments: raise TypeError, 'No optional args expected' 23 if _no_object is not None: raise TypeError, 'No direct arg expected' 24 25 26 _reply, _arguments, _attributes = self.send(_code, _subcode, 27 _arguments, _attributes) 28 if _arguments.get('errn', 0): 29 raise aetools.Error, aetools.decodeerror(_arguments) 30 # XXXX Optionally decode result 31 if _arguments.has_key('----'): 32 return _arguments['----'] 33 34 _argmap_sort = { 35 'by' : 'by ', 36 } 37 38 def sort(self, _object, _attributes={}, **_arguments): 39 """sort: (NOT AVAILABLE YET) Return the specified object(s) in a sorted list 40 Required argument: a list of finder objects to sort 41 Keyword argument by: the property to sort the items by (name, index, date, etc.) 42 Keyword argument _attributes: AppleEvent attribute dictionary 43 Returns: the sorted items in their new order 44 """ 45 _code = 'DATA' 46 _subcode = 'SORT' 47 48 aetools.keysubst(_arguments, self._argmap_sort) 49 _arguments['----'] = _object 50 51 52 _reply, _arguments, _attributes = self.send(_code, _subcode, 53 _arguments, _attributes) 54 if _arguments.get('errn', 0): 55 raise aetools.Error, aetools.decodeerror(_arguments) 56 # XXXX Optionally decode result 57 if _arguments.has_key('----'): 58 return _arguments['----'] 59 60 61 class application(aetools.ComponentItem): 62 """application - The Finder """ 63 want = 'capp' 64 class _Prop_Finder_preferences(aetools.NProperty): 65 """Finder preferences - (NOT AVAILABLE YET) Various preferences that apply to the Finder as a whole """ 66 which = 'pfrp' 67 want = 'cprf' 68 Finder_preferences = _Prop_Finder_preferences() 69 class _Prop_clipboard(aetools.NProperty): 70 """clipboard - (NOT AVAILABLE YET) the Finder\xd5s clipboard window """ 71 which = 'pcli' 72 want = 'obj ' 73 clipboard = _Prop_clipboard() 74 class _Prop_desktop(aetools.NProperty): 75 """desktop - the desktop """ 76 which = 'desk' 77 want = 'cdsk' 78 desktop = _Prop_desktop() 79 class _Prop_frontmost(aetools.NProperty): 80 """frontmost - Is the Finder the frontmost process? """ 81 which = 'pisf' 82 want = 'bool' 83 frontmost = _Prop_frontmost() 84 class _Prop_home(aetools.NProperty): 85 """home - the home directory """ 86 which = 'home' 87 want = 'cfol' 88 home = _Prop_home() 89 class _Prop_insertion_location(aetools.NProperty): 90 """insertion location - the container in which a new folder would appear if \xd2New Folder\xd3 was selected """ 91 which = 'pins' 92 want = 'obj ' 93 insertion_location = _Prop_insertion_location() 94 class _Prop_name(aetools.NProperty): 95 """name - the Finder\xd5s name """ 96 which = 'pnam' 97 want = 'itxt' 98 name = _Prop_name() 99 class _Prop_product_version(aetools.NProperty): 100 """product version - the version of the System software running on this computer """ 101 which = 'ver2' 102 want = 'utxt' 103 product_version = _Prop_product_version() 104 class _Prop_selection(aetools.NProperty): 105 """selection - the selection in the frontmost Finder window """ 106 which = 'sele' 107 want = 'obj ' 108 selection = _Prop_selection() 109 class _Prop_startup_disk(aetools.NProperty): 110 """startup disk - the startup disk """ 111 which = 'sdsk' 112 want = 'cdis' 113 startup_disk = _Prop_startup_disk() 114 class _Prop_trash(aetools.NProperty): 115 """trash - the trash """ 116 which = 'trsh' 117 want = 'ctrs' 118 trash = _Prop_trash() 119 class _Prop_version(aetools.NProperty): 120 """version - the version of the Finder """ 121 which = 'vers' 122 want = 'utxt' 123 version = _Prop_version() 124 class _Prop_visible(aetools.NProperty): 125 """visible - Is the Finder\xd5s layer visible? """ 126 which = 'pvis' 127 want = 'bool' 128 visible = _Prop_visible() 129 # element 'alia' as ['indx', 'name'] 130 # element 'appf' as ['indx', 'name', 'ID '] 131 # element 'brow' as ['indx', 'ID '] 132 # element 'cdis' as ['indx', 'name', 'ID '] 133 # element 'cfol' as ['indx', 'name', 'ID '] 134 # element 'clpf' as ['indx', 'name'] 135 # element 'cobj' as ['indx', 'rele', 'name', 'rang', 'test'] 136 # element 'ctnr' as ['indx', 'name'] 137 # element 'cwin' as ['indx', 'name'] 138 # element 'docf' as ['indx', 'name'] 139 # element 'file' as ['indx', 'name'] 140 # element 'inlf' as ['indx', 'name'] 141 # element 'lwnd' as ['indx', 'name'] 142 # element 'pack' as ['indx', 'name'] 143 application._superclassnames = [] 144 import Files 145 import Window_classes 146 import Containers_and_folders 147 import Finder_items 148 application._privpropdict = { 149 'Finder_preferences' : _Prop_Finder_preferences, 150 'clipboard' : _Prop_clipboard, 151 'desktop' : _Prop_desktop, 152 'frontmost' : _Prop_frontmost, 153 'home' : _Prop_home, 154 'insertion_location' : _Prop_insertion_location, 155 'name' : _Prop_name, 156 'product_version' : _Prop_product_version, 157 'selection' : _Prop_selection, 158 'startup_disk' : _Prop_startup_disk, 159 'trash' : _Prop_trash, 160 'version' : _Prop_version, 161 'visible' : _Prop_visible, 162 } 163 application._privelemdict = { 164 'Finder_window' : Window_classes.Finder_window, 165 'alias_file' : Files.alias_file, 166 'application_file' : Files.application_file, 167 'clipping' : Files.clipping, 168 'clipping_window' : Window_classes.clipping_window, 169 'container' : Containers_and_folders.container, 170 'disk' : Containers_and_folders.disk, 171 'document_file' : Files.document_file, 172 'file' : Files.file, 173 'folder' : Containers_and_folders.folder, 174 'internet_location_file' : Files.internet_location_file, 175 'item' : Finder_items.item, 176 'package' : Files.package, 177 'window' : Window_classes.window, 178 } 179 180 # 181 # Indices of types declared in this module 182 # 183 _classdeclarations = { 184 'capp' : application, 185 } 186 187 _propdeclarations = { 188 'desk' : _Prop_desktop, 189 'home' : _Prop_home, 190 'pcli' : _Prop_clipboard, 191 'pfrp' : _Prop_Finder_preferences, 192 'pins' : _Prop_insertion_location, 193 'pisf' : _Prop_frontmost, 194 'pnam' : _Prop_name, 195 'pvis' : _Prop_visible, 196 'sdsk' : _Prop_startup_disk, 197 'sele' : _Prop_selection, 198 'trsh' : _Prop_trash, 199 'ver2' : _Prop_product_version, 200 'vers' : _Prop_version, 201 } 202 203 _compdeclarations = { 204 } 205 206 _enumdeclarations = { 207 } 208