How to use the deform.widget.RadioChoiceWidget function in deform

To help you get started, we’ve selected a few deform examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github VoteIT / voteit.core / voteit / core / plugins / gravatar_profile_image.py View on Github external
)
    except AttributeError:
        default_type = "robohash"
    schema.add(
        colander.SchemaNode(
            colander.String(),
            default=default_type,
            name="gravatar_default_type",
            title=_("Gravatar default type"),
            description=_(
                "gravatar_default_description",
                default="What to use in case users don't have a gravatar image registered. "
                "See: ${url} for more information and examples.",
                mapping={"url": "https://gravatar.com/site/implement/images"},
            ),
            widget=deform.widget.RadioChoiceWidget(values=_GRAVATAR_CHOICES),
        )
github eea / eea.corpus / src / eea.corpus / eea / corpus / processing / noun_chunks.py View on Github external
description = "Find and process noun chunks in text."

    MODES = (
        ('tokenize', 'Tokenize noun chunks in text'),
        ('append', 'Add tokenized noun chunks to text'),
        ('replace', 'Replace all text with found tokenized noun chunks')
    )

    mode = colander.SchemaNode(
        colander.String(),
        validator=colander.OneOf([x[0] for x in MODES]),
        default=MODES[0][0],
        missing=MODES[0][0],
        title="Operating mode",
        widget=deform.widget.RadioChoiceWidget(values=MODES)
    )

    drop_determiners = colander.SchemaNode(
        colander.Bool(),
        default=True,
        missing=False,
        label="Determiners are leading word particles (ex: the)",
        title='Drop determiners',
    )

    min_freq = colander.SchemaNode(
        colander.Int(),
        title="Minimum frequency count",
        description="""Ignore phrases with lower count then given number""",
        default=1,
    )
github wsgicabal / wiseguy / wiseguy / web / app.py View on Github external
@colander.deferred
def deferred_component_widget(node, kw):
    loader = kw['loader']
    components = loader.ep_parser.get_components()
    values = []
    for component_name, component in components:
        title = getattr(component, 'title', component_name)
        values.append((component_name, title))
    return deform.widget.RadioChoiceWidget(values=values)
github VoteIT / voteit.core / voteit / core / widget.py View on Github external
from deform.widget import RadioChoiceWidget


class StarWidget(RadioChoiceWidget):
    #FIXME: the resources for this widget is now hardcoded into main.pt, they should be added through deform resource manager
    #requirements = ( ('jquery.rating', None), )
    template = 'star_choice'
    readonly_template = 'readonly/star_choice'
github eea / eea.corpus / src / eea.corpus / eea / corpus / processing / phrases / schema.py View on Github external
mode = colander.SchemaNode(
        colander.String(),
        validator=colander.OneOf([x[0] for x in MODES]),
        default=MODES[0][0],
        missing=MODES[0][0],
        title="Operating mode",
        widget=deform.widget.RadioChoiceWidget(values=MODES)
    )

    level = colander.SchemaNode(
        colander.Int(),
        default=LEVELS[0][0],
        missing=LEVELS[0][0],
        title='N-gram level',
        widget=deform.widget.RadioChoiceWidget(values=LEVELS),
        description='How many words to include in phrase detection',
    )

    min_count = colander.SchemaNode(
        colander.Int(),
        default=5,
        missing=5,
        title='Minimum number',
        description='Ignore all words with total count lower then this',
    )

    threshold = colander.SchemaNode(
        colander.Float(),
        default=10.0,
        missing=10.0,
        title='Threshold',
github VoteIT / voteit.core / voteit / core / plugins / majority_poll.py View on Github external
title = "#%s - %s" % (prop.get_field_value("aid"), prop.text)
            choices.add((prop.uid, title))
        poll_wf_state = self.context.get_workflow_state()
        if poll_wf_state == "ongoing":
            proposal_title = _("Vote for one")
        else:
            proposal_title = _("You can't change your vote now.")

        class Schema(colander.Schema):
            widget = deform.widget.FormWidget(
                template="form_modal", readonly_template="readonly/form_modal"
            )
            proposal = colander.SchemaNode(
                colander.String(),
                validator=colander.OneOf([x[0] for x in choices]),
                widget=deform.widget.RadioChoiceWidget(values=choices),
                title=proposal_title,
                description="",
            )

        return Schema()
github Kotti / deform_bootstrap / deform_bootstrap / demo / __init__.py View on Github external
def inline_radiochoice(self):
        class Schema(colander.Schema):
            choice = colander.SchemaNode(
                colander.String(),
                widget=deform.widget.RadioChoiceWidget(
                    values=[('a', 'Arrow'),
                            ('b', 'Brick'),
                            ('c', 'Cardamom')],
                    inline=True),
                description='Pick one')
        schema = Schema()
        form = deform.Form(schema, buttons=('submit',))
        return self.render_form(form)
github VoteIT / voteit.core / voteit / core / schemas / layout.py View on Github external
def deferred_ai_layout_right_widget(node, kw):
    request = kw['request']
    choices = _get_choices(request, 'ai_widgets')
    choices.append(('', _(u"")))
    return deform.widget.RadioChoiceWidget(values=choices)