sublime_music.adapters.configure_server_form module

This file contains all of the classes related for a shared server configuration form.

class sublime_music.adapters.configure_server_form.ConfigParamDescriptor(type, description, required=True, helptext=None, advanced=None, default=None, numeric_bounds=None, numeric_step=None, options=None, pathtype=None)[source]

Bases: object

Describes a parameter that can be used to configure an adapter. The description, required and default: should be self-evident as to what they do.

The helptext parameter is optional detailed text that will be shown in a help bubble corresponding to the field.

The type must be one of the following:

  • The literal type str: corresponds to a freeform text entry field in the UI.

  • The literal type bool: corresponds to a toggle in the UI.

  • The literal type int: corresponds to a numeric input in the UI.

  • The literal string "password": corresponds to a password entry field in the UI.

  • The literal string "option": corresponds to dropdown in the UI.

  • The literal type Path: corresponds to a file picker in the UI.

The advanced parameter specifies whether the setting should be behind an “Advanced” expander.

The numeric_bounds parameter only has an effect if the type is int. It specifies the min and max values that the UI control can have.

The numeric_step parameter only has an effect if the type is int. It specifies the step that will be taken using the “+” and “-” buttons on the UI control (if supported).

The options parameter only has an effect if the type is "option". It specifies the list of options that will be available in the dropdown in the UI.

The pathtype parameter only has an effect if the type is Path. It can be either "file" or "directory" corresponding to a file picker and a directory picker, respectively.

Parameters
Return type

None

__init__(type, description, required=True, helptext=None, advanced=None, default=None, numeric_bounds=None, numeric_step=None, options=None, pathtype=None)
Parameters
Return type

None

advanced: Optional[bool] = None
default: Any = None
description: str
helptext: Optional[str] = None
numeric_bounds: Optional[Tuple[int, int]] = None
numeric_step: Optional[int] = None
options: Optional[Iterable[str]] = None
pathtype: Optional[str] = None
required: bool = True
type: Union[Type, str]
class sublime_music.adapters.configure_server_form.ConfigureServerForm(config_store, config_parameters, verify_configuration, is_networked=True)[source]

Bases: gi.overrides.Gtk.Box

Parameters
__init__(config_store, config_parameters, verify_configuration, is_networked=True)[source]

Inititialize a ConfigureServerForm with the given configuration parameters.

Parameters
  • config_store (sublime_music.adapters.adapter_base.ConfigurationStore) – The ConfigurationStore to use to store configuration values for this adapter.

  • config_parameters (Dict[str, sublime_music.adapters.configure_server_form.ConfigParamDescriptor]) – An dictionary where the keys are the name of the configuration paramter and the values are the ConfigParamDescriptor object corresponding to that configuration parameter. The order of the keys in the dictionary correspond to the order that the configuration parameters will be shown in the UI.

  • verify_configuration (Callable[[], Dict[str, Optional[str]]]) –

    A function that verifies whether or not the current state of the config_store is valid. The output should be a dictionary containing verification errors. The keys of the returned dictionary should be the same as the keys passed in via the config_parameters parameter. The values should be strings describing why the corresponding value in the config_store is invalid.

    If the adapter is_networked, and the special "__ping__" key is returned, then the error will be shown below all of the other settings in the ping status box.

  • is_networked (bool) – whether or not the adapter is networked.

had_all_required_keys = False
verifying_in_progress = False