vimsheet.ui.formula_bar

Formula bar widget — address, formula/value display, mode indicator.

class vimsheet.ui.formula_bar.FormulaBar(**kwargs)[source]

Bases: Widget

One-line bar: [address] [content …] [mode]

Parameters:

kwargs (object)

DEFAULT_CSS = '\n    FormulaBar {\n        height: 1;\n        background: $surface;\n        color: $text;\n        padding: 0;\n    }\n    FormulaBar Static {\n        height: 1;\n        background: transparent;\n    }\n    '

Default TCSS.

cell_address: reactive[str]

Create a reactive attribute.

Parameters:
  • default – A default value or callable that returns a default.

  • layout – Perform a layout on change.

  • repaint – Perform a repaint on change.

  • init – Call watchers on initialize (post mount).

  • always_update – Call watchers even when the new value equals the old value.

  • recompose – Compose the widget again when the attribute changes.

  • bindings – Refresh bindings when the reactive changes.

  • toggle_class – An optional TCSS classname(s) to toggle based on the truthiness of the value.

formula_text: reactive[str]

Create a reactive attribute.

Parameters:
  • default – A default value or callable that returns a default.

  • layout – Perform a layout on change.

  • repaint – Perform a repaint on change.

  • init – Call watchers on initialize (post mount).

  • always_update – Call watchers even when the new value equals the old value.

  • recompose – Compose the widget again when the attribute changes.

  • bindings – Refresh bindings when the reactive changes.

  • toggle_class – An optional TCSS classname(s) to toggle based on the truthiness of the value.

cursor_pos: reactive[int]

Create a reactive attribute.

Parameters:
  • default – A default value or callable that returns a default.

  • layout – Perform a layout on change.

  • repaint – Perform a repaint on change.

  • init – Call watchers on initialize (post mount).

  • always_update – Call watchers even when the new value equals the old value.

  • recompose – Compose the widget again when the attribute changes.

  • bindings – Refresh bindings when the reactive changes.

  • toggle_class – An optional TCSS classname(s) to toggle based on the truthiness of the value.

mode: reactive[Mode]

Create a reactive attribute.

Parameters:
  • default – A default value or callable that returns a default.

  • layout – Perform a layout on change.

  • repaint – Perform a repaint on change.

  • init – Call watchers on initialize (post mount).

  • always_update – Call watchers even when the new value equals the old value.

  • recompose – Compose the widget again when the attribute changes.

  • bindings – Refresh bindings when the reactive changes.

  • toggle_class – An optional TCSS classname(s) to toggle based on the truthiness of the value.

is_modified: reactive[bool]

Create a reactive attribute.

Parameters:
  • default – A default value or callable that returns a default.

  • layout – Perform a layout on change.

  • repaint – Perform a repaint on change.

  • init – Call watchers on initialize (post mount).

  • always_update – Call watchers even when the new value equals the old value.

  • recompose – Compose the widget again when the attribute changes.

  • bindings – Refresh bindings when the reactive changes.

  • toggle_class – An optional TCSS classname(s) to toggle based on the truthiness of the value.

is_locked: reactive[bool]

Create a reactive attribute.

Parameters:
  • default – A default value or callable that returns a default.

  • layout – Perform a layout on change.

  • repaint – Perform a repaint on change.

  • init – Call watchers on initialize (post mount).

  • always_update – Call watchers even when the new value equals the old value.

  • recompose – Compose the widget again when the attribute changes.

  • bindings – Refresh bindings when the reactive changes.

  • toggle_class – An optional TCSS classname(s) to toggle based on the truthiness of the value.

__init__(**kwargs)[source]

Initialize a Widget.

Parameters:
  • *children – Child widgets.

  • name – The name of the widget.

  • id – The ID of the widget in the DOM.

  • classes – The CSS classes for the widget.

  • disabled – Whether the widget is disabled or not.

  • markup – Enable content markup?

  • kwargs (object)

Return type:

None

set_palette(palette)[source]
Parameters:

palette (GridPalette)

Return type:

None

compose()[source]

Called by Textual to create child widgets.

This method is called when a widget is mounted or by setting recompose=True when calling [refresh()][textual.widget.Widget.refresh].

Note that you don’t typically need to explicitly call this method.

Example

```python def compose(self) -> ComposeResult:

yield Header() yield Label(“Press the button below:”) yield Button() yield Footer()

```

Return type:

Iterable[Widget]

watch_cell_address(_v)[source]
Parameters:

_v (str)

Return type:

None

watch_formula_text(_v)[source]
Parameters:

_v (str)

Return type:

None

watch_cursor_pos(_v)[source]
Parameters:

_v (int)

Return type:

None

watch_mode(_v)[source]
Parameters:

_v (Mode)

Return type:

None

watch_is_modified(_v)[source]
Parameters:

_v (bool)

Return type:

None

watch_is_locked(_v)[source]
Parameters:

_v (bool)

Return type:

None

update_cell(address, formula_or_value, locked=False, cursor_pos=-1)[source]

Convenience: update address and content together.

Parameters:
  • address (str)

  • formula_or_value (str)

  • locked (bool)

  • cursor_pos (int)

Return type:

None

can_focus = False

Widget may receive focus.

can_focus_children = True

Widget’s children may receive focus.