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
anddefault:
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 thetype
is int. It specifies the min and max values that the UI control can have.The
numeric_step
parameter only has an effect if thetype
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 thetype
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 thetype
isPath
. 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
- default: Any = None
- class sublime_music.adapters.configure_server_form.ConfigureServerForm(config_store, config_parameters, verify_configuration, is_networked=True)[source]
Bases:
gi.overrides.Gtk.Box
- Parameters
config_store (sublime_music.adapters.adapter_base.ConfigurationStore) –
config_parameters (Dict[str, sublime_music.adapters.configure_server_form.ConfigParamDescriptor]) –
verify_configuration (Callable[[], Dict[str, Optional[str]]]) –
is_networked (bool) –
- __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 theconfig_parameters
parameter. The values should be strings describing why the corresponding value in theconfig_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