Source

pyobjc / Lib / AppKit / __init__.py

"""
Python mapping for the Cocoa AppKit.

This module does not contain docstrings for the wrapped code, check Apple's
documentation for details on how to use these functions and classes.
"""

import _AppKitSignatures
import objc as _objc

# Import contansts and global functions.
from _AppKit import *

# Load the Cocoa bundle, and gather all classes defined there
if _objc.platform == 'MACOSX':
    _objc.loadBundle(
        "AppKit",
        globals(),
        bundle_identifier=u'com.apple.AppKit',
    )
else:
    _objc.loadBundle(
        "AppKit",
        globals(),
        bundle_path=_objc.pathForFramework(
            u"/System/Library/Frameworks/AppKit.framework",
        ),
    )


# Define useful utility methods here
NSClassForName = _objc.lookUpClass

# The used to be defined here as pure python functions, these aliasses
# are left here for backward compatibility.
from Foundation import NSMakePoint, NSMakeSize, NSMakeRect

import protocols  # no need to export these, just register with PyObjC

# NSView declares, but does not implement this method. This
# additional protocol is needed to ensure that python implementations of
# the method pick up the right signature.
protocols.NSWindowPrinting = _objc.informal_protocol(
    "NSWindowPrinting",
    [
        # - (BOOL)knowsPageRange:(NSRangePointer)range;
        _objc.selector(
            None,
            selector='knowsPageRange:',
            signature='C@:o^{_NSRange=II}',
            isRequired=0,
        ),
    ]
)


#
# (informal) protocols exported for b/w compatibility
#
from protocols import NSAccessibility, NSChangeSpelling, NSColorPickingCustom, \
                      NSColorPickingDefault, NSComboBoxCellDataSource, \
                      NSComboBoxDataSource, NSDraggingDestination, \
                      NSDraggingInfo, NSDraggingSource, \
                      NSIgnoreMisspelledWords, NSInputServerMouseTracker, \
                      NSMenuValidation, NSOutlineViewDelegate, \
                      NSOutlineViewDataSource, NSServicesRequests, \
                      NSTableViewDelegate, NSTableDataSource, NSToolTipOwner, \
                      NSToolbarItemValidation, NSToolbarDelegate, \
                      NSUserInterfaceValidations, \
                      NSValidatedUserInterfaceItem, NSApplicationDelegate, \
                      NSTextViewDelegate
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.