direct: a few improvements to API documentation

This commit is contained in:
rdb 2019-11-02 19:41:11 +01:00
parent b3c79096e5
commit 22e88a5b6a
14 changed files with 71 additions and 19 deletions

View File

@ -117,7 +117,7 @@ class FSM(DirectObject):
at construction time; it is simply in Off already by convention.
If you need to call code in enterOff() to initialize your FSM
properly, call it explicitly in the constructor. Similarly, when
cleanup() is called or the FSM is destructed, the FSM transitions
`cleanup()` is called or the FSM is destructed, the FSM transitions
back to 'Off' by convention. (It does call enterOff() at this
point, but does not call exitOff().)
@ -261,9 +261,9 @@ class FSM(DirectObject):
def demand(self, request, *args):
"""Requests a state transition, by code that does not expect
the request to be denied. If the request is denied, raises a
RequestDenied exception.
`RequestDenied` exception.
Unlike request(), this method allows a new request to be made
Unlike `request()`, this method allows a new request to be made
while the FSM is currently in transition. In this case, the
request is queued up and will be executed when the current
transition finishes. Multiple requests will queue up in
@ -290,7 +290,7 @@ class FSM(DirectObject):
"""Requests a state transition (or other behavior). The
request may be denied by the FSM's filter function. If it is
denied, the filter function may either raise an exception
(RequestDenied), or it may simply return None, without
(`RequestDenied`), or it may simply return None, without
changing the FSM's state.
The request parameter should be a string. The request, along
@ -305,7 +305,7 @@ class FSM(DirectObject):
If the FSM is currently in transition (i.e. in the middle of
executing an enterState or exitState function), an
AlreadyInTransition exception is raised (but see demand(),
`AlreadyInTransition` exception is raised (but see `demand()`,
which will queue these requests up and apply when the
transition is complete)."""
@ -401,7 +401,6 @@ class FSM(DirectObject):
return (request,) + args
return self.defaultFilter(request, args)
def setStateArray(self, stateArray):
"""array of unique states to iterate through"""
self.fsmLock.acquire()
@ -410,7 +409,6 @@ class FSM(DirectObject):
finally:
self.fsmLock.release()
def requestNext(self, *args):
"""Request the 'next' state in the predefined state array."""
self.fsmLock.acquire()

View File

@ -1,4 +1,8 @@
"""This module contains the DirectButton class."""
"""This module contains the DirectButton class.
See the :ref:`directbutton` page in the programming manual for a more
in-depth explanation and an example of how to use this class.
"""
__all__ = ['DirectButton']

View File

@ -1,6 +1,10 @@
"""A DirectCheckButton is a type of button that toggles between two states
when clicked. It also has a separate indicator that can be modified
separately."""
separately.
See the :ref:`directcheckbutton` page in the programming manual for a more
in-depth explanation and an example of how to use this class.
"""
__all__ = ['DirectCheckButton']

View File

@ -1,4 +1,8 @@
"""This module defines various dialog windows for the DirectGUI system."""
"""This module defines various dialog windows for the DirectGUI system.
See the :ref:`directdialog` page in the programming manual for a more
in-depth explanation and an example of how to use this class.
"""
__all__ = [
'findDialog', 'cleanupDialog', 'DirectDialog', 'OkDialog',

View File

@ -1,5 +1,9 @@
"""Contains the DirectEntry class, a type of DirectGUI widget that accepts
text entered using the keyboard."""
text entered using the keyboard.
See the :ref:`directentry` page in the programming manual for a more in-depth
explanation and an example of how to use this class.
"""
__all__ = ['DirectEntry']

View File

@ -11,6 +11,9 @@ A DirectFrame can have:
Each of these has 1 or more states. The same object can be used for
all states or each state can have a different text/geom/image (for
radio button and check button indicators, for example).
See the :ref:`directframe` page in the programming manual for a more in-depth
explanation and an example of how to use this class.
"""
__all__ = ['DirectFrame']

View File

@ -1,4 +1,8 @@
"""Contains the DirectLabel class."""
"""Contains the DirectLabel class.
See the :ref:`directlabel` page in the programming manual for a more in-depth
explanation and an example of how to use this class.
"""
__all__ = ['DirectLabel']

View File

@ -1,4 +1,8 @@
"""Implements a pop-up menu containing multiple clickable options."""
"""Implements a pop-up menu containing multiple clickable options.
See the :ref:`directoptionmenu` page in the programming manual for a more
in-depth explanation and an example of how to use this class.
"""
__all__ = ['DirectOptionMenu']

View File

@ -1,7 +1,11 @@
"""A DirectRadioButton is a type of button that, similar to a
DirectCheckButton, has a separate indicator and can be toggled between
two states. However, only one DirectRadioButton in a group can be enabled
at a particular time."""
at a particular time.
See the :ref:`directradiobutton` page in the programming manual for a more
in-depth explanation and an example of how to use this class.
"""
__all__ = ['DirectRadioButton']

View File

@ -1,4 +1,8 @@
"""Defines the DirectScrollBar class."""
"""Defines the DirectScrollBar class.
See the :ref:`directscrollbar` page in the programming manual for a more
in-depth explanation and an example of how to use this class.
"""
__all__ = ['DirectScrollBar']

View File

@ -1,4 +1,8 @@
"""Contains the DirectScrolledFrame class."""
"""Contains the DirectScrolledFrame class.
See the :ref:`directscrolledframe` page in the programming manual for a more
in-depth explanation and an example of how to use this class.
"""
__all__ = ['DirectScrolledFrame']
@ -82,6 +86,9 @@ class DirectScrolledFrame(DirectFrame):
self.guiItem.setVirtualFrame(f[0], f[1], f[2], f[3])
def getCanvas(self):
"""Returns the NodePath of the virtual canvas. Nodes parented to this
canvas will show inside the scrolled area.
"""
return self.canvas
def setManageScrollBars(self):

View File

@ -1,4 +1,8 @@
"""Contains the DirectScrolledList class."""
"""Contains the DirectScrolledList class.
See the :ref:`directscrolledlist` page in the programming manual for a more
in-depth explanation and an example of how to use this class.
"""
__all__ = ['DirectScrolledListItem', 'DirectScrolledList']

View File

@ -1,4 +1,8 @@
"""Defines the DirectSlider class."""
"""Defines the DirectSlider class.
See the :ref:`directslider` page in the programming manual for a more
in-depth explanation and an example of how to use this class.
"""
__all__ = ['DirectSlider']

View File

@ -1,4 +1,8 @@
"""Contains the DirectWaitBar class, a progress bar widget."""
"""Contains the DirectWaitBar class, a progress bar widget.
See the :ref:`directwaitbar` page in the programming manual for a more
in-depth explanation and an example of how to use this class.
"""
__all__ = ['DirectWaitBar']