Stub the parts of PyObjC I'm using (whee)

This commit is contained in:
Danielle McLean 2023-11-27 16:52:17 +11:00
parent 5a3ddd570d
commit 73972cd17e
Signed by: 00dani
GPG key ID: 52C059C3B22A753E
3 changed files with 106 additions and 0 deletions

33
stubs/AppKit/__init__.pyi Normal file
View file

@ -0,0 +1,33 @@
from typing import Final, Literal
from Foundation import CGSize
# There are many other operations available but we only actually use copy, so we don't need all of them here.
NSCompositingOperationClear: Final = 0
NSCompositingOperationCopy: Final = 1
NSCompositingOperation = Literal[0, 1]
class NSRect:
pass
def NSMakeRect(x: float, y: float, w: float, h: float) -> NSRect: ...
class NSImage:
@staticmethod
def alloc() -> type[NSImage]: ...
@staticmethod
def initByReferencingFile_(file: str) -> NSImage: ...
@staticmethod
def initWithData_(data: bytes) -> NSImage: ...
@staticmethod
def initWithSize_(size: CGSize) -> NSImage: ...
def size(self) -> CGSize: ...
def lockFocus(self) -> None: ...
def unlockFocus(self) -> None: ...
def drawInRect_fromRect_operation_fraction_(self, inRect: NSRect, fromRect: NSRect, operation: NSCompositingOperation, fraction: float) -> None: ...