Karana.KUtils.MultibodyTUI.mode
===============================

.. py:module:: Karana.KUtils.MultibodyTUI.mode

.. autoapi-nested-parse::

   Contains ModeCycler, which can be used to cycle through TUI modes.



Attributes
----------

.. autoapisummary::

   Karana.KUtils.MultibodyTUI.mode.T


Classes
-------

.. autoapisummary::

   Karana.KUtils.MultibodyTUI.mode.ModeCycler


Module Contents
---------------

.. py:data:: T

.. py:class:: ModeCycler

   Bases: :py:obj:`Generic`\ [\ :py:obj:`T`\ ]


   Cycles through a finite list of literals representing modes.

   It's somewhat awkward in Python to access the generic type at
   runtime. This class provides an abstraction that handles the gory
   details so that it's straightforward to bind a typing.Literal to
   the generic and use the literal options both in type hints and at
   runtime.

   Should be specialized with a typing.Literal - for example:
       FooBarOptions = typing.Literal["foo", "bar"]
       FooBarCycler = ModeCycler[FooBarOptions]

   Then FooBarCycler is a class that can be instantiated to cycle
   between modes "foo" and "bar".


   .. py:method:: copy() -> Self

      Get a copy of self.



   .. py:method:: __len__() -> int

      Return the number of modes.



   .. py:property:: mode
      :type: T


      The current mode.


   .. py:property:: modes
      :type: list[T]


      The list of available modes.


   .. py:property:: index
      :type: int


      The current index into the mode list.


   .. py:method:: next()

      Change to the next mode in the list.



   .. py:method:: prev()

      Change to the previous mode in the list.



   .. py:method:: reset()

      Reset to the default mode.



