def connect_value(client, prop, widget, value_range=None, log=False):

    if log:
        if value_range is None:
            raise ValueError("log option can only be set if value_range is given")
        else:
            value_range = math.log10(value_range[0]), math.log10(value_range[1])

    def update_prop():
        val = widget.value()
        if value_range is not None:
            imin, imax = widget.minimum(), widget.maximum()
            val = (val - imin) / (imax - imin) * (value_range[1] - value_range[0]) + value_range[0]
        if log:
            val = 10 ** val
        setattr(client, prop, val)

    def update_widget(val):
        if val is None:
            widget.setValue(0)
            return
        if log:
            val = math.log10(val)
        if value_range is not None:
            imin, imax = widget.minimum(), widget.maximum()
            val = (val - value_range[0]) / (value_range[1] - value_range[0]) * (imax - imin) + imin
        widget.setValue(val)

    add_callback(client, prop, update_widget)
    widget.valueChanged.connect(update_prop)
    update_widget(getattr(client, prop))
Shutdown connection to server.
dataset/ETHPy150Open glue-viz/glue/glue/utils/qt/widget_properties.py/connect_value--crossover with--dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/imaplib.py/IMAP4.logout