SelectPageList#

class alfred3.element.input.SelectPageList(scope: str = 'exp', include_self: bool = False, check_jumpto: bool = True, check_jumpfrom: bool = True, show_all_in_scope: bool = True, display_page_name: bool = True, **kwargs)[source]#

Bases: alfred3.element.input.SingleChoiceList

A SingleChoiceList, automatically filled with page names.

Parameters
  • scope – Can be ‘exp’, or a section name. If scope is ‘exp’, all pages in the experiment are listed as choices. If scope is a section name, all pages in that section are listed.

  • include_self – Whether to include the current page in the list, if it is in scope.

  • check_jumpto – If True (default), pages that cannot be jumped to will be marked as disabled options. The evaluation is based on the Section.allow_jumpto attribute of each page’s direct parent section (and only that section).

  • check_jumpfrom – If True, the element will check, if the current page can be left via jump. If not, all pages in the list will be marked as disabled options.

  • show_all_in_scope – If True (default), all pages in the scope will be shown, including those that cannot be jumped to.

  • display_page_name – If True, the page name will be displayed in the select list. Defaults to True.

  • **kwargs

    Inherited keyword arguments

    align

    Horizontal alignment of text in the element. Does not usually apply to labels. Think of it as an alignment that applies to the innermost layer of an element (while labels are generally located at outer layers). See LabelledElement for more on labelled elements. Can be left (default), center, right, or justify.

    debug_value

    Value to be used in debug mode. If None (default), alfred will first try to use the elements ordinary default value. If there is no default value, alfred will read the debug value from the config.conf.

    default

    The default argument of single choice elements is an integer, indicating which choice should be selected by default. Counting of choices starts at 1.

    description

    An additional description of the element. This will show up in the alfred-generated codebook. It has no effect on the display of the experiment, as it only serves as a descriptor for humans.

    font_size

    Font size for text in the element. You can use a keyword or an exact specification. The available keywords are tiny, small, normal, big, and huge. The exact specification shoul ideally include a unit, such as 1rem, or 12pt. If you supply an integer without a unit, a unit of pt will be assumed. Defaults to normal.

    force_input

    If True, users can only progress to the next page if they enter data into this field. Note that a NoValidationSection or similar sections might overrule this setting. A general, experiment-wide setting for force_input can be placed in the config.conf (section general). That setting is used by default and can be overruled here for individual elements. Defaults to False. The experiment-wide default can be changed in config.conf.

    height

    Vertical height of the elements display area. Supply a string with a unit, e.g. 80px. Usually, the default is fine. For adding vertical space to a page, you should prefer the VerticalSpace element, as it is sematically more clear.

    instance_log

    If True, the element will use an instance-specific logger, thereby allowing detailed fine- tuning of its logging behavior.

    layout

    Can be one of the following: 1) An instance of RowLayout, or 2) a tuple of integers, specifying the allocation of horizontal space between leftlab, main element widget and rightlab on small screens upwards. Option 1) offers fine-tuned flexibility, 2) uses a default RowLayout and changes the RowLayout.width_sm attribute. By default, the layout is set automatically depending on the specification of the left and right labels.

    name

    Name of the element. This should be a unique identifier. It will be used to identify the corresponding data in the final data set.

    no_input_hint

    Hint to be displayed if force_input set to True and no user input registered. Defaults to the experiment-wide default value specified in config.conf.

    position

    Horizontal position of the full element on the page. Values can be left, center (default), end, or any valid value for the justify-content flexbox utility. Takes effect only, when the element is not full-width.

    prefix

    Prefix for the input field.

    save_data (bool)

    If False, this element will not save any data to the experiment data and will not appear in the codebook.

    showif

    A dictionary, defining conditions that must be met for the element to be shown. The conditions take the form of key-value pairs, where each key is an element name and the value is the required input. See showif for details.

    suffix

    Suffix for the input field.

    toplab, bottomlab, leftlab, rightlab

    Labels above, below, left and right of the element.

    vertical

    Boolean switch, indicating whether the choices should be listed vertically. Defaults to False, i.e. horizontal display.

    width

    Defines the horizontal width of the element from small screens upwards. It is always full-width on extra small screens. Possible values are narrow, medium, wide, and full. For more detailed control, you can define the element_width attribute.

Notes

This is mostly a utility element for the implementation of JumpList.

Examples

Minimal example:

import alfred3 as al
exp = al.Experiment()

@exp.member
class Demo1(al.Page):
    name = "demo1"

    def on_exp_access(self):
        self += al.SelectPageList(name="select_page")

@exp.member()
class Target(al.Page):
    name = "demo2"

Methods

add_css

Adds CSS to the element.

add_js

Adds Javascript to the element.

added_to_experiment

Tells the element that it was added to an experiment.

added_to_page

If choice labels are element instances, they are added to the page to enable their full functionality.

define_choices

Abstract method for the definition of the individual choices belonging to this element.

prepare_web_widget

Hook for computations for preparing an element's web widget.

render_inner_html

Renders the element template element_template.

set_data

Sets the input data.

validate_data

Method for validation of input to the element.

Attributes

base_template

Base template for the element, which will be used to hold the rendered element template.

bottomlab

Label below of the main element widget.

choice_labels

Stored list of choice labels.

codebook_data

Information about the element in dictionary form.

converted_width

List of bootstrap column widths at different screen sizes.

corrective_hints

Shortcut for accessing the element's corrective hints.

css_class_container

Returns the name the element container's CSS class.

css_class_element

Returns the name of the element's CSS class.

css_code

A list of tuples, which contain a priority and CSS code.

css_urls

A list of tuples, which contain a priority and an url pointing to CSS code.

data

Dictionary of element data.

debug_enabled

Boolean flag, indicating whether debug mode is enabled and default values should be set.

debug_value

Value to be used as a default in debug mode.

default

Default value of this element.

default_no_input_hint

Default hint if subject input is missing in force_entry elements.

description

Detailed description of this element to be added to the automatically generated codebook

disabled

A boolean flag, indicating whether the element is disabled A disabled input element is shown and displays its input value, but subjects cannot enter any data.

display_standalone

If True (default), the element will be displayed as usual on its own.

element_template

The element's specific, inner template.

element_width

Returns a string of column width definitions.

emojize

Switch for turning the interpretation of emoji shortcodes in the choice labels off, if necessary.

exp

The experiment session to which this element belongs.

experiment

Alias for exp

font_size

Font size

force_input

If True, subjects must fill this element to proceed.

hint_manager

A MessageManager, handling the corrective hints for this element.

input

Text of selected choice.

js_code

A list of tuples, which contain a priority and Javascript.

js_urls

A list of tuples, which contain a priority and an url pointing to JavaScript.

labels

Returns the labels in a single, nicely formatted string.

layout

Controls the allocation of horizontal space between the left and right label, as well as the main element.

leftlab

Label to the left of the main element widget.

name

Unique identifier for the element.

no_input_hint

Hint for subjects, if they left a force_input field empty.

page

The page to which this element belongs.

position

Position of the whole element on the page.

prefix

A string or element, serving as prefix.

rightlab

Label to the right of the main element widget.

section

The direct parent section of this element's page.

short_tree

String, giving the exact position in the experiment.

should_be_shown

Boolean, indicating whether the element is meant to be shown.

show_hints

Flag, indicating whether corrective hints regarding this element should be shown.

showif

Conditions that have to be met for the element to be shown.

suffix

A string or element, serving as suffix.

template_data

Dictionary of data to be passed on to jinja templates.

toplab

Label above of the main element widget.

tree

String, giving the exact position in the experiment.

type

Choice type (e.g.

vertical

Attribute defining, whether the element is displayed vertically.

web_widget

The element's rendered html code for display on a page.

width

Element width