diff --git a/Release_Notes.md b/Release_Notes.md index 075f5296..db55bcd4 100644 --- a/Release_Notes.md +++ b/Release_Notes.md @@ -1,5 +1,11 @@ # LGR-Toolset Release notes +## 1.8.1 (2017-11-15) +Fixes: + - Remove script/mimetype from merged description when all descriptions use the text/html mimetype. + - Fix cross-script variants tool: output variants composed of code point which are in other scripts + than the one(s) defined in the LGR. + ## 1.8 (2017-10-18) Fixes: - Merge LGR containing the same code point. diff --git a/etc/requirements.txt b/etc/requirements.txt index f3a6107f..af700164 100644 --- a/etc/requirements.txt +++ b/etc/requirements.txt @@ -7,7 +7,7 @@ celery[redis]==3.1.23 # LGR/Unicode modules picu==0.8 munidata==1.2 -lgr-core==1.8 +lgr-core==1.8.1 # Natural sorting implementation natsort==5.0.3 diff --git a/setup.py b/setup.py index 4803cbe8..a81dee45 100755 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ setup( name='lgr-django', - version='1.8', + version='1.8.1', author='Viagenie and Wil Tan', author_email='support@viagenie.ca', packages=find_packages('src'), diff --git a/src/lgr_editor/locale/ar/LC_MESSAGES/django.mo b/src/lgr_editor/locale/ar/LC_MESSAGES/django.mo index 63748712..d2bbacae 100644 Binary files a/src/lgr_editor/locale/ar/LC_MESSAGES/django.mo and b/src/lgr_editor/locale/ar/LC_MESSAGES/django.mo differ diff --git a/src/lgr_editor/locale/ar/LC_MESSAGES/django.po b/src/lgr_editor/locale/ar/LC_MESSAGES/django.po index a10d6253..5f2f30d7 100644 --- a/src/lgr_editor/locale/ar/LC_MESSAGES/django.po +++ b/src/lgr_editor/locale/ar/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-10-11 17:06+0000\n" +"POT-Creation-Date: 2017-10-30 20:24+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/src/lgr_editor/locale/en/LC_MESSAGES/django.mo b/src/lgr_editor/locale/en/LC_MESSAGES/django.mo index dde25836..11d98eb6 100644 Binary files a/src/lgr_editor/locale/en/LC_MESSAGES/django.mo and b/src/lgr_editor/locale/en/LC_MESSAGES/django.mo differ diff --git a/src/lgr_editor/locale/en/LC_MESSAGES/django.po b/src/lgr_editor/locale/en/LC_MESSAGES/django.po index 28581188..8654efd6 100644 --- a/src/lgr_editor/locale/en/LC_MESSAGES/django.po +++ b/src/lgr_editor/locale/en/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-10-11 17:06+0000\n" +"POT-Creation-Date: 2017-10-30 20:24+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/src/lgr_editor/locale/fr/LC_MESSAGES/django.mo b/src/lgr_editor/locale/fr/LC_MESSAGES/django.mo index 6380fc7a..756c2f28 100644 Binary files a/src/lgr_editor/locale/fr/LC_MESSAGES/django.mo and b/src/lgr_editor/locale/fr/LC_MESSAGES/django.mo differ diff --git a/src/lgr_editor/locale/fr/LC_MESSAGES/django.po b/src/lgr_editor/locale/fr/LC_MESSAGES/django.po index a338abcc..ff16d012 100644 --- a/src/lgr_editor/locale/fr/LC_MESSAGES/django.po +++ b/src/lgr_editor/locale/fr/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-10-11 17:06+0000\n" +"POT-Creation-Date: 2017-10-30 20:24+0000\n" "PO-Revision-Date: 2017-10-11 13:11-0400\n" "Last-Translator: \n" "Language-Team: \n" diff --git a/src/lgr_tools/api.py b/src/lgr_tools/api.py index a2b7c81f..6047ebd9 100644 --- a/src/lgr_tools/api.py +++ b/src/lgr_tools/api.py @@ -130,14 +130,12 @@ def lgr_set_annotate_labels(lgr, script_lgr, set_labels, labels_file): return lgr_set_annotate(lgr, script_lgr, set_labels, labels_file) -def lgr_cross_script_variants(merged_lgr, lgr_set, unidb, labels_file): +def lgr_cross_script_variants(lgr, labels_file): """ Compute cross-script variants of a list of labels in a LGR. - :param merged_lgr: The merged LGR object. - :param lgr_set: The LGR set object. - :param unidb: The unicode database to use. + :param lgr: The LGR to use for variant generation. :param labels_file: The file containing the list of labels :return: Text log to be displayed """ - return cross_script_variants(merged_lgr, lgr_set, unidb, labels_file) + return cross_script_variants(lgr, labels_file) diff --git a/src/lgr_tools/forms.py b/src/lgr_tools/forms.py index accac3cd..ab15671b 100644 --- a/src/lgr_tools/forms.py +++ b/src/lgr_tools/forms.py @@ -142,37 +142,22 @@ def __init__(self, *args, **kwargs): self.fields['lgr'].initial = lgr_id -class LGRAnnotateSelector(forms.Form): +class LGRSetCompatibleForm(forms.Form): lgr = forms.ChoiceField(label=_("LGR"), help_text=_('LGR to use for annotation'), required=True, widget=DataSelectWidget) - set_labels = forms.FileField(label=_("Allocated Set labels"), - required=False, - help_text=_('Optional list of labels already allocated ' - 'in the LGR set, that will be used to check ' - 'for collisions when evaluating labels using ' - 'the merged LGR set')) - script = forms.ChoiceField(label=_("Script"), help_text=_('The script used to validate the label'), required=False) - labels = forms.FileField(label=_("Labels"), - help_text=_('List of labels to use in diff. ' - 'File must be encoded in UNIX format.'), - required=True) - - email = forms.EmailField(label=_("E-mail"), - help_text=_('Provide your e-mail address'), - required=True) - def __init__(self, *args, **kwargs): session_lgrs = kwargs.pop('session_lgrs', {}) + lgr_id = kwargs.pop('lgr_id', '') lgr_info = kwargs.pop('lgr_info', None) scripts = kwargs.pop('scripts', []) - super(LGRAnnotateSelector, self).__init__(*args, **kwargs) + super(LGRSetCompatibleForm, self).__init__(*args, **kwargs) lgr_sets = [lgr for lgr in session_lgrs if lgr['is_set']] lgrs = [lgr for lgr in session_lgrs if not lgr['is_set']] # dynamically append the session LGRs (by copy, not by reference) @@ -180,19 +165,21 @@ def __init__(self, *args, **kwargs): (_('LGR set'), [(lgr['name'], lgr['name']) for lgr in lgr_sets])) self.fields['lgr'].widget.data = {lgr['name']: {'lgr-set': ','.join([l['name'] for l in lgr['lgr_set_dct']])} for lgr in lgr_sets} + self.fields['lgr'].initial = lgr_id if lgr_info is not None: self.fields['lgr'].initial = lgr_info.name - if lgr_info.set_labels_info is not None: - self.fields['set_labels'].initial = lgr_info.set_labels_info.name if scripts: self.fields['script'].choices = scripts -class LGRCrossScriptVariantsSelector(forms.Form): - lgr = forms.ChoiceField(label=_("LGR"), - help_text=_('LGR to use for collisions'), - required=True) +class LGRAnnotateSelector(LGRSetCompatibleForm): + set_labels = forms.FileField(label=_("Allocated Set labels"), + required=False, + help_text=_('Optional list of labels already allocated ' + 'in the LGR set, that will be used to check ' + 'for collisions when evaluating labels using ' + 'the merged LGR set')) labels = forms.FileField(label=_("Labels"), help_text=_('List of labels to use in diff. ' @@ -204,10 +191,18 @@ class LGRCrossScriptVariantsSelector(forms.Form): required=True) def __init__(self, *args, **kwargs): - session_lgrs = kwargs.pop('session_lgrs', []) - lgr_id = kwargs.pop('lgr_id', '') - super(LGRCrossScriptVariantsSelector, self).__init__(*args, **kwargs) - lgr_sets = [lgr for lgr in session_lgrs if lgr['is_set']] - # dynamically append the session LGRs (by copy, not by reference) - self.fields['lgr'].choices = ((lgr['name'], lgr['name']) for lgr in lgr_sets) - self.fields['lgr'].initial = lgr_id + lgr_info = kwargs.get('lgr_info', None) + super(LGRAnnotateSelector, self).__init__(*args, **kwargs) + if lgr_info is not None and lgr_info.set_labels_info is not None: + self.fields['set_labels'].initial = lgr_info.set_labels_info.name + + +class LGRCrossScriptVariantsSelector(LGRSetCompatibleForm): + labels = forms.FileField(label=_("Labels"), + help_text=_('List of labels to use in diff. ' + 'File must be encoded in UNIX format.'), + required=True) + + email = forms.EmailField(label=_("E-mail"), + help_text=_('Provide your e-mail address'), + required=True) diff --git a/src/lgr_tools/locale/ar/LC_MESSAGES/django.mo b/src/lgr_tools/locale/ar/LC_MESSAGES/django.mo index af53eaac..d2bbacae 100644 Binary files a/src/lgr_tools/locale/ar/LC_MESSAGES/django.mo and b/src/lgr_tools/locale/ar/LC_MESSAGES/django.mo differ diff --git a/src/lgr_tools/locale/ar/LC_MESSAGES/django.po b/src/lgr_tools/locale/ar/LC_MESSAGES/django.po index bcfdbf76..bcd9edbf 100644 --- a/src/lgr_tools/locale/ar/LC_MESSAGES/django.po +++ b/src/lgr_tools/locale/ar/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-10-11 17:07+0000\n" +"POT-Creation-Date: 2017-10-30 20:24+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -55,11 +55,11 @@ msgstr "" msgid "Choose the action to perform on selected LGRs" msgstr "" -#: forms.py:61 forms.py:114 forms.py:146 forms.py:179 forms.py:193 +#: forms.py:61 forms.py:114 forms.py:146 forms.py:164 msgid "LGR" msgstr "" -#: forms.py:62 forms.py:180 +#: forms.py:62 forms.py:165 msgid "LGR set" msgstr "" @@ -71,19 +71,19 @@ msgstr "" msgid "Second LGR to use in diff" msgstr "" -#: forms.py:80 forms.py:118 forms.py:162 forms.py:197 +#: forms.py:80 forms.py:118 forms.py:184 forms.py:201 msgid "Labels" msgstr "" -#: forms.py:81 forms.py:119 forms.py:163 forms.py:198 +#: forms.py:81 forms.py:119 forms.py:185 forms.py:202 msgid "List of labels to use in diff. File must be encoded in UNIX format." msgstr "" -#: forms.py:85 forms.py:123 forms.py:167 forms.py:202 +#: forms.py:85 forms.py:123 forms.py:189 forms.py:206 msgid "E-mail" msgstr "" -#: forms.py:86 forms.py:124 forms.py:168 forms.py:203 +#: forms.py:86 forms.py:124 forms.py:190 forms.py:207 msgid "Provide your e-mail address" msgstr "" @@ -111,7 +111,7 @@ msgstr "" msgid "Show rules in output (this can be very verbose)" msgstr "" -#: forms.py:115 forms.py:194 +#: forms.py:115 msgid "LGR to use for collisions" msgstr "" @@ -120,25 +120,25 @@ msgid "LGR to use for annotation" msgstr "" #: forms.py:151 -msgid "Allocated Set labels" +msgid "Script" msgstr "" -#: forms.py:153 -msgid "" -"Optional list of labels already allocated in the LGR set, that will be used " -"to check for collisions when evaluating labels using the merged LGR set" +#: forms.py:152 +msgid "The script used to validate the label" msgstr "" -#: forms.py:158 -msgid "Script" +#: forms.py:177 +msgid "Allocated Set labels" msgstr "" -#: forms.py:159 -msgid "The script used to validate the label" +#: forms.py:179 +msgid "" +"Optional list of labels already allocated in the LGR set, that will be used " +"to check for collisions when evaluating labels using the merged LGR set" msgstr "" #: templates/lgr_tools/annotate.html:15 templates/lgr_tools/collision.html:11 -#: templates/lgr_tools/cross_script_variants.html:11 +#: templates/lgr_tools/cross_script_variants.html:14 #: templates/lgr_tools/diff.html:12 msgid "" "As the computing may be very long, we will warn by e-mail once the result " @@ -198,7 +198,7 @@ msgid "" "simple LGRs, union and intersection are not available for LGR sets." msgstr "" -#: templates/lgr_tools/cross_script_variants.html:17 +#: templates/lgr_tools/cross_script_variants.html:20 msgid "Launch" msgstr "" diff --git a/src/lgr_tools/locale/en/LC_MESSAGES/django.mo b/src/lgr_tools/locale/en/LC_MESSAGES/django.mo index 338d6f42..11d98eb6 100644 Binary files a/src/lgr_tools/locale/en/LC_MESSAGES/django.mo and b/src/lgr_tools/locale/en/LC_MESSAGES/django.mo differ diff --git a/src/lgr_tools/locale/en/LC_MESSAGES/django.po b/src/lgr_tools/locale/en/LC_MESSAGES/django.po index e1417f10..28be33af 100644 --- a/src/lgr_tools/locale/en/LC_MESSAGES/django.po +++ b/src/lgr_tools/locale/en/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-10-11 17:07+0000\n" +"POT-Creation-Date: 2017-10-30 20:24+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -53,11 +53,11 @@ msgstr "" msgid "Choose the action to perform on selected LGRs" msgstr "" -#: forms.py:61 forms.py:114 forms.py:146 forms.py:179 forms.py:193 +#: forms.py:61 forms.py:114 forms.py:146 forms.py:164 msgid "LGR" msgstr "" -#: forms.py:62 forms.py:180 +#: forms.py:62 forms.py:165 msgid "LGR set" msgstr "" @@ -69,19 +69,19 @@ msgstr "" msgid "Second LGR to use in diff" msgstr "" -#: forms.py:80 forms.py:118 forms.py:162 forms.py:197 +#: forms.py:80 forms.py:118 forms.py:184 forms.py:201 msgid "Labels" msgstr "" -#: forms.py:81 forms.py:119 forms.py:163 forms.py:198 +#: forms.py:81 forms.py:119 forms.py:185 forms.py:202 msgid "List of labels to use in diff. File must be encoded in UNIX format." msgstr "" -#: forms.py:85 forms.py:123 forms.py:167 forms.py:202 +#: forms.py:85 forms.py:123 forms.py:189 forms.py:206 msgid "E-mail" msgstr "" -#: forms.py:86 forms.py:124 forms.py:168 forms.py:203 +#: forms.py:86 forms.py:124 forms.py:190 forms.py:207 msgid "Provide your e-mail address" msgstr "" @@ -109,7 +109,7 @@ msgstr "" msgid "Show rules in output (this can be very verbose)" msgstr "" -#: forms.py:115 forms.py:194 +#: forms.py:115 msgid "LGR to use for collisions" msgstr "" @@ -118,25 +118,25 @@ msgid "LGR to use for annotation" msgstr "" #: forms.py:151 -msgid "Allocated Set labels" +msgid "Script" msgstr "" -#: forms.py:153 -msgid "" -"Optional list of labels already allocated in the LGR set, that will be used " -"to check for collisions when evaluating labels using the merged LGR set" +#: forms.py:152 +msgid "The script used to validate the label" msgstr "" -#: forms.py:158 -msgid "Script" +#: forms.py:177 +msgid "Allocated Set labels" msgstr "" -#: forms.py:159 -msgid "The script used to validate the label" +#: forms.py:179 +msgid "" +"Optional list of labels already allocated in the LGR set, that will be used " +"to check for collisions when evaluating labels using the merged LGR set" msgstr "" #: templates/lgr_tools/annotate.html:15 templates/lgr_tools/collision.html:11 -#: templates/lgr_tools/cross_script_variants.html:11 +#: templates/lgr_tools/cross_script_variants.html:14 #: templates/lgr_tools/diff.html:12 msgid "" "As the computing may be very long, we will warn by e-mail once the result " @@ -196,7 +196,7 @@ msgid "" "simple LGRs, union and intersection are not available for LGR sets." msgstr "" -#: templates/lgr_tools/cross_script_variants.html:17 +#: templates/lgr_tools/cross_script_variants.html:20 msgid "Launch" msgstr "" diff --git a/src/lgr_tools/locale/fr/LC_MESSAGES/django.mo b/src/lgr_tools/locale/fr/LC_MESSAGES/django.mo index 8fe8e98f..80e4f264 100644 Binary files a/src/lgr_tools/locale/fr/LC_MESSAGES/django.mo and b/src/lgr_tools/locale/fr/LC_MESSAGES/django.mo differ diff --git a/src/lgr_tools/locale/fr/LC_MESSAGES/django.po b/src/lgr_tools/locale/fr/LC_MESSAGES/django.po index 4fd17af9..89460137 100644 --- a/src/lgr_tools/locale/fr/LC_MESSAGES/django.po +++ b/src/lgr_tools/locale/fr/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-10-11 17:07+0000\n" +"POT-Creation-Date: 2017-10-30 20:24+0000\n" "PO-Revision-Date: 2017-10-11 13:07-0400\n" "Last-Translator: \n" "Language-Team: \n" @@ -54,11 +54,11 @@ msgstr "Action à effectuer sur les LGR" msgid "Choose the action to perform on selected LGRs" msgstr "Choisir l'action à exécuter sur les LGR" -#: forms.py:61 forms.py:114 forms.py:146 forms.py:179 forms.py:193 +#: forms.py:61 forms.py:114 forms.py:146 forms.py:164 msgid "LGR" msgstr "LGR" -#: forms.py:62 forms.py:180 +#: forms.py:62 forms.py:165 msgid "LGR set" msgstr "Set LGR" @@ -70,21 +70,21 @@ msgstr "Première LGR sur laquelle appliquer la différence" msgid "Second LGR to use in diff" msgstr "Seconde LGR sur laquelle appliquer la différence" -#: forms.py:80 forms.py:118 forms.py:162 forms.py:197 +#: forms.py:80 forms.py:118 forms.py:184 forms.py:201 msgid "Labels" msgstr "Labels" -#: forms.py:81 forms.py:119 forms.py:163 forms.py:198 +#: forms.py:81 forms.py:119 forms.py:185 forms.py:202 msgid "List of labels to use in diff. File must be encoded in UNIX format." msgstr "" "Liste de labels sur lesquels tester les différences. Le fichier doit être " "encodé au format UNIX." -#: forms.py:85 forms.py:123 forms.py:167 forms.py:202 +#: forms.py:85 forms.py:123 forms.py:189 forms.py:206 msgid "E-mail" msgstr "E-mail" -#: forms.py:86 forms.py:124 forms.py:168 forms.py:203 +#: forms.py:86 forms.py:124 forms.py:190 forms.py:207 msgid "Provide your e-mail address" msgstr "Fournir une adresse e-mail" @@ -113,7 +113,7 @@ msgid "Show rules in output (this can be very verbose)" msgstr "" "Affiche les règles dans le fichier de sortie (cela peut être très verbeux)" -#: forms.py:115 forms.py:194 +#: forms.py:115 msgid "LGR to use for collisions" msgstr "LGR sur laquelle vérifier les collisions" @@ -122,10 +122,18 @@ msgid "LGR to use for annotation" msgstr "LGR sur laquelle effectuer les annotations" #: forms.py:151 +msgid "Script" +msgstr "Script" + +#: forms.py:152 +msgid "The script used to validate the label" +msgstr "Script utilisé pour valider le label" + +#: forms.py:177 msgid "Allocated Set labels" msgstr "Labels du set alloués" -#: forms.py:153 +#: forms.py:179 msgid "" "Optional list of labels already allocated in the LGR set, that will be used " "to check for collisions when evaluating labels using the merged LGR set" @@ -134,16 +142,8 @@ msgstr "" "pour vérifier les collisions lors de l'évaluation de labels en utilisant le " "set LGR fusionné" -#: forms.py:158 -msgid "Script" -msgstr "Script" - -#: forms.py:159 -msgid "The script used to validate the label" -msgstr "Script utilisé pour valider le label" - #: templates/lgr_tools/annotate.html:15 templates/lgr_tools/collision.html:11 -#: templates/lgr_tools/cross_script_variants.html:11 +#: templates/lgr_tools/cross_script_variants.html:14 #: templates/lgr_tools/diff.html:12 msgid "" "As the computing may be very long, we will warn by e-mail once the result " @@ -219,7 +219,7 @@ msgstr "" "simples, l'union et la comparaison ne sont pas disponibles pour les set LGR." "" -#: templates/lgr_tools/cross_script_variants.html:17 +#: templates/lgr_tools/cross_script_variants.html:20 msgid "Launch" msgstr "Démarrer" diff --git a/src/lgr_tools/tasks.py b/src/lgr_tools/tasks.py index 9832b55a..06fba374 100644 --- a/src/lgr_tools/tasks.py +++ b/src/lgr_tools/tasks.py @@ -220,7 +220,7 @@ def lgr_set_annotate_task(lgr_json, script_lgr_json, labels_json, email_address, @shared_task def cross_script_variants_task(lgr_json, labels_json, email_address, storage_path): """ - Compute cross-script variants of labels in a LGR set. + Compute cross-script variants of labels in a LGR. :param lgr_json: The LGRInfo as a JSON object. :param labels_json: The LabelInfo as a JSON object. @@ -243,7 +243,5 @@ def cross_script_variants_task(lgr_json, labels_json, email_address, storage_pat email_body=body, email_address=email_address, cb=lgr_cross_script_variants, - merged_lgr=lgr_info.lgr, - lgr_set=[l.lgr for l in lgr_info.lgr_set], - unidb=lgr_info.lgr.unicode_database, + lgr=lgr_info.lgr, labels_file=labels_info.labels) diff --git a/src/lgr_tools/templates/lgr_tools/cross_script_variants.html b/src/lgr_tools/templates/lgr_tools/cross_script_variants.html index f213cc95..095c3541 100644 --- a/src/lgr_tools/templates/lgr_tools/cross_script_variants.html +++ b/src/lgr_tools/templates/lgr_tools/cross_script_variants.html @@ -7,6 +7,9 @@
{% csrf_token %} {% include "lgr_editor/_form_field.html" with field=form.lgr %} +
+ {% include "lgr_editor/_form_field.html" with field=form.script %} +
{% include "lgr_editor/_form_field.html" with field=form.labels %}

{% blocktrans %}As the computing may be very long, we will warn by e-mail once the result can be downloaded. Please provide a valid e-mail address:{% endblocktrans %}

{% include "lgr_editor/_form_field.html" with field=form.email %} @@ -18,4 +21,44 @@
-{% endblock content %} \ No newline at end of file +{% endblock content %} + +{% block html_body_more %} + {{ block.super }} + +{% endblock html_body_more %} \ No newline at end of file diff --git a/src/lgr_tools/views.py b/src/lgr_tools/views.py index 2c7fb8a0..83988e97 100644 --- a/src/lgr_tools/views.py +++ b/src/lgr_tools/views.py @@ -180,7 +180,7 @@ def lgr_collisions(request, lgr_id): return render(request, 'lgr_tools/collision.html', context=ctx) -def lgr_annotate(request, lgr_id): +def _create_set_compatible_form_instance(form_class, request, lgr_id): # Retrieve complete list of all scripts defined in all sets lgr_scripts = set() for lgr_dct in session_list_lgr(request): @@ -199,11 +199,20 @@ def lgr_annotate(request, lgr_id): if lgr_id is not None: lgr_info = session_select_lgr(request, lgr_id) - form = LGRAnnotateSelector(request.POST or None, request.FILES or None, - session_lgrs=session_list_lgr(request), - lgr_info=lgr_info, - scripts=list(lgr_scripts)) + form = form_class(request.POST or None, request.FILES or None, + session_lgrs=session_list_lgr(request), + lgr_info=lgr_info, + scripts=list(lgr_scripts)) + return form + + +def lgr_annotate(request, lgr_id): + lgr_info = None + if lgr_id is not None: + lgr_info = session_select_lgr(request, lgr_id) + form = _create_set_compatible_form_instance(LGRAnnotateSelector, + request, lgr_id) if form.is_valid(): ctx = {} lgr_id = form.cleaned_data['lgr'] @@ -256,9 +265,12 @@ def lgr_annotate(request, lgr_id): def lgr_cross_script_variants(request, lgr_id): - form = LGRCrossScriptVariantsSelector(request.POST or None, request.FILES or None, - session_lgrs=session_list_lgr(request), - lgr_id=lgr_id) + lgr_info = None + if lgr_id is not None: + lgr_info = session_select_lgr(request, lgr_id) + + form = _create_set_compatible_form_instance(LGRCrossScriptVariantsSelector, + request, lgr_id) if form.is_valid(): ctx = {} @@ -273,21 +285,28 @@ def lgr_cross_script_variants(request, lgr_id): # need to transmit json serializable data labels_json = LabelInfo.from_form(labels_file.name, labels_file.read()).to_dict() - if not lgr_info.is_set: - messages.add_message(request, messages.ERROR, 'Please select an LGR set.') - else: - lgr_json = lgr_info.to_dict() - cross_script_variants_task.delay(lgr_json, labels_json, email_address, storage_path) - ctx.update({ - 'lgr_info': lgr_info, - 'labels_file': labels_file.name, - 'email': email_address, - }) - return render(request, 'lgr_tools/wait_cross_scripts.html', context=ctx) + if lgr_info.is_set: + script_lgr_id = form.cleaned_data['script'] + script_lgr = session_select_lgr(request, script_lgr_id, + lgr_set_id=lgr_id) + lgr_info = script_lgr + + cross_script_variants_task.delay(lgr_info.to_dict(), labels_json, + email_address, storage_path) + + ctx.update({ + 'lgr_info': lgr_info, + 'labels_file': labels_file.name, + 'email': email_address, + }) + return render(request, 'lgr_tools/wait_cross_scripts.html', context=ctx) ctx = { 'form': form, + 'lgr_id': lgr_id if lgr_id is not None else '', + 'lgr': lgr_info.lgr if lgr_info is not None else '', + 'is_set': lgr_info.is_set if lgr_info is not None else '', } return render(request, 'lgr_tools/cross_script_variants.html', context=ctx) diff --git a/src/lgr_validator/locale/ar/LC_MESSAGES/django.mo b/src/lgr_validator/locale/ar/LC_MESSAGES/django.mo index af53eaac..d2bbacae 100644 Binary files a/src/lgr_validator/locale/ar/LC_MESSAGES/django.mo and b/src/lgr_validator/locale/ar/LC_MESSAGES/django.mo differ diff --git a/src/lgr_validator/locale/ar/LC_MESSAGES/django.po b/src/lgr_validator/locale/ar/LC_MESSAGES/django.po index 6537c5e3..224439c9 100644 --- a/src/lgr_validator/locale/ar/LC_MESSAGES/django.po +++ b/src/lgr_validator/locale/ar/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-10-11 17:07+0000\n" +"POT-Creation-Date: 2017-10-30 20:24+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -65,13 +65,13 @@ msgstr "" #: templates/lgr_validator/validator.html:70 #: templates/lgr_validator/validator.html:122 -#: templates/lgr_validator/validator.html:182 +#: templates/lgr_validator/validator.html:183 msgid "Show / hide rule" msgstr "" #: templates/lgr_validator/validator.html:80 #: templates/lgr_validator/validator.html:132 -#: templates/lgr_validator/validator.html:192 +#: templates/lgr_validator/validator.html:193 #, python-format msgid "[Action index: %(action_idx)s] %(action)s" msgstr "" @@ -92,33 +92,33 @@ msgstr "" msgid "No collision." msgstr "" -#: templates/lgr_validator/validator.html:151 +#: templates/lgr_validator/validator.html:152 msgid "Variant labels" msgstr "" -#: templates/lgr_validator/validator.html:151 +#: templates/lgr_validator/validator.html:152 msgid " (including original as last)" msgstr "" -#: templates/lgr_validator/validator.html:156 +#: templates/lgr_validator/validator.html:157 #, python-format msgid "%(num_variants)s variant label(s) generated." msgstr "" -#: templates/lgr_validator/validator.html:158 +#: templates/lgr_validator/validator.html:159 msgid "By disposition: " msgstr "" -#: templates/lgr_validator/validator.html:160 +#: templates/lgr_validator/validator.html:161 msgid "No variant labels generated." msgstr "" -#: templates/lgr_validator/validator.html:205 +#: templates/lgr_validator/validator.html:207 msgid "" "Too many variant labels to be displayed in the browser. Please download the " "results in .csv instead." msgstr "" -#: templates/lgr_validator/validator.html:223 +#: templates/lgr_validator/validator.html:227 msgid "Download results in CSV" msgstr "" diff --git a/src/lgr_validator/locale/en/LC_MESSAGES/django.mo b/src/lgr_validator/locale/en/LC_MESSAGES/django.mo index 338d6f42..11d98eb6 100644 Binary files a/src/lgr_validator/locale/en/LC_MESSAGES/django.mo and b/src/lgr_validator/locale/en/LC_MESSAGES/django.mo differ diff --git a/src/lgr_validator/locale/en/LC_MESSAGES/django.po b/src/lgr_validator/locale/en/LC_MESSAGES/django.po index 57fdf933..31afa7ab 100644 --- a/src/lgr_validator/locale/en/LC_MESSAGES/django.po +++ b/src/lgr_validator/locale/en/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-10-11 17:07+0000\n" +"POT-Creation-Date: 2017-10-30 20:24+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -63,13 +63,13 @@ msgstr "" #: templates/lgr_validator/validator.html:70 #: templates/lgr_validator/validator.html:122 -#: templates/lgr_validator/validator.html:182 +#: templates/lgr_validator/validator.html:183 msgid "Show / hide rule" msgstr "" #: templates/lgr_validator/validator.html:80 #: templates/lgr_validator/validator.html:132 -#: templates/lgr_validator/validator.html:192 +#: templates/lgr_validator/validator.html:193 #, python-format msgid "[Action index: %(action_idx)s] %(action)s" msgstr "" @@ -90,33 +90,33 @@ msgstr "" msgid "No collision." msgstr "" -#: templates/lgr_validator/validator.html:151 +#: templates/lgr_validator/validator.html:152 msgid "Variant labels" msgstr "" -#: templates/lgr_validator/validator.html:151 +#: templates/lgr_validator/validator.html:152 msgid " (including original as last)" msgstr "" -#: templates/lgr_validator/validator.html:156 +#: templates/lgr_validator/validator.html:157 #, python-format msgid "%(num_variants)s variant label(s) generated." msgstr "" -#: templates/lgr_validator/validator.html:158 +#: templates/lgr_validator/validator.html:159 msgid "By disposition: " msgstr "" -#: templates/lgr_validator/validator.html:160 +#: templates/lgr_validator/validator.html:161 msgid "No variant labels generated." msgstr "" -#: templates/lgr_validator/validator.html:205 +#: templates/lgr_validator/validator.html:207 msgid "" "Too many variant labels to be displayed in the browser. Please download the " "results in .csv instead." msgstr "" -#: templates/lgr_validator/validator.html:223 +#: templates/lgr_validator/validator.html:227 msgid "Download results in CSV" msgstr "" diff --git a/src/lgr_validator/locale/fr/LC_MESSAGES/django.mo b/src/lgr_validator/locale/fr/LC_MESSAGES/django.mo index 7fe6f53b..d119994a 100644 Binary files a/src/lgr_validator/locale/fr/LC_MESSAGES/django.mo and b/src/lgr_validator/locale/fr/LC_MESSAGES/django.mo differ diff --git a/src/lgr_validator/locale/fr/LC_MESSAGES/django.po b/src/lgr_validator/locale/fr/LC_MESSAGES/django.po index 27d9c924..2a8fc39d 100644 --- a/src/lgr_validator/locale/fr/LC_MESSAGES/django.po +++ b/src/lgr_validator/locale/fr/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-10-11 17:07+0000\n" +"POT-Creation-Date: 2017-10-30 20:24+0000\n" "PO-Revision-Date: 2017-10-03 17:06-0400\n" "Last-Translator: \n" "Language-Team: \n" @@ -68,13 +68,13 @@ msgstr "Séquence de code points" #: templates/lgr_validator/validator.html:70 #: templates/lgr_validator/validator.html:122 -#: templates/lgr_validator/validator.html:182 +#: templates/lgr_validator/validator.html:183 msgid "Show / hide rule" msgstr "Montrer / Cacher la règle" #: templates/lgr_validator/validator.html:80 #: templates/lgr_validator/validator.html:132 -#: templates/lgr_validator/validator.html:192 +#: templates/lgr_validator/validator.html:193 #, python-format msgid "[Action index: %(action_idx)s] %(action)s" msgstr "[Index de l'action : %(action_idx)s] %(action)s" @@ -95,28 +95,28 @@ msgstr "Collision" msgid "No collision." msgstr "Pas de collisions." -#: templates/lgr_validator/validator.html:151 +#: templates/lgr_validator/validator.html:152 msgid "Variant labels" msgstr "Labels variants" -#: templates/lgr_validator/validator.html:151 +#: templates/lgr_validator/validator.html:152 msgid " (including original as last)" msgstr " (incluant l'original en dernier)" -#: templates/lgr_validator/validator.html:156 +#: templates/lgr_validator/validator.html:157 #, python-format msgid "%(num_variants)s variant label(s) generated." msgstr "%(num_variants)s label(s) variant(s) généré(s)." -#: templates/lgr_validator/validator.html:158 +#: templates/lgr_validator/validator.html:159 msgid "By disposition: " msgstr "Par disposition : " -#: templates/lgr_validator/validator.html:160 +#: templates/lgr_validator/validator.html:161 msgid "No variant labels generated." msgstr "Aucun label variant généré." -#: templates/lgr_validator/validator.html:205 +#: templates/lgr_validator/validator.html:207 msgid "" "Too many variant labels to be displayed in the browser. Please download the " "results in .csv instead." @@ -124,6 +124,6 @@ msgstr "" "Trop de labels variants pour être affichés dans le navigateur. Prière de " "télécharger le resultat au format CSV." -#: templates/lgr_validator/validator.html:223 +#: templates/lgr_validator/validator.html:227 msgid "Download results in CSV" msgstr "Télécharger les résultats en CSV" diff --git a/src/lgr_web/locale/ar/LC_MESSAGES/django.mo b/src/lgr_web/locale/ar/LC_MESSAGES/django.mo index 63748712..d2bbacae 100644 Binary files a/src/lgr_web/locale/ar/LC_MESSAGES/django.mo and b/src/lgr_web/locale/ar/LC_MESSAGES/django.mo differ diff --git a/src/lgr_web/locale/ar/LC_MESSAGES/django.po b/src/lgr_web/locale/ar/LC_MESSAGES/django.po index cf15bca9..2295141b 100644 --- a/src/lgr_web/locale/ar/LC_MESSAGES/django.po +++ b/src/lgr_web/locale/ar/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-10-11 17:06+0000\n" +"POT-Creation-Date: 2017-10-30 20:24+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -79,75 +79,75 @@ msgstr "" msgid "Get collisions in a list of labels" msgstr "" -#: templates/_base.html:105 +#: templates/_base.html:104 msgid "Compute cross-script variants" msgstr "" -#: templates/_base.html:108 +#: templates/_base.html:107 msgid "Cross-script variants" msgstr "" -#: templates/_base.html:114 +#: templates/_base.html:112 msgid "Annotate list of labels with their disposition" msgstr "" -#: templates/_base.html:117 +#: templates/_base.html:115 msgid "Generate disp. annotations" msgstr "" -#: templates/_base.html:136 +#: templates/_base.html:134 msgid "Validate label against LGR" msgstr "" -#: templates/_base.html:138 templates/_base.html.py:263 +#: templates/_base.html:136 templates/_base.html.py:261 msgid "Validate label" msgstr "" -#: templates/_base.html:142 +#: templates/_base.html:140 msgid "Analyze current file for errors and statistics" msgstr "" -#: templates/_base.html:145 +#: templates/_base.html:143 msgid "Summary" msgstr "" -#: templates/_base.html:148 +#: templates/_base.html:146 msgid "Preview LGR file" msgstr "" -#: templates/_base.html:151 +#: templates/_base.html:149 msgid "View XML" msgstr "" -#: templates/_base.html:154 templates/_base.html.py:157 +#: templates/_base.html:152 templates/_base.html.py:155 msgid "HTML Output" msgstr "" -#: templates/_base.html:160 +#: templates/_base.html:158 msgid "Download LGR file" msgstr "" -#: templates/_base.html:162 +#: templates/_base.html:160 msgid "Download" msgstr "" -#: templates/_base.html:167 +#: templates/_base.html:165 msgid "About LGR Toolset" msgstr "" -#: templates/_base.html:168 templates/_base.html.py:279 +#: templates/_base.html:166 templates/_base.html.py:277 msgid "About" msgstr "" -#: templates/_base.html:232 +#: templates/_base.html:230 msgid "LGR Summary" msgstr "" -#: templates/_base.html:242 +#: templates/_base.html:240 msgid "Save summary" msgstr "" -#: templates/_base.html:244 templates/_base.html.py:285 +#: templates/_base.html:242 templates/_base.html.py:283 msgid "Close" msgstr "" diff --git a/src/lgr_web/locale/en/LC_MESSAGES/django.mo b/src/lgr_web/locale/en/LC_MESSAGES/django.mo index dde25836..11d98eb6 100644 Binary files a/src/lgr_web/locale/en/LC_MESSAGES/django.mo and b/src/lgr_web/locale/en/LC_MESSAGES/django.mo differ diff --git a/src/lgr_web/locale/en/LC_MESSAGES/django.po b/src/lgr_web/locale/en/LC_MESSAGES/django.po index f9e4cd51..422f2874 100644 --- a/src/lgr_web/locale/en/LC_MESSAGES/django.po +++ b/src/lgr_web/locale/en/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-10-11 17:06+0000\n" +"POT-Creation-Date: 2017-10-30 20:24+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -77,75 +77,75 @@ msgstr "" msgid "Get collisions in a list of labels" msgstr "" -#: templates/_base.html:105 +#: templates/_base.html:104 msgid "Compute cross-script variants" msgstr "" -#: templates/_base.html:108 +#: templates/_base.html:107 msgid "Cross-script variants" msgstr "" -#: templates/_base.html:114 +#: templates/_base.html:112 msgid "Annotate list of labels with their disposition" msgstr "" -#: templates/_base.html:117 +#: templates/_base.html:115 msgid "Generate disp. annotations" msgstr "" -#: templates/_base.html:136 +#: templates/_base.html:134 msgid "Validate label against LGR" msgstr "" -#: templates/_base.html:138 templates/_base.html.py:263 +#: templates/_base.html:136 templates/_base.html.py:261 msgid "Validate label" msgstr "" -#: templates/_base.html:142 +#: templates/_base.html:140 msgid "Analyze current file for errors and statistics" msgstr "" -#: templates/_base.html:145 +#: templates/_base.html:143 msgid "Summary" msgstr "" -#: templates/_base.html:148 +#: templates/_base.html:146 msgid "Preview LGR file" msgstr "" -#: templates/_base.html:151 +#: templates/_base.html:149 msgid "View XML" msgstr "" -#: templates/_base.html:154 templates/_base.html.py:157 +#: templates/_base.html:152 templates/_base.html.py:155 msgid "HTML Output" msgstr "" -#: templates/_base.html:160 +#: templates/_base.html:158 msgid "Download LGR file" msgstr "" -#: templates/_base.html:162 +#: templates/_base.html:160 msgid "Download" msgstr "" -#: templates/_base.html:167 +#: templates/_base.html:165 msgid "About LGR Toolset" msgstr "" -#: templates/_base.html:168 templates/_base.html.py:279 +#: templates/_base.html:166 templates/_base.html.py:277 msgid "About" msgstr "" -#: templates/_base.html:232 +#: templates/_base.html:230 msgid "LGR Summary" msgstr "" -#: templates/_base.html:242 +#: templates/_base.html:240 msgid "Save summary" msgstr "" -#: templates/_base.html:244 templates/_base.html.py:285 +#: templates/_base.html:242 templates/_base.html.py:283 msgid "Close" msgstr "" diff --git a/src/lgr_web/locale/fr/LC_MESSAGES/django.mo b/src/lgr_web/locale/fr/LC_MESSAGES/django.mo index 1d4865f4..cf1ab069 100644 Binary files a/src/lgr_web/locale/fr/LC_MESSAGES/django.mo and b/src/lgr_web/locale/fr/LC_MESSAGES/django.mo differ diff --git a/src/lgr_web/locale/fr/LC_MESSAGES/django.po b/src/lgr_web/locale/fr/LC_MESSAGES/django.po index 61e62de0..c614a0c8 100644 --- a/src/lgr_web/locale/fr/LC_MESSAGES/django.po +++ b/src/lgr_web/locale/fr/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-10-11 17:06+0000\n" +"POT-Creation-Date: 2017-10-30 20:24+0000\n" "PO-Revision-Date: 2017-10-03 17:02-0400\n" "Last-Translator: \n" "Language-Team: \n" @@ -79,75 +79,75 @@ msgstr "Diff labels entre deux LGR" msgid "Get collisions in a list of labels" msgstr "Calculer les collisions sur une liste de labels" -#: templates/_base.html:105 +#: templates/_base.html:104 msgid "Compute cross-script variants" msgstr "Calculer les variantes cross-script" -#: templates/_base.html:108 +#: templates/_base.html:107 msgid "Cross-script variants" msgstr "Variantes cross-script" -#: templates/_base.html:114 +#: templates/_base.html:112 msgid "Annotate list of labels with their disposition" msgstr "Annote une liste de labels avec leur disposition" -#: templates/_base.html:117 +#: templates/_base.html:115 msgid "Generate disp. annotations" msgstr "Génére les annotations de disposition" -#: templates/_base.html:136 +#: templates/_base.html:134 msgid "Validate label against LGR" msgstr "Valider un label avec une LGR" -#: templates/_base.html:138 templates/_base.html.py:263 +#: templates/_base.html:136 templates/_base.html.py:261 msgid "Validate label" msgstr "Valider un label" -#: templates/_base.html:142 +#: templates/_base.html:140 msgid "Analyze current file for errors and statistics" msgstr "Analyser le fichier courant pour les erreurs et les statistiques" -#: templates/_base.html:145 +#: templates/_base.html:143 msgid "Summary" msgstr "Résumé" -#: templates/_base.html:148 +#: templates/_base.html:146 msgid "Preview LGR file" msgstr "Prévisualiser le fichier LGR" -#: templates/_base.html:151 +#: templates/_base.html:149 msgid "View XML" msgstr "Voir le XML" -#: templates/_base.html:154 templates/_base.html.py:157 +#: templates/_base.html:152 templates/_base.html.py:155 msgid "HTML Output" msgstr "Sortie HTML" -#: templates/_base.html:160 +#: templates/_base.html:158 msgid "Download LGR file" msgstr "Télécharger le fichier LGR" -#: templates/_base.html:162 +#: templates/_base.html:160 msgid "Download" msgstr "Télécharger" -#: templates/_base.html:167 +#: templates/_base.html:165 msgid "About LGR Toolset" msgstr "À propos de l'application LGR" -#: templates/_base.html:168 templates/_base.html.py:279 +#: templates/_base.html:166 templates/_base.html.py:277 msgid "About" msgstr "À propos" -#: templates/_base.html:232 +#: templates/_base.html:230 msgid "LGR Summary" msgstr "Résumé de la LGR" -#: templates/_base.html:242 +#: templates/_base.html:240 msgid "Save summary" msgstr "Sauvegarder" -#: templates/_base.html:244 templates/_base.html.py:285 +#: templates/_base.html:242 templates/_base.html.py:283 msgid "Close" msgstr "Fermer" diff --git a/src/lgr_web/templates/_base.html b/src/lgr_web/templates/_base.html index dfecb9ea..2cce7818 100644 --- a/src/lgr_web/templates/_base.html +++ b/src/lgr_web/templates/_base.html @@ -71,7 +71,7 @@ {% url 'lgr_tools_diff' lgr_id as lgr_tools_diff_url %} {% url 'lgr_tools_collisions' lgr_id as lgr_tools_collisions_url %} {% url 'lgr_tools_annotate' lgr_id as lgr_tools_annotate_url %} - {% url 'lgr_tools_cross_script' as lgr_tools_cross_script_url %} + {% url 'lgr_tools_cross_script' lgr_id as lgr_tools_cross_script_url %} {% endif %}