/Doc/library/macostools.rst

http://unladen-swallow.googlecode.com/ · ReStructuredText · 120 lines · 66 code · 54 blank · 0 comment · 0 complexity · 457a9c2d09832860f072cdb84dc6f6d8 MD5 · raw file

  1. :mod:`macostools` --- Convenience routines for file manipulation
  2. ================================================================
  3. .. module:: macostools
  4. :platform: Mac
  5. :synopsis: Convenience routines for file manipulation.
  6. :deprecated:
  7. This module contains some convenience routines for file-manipulation on the
  8. Macintosh. All file parameters can be specified as pathnames, :class:`FSRef` or
  9. :class:`FSSpec` objects. This module expects a filesystem which supports forked
  10. files, so it should not be used on UFS partitions.
  11. .. note::
  12. This module has been removed in Python 3.0.
  13. The :mod:`macostools` module defines the following functions:
  14. .. function:: copy(src, dst[, createpath[, copytimes]])
  15. Copy file *src* to *dst*. If *createpath* is non-zero the folders leading to
  16. *dst* are created if necessary. The method copies data and resource fork and
  17. some finder information (creator, type, flags) and optionally the creation,
  18. modification and backup times (default is to copy them). Custom icons, comments
  19. and icon position are not copied.
  20. .. function:: copytree(src, dst)
  21. Recursively copy a file tree from *src* to *dst*, creating folders as needed.
  22. *src* and *dst* should be specified as pathnames.
  23. .. function:: mkalias(src, dst)
  24. Create a finder alias *dst* pointing to *src*.
  25. .. function:: touched(dst)
  26. Tell the finder that some bits of finder-information such as creator or type for
  27. file *dst* has changed. The file can be specified by pathname or fsspec. This
  28. call should tell the finder to redraw the files icon.
  29. .. deprecated:: 2.6
  30. The function is a no-op on OS X.
  31. .. data:: BUFSIZ
  32. The buffer size for ``copy``, default 1 megabyte.
  33. Note that the process of creating finder aliases is not specified in the Apple
  34. documentation. Hence, aliases created with :func:`mkalias` could conceivably
  35. have incompatible behaviour in some cases.
  36. :mod:`findertools` --- The :program:`finder`'s Apple Events interface
  37. =====================================================================
  38. .. module:: findertools
  39. :platform: Mac
  40. :synopsis: Wrappers around the finder's Apple Events interface.
  41. .. index:: single: AppleEvents
  42. This module contains routines that give Python programs access to some
  43. functionality provided by the finder. They are implemented as wrappers around
  44. the AppleEvent interface to the finder.
  45. All file and folder parameters can be specified either as full pathnames, or as
  46. :class:`FSRef` or :class:`FSSpec` objects.
  47. The :mod:`findertools` module defines the following functions:
  48. .. function:: launch(file)
  49. Tell the finder to launch *file*. What launching means depends on the file:
  50. applications are started, folders are opened and documents are opened in the
  51. correct application.
  52. .. function:: Print(file)
  53. Tell the finder to print a file. The behaviour is identical to selecting the
  54. file and using the print command in the finder's file menu.
  55. .. function:: copy(file, destdir)
  56. Tell the finder to copy a file or folder *file* to folder *destdir*. The
  57. function returns an :class:`Alias` object pointing to the new file.
  58. .. function:: move(file, destdir)
  59. Tell the finder to move a file or folder *file* to folder *destdir*. The
  60. function returns an :class:`Alias` object pointing to the new file.
  61. .. function:: sleep()
  62. Tell the finder to put the Macintosh to sleep, if your machine supports it.
  63. .. function:: restart()
  64. Tell the finder to perform an orderly restart of the machine.
  65. .. function:: shutdown()
  66. Tell the finder to perform an orderly shutdown of the machine.