libstp.ui.screens.input ======================= .. py:module:: libstp.ui.screens.input .. autoapi-nested-parse:: Input screens for collecting user data. Classes ------- .. autoapisummary:: libstp.ui.screens.input.NumberInputResult libstp.ui.screens.input.TextInputResult libstp.ui.screens.input.SliderInputResult libstp.ui.screens.input.NumberInputScreen libstp.ui.screens.input.TextInputScreen libstp.ui.screens.input.SliderInputScreen Module Contents --------------- .. py:class:: NumberInputResult Result from NumberInputScreen. .. py:attribute:: value :type: float .. py:attribute:: confirmed :type: bool .. py:class:: TextInputResult Result from TextInputScreen. .. py:attribute:: value :type: str .. py:attribute:: confirmed :type: bool .. py:class:: SliderInputResult Result from SliderInputScreen. .. py:attribute:: value :type: float .. py:attribute:: confirmed :type: bool .. py:class:: NumberInputScreen(title: str = 'Input', prompt: str = 'Enter value:', unit: str = '', initial_value: float = 0, min_value: Optional[float] = None, max_value: Optional[float] = None, label: str = None, default: float = None) Bases: :py:obj:`libstp.ui.screen.UIScreen`\ [\ :py:obj:`NumberInputResult`\ ] Numeric input with touch keypad. Returns NumberInputResult. .. rubric:: Example result = await self.show(NumberInputScreen( "Measurement", "Enter measured distance:", unit="cm", default=30.0 )) if result.confirmed: distance = result.value .. py:attribute:: title :value: 'Input' .. py:attribute:: label :value: 'Enter value:' .. py:attribute:: unit :value: '' .. py:attribute:: value :value: None .. py:attribute:: min_value :value: None .. py:attribute:: max_value :value: None .. py:method:: build() -> libstp.ui.widgets.Widget Build the screen layout. Called on every render. Return a Widget tree describing what to display. .. py:method:: on_key(key: str) :async: .. py:method:: on_adjust(value: float) :async: .. py:method:: on_submit() :async: .. py:method:: on_cancel() :async: .. py:class:: TextInputScreen(title: str = 'Input', prompt: str = 'Enter text:', default: str = '', placeholder: str = '', label: str = None) Bases: :py:obj:`libstp.ui.screen.UIScreen`\ [\ :py:obj:`TextInputResult`\ ] Text input screen. Returns TextInputResult. .. rubric:: Example result = await self.show(TextInputScreen( "Name", "Enter robot name:", default="MyRobot" )) if result.confirmed: name = result.value .. py:attribute:: title :value: 'Input' .. py:attribute:: label :value: 'Enter text:' .. py:attribute:: value :value: '' .. py:attribute:: placeholder :value: '' .. py:method:: build() -> libstp.ui.widgets.Widget Build the screen layout. Called on every render. Return a Widget tree describing what to display. .. py:method:: on_change_value(value: str) :async: .. py:method:: on_submit() :async: .. py:method:: on_cancel() :async: .. py:class:: SliderInputScreen(title: str = 'Input', prompt: str = 'Select value:', min: float = 0, max: float = 100, default: float = None, label: str = None) Bases: :py:obj:`libstp.ui.screen.UIScreen`\ [\ :py:obj:`SliderInputResult`\ ] Slider input screen. Returns SliderInputResult. .. rubric:: Example result = await self.show(SliderInputScreen( "Speed", "Select speed:", min=0, max=100, default=50 )) if result.confirmed: speed = result.value .. py:attribute:: title :value: 'Input' .. py:attribute:: label :value: 'Select value:' .. py:attribute:: min :value: 0 .. py:attribute:: max :value: 100 .. py:attribute:: value :value: None .. py:method:: build() -> libstp.ui.widgets.Widget Build the screen layout. Called on every render. Return a Widget tree describing what to display. .. py:method:: on_slider_change(value: float) :async: .. py:method:: on_change_value(value: float) :async: .. py:method:: on_submit() :async: .. py:method:: on_cancel() :async: