def set_opts(self): for key, val in self.opts.items(): param, tooltip, widget, ptype = val tooltip = tooltip.decode() if ptype == M64TYPE_BOOL: if param: widget.setChecked(param) else: widget.setChecked(False) elif ptype == M64TYPE_INT: widget.setCurrentIndex(widget.findData(param)) elif ptype == M64TYPE_STRING: param = param.decode() if key in ["AnalogDeadzone", "AnalogPeak"]: if param: paramX, paramY = param.split(",") spin1, spin2 = widget spin1.setValue(int(paramX)) spin2.setValue(int(paramY)) spin1.setToolTip(format_tooltip(tooltip)) spin2.setToolTip(format_tooltip(tooltip)) else: widget.setText(param) if key not in ["AnalogDeadzone", "AnalogPeak"] and tooltip: widget.setToolTip(tooltip)
def set_opts(self): for key, val in self.opts.items(): param, tooltip, widget, ptype = val if tooltip: tooltip = tooltip.decode() else: tooltip = "" if ptype == M64TYPE_BOOL: if param: widget.setChecked(param) else: widget.setChecked(False) elif ptype == M64TYPE_INT: widget.setCurrentIndex(widget.findData(param)) elif ptype == M64TYPE_STRING: if key in ["AnalogDeadzone", "AnalogPeak"]: if param: param = param.decode() paramX, paramY = param.split(",") spin1, spin2 = widget spin1.setValue(int(paramX)) spin2.setValue(int(paramY)) spin1.setToolTip(format_tooltip(tooltip)) spin2.setToolTip(format_tooltip(tooltip)) else: widget.setText(param) if key not in ["AnalogDeadzone", "AnalogPeak"] and tooltip: widget.setToolTip(tooltip)