elif b in _TYPESKIPPED: pass # ignore type, width and offsets if opened: raise TypeCodeError('encoding %s: %r' % ('unbalanced', bytes2str(encoding))) if code: # final type code codes.append(_join(code)) return codes __all__ = _exports(locals(), 'PyObjectEncoding', 'TypeCodeError', 'c_void', starts=('CG', 'CF', 'NS', 'ObjC', 'is', 'split_'), ends='_t') if __name__ == '__main__': from utils import _allisting, bytes2repr, _Globals, printf _Globals.argv0 = '' def _c(ctype): return 'c_void' if ctype is c_void else ctype.__name__ printf('%s ...', 'ctype2encoding', nl=1) i = 0 for c, e in sorted((_c(c), e) for c, e in _ctype2encoding.items()):
# kPMStatusFailed = -9784, # connection status failed # kPMCloseFailed = -9785, # close file/connection failed # kPMUnsupportedConnection = -9786, # connection type not supported # kPMIOAttrNotAvailable = -9787, # IO attribute not available on current connection type # kPMReadGotZeroData = -9788, # read got zero bytes, but no error # End of list # kPMLastErrorCodeToMakeMaintenanceOfThisListEasier = -9799 _Types.Paper = Paper _Types.PaperCustom = PaperCustom _Types.PaperMargins = PaperMargins _Types.Printer = Printer # filter locals() for .__init__.py __all__ = _exports(locals(), 'get_libPC', 'get_resolutions', 'libPC', 'Printer', starts=('Paper', 'get_p')) if __name__ == '__main__': for i, p in enumerate(get_printers()): print('%2s %s: ID %r, makemodel %r, URI %r' % (i + 1, p, p.ID, p.makemodel, p.deviceURI)) d = get_printer() if d: print('\ndefault (%s) printer: %s...' % (d.isDefault, d)) for a in ('name', 'ID', 'makemodel', 'isColor', 'location', 'psCapable', 'psLevel', 'isRemote', 'deviceURI', 'deviceDescription', 'description', 'PPD', 'resolution'):
t = '%r of %r' % (w._NSuniqID, w) except KeyError: t = None raise RuntimeError('%s %s %r vs %s' % (ns, '.uniqueID', u, t)) _Types.Window = NSWindow._Type = Window _Types.MediaWindow = MediaWindow _Types.TextWindow = TextWindow # filter locals() for .__init__.py __all__ = _exports(locals(), 'BezelStyle', 'Border', 'MediaWindow', 'ns2Window', 'NSWindowDelegate', 'Screen', 'TextWindow', starts=('AutoResize', 'autoResizes', 'Window', 'window')) if __name__ == '__main__': from utils import _allisting _allisting(__all__, locals(), __version__, __file__) # MIT License <http://OpenSource.org/licenses/MIT> # # Copyright (C) 2017-2019 -- mrJean1 at Gmail dot com #
# ObjCClass.get_instance_method = ObjCClass.get_method # PYCHOK expected # parse_type_encoding = split_encoding # PYCHOK expected # set_instance_variable = set_ivar # PYCHOK expected # unichar = unichar_t # PYCHOK expected # UniChar = UniChar_t # PYCHOK expected # if needed, previous NS...WindowMask names, deprecated ones are marked with D? # NSBorderlessWindowMask = NSWindowStyleMaskBorderless # PYCHOK D? # NSClosableWindowMask = NSWindowStyleMaskClosable # PYCHOK expected # NSFullScreenWindowMask = NSWindowStyleMaskFullScreen # PYCHOK D? # NSFullSizeContentViewWindowMask = NSWindowStyleMaskFullSizeContentView # PYCHOK D? # NSHUDWindowMask? = NSWindowStyleMaskHUDWindow # PYCHOK D? # NSMiniaturizableWindowMask = NSWindowStyleMaskMiniaturizable # PYCHOK expected # NSMiniWindowMask = NSWindowStyleMaskNonactivatingPanel # PYCHOK D? # NSResizableWindowMask = NSWindowStyleMaskResizable # PYCHOK expected # NSTexturedBackgroundWindowMask = NSWindowStyleMaskTexturedBackground # PYCHOK D? # NSTitledWindowMask = NSWindowStyleMaskTitled # PYCHOK D? # NSUtilityWindowMask = NSWindowStyleMaskUtilityWindow # PYCHOK D? # NSUnifiedTitleAndToolbarWindowMask = NSWindowStyleMaskUnifiedTitleAndToolbar # PYCHOK D? # NSUnscaledWindowMask = NSWindowStyleMaskUnscaled # PYCHOK D? XXX # filter locals() for .__init__.py from utils import _exports # PYCHOK expected __all__ = _exports(locals(), not_starts=('_', 'CFUNCTION', 'c_', 'kC')) if __name__ == '__main__': from utils import _allisting # PYCHOK expected _allisting(__all__, locals(), __version__, 'pycocoa')
else: # printf('ns2Type(%r) -> %s', ns.objc_class, type(ns2py(ns))) _Type = ns2py # save the Python Type or ns2py convertor at the NS/Class # to expedite future conversions of such class instances ns.objc_class._Type = _Type return _Type(ns) # filter locals() for .__init__.py __all__ = _exports(locals(), 'at', 'isAlias', 'isLink', 'isNone', starts=('NS', 'ns'), ends='2NS') if __name__ == '__main__': from utils import _allisting _allisting(__all__, locals(), __version__, __file__) # MIT License <http://OpenSource.org/licenses/MIT> # # Copyright (C) 2017-2019 -- mrJean1 at Gmail dot com # # Permission is hereby granted, free of charge, to any person obtaining
@param py: The value (C{Type}). @return: The ObjC instance (L{ObjCInstance}). @raise TypeError: Unhandled, unexpected C{Type}. @see: Function L{py2NS}. ''' try: return py.NS except AttributeError: return py2NS(py) # filter locals() for .__init__.py __all__ = _exports(locals(), ends='2NS') if __name__ == '__main__': from utils import _allisting _allisting(__all__, locals(), __version__, __file__) # MIT License <http://OpenSource.org/licenses/MIT> # # Copyright (C) 2017-2019 -- mrJean1 at Gmail dot com # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense,
def get_superclassnameof(objc, dflt=missing): '''Get the name of the ObjC super-class of an object. @param objc: The object (C{Object} or L{Id_t}). @return: The object'ssuper-class name (C{str}). @raise ValueError: Invalid I{objc}, iff no I{dflt} provided. ''' return get_classname(get_superclassof(objc), dflt=dflt) # filter locals() for .__init__.py __all__ = _exports(locals(), starts='get_') if __name__ == '__main__': from utils import _allisting _allisting(__all__, locals(), __version__, __file__) # MIT License <http://OpenSource.org/licenses/MIT> # # Copyright (C) 2017-2019 -- mrJean1 at Gmail dot com # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense,
def fontTraitstrs(traits): '''Return font traits as names. @param traits: Traits (C{FontTrait}C{s mask}). @return: Tuple of trait names (C{str}s). ''' return tuple(n for n, m in sorted(FontTrait.items()) if traits & m) NSFont._Type = _Types.Font = Font # filter locals() for .__init__.py __all__ = _exports(locals(), starts=('Font', 'font')) if __name__ == '__main__': from utils import _allisting _allisting(__all__, locals(), __version__, __file__) _ = ''' fonts.__all__ = tuple( fonts.Font is <class .Font>, fonts.FontError is <class .FontError>, fonts.fontfamilies is <function .fontfamilies at 0x106b93b18>, fonts.fontnamesof is <function .fontnamesof at 0x106b97488>, fonts.Fonts.App=Font(name='Helvetica', family='Helvetica', size=12, weight=5),