Esempio n. 1
0
    class child(twf.TableLayout):

        hover_help = True

        email_filter = twf.HiddenField()
        id_filter = twf.HiddenField()
        user_Id= twf.TextField(help_text='Enter a user id.', validator=twc.IntValidator(required=True))
        licenses = twf.MultipleSelectField(help_text='Licenses to assign.', options=[], validator=twc.Required)
        license_type = twf.SingleSelectField(help_text='Licenes Type.', value=0, options=[], validator=twc.Required)
        count = twf.SingleSelectField(help_text='Number of licenses.', value=1, options=[(i, i) for i in range(1,6)], validator=twc.Required)
Esempio n. 2
0
 class child(twf.TableLayout):
     id = twf.HiddenField()
     name = twf.TextField()
     status_id = twf.SingleSelectField(
         options=[str(r) for r in Status.query.all()])
     customer_id = twf.SingleSelectField(
         options=[str(r) for r in People.query.all()])
     assignee_id = twf.SingleSelectField(
         options=[str(r) for r in People.query.all()])
     delivery = twf.CheckBox()
     address = twf.TextArea()
Esempio n. 3
0
class EditSample(twf.TableForm):
    IDselected = twf.HiddenField(label_text="ID selected :")
    project = twf.SingleSelectField(
        label_text="Your projects : ",
        help_text="the project which contains your sample is selected")
    name = twf.TextField(label_text="Name :", validator=twc.Required)
    type = twf.SingleSelectField(label_text="Type : ")
    protocole = twf.TextArea(label_text="Protocole :")
    measurements = twf.MultipleSelectField(
        label_text="Attached measurement(s) : ")

    submit = twf.SubmitButton(value="Edit my sample")
Esempio n. 4
0
class NewTrack(twf.TableForm):
    file_upload = twf.FileField(label='Upload : ',
                                help_text='Upload file from filesystem')
    url = twf.TextField(label='Url : ', help_text='Provide an url')
    smapping = twf.HiddenField()
    trackname = twf.TextField(label='Name : ')
    extension = twf.TextField(
        label='Extension : ',
        help_text=
        "Specify the extension of your file if it's not already provided by your file name."
    )
    species = twf.SingleSelectField(label='Species :')
    assembly = twf.SingleSelectField(label='Assembly :', options=[])
    submit = twf.SubmitButton(id="submit", value="New")
Esempio n. 5
0
 class operator(twf.TableLayout):
     uid = twf.SingleSelectField(label="SUNetID",
                                 options=twc.Deferred(user_list),
                                 validator=twc.Any(
                                     twc.StringLengthValidator(min=0,
                                                               max=0),
                                     UserExists()))
Esempio n. 6
0
        class child(twd.HidingTableLayout):
            id = twf.HiddenField()
            name = twf.TextField()
            status_id = twf.SingleSelectField(
                options=[str(r) for r in Status.query.all()])
            customer_id = twf.SingleSelectField(
                options=[str(r) for r in People.query.all()])
            assignee_id = twf.SingleSelectField(
                options=[str(r) for r in People.query.all()])
            delivery = twd.HidingCheckBox(mapping={1: ['address']})
            address = twf.TextArea()

            class items(twd.GrowingGridLayout):
                id = twf.HiddenField()
                order_id = twf.HiddenField()
                code = twf.SingleSelectField(options=['Red', 'Blue', 'Green'])
                description = twf.TextField()
Esempio n. 7
0
 class wisdom(twf.GridLayout):
     extra_reps = 1
     attr_options = [str(x) for x in range(3, 19)]
     wisdom = twf.SingleSelectField(options=attr_options)
     wisdom_modifier = twf.TextField(size=5)
     wroll = twf.Button(
         id="wisdomButton",
         value='Roll',
         attrs={
             'onclick':
             'var val = roll(); document.getElementById("characterform:wisdom:0:wisdom").selectedIndex = (val - 2);document.getElementById("characterform:wisdom:0:wisdom_modifier").value = Math.ceil((val - 11) / 2)'
         })
Esempio n. 8
0
 class dexterity(twf.GridLayout):
     extra_reps = 1
     attr_options = [str(x) for x in range(3, 19)]
     dexterity = twf.SingleSelectField(options=attr_options)
     dexterity_modifier = twf.TextField(size=5)
     droll = twf.Button(
         id="dexterityButton",
         value='Roll',
         attrs={
             'onclick':
             'var val = roll(); document.getElementById("characterform:dexterity:0:dexterity").selectedIndex = (val - 2);document.getElementById("characterform:dexterity:0:dexterity_modifier").value = Math.ceil((val - 11) / 2);document.getElementById("characterform:armor_class").value = 10+Math.ceil((val - 11) / 2)'
         })
Esempio n. 9
0
 class intelligence(twf.GridLayout):
     extra_reps = 1
     attr_options = [str(x) for x in range(3, 19)]
     intelligence = twf.SingleSelectField(options=attr_options)
     intelligence_modifier = twf.TextField(size=5)
     iroll = twf.Button(
         id="intelligenceButton",
         value='Roll',
         attrs={
             'onclick':
             'var val = roll(); document.getElementById("characterform:intelligence:0:intelligence").selectedIndex = (val - 2);document.getElementById("characterform:intelligence:0:intelligence_modifier").value = Math.ceil((val - 11) / 2)'
         })
Esempio n. 10
0
        class child(twf.TableLayout):
            file = twf.FileField(validator=twf.FileValidator(required=True, extention='.html'))
            email = twf.TextField(validator=twc.EmailValidator(required=True))
#            confirm_email = twf.TextField()

            class fred(twf.GridLayout):
                repetitions = 3
                class child(twf.RowLayout):
                    bob = twf.TextField()
                    rob = twf.TextField()
                    validator = twc.MatchValidator('bob', 'rob')

            select = twf.SingleSelectField(options=list(enumerate(opts)), validator=twc.Validator(required=True), item_validator=twc.IntValidator())
Esempio n. 11
0
    class BillInfo(twf.ListFieldSet):
        label = l_("Dati Fatturazione")
        key = 'bill_info'

        company = twf.TextField(css_class="form-control",
                                label=l_("Ragione Sociale"))
        vat = twf.TextField(css_class="form-control", label=l_("Partita IVA"))
        fiscal_code = twf.TextField(css_class="form-control",
                                    label=l_("Codice Fiscale"))
        address = twf.TextField(css_class="form-control",
                                label=l_("Indirizzo"))
        city = twf.TextField(css_class="form-control", label=l_("Città"))
        province = twf.TextField(css_class="form-control",
                                 label=l_("Provincia"))
        zip_code = twf.TextField(css_class="form-control", label=l_("CAP"))
        country = twf.SingleSelectField(
            css_class="form-control",
            prompt_text=None,
            label=l_("Stato"),
            options=twc.Deferred(lambda: [('IT', l_('Stato'))]))
Esempio n. 12
0
        class child(twf.TableLayout):
            id = 'xx'
            a = twd.CalendarDatePicker()
            aa = twd.WriteOnlyTextField(validator=twc.EmailValidator,
                                        value='xx')
            b = twf.CheckBox(validator=twc.Validator(required=True))
            c = twd.LinkContainer(link='x$',
                                  child=twf.SingleSelectField(options=[''] +
                                                              opts))

            class d(twd.GrowingGridLayout):
                value = [{'a': 'aaa', 'b': 'bbb'}]
                a = twf.TextField(validator=twc.EmailValidator)
                b = twf.TextField()

            class e(twd.HidingTableLayout):
                a = twd.HidingSingleSelectField(options=[''] + opts,
                                                mapping={
                                                    'Red': ['b'],
                                                    'Yellow': ['c']
                                                })
                b = twf.TextField(validator=twc.Required)
                c = twf.TextField()
Esempio n. 13
0
    class ShipmentInfo(twf.ListFieldSet):
        label = l_("Dati Spedizione")
        key = 'shipment_info'

        receiver = twf.TextField(validator=twc.Validator(required=True),
                                 css_class="form-control",
                                 label=l_("Destinatario"))
        address = twf.TextField(validator=twc.Validator(required=True),
                                css_class="form-control",
                                label=l_("Indirizzo"))
        city = twf.TextField(validator=twc.Validator(required=True),
                             css_class="form-control",
                             label=l_("Città"))
        province = twf.TextField(validator=twc.Validator(required=True),
                                 css_class="form-control",
                                 label=l_("Provincia"))
        zip_code = twf.TextField(validator=twc.Validator(required=True),
                                 css_class="form-control",
                                 label=l_("CAP"))
        country = twf.SingleSelectField(
            css_class="form-control",
            prompt_text=None,
            label=l_("Stato"),
            options=twc.Deferred(lambda: [('IT', l_('Stato'))]))
Esempio n. 14
0
 class child(twf.TableLayout):
     owner = twf.SingleSelectField(options=twc.Deferred(get_owners), validator=twc.Required)
     name = twf.TextField(validator=twc.All(twc.StringLengthValidator(min=1), ExperimentDoesntExist('owner')))
Esempio n. 15
0
 class child(twf.TableForm):
     action = 'post_edit'
     id = twf.HiddenField()
     owner = twf.SingleSelectField(options=twc.Deferred(get_owners), validator=twc.Required)
     name = twf.TextField(validator=twc.All(twc.StringLengthValidator(min=1), ExperimentDoesntExist('owner')))
     timestamp = twf.LabelField()
Esempio n. 16
0
class NewSequenceForm(twf.ListForm):
    smapping = twf.HiddenField()
    species = twf.SingleSelectField(label='Species : ', options=[])
    assembly = twf.SingleSelectField(label='Assembly :', options=[])
    submit = twf.SubmitButton(id="submit", value="New")
Esempio n. 17
0
 class child(twf.TableForm):
     name = twf.TextField(validator=twc.Required)
     group = twf.SingleSelectField(options=['Red', 'Green', 'Blue'])
     notes = twf.TextArea()
     submit = twf.SubmitButton(value='Go!')
Esempio n. 18
0
    class child(twf.TableLayout):

        hover_help = True

        computer = twf.SingleSelectField(help_text='Select a computer.', options=[], validator=twc.Required)
        license = twf.SingleSelectField(help_text='Select a license to assign.', options=[], validator=twc.Required)
Esempio n. 19
0
class LabChoice(twf.TableForm):
    lab_choice = twf.SingleSelectField(
        id="lab_choice",
        label_text="Choose your lab for the session : ",
        prompt_text=None)
Esempio n. 20
0
    class child(twf.TableForm):
        action = "/characters"
        method = "POST"
        id = twf.HiddenField(size=50)
        name = twf.TextField('name', size=30)
        character_class = twf.SingleSelectField(options=[
            '',
            str(CharClass.Fighter),
            str(CharClass.Cleric),
            str(CharClass.Wizard),
            str(CharClass.Thief)
        ])
        race = twf.SingleSelectField(options=[
            '',
            str(Race.human),
            str(Race.dwarf),
            str(Race.elf),
            str(Race.halfElf)
        ])

        class strength(twf.GridLayout):
            extra_reps = 1
            attr_options = [str(x) for x in range(3, 19)]
            strength = twf.SingleSelectField(options=attr_options)
            strength_modifier = twf.TextField(size=5)
            roll = twf.Button(
                id="strengthButton",
                value='Roll',
                attrs={
                    'onclick':
                    'var val = roll(); document.getElementById("characterform:strength:0:strength").selectedIndex = (val - 2);document.getElementById("characterform:strength:0:strength_modifier").value = Math.ceil((val - 11) / 2)'
                })

        class dexterity(twf.GridLayout):
            extra_reps = 1
            attr_options = [str(x) for x in range(3, 19)]
            dexterity = twf.SingleSelectField(options=attr_options)
            dexterity_modifier = twf.TextField(size=5)
            droll = twf.Button(
                id="dexterityButton",
                value='Roll',
                attrs={
                    'onclick':
                    'var val = roll(); document.getElementById("characterform:dexterity:0:dexterity").selectedIndex = (val - 2);document.getElementById("characterform:dexterity:0:dexterity_modifier").value = Math.ceil((val - 11) / 2);document.getElementById("characterform:armor_class").value = 10+Math.ceil((val - 11) / 2)'
                })

        class constitution(twf.GridLayout):
            extra_reps = 1
            attr_options = [str(x) for x in range(3, 19)]
            constitution = twf.SingleSelectField(options=attr_options)
            constitution_modifier = twf.TextField(size=5)
            croll = twf.Button(
                id="constitutionButton",
                value='Roll',
                attrs={
                    'onclick':
                    'var val = roll(); document.getElementById("characterform:constitution:0:constitution").selectedIndex = (val - 2);document.getElementById("characterform:constitution:0:constitution_modifier").value = Math.ceil((val - 11) / 2)'
                })

        class intelligence(twf.GridLayout):
            extra_reps = 1
            attr_options = [str(x) for x in range(3, 19)]
            intelligence = twf.SingleSelectField(options=attr_options)
            intelligence_modifier = twf.TextField(size=5)
            iroll = twf.Button(
                id="intelligenceButton",
                value='Roll',
                attrs={
                    'onclick':
                    'var val = roll(); document.getElementById("characterform:intelligence:0:intelligence").selectedIndex = (val - 2);document.getElementById("characterform:intelligence:0:intelligence_modifier").value = Math.ceil((val - 11) / 2)'
                })

        class wisdom(twf.GridLayout):
            extra_reps = 1
            attr_options = [str(x) for x in range(3, 19)]
            wisdom = twf.SingleSelectField(options=attr_options)
            wisdom_modifier = twf.TextField(size=5)
            wroll = twf.Button(
                id="wisdomButton",
                value='Roll',
                attrs={
                    'onclick':
                    'var val = roll(); document.getElementById("characterform:wisdom:0:wisdom").selectedIndex = (val - 2);document.getElementById("characterform:wisdom:0:wisdom_modifier").value = Math.ceil((val - 11) / 2)'
                })

        class charisma(twf.GridLayout):
            extra_reps = 1
            attr_options = [str(x) for x in range(3, 19)]
            charisma = twf.SingleSelectField(options=attr_options)
            charisma_modifier = twf.TextField(size=5)
            chroll = twf.Button(
                id="charismaButton",
                value='Roll',
                attrs={
                    'onclick':
                    'var val = roll(); document.getElementById("characterform:charisma:0:charisma").selectedIndex = (val - 2);document.getElementById("characterform:charisma:0:charisma_modifier").value = Math.ceil((val - 11) / 2)'
                })

        armor_class = twf.TextField(size=5)
Esempio n. 21
0
def edit_form(user_lab, owner, id_object):
    '''
    to edit dynamic form
    '''
    lab = DBSession.query(Labs).filter(Labs.name == user_lab).first()
    #static lists
    list_static_samples = [
        twf.HiddenField(id="IDselected", label_text="ID selected :"),
        twf.SingleSelectField(
            id="project",
            label_text="Your projects : ",
            help_text="the project which contains your sample is selected",
            prompt_text=None),
        twf.TextField(id="name", label_text="Name :", validator=twc.Required),
        twf.SingleSelectField(id="type",
                              label_text="Type : ",
                              help_text="What technique do you use ?",
                              prompt_text=None),
        twf.TextArea(
            id="protocole",
            label_text="Protocole :",
        ),
        twf.MultipleSelectField(id="measurements",
                                label_text="Attached measurement(s) : ")
    ]
    list_static_measurements = [
        twf.HiddenField(id="IDselected", label_text="ID selected :"),
        twf.TextField(id="name",
                      label_text="Name :",
                      placeholder="Measurement name...",
                      validator=twc.Required),
        twf.TextArea(id="description", label_text="Description :"),
        twf.MultipleSelectField(
            id="samples",
            label_text="Your samples : ",
            help_text="You can add some of your existing data to this project."
        ),
        twf.CheckBox(
            id="status_type",
            label_text="Privacy : ",
            help_text=
            "Check to have it available from outside EPFL (required for UCSC visualisation)"
        ),
        twf.CheckBox(id="type",
                     label_text="Raw data : ",
                     help_text="Check if raw data"),
        twf.MultipleSelectField(id="parents",
                                label_text="Parents : ",
                                help_text="Parent(s) of this measurement."),
        twf.LabelField(
            id="uploaded",
            help_text=
            "is attached to this measurement. If you want to change, it's better to delete this measurement and create a new one."
        ),
        twf.TextField(
            id="url_path",
            help_text=
            "If you want to add a new URL, your old URL will be stored into the description",
            placeholder="http://www...")
        #twf.CheckBox(id="url_up", label_text="I want to upload the file from this URL : ",
        #help_text="tick it if you want to download it in BioRepo")
    ]

    list_dynamic_samples = []
    list_dynamic_measurements = []
    if lab is None:
        print "----- no dynamic fields detected ---------"
        list_fields = [
            list_static_samples, list_dynamic_samples,
            list_static_measurements, list_dynamic_measurements
        ]
        return list_fields
    else:
        if owner == "sample":
            object_edited = DBSession.query(Samples).filter(
                Samples.id == int(id_object)).first()
            list_dynamic = list_dynamic_samples
            tag = "samples"
        elif owner == "meas":
            object_edited = DBSession.query(Measurements).filter(
                Measurements.id == int(id_object)).first()
            list_dynamic = list_dynamic_measurements
            tag = "measurements"
        else:
            print "----------------- owner error : ", owner, " <----owner --------------------"
            raise

        if object_edited is not None:
            list_dynamic_attributes = object_edited.attributs
            for att in list_dynamic_attributes:
                if att.deprecated == False:
                    twf_type = convert_widget(att.widget)
                    twf_type.id = att.key
                    list_a_values = att.values

                    if att.widget == "textfield" or att.widget == "textarea" or att.widget == "hiding_textfield" or att.widget == "hiding_textarea":
                        for v in list_a_values:
                            if hasattr(v, tag):
                                value_object = getattr(v, tag)
                            if object_edited in value_object:
                                twf_type.value = v.value
                        list_dynamic.append(twf_type)
                    elif att.widget == "checkbox" or att.widget == "hiding_checkbox":
                        for v in list_a_values:
                            if hasattr(v, tag):
                                value_object = getattr(v, tag)
                            if object_edited in value_object:
                                #dynamic boolean are stored in varchar in the db, we have to cast them in boolean for the display
                                value_2_display = check_boolean(v.value)
                                twf_type.value = value_2_display
                        list_dynamic.append(twf_type)
                    elif att.widget == "multipleselectfield" or att.widget == "hiding_multipleselectfield":
                        list_possible_values = []
                        for v in list_a_values:
                            list_possible_values.append(v.value)
                        twf_type.options = list_possible_values
                        selected_values = []
                        for v in list_a_values:
                            if hasattr(v, tag):
                                value_object = getattr(v, tag)
                            if object_edited in value_object:
                                selected_values.append(v.value)
                        twf_type.value = selected_values
                        list_dynamic.append(twf_type)

                    elif att.widget == "singleselectfield" or att.widget == "hiding_singleselectfield":
                        list_possible_values = []
                        for v in list_a_values:
                            if v.value not in list_possible_values:
                                list_possible_values.append(v.value)
                        twf_type.options = list_possible_values
                        for v in list_a_values:
                            if hasattr(v, tag):
                                value_object = getattr(v, tag)
                            if object_edited in value_object:
                                twf_type.value = v.value
                        list_dynamic.append(twf_type)

        else:
            print "Your ", owner, " was not found. ID problem. id :", id_object
            raise

        list_fields = [
            list_static_samples, list_dynamic_samples,
            list_static_measurements, list_dynamic_measurements
        ]
        return list_fields
Esempio n. 22
0
def new_form_parents(user_lab):
    '''for new form with parents'''
    lab = DBSession.query(Labs).filter(Labs.name == user_lab).first()

    #static lists
    list_static_samples = [
        twf.SingleSelectField(id="project",
                              label_text="Your projects : ",
                              help_text="Select project for this sample",
                              prompt_text=None),
        twf.TextField(id="name",
                      label_text="Name :",
                      validator=twc.Validator(required=True)),
        twf.SingleSelectField(id="type",
                              label_text="Type : ",
                              help_text="Technique used",
                              prompt_text=None),
        twf.TextArea(
            id="protocole",
            label_text="Protocole :",
        )
    ]
    list_static_measurements = [
        twf.HiddenField(id="IDselected", label_text="ID selected :"),
        twf.TextField(id="name",
                      label_text="Name :",
                      placeholder="Measurement name...",
                      validator=twc.Validator(required=True)),
        twf.TextArea(id="description", label_text="Description :"),
        twf.MultipleSelectField(
            id="samples",
            label_text="Your samples : ",
            help_text="You can add some of your existing data to this project."
        ),
        twf.CheckBox(
            id="status_type",
            label_text="Privacy : ",
            help_text=
            "Check to have it available from outside EPFL (required for UCSC visualisation)"
        ),
        twf.CheckBox(id="type",
                     label_text="Raw data : ",
                     help_text="Check if raw data"),
        twf.MultipleSelectField(id="parents",
                                label_text="Parents : ",
                                help_text="Parent(s) of this measurement."),
        twd.HidingRadioButtonList(id="upload_way",
                                  label_text='Upload my file via...',
                                  options=('my computer', 'a Vital-IT path',
                                           'a URL'),
                                  mapping={
                                      'my computer': ['upload'],
                                      'a Vital-IT path': ['vitalit_path'],
                                      'a URL': ['url_path', 'url_up'],
                                  }),
        twf.FileField(id="upload", help_text='Please provide a data'),
        twf.TextField(id="vitalit_path",
                      label_text="Scratch path",
                      placeholder="/scratch/el/biorepo/dropbox/"),
        twf.TextField(id="url_path",
                      label_text="File's url",
                      placeholder="http://www..."),
        twf.CheckBox(id="url_up",
                     label_text="I want to upload the file from this URL : ",
                     help_text="tick it if you want to download it in BioRepo")
    ]
    list_dynamic_samples = []
    list_hiding_samples = []
    list_dynamic_measurements = []
    list_hiding_meas = []
    #catch the dynamic hiding fields
    dic_hiding_meas = session.get("hiding_meas", {})
    dic_hiding_samples = session.get("hiding_sample", {})

    if lab is None:
        print "----- no dynamic fields detected ---------"
        list_fields = [
            list_static_samples, list_dynamic_samples,
            list_static_measurements, list_dynamic_measurements
        ]
        return list_fields
    else:
        lab_id = lab.id
        list_attributs = DBSession.query(Attributs).filter(
            Attributs.lab_id == lab_id).all()

        if len(list_attributs) > 0:
            #lists_construction(list_attributs)
            for a in list_attributs:
                attribut_key = a.key
                deprecated = a.deprecated
                fixed_value = a.fixed_value
                widget = a.widget
                owner = a.owner
                #############################
                ######### NEW SAMPLE ########
                #############################
                if owner == "sample":
                    #dynamic
                    if not deprecated and fixed_value:
                        twf_type = convert_widget(widget)
                        twf_type.id = attribut_key
                        if widget == "multipleselectfield" or widget == "singleselectfield":
                            list_values = []
                            list_attributes_values = DBSession.query(
                                Attributs_values).filter(
                                    Attributs_values.attribut_id ==
                                    a.id).all()
                            for av in list_attributes_values:
                                if not av.deprecated and av.value not in list_values:
                                    list_values.append(av.value)
                            twf_type.options = list_values
                            list_dynamic_samples.append(twf_type)

                        elif widget == "checkbox":
                            list_dynamic_samples.append(twf_type)

                        elif widget == "hiding_singleselectfield":
                            list_values = []
                            list_attributes_values = DBSession.query(
                                Attributs_values).filter(
                                    Attributs_values.attribut_id ==
                                    a.id).all()
                            for av in list_attributes_values:
                                if not av.deprecated and av.value not in list_values:
                                    list_values.append(av.value)
                            twf_type.options = list_values
                            list_hiding_samples.append(twf_type)

                        elif widget == "hiding_checkbox":
                            list_hiding_samples.append(twf_type)

                        else:
                            print widget, "-----ERROR----- ELSE, type samples widget in forms.py"
                    elif not deprecated and not fixed_value:
                        twf_type = convert_widget(widget)
                        twf_type.id = attribut_key
                        if widget == "textfield" or widget == "textarea":
                            twf_type.placeholder = "Write here..."
                            list_dynamic_samples.append(twf_type)
                        elif widget == "checkbox":
                            list_dynamic_samples.append(twf_type)
                        elif widget == "hiding_textfield" or widget == "hiding_textarea":
                            twf_type.placeholder = "Write here..."
                            list_hiding_samples.append(twf_type)
                        elif widget == "hiding_checkbox":
                            list_hiding_samples.append(twf_type)
                        else:
                            print widget, "WIDGET SAMPLE NOT FOUND, add an elif please"
                            raise
                    elif deprecated:
                        pass
                    else:
                        print "WIDGET SAMPLES ERROR : widget type is not known --> ", widget
                        raise
                ################################
                ######## NEW MEASUREMENT #######
                ################################
                elif owner == "measurement":
                    #dynamic
                    #for attributes with fixed values
                    if not deprecated and fixed_value:
                        twf_type = convert_widget(widget)
                        twf_type.id = attribut_key
                        if widget == "multipleselectfield" or widget == "singleselectfield":
                            list_values = []
                            list_attributes_values = DBSession.query(
                                Attributs_values).filter(
                                    Attributs_values.attribut_id ==
                                    a.id).all()
                            for av in list_attributes_values:
                                if not av.deprecated and av.value not in list_values:
                                    list_values.append(av.value)
                            twf_type.options = list_values
                            list_dynamic_measurements.append(twf_type)

                        elif widget == "hiding_singleselectfield":
                            list_values = []
                            list_attributes_values = DBSession.query(
                                Attributs_values).filter(
                                    Attributs_values.attribut_id ==
                                    a.id).all()
                            for av in list_attributes_values:
                                if not av.deprecated and av.value not in list_values:
                                    list_values.append(av.value)
                            twf_type.options = list_values
                            list_hiding_meas.append(twf_type)
                        #elif widget == "checkbox":
                        #list_dynamic_measurements.append(twf_type)
                        else:
                            print widget, "-----ERROR----- ELSE, type measurements widget in forms.py"
                            raise

                    #for others attributes
                    elif not deprecated and not fixed_value:
                        twf_type = convert_widget(widget)
                        twf_type.id = attribut_key
                        if widget == "textfield" or widget == "textarea":
                            twf_type.placeholder = "Write here..."
                            list_dynamic_measurements.append(twf_type)
                        elif widget == "checkbox":
                            list_dynamic_measurements.append(twf_type)
                        elif widget == "hiding_textfield" or widget == "hiding_textarea":
                            twf_type.placeholder = "Write here..."
                            list_hiding_meas.append(twf_type)
                        elif widget == "hiding_checkbox":
                            list_hiding_meas.append(twf_type)
                        else:
                            print widget, "WIGDET MEASUREMENT NOT FOUND, add an elif please"
                            raise
                    elif deprecated:
                        pass
                    #in bugs case
                    else:
                        print "WIDGET MEASUREMENTS ERROR : widget type is not known --> ", widget
                        raise
            #TO TEST WITH SEVERAL TWD OBJECTS
            #build dynamic dynamic fields
            #samples
            list_twd_s = []
            for k in dic_hiding_samples:
                twd_object = twd.HidingRadioButtonList()
                twd_object.id = k
                dico_mapping = dic_hiding_samples[k]
                options = []
                for key in dico_mapping.keys():
                    options.append(key)
                twd_object.options = options
                twd_object.mapping = dico_mapping
                list_twd_s.append(twd_object)
            list_dynamic_samples = list_dynamic_samples + list_twd_s + list_hiding_samples

            #measurements
            list_twd_m = []
            for k in dic_hiding_meas:
                twd_object = twd.HidingRadioButtonList()
                twd_object.id = k
                dico_mapping = dic_hiding_meas[k]
                options = []
                for key in dico_mapping.keys():
                    options.append(key)
                twd_object.options = options
                twd_object.mapping = dico_mapping
                list_twd_m.append(twd_object)
            list_dynamic_measurements = list_dynamic_measurements + list_twd_m + list_hiding_meas

            list_fields = [
                list_static_samples, list_dynamic_samples,
                list_static_measurements, list_dynamic_measurements
            ]
            return list_fields

        else:
            print "-----forms.py----- Houston, we have a problem : The lab ", lab.name, " doesn't get any attributes -----"
            raise
Esempio n. 23
0
 class items(twd.GrowingGridLayout):
     id = twf.HiddenField()
     order_id = twf.HiddenField()
     code = twf.SingleSelectField(options=['Red', 'Blue', 'Green'])
     description = twf.TextField()
Esempio n. 24
0
 class Assignments(twd.GrowingGridLayout):
     computer = twf.SingleSelectField(options='display_name',
                                      validator=twc.Required)
     phone_number = twf.TextField()
     personal = twf.CheckBox()
Esempio n. 25
0
class NewProject(twf.TableForm):
    smapping = twf.HiddenField()
    name = twf.TextField(label='Name')
    species = twf.SingleSelectField(label='Species : ')
    assembly = twf.SingleSelectField(label='Assembly :', options=[])
    submit = twf.SubmitButton(id="submit", value="New")
Esempio n. 26
0
class DemoLinkContainer(twd.LinkContainer):
    child = twf.SingleSelectField(options=('', 'www.google.com','www.yahoo.com'))
    link = 'http://$'
Esempio n. 27
0
 class type(twf.ListLayout):
     id = None
     type = twf.SingleSelectField(options=['SAC', 'MSEED'])
     type.value = 'SAC'