Simple Fields

class pumpia.module_handling.fields.simple.BaseField(initial_value: ValT | Callable[[], ValT], parent: Misc | None = None, *, verbose_name: str | None = None, label_style: str | None = None, entry_style: str | None = None, hidden: bool = False, read_only: bool = False, reset_on_analysis: bool = False)

Base class for fields in modules.

Parameters:
  • initial_value (ValT or Callable[[], ValT]) – The initial value or a callable that returns the initial value.

  • parent (tk.Misc, optional) – The parent widget (default is None).

  • verbose_name (str, optional) – The verbose name of the field (default is None).

  • label_style (str, optional) – The ttk style of the labels linked to this field (default is None).

  • entry_style (str, optional) – The ttk style of the entries linked to this field (default is None).

  • hidden (bool, optional) – Whether the field is hidden in the user interface (default is False).

  • read_only (bool, optional) – Whether the field is read only in the user interface (default is False).

  • reset_on_analysis (bool, optional) – Whether the field is set to the initial value prior to analysis for a module (default is False).

verbose_name
Type:

str | None

value
Type:

ValT

label
Type:

ttk.Label

label_var
Type:

tk.StringVar

value_var
Type:

TkVarT

hidden
Type:

bool

parent
Type:

tk.Misc | None

reset_value()

Resets the field to the initial value.

new_label(parent: tk.Misc) ttk.Label:

Returns a label linked to this field, with text of verbose_name. This is placed in parent, this is not the fields parent.

configure_label_style(**kw):

Use to configure the ttk labels for this field. Passes arguments provided into ttk.Style.configure.

reset_label_style():

Resets label styles to the originally provided one.

new_entry(parent: tk.Misc) ttk.Entry:

Returns an entry linked to this field. This is placed in parent, this is not the fields parent.

configure_entry_style(**kw):

Use to configure the ttk entries for this field. Passes arguments provided into ttk.Style.configure.

WARNING: Base ttk Entry widgets are not very configurable trhough styles, it is therefore recommended to configure the field labels instead using configure_label_style.

reset_entry_style():

Resets entry styles to the originally provided one.

class pumpia.module_handling.fields.simple.OptionField(options_map: dict[str, DictValT], initial: str | Callable[[], str], parent: Misc | None = None, *, verbose_name: str | None = None, label_style=None, entry_style=None, allow_inv_mapping: bool = False, hidden: bool = False, read_only: bool = False, reset_on_analysis: bool = False)

Represents an option field. Has the same attributes and methods as BaseField unless stated below.

Parameters:
  • options_map (dict[str, DictValT]) – A dictionary mapping the options in the dropdown to an object.

  • initial (str or Callable[[], str]) – The initial dropdown value or a callable that returns the initial value.

  • allow_inv_mapping (bool, optional) – Whether to allow inverse mapping from an object to the option (default is False).

class pumpia.module_handling.fields.simple.BoolField(initial_value: bool | Callable[[], bool] = True, parent: Misc | None = None, *, verbose_name: str | None = None, label_style: str | None = None, entry_style: str | None = None, hidden: bool = False, read_only: bool = False, reset_on_analysis: bool = False)

Represents a boolean field. Has the same attributes and methods as BaseField unless stated below.

class pumpia.module_handling.fields.simple.StringField(initial_value: str | Callable[[], str] = '', parent: Misc | None = None, *, verbose_name: str | None = None, label_style: str | None = None, entry_style: str | None = None, hidden: bool = False, read_only: bool = False, reset_on_analysis: bool = False)

Represents a string field. Has the same attributes and methods as BaseField unless stated below.

class pumpia.module_handling.fields.simple.IntField(initial_value: int | Callable[[], int] = 0, parent: Misc | None = None, *, verbose_name: str | None = None, label_style: str | None = None, entry_style: str | None = None, hidden: bool = False, read_only: bool = False, reset_on_analysis: bool = False)

Represents an integer field. Has the same attributes and methods as BaseField unless stated below.

class pumpia.module_handling.fields.simple.PercField(initial_value: float | Callable[[], float] = 0, parent: Misc | None = None, *, verbose_name: str | None = None, label_style: str | None = None, entry_style: str | None = None, hidden: bool = False, read_only: bool = False, reset_on_analysis: bool = False)

Represents a percentage field. Has the same attributes and methods as BaseField unless stated below.

class pumpia.module_handling.fields.simple.FloatField(initial_value: float | Callable[[], float] = 0, parent: Misc | None = None, *, verbose_name: str | None = None, label_style: str | None = None, entry_style: str | None = None, hidden: bool = False, read_only: bool = False, reset_on_analysis: bool = False)

Represents a float field. Has the same attributes and methods as BaseField unless stated below.

class pumpia.module_handling.fields.simple.DateField(initial_value: Callable[[], ~datetime.date]=<built-in method today of type object>, parent: Misc | None = None, *, verbose_name: str | None = None, label_style: str | None = None, entry_style: str | None = None, hidden: bool = False, read_only: bool = False, reset_on_analysis: bool = False)

Represents a date field. Has the same attributes and methods as BaseField unless stated below.