l.a.w.s.SuggestionWidget(LaunchpadRadioWidget) : class documentation

Part of lp.app.widgets.suggestion View In Hierarchy

Known subclasses: lp.app.widgets.suggestion.RecipeOwnerWidget, lp.app.widgets.suggestion.TargetBranchWidget, lp.app.widgets.suggestion.TargetGitRepositoryWidget, lp.app.widgets.tests.test_suggestion.TestSuggestionWidget.ExampleSuggestionWidget

Base class for widgets that suggest values.

Users can pick a suggested value from a radio button list, or use the normal widget to pick any value they could normally pick.

Method __init__ Undocumented
Method hasInput Is there any input for the widget.
Method getInputValue Return the branch defined by the input value.
Method setRenderedValue This widget does not support setting the value.
Method renderItems Render the items for the selector.
Method __call__ Don't render the radio buttons if only one choice.
Class Method _generateSuggestionVocab Generate a vocabulary for the suggestions.
Method _shouldRenderSuggestions Return True if suggestions should be rendered.
Method _optionId Undocumented
Method _otherId Return the id of the "Other" option.
Method _toFieldValue Convert the form value into the target value.
Method _renderLabel Render a label for the option with the specified index.
Method _renderSuggestionLabel Render a label for the option based on a branch.
Static Method _valueDisplayname Return the displayname for a value.

Inherited from LaunchpadRadioWidget:

Method _renderItem Undocumented
Method _div Undocumented
def __init__(self, field, vocabulary, request):
Undocumented
@classmethod
def _generateSuggestionVocab(cls, context, full_vocabulary):
Generate a vocabulary for the suggestions.
ParameterscontextThe context object to generate suggestions for.
full_vocabularyThe vocabulary suggestions may be drawn from. suggestions not present in this vocabulary are ignored.
def _shouldRenderSuggestions(self):
Return True if suggestions should be rendered.
def _optionId(self, index):
Undocumented
def _otherId(self):
Return the id of the "Other" option.
def _toFieldValue(self, form_value):
Convert the form value into the target value.

If there were no radio button options, or 'other' was selected, then get the value from the other_selection widget, otherwise get the object reference from the built up vocabulary.

def hasInput(self):
Is there any input for the widget.

We need to defer the call to the other widget when either there are no terms in the vocabulary or the other radio button was selected.

def getInputValue(self):
Return the branch defined by the input value.
def setRenderedValue(self, value):
This widget does not support setting the value.
def _renderLabel(self, text, index):
Render a label for the option with the specified index.
def _renderSuggestionLabel(self, value, index):
Render a label for the option based on a branch.
@staticmethod
def _valueDisplayname(value):
Return the displayname for a value.
def renderItems(self, value):
Render the items for the selector.
def __call__(self):
Don't render the radio buttons if only one choice.
API Documentation for Launchpad, generated by pydoctor at 2019-12-13 00:00:05.