diff --git a/omero_vitessce/forms.py b/omero_vitessce/forms.py new file mode 100644 index 0000000..dacc466 --- /dev/null +++ b/omero_vitessce/forms.py @@ -0,0 +1,27 @@ +from django import forms + + +class ConfigForm(forms.Form): + + def __init__(self, file_names, file_urls, + img_names, img_urls, *args, **kwargs): + super(ConfigForm, self).__init__(*args, **kwargs) + + self.text_choices = [i for i in zip(file_urls, file_names)] + self.image_choices = [i for i in zip(img_urls, img_names)] + + self.text_choices.insert(0, ('', '---')) + + # No empty default, we alway want an image in the config + self.fields["image"] = forms.ChoiceField( + choices=self.image_choices, required=True) + + # For other fields it is OK not to have an image + self.image_choices.insert(0, ('', '---')) + + self.fields["segmentation"] = forms.ChoiceField( + choices=self.image_choices, required=False) + self.fields["cell identities"] = forms.ChoiceField( + choices=self.text_choices, required=False) + self.fields["expression"] = forms.ChoiceField( + choices=self.text_choices, required=False) diff --git a/omero_vitessce/templates/omero_vitessce/vitessce_panel.html b/omero_vitessce/templates/omero_vitessce/vitessce_panel.html index 5eddea4..c56893f 100644 --- a/omero_vitessce/templates/omero_vitessce/vitessce_panel.html +++ b/omero_vitessce/templates/omero_vitessce/vitessce_panel.html @@ -8,18 +8,22 @@ {% if json_configs %}
Please select an attached config file from the list below:
+There are no config files attached!
Either attach a config file or click below to autogenerate one:
- +