Menu Configuration
Data menu configuration for the Daitum UI framework.
This module provides the MenuConfiguration class, which controls the visibility of standard menu items and lets you build a custom data menu from ordered entries (imports, data sources, reports, dividers, and model events).
- Keyword-only arguments:
The
add_*_entrymethods use a bare*in their signatures to mark every argument after it as keyword-only. Arguments before the*(such askeyorevent) may be passed positionally, but options likeicon,prompt_user, andprompt_textmust be passed by name. This keeps call sites self-documenting and prevents options from being passed in the wrong position:menu.add_import_sheet_entry("jobs", icon=Icon.UPLOAD, prompt_user=True) # correct menu.add_import_sheet_entry("jobs", Icon.UPLOAD) # TypeError
- class MenuConfiguration[source]
Bases:
BuildableConfiguration options controlling the visibility of various menu items.
- hide_optimisation
Whether to hide the optimisation menu option.
- hide_import
Whether to hide the main import menu option.
- hide_bulk_import
Whether to hide the bulk-import functionality.
- hide_import_into_sheets
Whether to hide the “import into sheets” functionality.
- data_menu
Custom data menu entries. When any entries are present, only those entries are displayed in the order they were added, superseding hide_import, hide_bulk_import, and hide_import_into_sheets. Other data source and report visibility conditions still apply.
- add_import_sheet_entry(key, *, icon=None, prompt_user=False, prompt_text=None)[source]
Adds an import-into-sheet entry targeting the table identified by key.
- Parameters:
- Return type:
- add_import_entry(*, icon=None, prompt_user=False, prompt_text=None)[source]
Adds a general import entry for the current table.
- Parameters:
- Raises:
ValueError – If an import entry has already been added.
- Return type:
- add_bulk_import_entry(*, icon=None, prompt_user=False, prompt_text=None)[source]
Adds a bulk import entry.
- Parameters:
- Raises:
ValueError – If a bulk import entry has already been added.
- Return type:
- add_data_source_entry(key, *, icon=None, prompt_user=False, prompt_text=None)[source]
Adds a data source entry that runs the data source identified by key.
- add_report_entry(key, *, icon=None, prompt_user=False, prompt_text=None)[source]
Adds a report entry that runs the report identified by key.
- add_divider_entry()[source]
Adds a visual divider between entries in the data menu.
- Return type: