mirror of
https://github.com/python/cpython.git
synced 2025-07-27 21:24:32 +00:00
Moved most of Mac/Lib hierarchy to Lib/plat-mac: it can be used both
in MacPython-OS9 and MacPython-OSX (or the equivalent unix Python on Mac OS X). The only items remaining in Mac/Lib are modules that are meaningful only for MacPython-OS9 (CFM stuff, MacPython preferences in resources, etc).
This commit is contained in:
parent
c262a1f51c
commit
60087fb450
136 changed files with 207 additions and 0 deletions
380
Lib/plat-mac/lib-scriptpackages/Finder/Finder_Basics.py
Normal file
380
Lib/plat-mac/lib-scriptpackages/Finder/Finder_Basics.py
Normal file
|
@ -0,0 +1,380 @@
|
|||
"""Suite Finder Basics: Commonly-used Finder commands and object classes
|
||||
Level 1, version 1
|
||||
|
||||
Generated from /Volumes/Sap/System Folder/Finder
|
||||
AETE/AEUT resource version 0/144, language 0, script 0
|
||||
"""
|
||||
|
||||
import aetools
|
||||
import MacOS
|
||||
|
||||
_code = 'fndr'
|
||||
|
||||
class Finder_Basics_Events:
|
||||
|
||||
_argmap_computer = {
|
||||
'has' : 'has ',
|
||||
}
|
||||
|
||||
def computer(self, _object, _attributes={}, **_arguments):
|
||||
"""computer: Test attributes of this computer
|
||||
Required argument: the attribute to test
|
||||
Keyword argument has: test specific bits of response
|
||||
Keyword argument _attributes: AppleEvent attribute dictionary
|
||||
Returns: the result of the query
|
||||
"""
|
||||
_code = 'fndr'
|
||||
_subcode = 'gstl'
|
||||
|
||||
aetools.keysubst(_arguments, self._argmap_computer)
|
||||
_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 copy(self, _no_object=None, _attributes={}, **_arguments):
|
||||
"""copy: 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 != 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['----']
|
||||
|
||||
def restart(self, _no_object=None, _attributes={}, **_arguments):
|
||||
"""restart: Restart the computer
|
||||
Keyword argument _attributes: AppleEvent attribute dictionary
|
||||
"""
|
||||
_code = 'fndr'
|
||||
_subcode = 'rest'
|
||||
|
||||
if _arguments: raise TypeError, 'No optional args expected'
|
||||
if _no_object != 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['----']
|
||||
|
||||
def shut_down(self, _no_object=None, _attributes={}, **_arguments):
|
||||
"""shut down: Shut Down the computer
|
||||
Keyword argument _attributes: AppleEvent attribute dictionary
|
||||
"""
|
||||
_code = 'fndr'
|
||||
_subcode = 'shut'
|
||||
|
||||
if _arguments: raise TypeError, 'No optional args expected'
|
||||
if _no_object != 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['----']
|
||||
|
||||
def sleep(self, _no_object=None, _attributes={}, **_arguments):
|
||||
"""sleep: Put the computer to sleep
|
||||
Keyword argument _attributes: AppleEvent attribute dictionary
|
||||
"""
|
||||
_code = 'fndr'
|
||||
_subcode = 'slep'
|
||||
|
||||
if _arguments: raise TypeError, 'No optional args expected'
|
||||
if _no_object != 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: 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 clipboard(aetools.NProperty):
|
||||
"""clipboard - the Finder\xd5s clipboard window """
|
||||
which = 'pcli'
|
||||
want = 'obj '
|
||||
class largest_free_block(aetools.NProperty):
|
||||
"""largest free block - the largest free block of process memory available to launch an application """
|
||||
which = 'mfre'
|
||||
want = 'long'
|
||||
class name(aetools.NProperty):
|
||||
"""name - the Finder\xd5s name """
|
||||
which = 'pnam'
|
||||
want = 'itxt'
|
||||
class visible(aetools.NProperty):
|
||||
"""visible - Is the Finder\xd5s layer visible? """
|
||||
which = 'pvis'
|
||||
want = 'bool'
|
||||
class frontmost(aetools.NProperty):
|
||||
"""frontmost - Is the Finder the frontmost process? """
|
||||
which = 'pisf'
|
||||
want = 'bool'
|
||||
class selection(aetools.NProperty):
|
||||
"""selection - the selection visible to the user """
|
||||
which = 'sele'
|
||||
want = 'obj '
|
||||
class 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 '
|
||||
class file_sharing(aetools.NProperty):
|
||||
"""file sharing - Is file sharing on? """
|
||||
which = 'fshr'
|
||||
want = 'bool'
|
||||
class sharing_starting_up(aetools.NProperty):
|
||||
"""sharing starting up - Is file sharing in the process of starting up? """
|
||||
which = 'fsup'
|
||||
want = 'bool'
|
||||
class product_version(aetools.NProperty):
|
||||
"""product version - the version of the System software running on this computer """
|
||||
which = 'ver2'
|
||||
want = 'itxt'
|
||||
class version(aetools.NProperty):
|
||||
"""version - the version of the Finder """
|
||||
which = 'vers'
|
||||
want = 'itxt'
|
||||
class about_this_computer(aetools.NProperty):
|
||||
"""about this computer - the \xd2About this Computer\xd3 dialog and the list of running processes displayed in it """
|
||||
which = 'abbx'
|
||||
want = 'obj '
|
||||
class desktop(aetools.NProperty):
|
||||
"""desktop - the desktop """
|
||||
which = 'desk'
|
||||
want = 'cdsk'
|
||||
class execution_state(aetools.NProperty):
|
||||
"""execution state - the current execution state of the Finder """
|
||||
which = 'exec'
|
||||
want = 'ese0'
|
||||
class Finder_preferences(aetools.NProperty):
|
||||
"""Finder preferences - Various preferences that apply to the Finder as a whole """
|
||||
which = 'pfrp'
|
||||
want = 'cprf'
|
||||
# element 'cobj' as ['indx', 'name']
|
||||
# element 'ctnr' as ['indx', 'name']
|
||||
# element 'sctr' as ['indx', 'name']
|
||||
# element 'cdis' as ['indx', 'name', 'ID ']
|
||||
# element 'cfol' as ['indx', 'name', 'ID ']
|
||||
# element 'file' as ['indx', 'name']
|
||||
# element 'alia' as ['indx', 'name']
|
||||
# element 'appf' as ['indx', 'name', 'ID ']
|
||||
# element 'docf' as ['indx', 'name']
|
||||
# element 'fntf' as ['indx', 'name']
|
||||
# element 'dafi' as ['indx', 'name']
|
||||
# element 'inlf' as ['indx', 'name']
|
||||
# element 'sndf' as ['indx', 'name']
|
||||
# element 'clpf' as ['indx', 'name']
|
||||
# element 'pack' as ['indx', 'name']
|
||||
# element 'stcs' as ['indx', 'name']
|
||||
# element 'fsut' as ['indx', 'name']
|
||||
# element 'dsut' as ['indx', 'name']
|
||||
# element 'prcs' as ['indx', 'name']
|
||||
# element 'pcap' as ['indx', 'name']
|
||||
# element 'pcda' as ['indx', 'name']
|
||||
# element 'cwin' as ['indx', 'name']
|
||||
# element 'cwnd' as ['indx', 'name']
|
||||
# element 'iwnd' as ['indx', 'name']
|
||||
# element 'vwnd' as ['indx', 'name']
|
||||
# element 'lwnd' as ['indx', 'name']
|
||||
# element 'dwnd' as ['indx', 'name']
|
||||
|
||||
class special_folders(aetools.ComponentItem):
|
||||
"""special folders - The special folders used by the Mac OS """
|
||||
want = 'spfl'
|
||||
class system_folder(aetools.NProperty):
|
||||
"""system folder - the System folder """
|
||||
which = 'macs'
|
||||
want = 'obj '
|
||||
class apple_menu_items_folder(aetools.NProperty):
|
||||
"""apple menu items folder - the special folder named \xd2Apple Menu Items,\xd3 the contents of which appear in the Apple menu """
|
||||
which = 'amnu'
|
||||
want = 'obj '
|
||||
class control_panels_folder(aetools.NProperty):
|
||||
"""control panels folder - the special folder named \xd2Control Panels\xd3 """
|
||||
which = 'ctrl'
|
||||
want = 'obj '
|
||||
class extensions_folder(aetools.NProperty):
|
||||
"""extensions folder - the special folder named \xd2Extensions\xd3 """
|
||||
which = 'extn'
|
||||
want = 'obj '
|
||||
class fonts_folder(aetools.NProperty):
|
||||
"""fonts folder - the special folder named \xd2Fonts\xd3 """
|
||||
which = 'font'
|
||||
want = 'obj '
|
||||
class preferences_folder(aetools.NProperty):
|
||||
"""preferences folder - the special folder named \xd2Preferences\xd3 """
|
||||
which = 'pref'
|
||||
want = 'obj '
|
||||
class shutdown_items_folder(aetools.NProperty):
|
||||
"""shutdown items folder - the special folder named \xd2Shutdown Items\xd3 """
|
||||
which = 'shdf'
|
||||
want = 'obj '
|
||||
class startup_items_folder(aetools.NProperty):
|
||||
"""startup items folder - the special folder named \xd2Startup Items\xd3 """
|
||||
which = 'strt'
|
||||
want = 'obj '
|
||||
class temporary_items_folder(aetools.NProperty):
|
||||
"""temporary items folder - the special folder named \xd2Temporary Items\xd3 (invisible) """
|
||||
which = 'temp'
|
||||
want = 'obj '
|
||||
application._superclassnames = []
|
||||
import Earlier_terms
|
||||
import Containers_and_folders
|
||||
import Files_and_suitcases
|
||||
import Process_classes
|
||||
import Window_classes
|
||||
application._privpropdict = {
|
||||
'clipboard' : clipboard,
|
||||
'largest_free_block' : largest_free_block,
|
||||
'name' : name,
|
||||
'visible' : visible,
|
||||
'frontmost' : frontmost,
|
||||
'selection' : selection,
|
||||
'insertion_location' : insertion_location,
|
||||
'file_sharing' : file_sharing,
|
||||
'sharing_starting_up' : sharing_starting_up,
|
||||
'product_version' : product_version,
|
||||
'version' : version,
|
||||
'about_this_computer' : about_this_computer,
|
||||
'desktop' : desktop,
|
||||
'execution_state' : execution_state,
|
||||
'Finder_preferences' : Finder_preferences,
|
||||
}
|
||||
application._privelemdict = {
|
||||
'item' : Earlier_terms.item,
|
||||
'container' : Containers_and_folders.container,
|
||||
'sharable_container' : Earlier_terms.sharable_container,
|
||||
'disk' : Containers_and_folders.disk,
|
||||
'folder' : Containers_and_folders.folder,
|
||||
'file' : Files_and_suitcases.file,
|
||||
'alias_file' : Files_and_suitcases.alias_file,
|
||||
'application_file' : Earlier_terms.application_file,
|
||||
'document_file' : Files_and_suitcases.document_file,
|
||||
'font_file' : Files_and_suitcases.font_file,
|
||||
'desk_accessory_file' : Files_and_suitcases.desk_accessory_file,
|
||||
'internet_location' : Earlier_terms.internet_location,
|
||||
'sound_file' : Files_and_suitcases.sound_file,
|
||||
'clipping' : Files_and_suitcases.clipping,
|
||||
'package' : Files_and_suitcases.package,
|
||||
'suitcase' : Files_and_suitcases.suitcase,
|
||||
'font_suitcase' : Files_and_suitcases.font_suitcase,
|
||||
'accessory_suitcase' : Earlier_terms.accessory_suitcase,
|
||||
'process' : Earlier_terms.process,
|
||||
'application_process' : Process_classes.application_process,
|
||||
'accessory_process' : Earlier_terms.accessory_process,
|
||||
'window' : Earlier_terms.window,
|
||||
'container_window' : Earlier_terms.container_window,
|
||||
'information_window' : Earlier_terms.information_window,
|
||||
'view_options_window' : Window_classes.view_options_window,
|
||||
'clipping_window' : Window_classes.clipping_window,
|
||||
'content_space' : Window_classes.content_space,
|
||||
}
|
||||
special_folders._superclassnames = []
|
||||
special_folders._privpropdict = {
|
||||
'system_folder' : system_folder,
|
||||
'apple_menu_items_folder' : apple_menu_items_folder,
|
||||
'control_panels_folder' : control_panels_folder,
|
||||
'extensions_folder' : extensions_folder,
|
||||
'fonts_folder' : fonts_folder,
|
||||
'preferences_folder' : preferences_folder,
|
||||
'shutdown_items_folder' : shutdown_items_folder,
|
||||
'startup_items_folder' : startup_items_folder,
|
||||
'temporary_items_folder' : temporary_items_folder,
|
||||
}
|
||||
special_folders._privelemdict = {
|
||||
}
|
||||
|
||||
#
|
||||
# Indices of types declared in this module
|
||||
#
|
||||
_classdeclarations = {
|
||||
'capp' : application,
|
||||
'spfl' : special_folders,
|
||||
}
|
||||
|
||||
_propdeclarations = {
|
||||
'vers' : version,
|
||||
'ver2' : product_version,
|
||||
'pfrp' : Finder_preferences,
|
||||
'exec' : execution_state,
|
||||
'pins' : insertion_location,
|
||||
'mfre' : largest_free_block,
|
||||
'fsup' : sharing_starting_up,
|
||||
'desk' : desktop,
|
||||
'ctrl' : control_panels_folder,
|
||||
'macs' : system_folder,
|
||||
'font' : fonts_folder,
|
||||
'abbx' : about_this_computer,
|
||||
'shdf' : shutdown_items_folder,
|
||||
'temp' : temporary_items_folder,
|
||||
'pvis' : visible,
|
||||
'sele' : selection,
|
||||
'pisf' : frontmost,
|
||||
'pref' : preferences_folder,
|
||||
'strt' : startup_items_folder,
|
||||
'pcli' : clipboard,
|
||||
'fshr' : file_sharing,
|
||||
'pnam' : name,
|
||||
'extn' : extensions_folder,
|
||||
'amnu' : apple_menu_items_folder,
|
||||
}
|
||||
|
||||
_compdeclarations = {
|
||||
}
|
||||
|
||||
_enumdeclarations = {
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue