[shared] Added utils::flipDict allowing to flip keys<->values of a dict. [gen] file.py: added missing i18n labels. [gen] Added css style for rendering nice tables within the message popup.

This commit is contained in:
Gaetan Delannay 2015-01-16 20:22:29 +01:00
parent ffb8bed189
commit a905aaa139
12 changed files with 114 additions and 4 deletions

View file

@ -327,20 +327,20 @@ class File(Field):
checked=":value and 'checked' or None" checked=":value and 'checked' or None"
name=":'%s_delete' % name" id=":'%s_nochange' % name" name=":'%s_delete' % name" id=":'%s_nochange' % name"
onclick=":'document.getElementById(%s).disabled=true' % fName"/> onclick=":'document.getElementById(%s).disabled=true' % fName"/>
<label lfor=":'%s_nochange' % name">Keep the file unchanged</label><br/> <label lfor=":'%s_nochange' % name">:_('keep_file')</label><br/>
<!-- Delete the file. --> <!-- Delete the file. -->
<x if="not field.required"> <x if="not field.required">
<input type="radio" value="delete" <input type="radio" value="delete"
name=":'%s_delete' % name" id=":'%s_delete' % name" name=":'%s_delete' % name" id=":'%s_delete' % name"
onclick=":'document.getElementById(%s).disabled=true' % fName"/> onclick=":'document.getElementById(%s).disabled=true' % fName"/>
<label lfor=":'%s_delete' % name">Delete the file</label><br/> <label lfor=":'%s_delete' % name">:_('delete_file')</label><br/>
</x> </x>
<!-- Replace with a new file. --> <!-- Replace with a new file. -->
<input type="radio" value="" <input type="radio" value=""
checked=":not value and 'checked' or None" checked=":not value and 'checked' or None"
name=":'%s_delete' % name" id=":'%s_upload' % name" name=":'%s_delete' % name" id=":'%s_upload' % name"
onclick=":'document.getElementById(%s).disabled=false' % fName"/> onclick=":'document.getElementById(%s).disabled=false' % fName"/>
<label lfor=":'%s_upload' % name">Replace it with a new file</label><br/> <label lfor=":'%s_upload' % name">:_('replace_file')</label><br/>
</x> </x>
<!-- The upload field. --> <!-- The upload field. -->
<input type="file" name=":'%s_file' % name" id=":'%s_file' % name" <input type="file" name=":'%s_file' % name" id=":'%s_file' % name"

View file

@ -235,6 +235,18 @@ msgstr ""
msgid "page_unlock" msgid "page_unlock"
msgstr "" msgstr ""
#. Default: "Keep the file unchanged"
msgid "keep_file"
msgstr ""
#. Default: "Delete the file"
msgid "delete_file"
msgstr ""
#. Default: "Replace it with a new file"
msgid "replace_file"
msgstr ""
#. Default: "Are you sure?" #. Default: "Are you sure?"
msgid "action_confirm" msgid "action_confirm"
msgstr "" msgstr ""

View file

@ -235,6 +235,18 @@ msgstr ""
msgid "page_unlock" msgid "page_unlock"
msgstr "" msgstr ""
#. Default: "Keep the file unchanged"
msgid "keep_file"
msgstr ""
#. Default: "Delete the file"
msgid "delete_file"
msgstr ""
#. Default: "Replace it with a new file"
msgid "replace_file"
msgstr ""
#. Default: "Are you sure?" #. Default: "Are you sure?"
msgid "action_confirm" msgid "action_confirm"
msgstr "" msgstr ""

View file

@ -235,6 +235,18 @@ msgstr ""
msgid "page_unlock" msgid "page_unlock"
msgstr "" msgstr ""
#. Default: "Keep the file unchanged"
msgid "keep_file"
msgstr ""
#. Default: "Delete the file"
msgid "delete_file"
msgstr ""
#. Default: "Replace it with a new file"
msgid "replace_file"
msgstr ""
#. Default: "Are you sure?" #. Default: "Are you sure?"
msgid "action_confirm" msgid "action_confirm"
msgstr "" msgstr ""

View file

@ -236,6 +236,18 @@ msgstr "(Un)check everything"
msgid "page_unlock" msgid "page_unlock"
msgstr "Unlock" msgstr "Unlock"
#. Default: "Keep the file unchanged"
msgid "keep_file"
msgstr "Keep the file unchanged"
#. Default: "Delete the file"
msgid "delete_file"
msgstr "Delete the file"
#. Default: "Replace it with a new file"
msgid "replace_file"
msgstr "Replace it with a new file"
#. Default: "Are you sure?" #. Default: "Are you sure?"
msgid "action_confirm" msgid "action_confirm"
msgstr "Are you sure?" msgstr "Are you sure?"

View file

@ -235,6 +235,18 @@ msgstr ""
msgid "page_unlock" msgid "page_unlock"
msgstr "" msgstr ""
#. Default: "Keep the file unchanged"
msgid "keep_file"
msgstr ""
#. Default: "Delete the file"
msgid "delete_file"
msgstr ""
#. Default: "Replace it with a new file"
msgid "replace_file"
msgstr ""
#. Default: "Are you sure?" #. Default: "Are you sure?"
msgid "action_confirm" msgid "action_confirm"
msgstr "¿Está seguro?" msgstr "¿Está seguro?"

View file

@ -236,6 +236,18 @@ msgstr "Tout (dé)sélectionner"
msgid "page_unlock" msgid "page_unlock"
msgstr "Déverrouiller" msgstr "Déverrouiller"
#. Default: "Keep the file unchanged"
msgid "keep_file"
msgstr "Conserver le fichier"
#. Default: "Delete the file"
msgid "delete_file"
msgstr "Supprimer le fichier"
#. Default: "Replace it with a new file"
msgid "replace_file"
msgstr "Le remplacer par un autre"
#. Default: "Are you sure?" #. Default: "Are you sure?"
msgid "action_confirm" msgid "action_confirm"
msgstr "Êtes-vous sûr?" msgstr "Êtes-vous sûr?"

View file

@ -235,6 +235,18 @@ msgstr ""
msgid "page_unlock" msgid "page_unlock"
msgstr "" msgstr ""
#. Default: "Keep the file unchanged"
msgid "keep_file"
msgstr ""
#. Default: "Delete the file"
msgid "delete_file"
msgstr ""
#. Default: "Replace it with a new file"
msgid "replace_file"
msgstr ""
#. Default: "Are you sure?" #. Default: "Are you sure?"
msgid "action_confirm" msgid "action_confirm"
msgstr "È sicuro?" msgstr "È sicuro?"

View file

@ -235,6 +235,18 @@ msgstr "Alles (de)selecteren"
msgid "page_unlock" msgid "page_unlock"
msgstr "Ontgrendelen" msgstr "Ontgrendelen"
#. Default: "Keep the file unchanged"
msgid "keep_file"
msgstr ""
#. Default: "Delete the file"
msgid "delete_file"
msgstr ""
#. Default: "Replace it with a new file"
msgid "replace_file"
msgstr ""
#. Default: "Are you sure?" #. Default: "Are you sure?"
msgid "action_confirm" msgid "action_confirm"
msgstr "Bent u zeker?" msgstr "Bent u zeker?"

View file

@ -120,6 +120,12 @@ td.search { padding-top: 8px }
.grid th { font-style: italic; font-weight: normal; .grid th { font-style: italic; font-weight: normal;
border-bottom: 5px solid #fdfdfd; padding: 3px 5px 0 5px } border-bottom: 5px solid #fdfdfd; padding: 3px 5px 0 5px }
.grid td { padding: 3px 3px 0 3px } .grid td { padding: 3px 3px 0 3px }
.msgTable { margin: 6px 0; width: 100%; font-size: 93% }
.msgTable tr { vertical-align: top }
.msgTable td, .msgTable th { border: 1px solid grey; color: grey;
padding: 0px 5px; text-align: left }
.msgTable th { background-color: #f0e3b8; font-style: italic;
font-weight: normal }
.cellGap { padding-right: 0.4em } .cellGap { padding-right: 0.4em }
.cellDashed { border: 1px dashed grey !important } .cellDashed { border: 1px dashed grey !important }
.noStyle { border: 0 !important; padding: 0 !important; margin: 0 !important } .noStyle { border: 0 !important; padding: 0 !important; margin: 0 !important }

View file

@ -381,7 +381,7 @@ class ImageImporter(DocImporter):
self.importPath = newImportPath self.importPath = newImportPath
imagePath = os.path.splitext(imagePath)[0] + '.png' imagePath = os.path.splitext(imagePath)[0] + '.png'
self.format = 'png' self.format = 'png'
# Retrieve image size from self.size. # Retrieve image size from self.size
width = height = None width = height = None
if self.size and (self.sizeUnit != 'pc'): if self.size and (self.sizeUnit != 'pc'):
width, height = self.size width, height = self.size

View file

@ -169,6 +169,14 @@ def splitList(l, sub):
res[-1].append(elem) res[-1].append(elem)
return res return res
# ------------------------------------------------------------------------------
def flipDict(d):
'''Flips dict p_d: keys become values, values become keys. p_d is left
untouched: a new, flipped, dict is returned.'''
res = {}
for k, v in d.iteritems(): res[v] = k
return res
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
class Traceback: class Traceback:
'''Dumps the last traceback into a string.''' '''Dumps the last traceback into a string.'''