Updated map paragraph form manager
authorThierry Florac <tflorac@ulthar.net>
Mon, 01 Feb 2021 13:35:46 +0100
changeset 546 4d60dd445586
parent 545 6c3a314183f0
child 547 ac39aec467ea
Updated map paragraph form manager
src/pyams_default_theme/component/paragraph/zmi/map.py
--- a/src/pyams_default_theme/component/paragraph/zmi/map.py	Wed Jan 27 16:16:25 2021 +0100
+++ b/src/pyams_default_theme/component/paragraph/zmi/map.py	Mon Feb 01 13:35:46 2021 +0100
@@ -14,47 +14,38 @@
 
 
 from pyams_content.component.paragraph.interfaces.map import have_gis
+
+
 if have_gis:
 
-    # import standard library
+    from z3c.form import field
+    from z3c.form.browser.checkbox import SingleCheckBoxFieldWidget
 
-    # import interfaces
-    from pyams_default_theme.component.paragraph.interfaces.map import IMapParagraphDefaultRendererSettings
+    from pyams_default_theme.component.paragraph.interfaces.map import \
+        IMapParagraphDefaultRendererSettings
     from pyams_form.interfaces.form import IFormManager
+    from pyams_form.manager import DialogEditFormFormManager
     from pyams_skin.layer import IPyAMSLayer
-
-    # import packages
     from pyams_content.features.renderer.zmi import RendererPropertiesEditForm
     from pyams_form.group import NamedWidgetsGroup
-    from pyams_utils.adapter import adapter_config, ContextRequestViewAdapter
+    from pyams_utils.adapter import adapter_config
     from pyams_zmi.form import AdminDialogEditForm
-    from z3c.form import field
-    from z3c.form.browser.checkbox import SingleCheckBoxFieldWidget
 
     from pyams_default_theme import _
 
 
-    @adapter_config(context=(IMapParagraphDefaultRendererSettings, IPyAMSLayer, RendererPropertiesEditForm),
+    @adapter_config(context=(IMapParagraphDefaultRendererSettings, IPyAMSLayer,
+                             RendererPropertiesEditForm),
                     provides=IFormManager)
-    class MapParagraphDefaultRendererSettingsFormManager(ContextRequestViewAdapter):
+    class MapParagraphDefaultRendererSettingsFormManager(DialogEditFormFormManager):
         """Map paragraph default renderer settings form manager"""
 
         def getFields(self):
-            fields = field.Fields(IMapParagraphDefaultRendererSettings).omit('use_default_map_configuration')
+            fields = field.Fields(IMapParagraphDefaultRendererSettings).omit(
+                'use_default_map_configuration')
             fields['no_use_default_map_configuration'].widgetFactory = SingleCheckBoxFieldWidget
             return fields
 
-        def update(self):
-            view = self.view
-            view.dialog_class = 'modal-large'
-            AdminDialogEditForm.update(view)
-
-        def updateWidgets(self, prefix=None):
-            AdminDialogEditForm.updateWidgets(self.view, prefix)
-
-        def updateActions(self):
-            AdminDialogEditForm.updateActions(self.view)
-
         def updateGroups(self):
             form = self.view
             form.add_group(NamedWidgetsGroup(form, 'configuration', form.widgets,
@@ -63,5 +54,6 @@
                                              css_class='inner',
                                              switch=True,
                                              checkbox_switch=True,
-                                             checkbox_field=IMapParagraphDefaultRendererSettings['no_use_default_map_configuration']))
+                                             checkbox_field=IMapParagraphDefaultRendererSettings[
+                                                 'no_use_default_map_configuration']))
             AdminDialogEditForm.updateGroups(form)