Skip to content

Commit

Permalink
direct-stubs: Add deprecation notes
Browse files Browse the repository at this point in the history
  • Loading branch information
WMOkiishi committed Jan 4, 2024
1 parent d04c1c0 commit 423720d
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/direct-stubs/actor/Actor.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ __all__ = ['Actor']
from _typeshed import StrOrBytesPath
from collections.abc import Iterable, Mapping
from typing import ClassVar, SupportsFloat
from typing_extensions import Literal, TypeAlias
from typing_extensions import Literal, TypeAlias, deprecated

from direct.directnotify.Notifier import Notifier
from direct.interval.ActorInterval import ActorInterval
Expand Down Expand Up @@ -199,7 +199,9 @@ class Actor(DirectObject, NodePath):
blendType: _BlendType | None = None,
partName: str | None = None,
) -> None: ...
@deprecated('This method is deprecated. You should use setBlend() instead.')
def enable_blend(self, blendType: _BlendType = 1, partName: str | None = None) -> None: ...
@deprecated('This method is deprecated. You should use setBlend() instead.')
def disable_blend(self, partName: str | None = None) -> None: ...
def set_control_effect(
self, animName: str, effect: float, partName: str | None = None, lodName: str | None = None
Expand Down
11 changes: 10 additions & 1 deletion src/direct-stubs/gui/OnscreenText.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
__all__ = ['BlackOnWhite', 'NameConfirm', 'OnscreenText', 'Plain', 'ScreenPrompt', 'ScreenTitle']

from typing import Any, overload
from typing_extensions import Final, Literal, TypeAlias
from typing_extensions import Final, Literal, TypeAlias, deprecated

from direct._typing import Unused
from panda3d._typing import Vec4Like
Expand Down Expand Up @@ -70,31 +70,40 @@ class OnscreenText(NodePath[TextNode]):
def appendText(self, text: str) -> None: ...
def getText(self) -> str: ...
def setTextX(self, x: float) -> None: ...
@deprecated('Use `.setTextX()` method instead.')
def setX(self, x: float) -> None: ... # type: ignore[override]
def setTextY(self, y: float) -> None: ...
@deprecated('Use `.setTextY()` method instead.')
def setY(self, y: float) -> None: ... # type: ignore[override]
@overload
def setTextPos(self, x: float, y: float) -> None: ...
@overload
def setTextPos(self, x: _OrderedPair, y: None = None) -> None: ...
def getTextPos(self) -> _OrderedPair: ...
@deprecated('Use `.setTextPos()` method or `.text_pos` property instead.')
def setPos(self, x: float, y: float) -> None: ... # type: ignore[override]
@deprecated('Use `.getTextPos()` method or `.text_pos` property instead.')
def getPos(self) -> _OrderedPair: ... # type: ignore[override]
@property
def pos(self) -> _OrderedPair: ...
def setTextR(self, r: float) -> None: ...
def getTextR(self) -> float: ...
@deprecated('Use ``setTextR(-roll)`` instead (note the negated sign).')
def setRoll(self, roll: float) -> None: ...
@deprecated('Use ``-getTextR()`` instead (note the negated sign).')
def getRoll(self) -> float: ...
@overload
def setTextScale(self, sx: float | _OrderedPair, sy: None = None) -> None: ...
@overload
def setTextScale(self, sx: float, sy: float) -> None: ...
def getTextScale(self) -> _OrderedPair: ...
@overload # type: ignore[override]
@deprecated('Use `.setTextScale()` method or `.text_scale` property instead.')
def setScale(self, sx: float | _OrderedPair, sy: None = None) -> None: ...
@overload
@deprecated('Use `.setTextScale()` method or `.text_scale` property instead.')
def setScale(self, sx: float, sy: float) -> None: ...
@deprecated('Use `.getTextScale()` method or `.text_scale` property instead.')
def getScale(self) -> _OrderedPair: ... # type: ignore[override]
def updateTransformMat(self) -> None: ...
def setWordwrap(self, wordwrap: float) -> None: ...
Expand Down
2 changes: 2 additions & 0 deletions src/direct-stubs/particles/ForceGroup.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from _typeshed import SupportsWrite
from typing import ClassVar
from typing_extensions import deprecated

from direct.directnotify.Notifier import Notifier
from direct.showbase.DirectObject import DirectObject
Expand All @@ -23,6 +24,7 @@ class ForceGroup(DirectObject):
def is_enabled(self) -> bool: ...
def addForce(self, force: BaseForce) -> None: ...
def removeForce(self, force: BaseForce) -> None: ...
@deprecated('Deprecated: access .name directly instead.')
def getName(self) -> str: ...
def get_node(self) -> ForceGroup: ...
def get_node_path(self) -> NodePath[ForceNode]: ...
Expand Down
6 changes: 6 additions & 0 deletions src/direct-stubs/showbase/DConfig.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
__all__: list[str] = []

from typing_extensions import deprecated

@deprecated('')
def GetBool(sym: str, default: bool = False) -> bool: ...
@deprecated('')
def GetInt(sym: str, default: int = 0) -> int: ...
@deprecated('')
def GetDouble(sym: str, default: float = 0.0) -> float: ...
@deprecated('')
def GetString(sym: str, default: str = '') -> str: ...

GetFloat = GetDouble
7 changes: 6 additions & 1 deletion src/direct-stubs/showbase/Loader.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ __all__ = ['Loader']
from _typeshed import StrOrBytesPath
from collections.abc import Callable, Collection, Iterable, Sequence
from typing import Any, ClassVar, overload
from typing_extensions import Literal, Self, TypeAlias
from typing_extensions import Literal, Self, TypeAlias, deprecated

from direct.directnotify.Notifier import Notifier
from panda3d import core
Expand Down Expand Up @@ -205,10 +205,15 @@ class Loader(DirectObject):
priority: int | None,
blocking: Literal[False],
) -> _Callback: ...
@deprecated('This is now deprecated: call cb.cancel() instead.')
def cancelRequest(self, cb: _Callback) -> None: ...
@deprecated('This is now deprecated: call cb.cancel() instead.')
def isRequestPending(self, cb: _Callback) -> bool: ...
@deprecated('loader.loadModelOnce() is deprecated; use loader.loadModel() instead.')
def loadModelOnce(self, modelPath: str) -> NodePath | None: ...
@deprecated('loader.loadModelCopy() is deprecated; use loader.loadModel() instead.')
def loadModelCopy(self, modelPath: str, loaderOptions: LoaderOptions | None = None) -> NodePath | None: ...
@deprecated('loader.loadModelNode() is deprecated; use loader.loadModel() instead.')
def loadModelNode(self, modelPath: str) -> PandaNode | None: ...
def unload_model(self, model: NodePath | ModelNode | Filename | str) -> None: ...
@overload
Expand Down
4 changes: 3 additions & 1 deletion src/direct-stubs/showbase/ShowBase.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ from _typeshed import StrOrBytesPath
from collections.abc import Callable
from types import ModuleType
from typing import Any, ClassVar, overload
from typing_extensions import Literal, TypeAlias
from typing_extensions import Literal, TypeAlias, deprecated

from direct._typing import Unused
from direct.directnotify.Notifier import Notifier
Expand Down Expand Up @@ -339,7 +339,9 @@ class ShowBase(DirectObject):
def enable_sound_effects(self, bEnableSoundEffects: bool) -> None: ...
def disable_all_audio(self) -> None: ...
def enable_all_audio(self) -> None: ...
@deprecated('Use `.Loader.Loader.loadSfx()` instead.')
def loadSfx(self, name: StrOrBytesPath) -> Any: ...
@deprecated('Use `.Loader.Loader.loadMusic()` instead.')
def loadMusic(self, name: StrOrBytesPath) -> Any: ...
def playSfx(
self,
Expand Down
2 changes: 2 additions & 0 deletions src/direct-stubs/showbase/ShowBaseGlobal.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
__all__: list[str] = []

from typing import TypeVar
from typing_extensions import deprecated

from direct.tkpanels.Inspector import InspectorWindow
from panda3d.core import (
Expand Down Expand Up @@ -31,5 +32,6 @@ aspect2d: NodePath[PGTop]
hidden: NodePath[PandaNode]
base: ShowBase # only exists once an instance of ShowBase is created

@deprecated('run() is deprecated, use base.run() instead')
def run() -> None: ...
def inspect(anObject: _T) -> InspectorWindow[_T]: ...

0 comments on commit 423720d

Please sign in to comment.