Sets widget from code string

        Parameters
        ----------
        code: String
        \tCode representation of widget value
336185
def set_code(self, code):
        

        for i, (_, style_code) in enumerate(self.styles):
            if code == style_code:
                self.SetSelection(i)
655197
def _widget_from_p(self, pname, ptype):
        """"""

        widget_name = self.type2widget[ptype].__name__.lower()
        widget_name = "_".join([widget_name, pname])
        return getattr(self, widget_name)
570167
def add_codedValue(self, name, code):
        
        if self._codedValues is None:
            self._codedValues = []
        self._codedValues.append(
            {"name": name, "code": code}
        )
239850
@Override
    public void setBlockedDestinationCode(Integer code) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setBlockedDestinationCode", code);

        updateProperty(JmsInternalConstants.BLOCKED_DESTINATION, code);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setBlockedDestinationCode");
    }
1078605
def from_code(cls, co):
        """"""
        co_code = co.co_code
        labels = dict((addr, Label()) for addr in findlabels(co_code))
        linestarts = dict(cls._findlinestarts(co))
        cellfree = co.co_cellvars + co.co_freevars

        code = CodeList()
        n = len(co_code)
        i = 0
        extended_arg = 0
        while i < n:
            op = Opcode(ord(co_code[i]))
            if i in labels:
                code.append((labels[i], None))
            if i in linestarts:
                code.append((SetLineno, linestarts[i]))
            i += 1
            if op in hascode:
                lastop, lastarg = code[-1]
                if lastop != LOAD_CONST:
                    raise ValueError(
                        "%s should be preceded by LOAD_CONST code" % op)
                code[-1] = (LOAD_CONST, Code.from_code(lastarg))
            if op not in hasarg:
                code.append((op, None))
            else:
                arg = ord(co_code[i]) + ord(co_code[i+1])*256 + extended_arg
                extended_arg = 0
                i += 2
                if op == opcode.EXTENDED_ARG:
                    extended_arg = arg << 16
                elif op in hasconst:
                    code.append((op, co.co_consts[arg]))
                elif op in hasname:
                    code.append((op, co.co_names[arg]))
                elif op in hasjabs:
                    code.append((op, labels[arg]))
                elif op in hasjrel:
                    code.append((op, labels[i + arg]))
                elif op in haslocal:
                    code.append((op, co.co_varnames[arg]))
                elif op in hascompare:
                    code.append((op, cmp_op[arg]))
                elif op in hasfree:
                    code.append((op, cellfree[arg]))
                else:
                    code.append((op, arg))

        varargs = bool(co.co_flags & CO_VARARGS)
        varkwargs = bool(co.co_flags & CO_VARKEYWORDS)
        newlocals = bool(co.co_flags & CO_NEWLOCALS)
        args = co.co_varnames[:co.co_argcount + varargs + varkwargs]
        if co.co_consts and isinstance(co.co_consts[0], basestring):
            docstring = co.co_consts[0]
        else:
            docstring = None
        return cls(code = code,
                   freevars = co.co_freevars,
                   args = args,
                   varargs = varargs,
                   varkwargs = varkwargs,
                   newlocals = newlocals,
                   name = co.co_name,
                   filename = co.co_filename,
                   firstlineno = co.co_firstlineno,
                   docstring = docstring,
                   )
604960
def widget_from_single_value(o):
        """"""
        if isinstance(o, string_types):
            return Text(value=unicode_type(o))
        elif isinstance(o, bool):
            return Checkbox(value=o)
        elif isinstance(o, Integral):
            min, max, value = _get_min_max_value(None, None, o)
            return IntSlider(value=o, min=min, max=max)
        elif isinstance(o, Real):
            min, max, value = _get_min_max_value(None, None, o)
            return FloatSlider(value=o, min=min, max=max)
        else:
            return None
161887
function (code, items) {
        var langData = data[code];

        if (!langData) {
          data[code] = langData = {};
        }

        for (var name in items) {
          langData[name] = items[name];
        }

        this.setCode(code);
      }
463251
def set_code(self, code):
        """"""

        # Get attributes from code

        attributes = []
        strip = lambda s: s.strip('u').strip("'").strip('"')
        for attr_dict in parse_dict_strings(unicode(code).strip()[19:-1]):
            attrs = list(strip(s) for s in parse_dict_strings(attr_dict[1:-1]))
            attributes.append(dict(zip(attrs[::2], attrs[1::2])))

        if not attributes:
            return

        # Set widgets from attributes
        # ---------------------------

        # Figure attributes
        figure_attributes = attributes[0]

        for key, widget in self.figure_attributes_panel:
            try:
                obj = figure_attributes[key]
                kwargs_key = key + "_kwargs"
                if kwargs_key in figure_attributes:
                    widget.set_kwargs(figure_attributes[kwargs_key])

            except KeyError:
                obj = ""

            widget.code = charts.object2code(key, obj)

        # Series attributes
        self.all_series_panel.update(attributes[1:])
531876
def set_widgets(self):
        """"""
        self.clear()
        existing_inasafe_field = self.parent.get_existing_keyword(
            'inasafe_fields')
        existing_inasafe_default_values = self.parent.get_existing_keyword(
            'inasafe_default_values')
        # Remove old container and parameter
        if self.parameter_container:
            self.kwExtraKeywordsGridLayout.removeWidget(
                self.parameter_container)
        if self.parameters:
            self.parameters = []

        # Iterate through all inasafe fields
        # existing_inasafe_default_values

        for inasafe_field in self.inasafe_fields_for_the_layer():
            # Option for Not Available
            option_list = [no_field]
            for field in self.parent.layer.fields():
                # Check the field type
                if isinstance(inasafe_field['type'], list):
                    if field.type() in inasafe_field['type']:
                        field_name = field.name()
                        option_list.append('%s' % field_name)
                else:
                    if field.type() == inasafe_field['type']:
                        field_name = field.name()
                        option_list.append('%s' % field_name)

            # Create DefaultSelectParameter
            parameter = DefaultSelectParameter()
            parameter.guid = inasafe_field['key']
            parameter.name = inasafe_field['name']
            parameter.is_required = False
            parameter.description = inasafe_field['description']
            parameter.help_text = inasafe_field['help_text']
            parameter.element_type = str
            parameter.options_list = option_list
            parameter.value = no_field
            parameter.default_labels = get_inasafe_default_value_fields(
                self.parent.setting, inasafe_field['key'])[0]
            parameter.default_values = get_inasafe_default_value_fields(
                self.parent.setting, inasafe_field['key'])[1]
            parameter.minimum = inasafe_field['default_value'].get(
                'min_value')
            parameter.maximum = inasafe_field['default_value'].get(
                'max_value')
            # Check if there is already value in the metadata.
            if existing_inasafe_field:
                existing_value = existing_inasafe_field.get(
                    inasafe_field['key'])
                if existing_value:
                    if existing_value in parameter.options_list:
                        parameter.value = existing_value

            if existing_inasafe_default_values:
                existing_default_value = existing_inasafe_default_values.get(
                    inasafe_field['key'])
                if existing_default_value:
                    parameter.default = existing_default_value

            self.parameters.append(parameter)

        # Create the parameter container and add to the wizard.
        self.parameter_container = ParameterContainer(
            self.parameters, extra_parameters=self.extra_parameters)
        self.parameter_container.setup_ui()
        self.kwExtraKeywordsGridLayout.addWidget(self.parameter_container)
        # Add Message label
        self.kwExtraKeywordsGridLayout.addWidget(self.message_label)

        # Set default value to None
        for parameter_widget in self.parameter_container.\
                get_parameter_widgets():
            parameter_widget.widget().set_default(None)
            # Set selected radio button to 'Do not report'
            parameter_widget.widget().set_selected_radio_button()
        # Set default value from existing keywords
        if existing_inasafe_default_values:
            for guid, default in list(existing_inasafe_default_values.items()):
                parameter_widget = self.parameter_container.\
                    get_parameter_widget_by_guid(guid)
                if isinstance(parameter_widget, DefaultSelectParameterWidget):
                    parameter_widget.set_default(default)
                    # Set selected radio button to 'Do not report'
                    parameter_widget.set_selected_radio_button()
1037819
function (cfg, ctxt, lineNumber) {
        var controller = new ariaWidgetsControllersDateController();
        this.$TextInput.constructor.call(this, cfg, ctxt, lineNumber, controller);
        controller.setPattern(cfg.pattern);
        if (cfg.minValue) {
            controller.setMinValue(new Date(cfg.minValue));
        }
        if (cfg.maxValue) {
            controller.setMaxValue(new Date(cfg.maxValue));
        }
        if (cfg.referenceDate) {
            controller.setReferenceDate(new Date(cfg.referenceDate));
        }
    }
1344889
public void setCode(final String code) {
        if (isAttached()) {
            setCode(getElement(), code);
        } else {
            getElement().setInnerHTML(code);
        }
    }
155738
def _write_widget(self, val):
        """"""
        self._itsme = True
        try:
            setter = self._wid_info[self._wid][1]
            wtype = self._wid_info[self._wid][2]
            if setter:
                if wtype is not None:
                    setter(self._wid, self._cast_value(val, wtype))
                else:
                    setter(self._wid, val)
        finally:
            self._itsme = False
372479
function overwriteValueWithCode($code)
    {
        $this->replacedState = self::VALUE_REPLACED;
        $this->phpVariable = null;
        $this->setPHPCode($code);
    }
1362549
@Override
    public void setValue(Object value) throws WidgetException {
        try {
            if (value instanceof String) {
                Select select = new Select(getByLocator());
                select.selectOption((String) value);
            } else {
                throw new WidgetRuntimeException("value must be a String type", getByLocator());
            }
        } catch (Exception e) {
            throw new WidgetException("Error while seleting option on drop down", getByLocator(), e);
        }
    }
1246697
public function setCode($code) {
        $this->code = trim($code);
        $this->codeLength = strlen($this->code);
        return $this;
    }
730046
def get_code(self, code):
        
        # code= [code] if isinstance(code,str) else
        return self.new(self.data.loc[(slice(None), code), :])
782472
public void setCode(String timecode) throws Timecode.TimecodeException {
    clear();
    setHours(getToken(timecode, 0));
    setMinutes(getToken(timecode, 1));
    setSeconds(getToken(timecode, 2));
    setFrames(getToken(timecode, 3));
    if (useSamples()) {
      try {
        setSamples(getToken(timecode, 4));
        // If we got here, we're parsing a AES31-formatted string... Set our
        // frames per sec to 30 instead of 75
        setFramesPerSecond(30);
      } catch (Timecode.TimecodeException ignored) {
      } // If this fails, it just means the code didn't have samples appended
    }
    // fix badly formed values : 00:00:60:00 will become 00:01:00:00, etc.
    normalize();
  }