web/impl/lxml_toolkit_object.py
def init_widget(self):
        """ Initialize the state of the toolkit widget.

        This method is called during the top-down pass, just after the
        'create_widget()' method is called. This method should init the
        state of the widget. The child widgets will not yet be created.

        """
        widget = self.widget
        d = self.declaration

        #: Save ref id
        ref = d.ref
        CACHE[ref] = atomref(self)
        widget.set('ref', ref)

        if d.text:
            self.set_text(d.text)
        if d.tail:
            self.set_tail(d.tail)
        if d.style:
            self.set_style(d.style)
        if d.cls:
            self.set_cls(d.cls)
        if d.attrs:
            self.set_attrs(d.attrs)
        if d.id:
            widget.set('id', d.id)
        if d.draggable:
            self.set_draggable(d.draggable)

        # Set any attributes that may be defined
        for name, member in d.members().items():
            if not member.metadata:
                continue
            meta = member.metadata

            # Exclude any attr tags
            if not (meta.get('d_member') and meta.get('d_final')):
                continue

            # Skip any items with attr=false
            elif not meta.get('attr', True):
                continue

            elif isinstance(member, Event):
                continue
            value = getattr(d, name)
            if value:
                self.set_attribute(name, value)
def init_widget(self):
        """ Initialize the state of the toolkit widget.

        This method is called during the top-down pass, just after the
        'create_widget()' method is called. This method should init the
        state of the widget. The child widgets will not yet be created.

        """
        widget = self.widget
        d = self.declaration

        #: Save ref id
        ref = d.ref
        CACHE[ref] = atomref(self)
        widget.set('ref', ref)

        if d.text:
            self.set_text(d.text)
        if d.tail:
            self.set_tail(d.tail)
        if d.style:
            self.set_style(d.style)
        if d.cls:
            self.set_cls(d.cls)
        if d.attrs:
            self.set_attrs(d.attrs)
        if d.id:
            widget.set('id', d.id)
        if d.draggable:
            self.set_draggable(d.draggable)

        # Set any attributes that may be defined
        for name, member in d.members().items():
            if not member.metadata:
                continue
            meta = member.metadata

            # Exclude any attr tags
            if not (meta.get('d_member') and meta.get('d_final')):
                continue

            # Skip any items with attr=false
            elif not meta.get('attr', True):
                continue

            elif isinstance(member, Event):
                continue
            value = getattr(d, name)
            if value:
                self.set_attribute(name, value)
Initialize the state of the toolkit widget.

        This method is called during the top-down pass, just after the
        'create_widget()' method is called. This method should init the
        state of the widget. The child widgets will not yet be created.