--- a/src/pyams_skin/interfaces/__init__.py Thu May 03 12:39:11 2018 +0200
+++ b/src/pyams_skin/interfaces/__init__.py Fri May 04 09:56:55 2018 +0200
@@ -60,6 +60,11 @@
required=True,
default=False)
+ no_inherit_skin = Bool(title=_("Don't inherit parent skin?"),
+ description=_("Should we override parent skin?"),
+ required=True,
+ default=True)
+
skin_parent = Attribute("Skin parent (local or inherited)")
skin = Choice(title=_("Custom graphic theme"),
@@ -69,7 +74,7 @@
@invariant
def check_skin(self):
- if not (self.skin or self.inherit_skin):
+ if self.no_inherit_skin and not self.skin:
raise Invalid(_("You must select a custom skin or inherit from parent!"))
def get_skin(self, request=None):
Binary file src/pyams_skin/locales/fr/LC_MESSAGES/pyams_skin.mo has changed
--- a/src/pyams_skin/locales/fr/LC_MESSAGES/pyams_skin.po Thu May 03 12:39:11 2018 +0200
+++ b/src/pyams_skin/locales/fr/LC_MESSAGES/pyams_skin.po Fri May 04 09:56:55 2018 +0200
@@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE 1.0\n"
-"POT-Creation-Date: 2018-04-06 13:48+0200\n"
+"POT-Creation-Date: 2018-05-04 09:36+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -15,45 +15,45 @@
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Lingua 3.8\n"
-#: src/pyams_skin/table.py:65
+#: src/pyams_skin/table.py:85
msgid "Container elements"
msgstr "Contenu"
-#: src/pyams_skin/table.py:196
+#: src/pyams_skin/table.py:216
msgid "Name"
msgstr "Nom"
-#: src/pyams_skin/table.py:214
+#: src/pyams_skin/table.py:234
msgid "Properties"
msgstr "Propriétés"
-#: src/pyams_skin/table.py:298
+#: src/pyams_skin/table.py:318
msgid "Click and drag to sort rows"
msgstr "Faire un cliquer/déposer pour trier les éléments"
-#: src/pyams_skin/table.py:316
+#: src/pyams_skin/table.py:337
msgid "Switch element visibility"
msgstr "Cliquez pour rendre l'élément visible ou non"
-#: src/pyams_skin/table.py:340
+#: src/pyams_skin/table.py:361
msgid "Actions"
msgstr "Actions"
-#: src/pyams_skin/table.py:361
+#: src/pyams_skin/table.py:382
msgid "Delete object"
msgstr "Supprimer l'objet"
-#: src/pyams_skin/skin.py:139
+#: src/pyams_skin/skin.py:154
msgid "PyAMS base skin"
msgstr "Skin PyAMS par défaut"
-#: src/pyams_skin/container.py:61
+#: src/pyams_skin/container.py:71
msgid "No provided object_name argument!"
msgstr "Argument 'object_name' non fourni !"
-#: src/pyams_skin/container.py:69
-msgid "Given plug-in name doesn't exist!"
-msgstr "Le plug-in indiqué n'existe pas !"
+#: src/pyams_skin/container.py:84
+msgid "Given element name doesn't exist!"
+msgstr "L'élément indiqué n'existe pas !"
#: src/pyams_skin/templates/header.pt:5
msgid "Back to previous page"
@@ -190,17 +190,25 @@
msgid "Should we reuse parent skin?"
msgstr "Si 'oui', le même thème que celui du niveau parent sera utilisé"
-#: src/pyams_skin/interfaces/__init__.py:65
+#: src/pyams_skin/interfaces/__init__.py:63
+msgid "Don't inherit parent skin?"
+msgstr "Ne pas hériter du thème du parent ?"
+
+#: src/pyams_skin/interfaces/__init__.py:64
+msgid "Should we override parent skin?"
+msgstr "Si 'non', le même thème que celui du niveau parent sera utilisé"
+
+#: src/pyams_skin/interfaces/__init__.py:70
msgid "Custom graphic theme"
msgstr "Choisir un thème spécifique"
-#: src/pyams_skin/interfaces/__init__.py:66
+#: src/pyams_skin/interfaces/__init__.py:71
msgid "This theme will be used to handle graphic design (colors and images)"
msgstr ""
"Ce thème sera utilisé pour prendre en charge le modèle de présentation "
"(palette de couleurs et images)"
-#: src/pyams_skin/interfaces/__init__.py:73
+#: src/pyams_skin/interfaces/__init__.py:78
msgid "You must select a custom skin or inherit from parent!"
msgstr ""
"Vous devez choisir un thème spécifique ou hériter de celui du niveau parent"
--- a/src/pyams_skin/locales/pyams_skin.pot Thu May 03 12:39:11 2018 +0200
+++ b/src/pyams_skin/locales/pyams_skin.pot Fri May 04 09:56:55 2018 +0200
@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE 1.0\n"
-"POT-Creation-Date: 2018-04-06 13:48+0200\n"
+"POT-Creation-Date: 2018-05-04 09:36+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -16,44 +16,44 @@
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Lingua 3.10.dev0\n"
-#: ./src/pyams_skin/table.py:65
+#: ./src/pyams_skin/table.py:85
msgid "Container elements"
msgstr ""
-#: ./src/pyams_skin/table.py:196
+#: ./src/pyams_skin/table.py:216
msgid "Name"
msgstr ""
-#: ./src/pyams_skin/table.py:214
+#: ./src/pyams_skin/table.py:234
msgid "Properties"
msgstr ""
-#: ./src/pyams_skin/table.py:298
+#: ./src/pyams_skin/table.py:318
msgid "Click and drag to sort rows"
msgstr ""
-#: ./src/pyams_skin/table.py:316
+#: ./src/pyams_skin/table.py:337
msgid "Switch element visibility"
msgstr ""
-#: ./src/pyams_skin/table.py:340
-msgid "Actions"
-msgstr ""
-
#: ./src/pyams_skin/table.py:361
+msgid "Actions"
+msgstr ""
+
+#: ./src/pyams_skin/table.py:382
msgid "Delete object"
msgstr ""
-#: ./src/pyams_skin/skin.py:139
+#: ./src/pyams_skin/skin.py:154
msgid "PyAMS base skin"
msgstr ""
-#: ./src/pyams_skin/container.py:61
+#: ./src/pyams_skin/container.py:71
msgid "No provided object_name argument!"
msgstr ""
-#: ./src/pyams_skin/container.py:69
-msgid "Given plug-in name doesn't exist!"
+#: ./src/pyams_skin/container.py:84
+msgid "Given element name doesn't exist!"
msgstr ""
#: ./src/pyams_skin/templates/header.pt:5
@@ -184,15 +184,23 @@
msgid "Should we reuse parent skin?"
msgstr ""
-#: ./src/pyams_skin/interfaces/__init__.py:65
+#: ./src/pyams_skin/interfaces/__init__.py:63
+msgid "Don't inherit parent skin?"
+msgstr ""
+
+#: ./src/pyams_skin/interfaces/__init__.py:64
+msgid "Should we override parent skin?"
+msgstr ""
+
+#: ./src/pyams_skin/interfaces/__init__.py:70
msgid "Custom graphic theme"
msgstr ""
-#: ./src/pyams_skin/interfaces/__init__.py:66
+#: ./src/pyams_skin/interfaces/__init__.py:71
msgid "This theme will be used to handle graphic design (colors and images)"
msgstr ""
-#: ./src/pyams_skin/interfaces/__init__.py:73
+#: ./src/pyams_skin/interfaces/__init__.py:78
msgid "You must select a custom skin or inherit from parent!"
msgstr ""
--- a/src/pyams_skin/skin.py Thu May 03 12:39:11 2018 +0200
+++ b/src/pyams_skin/skin.py Fri May 04 09:56:55 2018 +0200
@@ -25,6 +25,7 @@
# import packages
from pyams_utils.registry import utility_config
from pyams_utils.traversing import get_parent
+from pyams_utils.zodb import volatile_property
from pyramid.events import subscriber
from pyramid.threadlocal import get_current_request
from pyramid_zope_request import PyramidPublisherRequest
@@ -51,17 +52,31 @@
@inherit_skin.setter
def inherit_skin(self, value):
- self._inherit_skin = value if self.can_inherit_skin else False
+ if self.can_inherit_skin:
+ self._inherit_skin = value
+ del self.skin_parent
+
+ @property
+ def no_inherit_skin(self):
+ return not bool(self.inherit_skin)
+
+ @no_inherit_skin.setter
+ def no_inherit_skin(self, value):
+ self.inherit_skin = not bool(value)
@property
def skin(self):
- return self._skin
+ if not self.inherit_skin:
+ return self._skin
+ else:
+ return self.skin_parent.skin
@skin.setter
def skin(self, value):
- self._skin = None if self.inherit_skin else value
+ if not self.inherit_skin:
+ self._skin = value
- @property
+ @volatile_property
def skin_parent(self):
if (not self._inherit_skin) and self.skin:
return self