dicogis.ui.imposed_settings module

Name: imposed_settings Purpose: Settings an environment variable imposes over options.ini in the GUI.

A DICOGIS_* variable set in the environment imposes its setting: the widget shows its value, locked, says which variable sets it, and the value isn’t saved, options.ini keeping its own for when the variable is unset. Shared by the settings form, the Publish tab and the output format of the main window.

Author: Julien Moura (@geojulien)

dicogis.ui.imposed_settings.get_env_value(env_var)

Read the value an environment variable imposes.

Parameters:

env_var (str) – name of the variable

Return type:

str | None

Returns:

its value, None if it’s unset or blank

dicogis.ui.imposed_settings.get_widget_value(widget)

Read the value of a setting from its widget.

Parameters:

widget (QWidget) – widget holding a setting

Return type:

bool | int | str

Returns:

value of the setting

dicogis.ui.imposed_settings.is_secret(env_var)

Tell whether an environment variable holds a secret, never to show.

Parameters:

env_var (str) – name of the variable

Return type:

bool

Returns:

True for an API key, a password…

dicogis.ui.imposed_settings.mark_imposed(widget, label, env_var)

Lock a setting imposed by an environment variable and tell it, in its label and not only in a tooltip. To call after each translation of the label.

Parameters:
  • widget (QWidget) – widget holding the setting

  • label (QLabel | None) – its label; None for a checkbox, which is its own label

  • env_var (str) – name of the variable imposing it

Return type:

None

dicogis.ui.imposed_settings.set_widget_value(widget, value)

Show a value in a widget, whatever its kind.

Parameters:
  • widget (QWidget) – widget holding a setting

  • value (str | bool | int | float) – value, as read from the environment or options.ini, or typed

Return type:

None