From bfd2f000309e5d6f249f8683e56a634654c75288 Mon Sep 17 00:00:00 2001 From: Enigma228322 Date: Mon, 2 Nov 2020 14:09:13 +0500 Subject: [PATCH] :zap: delete colors when deactivate items Signed-off-by: Enigma228322 --- theme_kit/models/theme.py | 145 ++++-- theme_kit/views/theme.xml | 922 ++++++++++++-------------------------- 2 files changed, 395 insertions(+), 672 deletions(-) diff --git a/theme_kit/models/theme.py b/theme_kit/models/theme.py index 63fd1cea0f..bd18be408d 100644 --- a/theme_kit/models/theme.py +++ b/theme_kit/models/theme.py @@ -146,6 +146,28 @@ def _compute_backend_theme_installed(self): else False ) + @api.multi + def write(self, vals): + res = super(ThemeTopPanel, self).write(vals) + if not vals.get("top_panel_bg_active", "Not found"): + self.top_panel_bg = "" + if not vals.get("top_panel_border_active", "Not found"): + self.top_panel_border = "" + if not vals.get("top_panel_font_active", "Not found"): + self.top_panel_font = "" + if not vals.get("top_panel_active_item_font_active", "Not found"): + self.top_panel_active_item_font = "" + if not vals.get("top_panel_active_item_bg_active", "Not found"): + self.top_panel_active_item_bg = "" + if not vals.get("top_panel_hover_item_font_active", "Not found"): + self.top_panel_hover_item_font = "" + if not vals.get("top_panel_hover_item_bg_active", "Not found"): + self.top_panel_hover_item_bg = "" + if not vals.get("left_panel_main_menu_active", "Not found"): + self.left_panel_main_menu = "" + if not vals.get("left_panel_sub_menu_active", "Not found"): + self.top_panel_hover_item_bg = "" + @api.multi def _compute_less(self): for r in self: @@ -192,40 +214,41 @@ def _compute_less(self): ) if self.top_panel_border_active: - code = ( - code - + """.o_main_navbar{{ - border-color: {theme.top_panel_border}; - }} - #oe_main_menu_navbar{{ - border-color: {theme.top_panel_border}; - }} - .o_control_panel {{ - border-bottom-color: {theme.top_panel_border}!important; - }} - .o_form_statusbar .o_arrow_button{{ - border-color: lighten({theme.top_panel_border}, 40%)!important; - }} - .o_form_statusbar .o_arrow_button:before{{ - border-left-color: lighten({theme.top_panel_border}, 40%)!important; - }} - .o_list_view thead {{ - color: {theme.top_panel_border}; - }} - .o_list_view thead > tr > th {{ - border-color: {theme.top_panel_border}; - }} - """ - ) - # Compatibility theme_kit and material backend theme modules - code = ( - code - + """.main-nav {{ - border: 1px solid {theme.top_panel_border} !important; - border-left: 0 !important; - border-right: 0 !important; - }} - """ + if not self.backend_theme_installed: + code = ( + code + + """.o_main_navbar{{ + border-color: {theme.top_panel_border}; + }} + #oe_main_menu_navbar{{ + border-color: {theme.top_panel_border}; + }} + .o_control_panel {{ + border-bottom-color: {theme.top_panel_border}!important; + }} + .o_form_statusbar .o_arrow_button{{ + border-color: lighten({theme.top_panel_border}, 40%)!important; + }} + .o_form_statusbar .o_arrow_button:before{{ + border-left-color: lighten({theme.top_panel_border}, 40%)!important; + }} + .o_list_view thead {{ + color: {theme.top_panel_border}; + }} + .o_list_view thead > tr > th {{ + border-color: {theme.top_panel_border}; + }} + """ + ) + else: + # Compatibility theme_kit and material backend theme modules + import wdb;wdb.set_trace() + code = ( + code + + """header {{ + border-bottom: 1px solid {theme.top_panel_border} !important; + }} + """ ) if self.top_panel_font_active and not self.backend_theme_installed: code = ( @@ -457,6 +480,26 @@ def _compute_backend_theme_installed(self): default=False, help="Font color for Top Panel" ) + @api.multi + def write(self, vals): + res = super(ThemeLeftPanel, self).write(vals) + if not vals.get("left_panel_bg_active", "Not found"): + self.left_panel_bg = "" + if not vals.get("left_panel_sub_menu_active", "Not found"): + self.left_panel_sub_menu = "" + if not vals.get("left_panel_main_menu_active", "Not found"): + self.left_panel_main_menu = "" + if not vals.get("left_panel_active_item_font_active", "Not found"): + self.left_panel_active_item_font = "" + if not vals.get("left_panel_active_item_bg_active", "Not found"): + self.left_panel_active_item_bg = "" + if not vals.get("left_panel_hover_item_font_active", "Not found"): + self.left_panel_hover_item_font = "" + if not vals.get("left_panel_hover_item_bg_active", "Not found"): + self.left_panel_hover_item_bg = "" + if not vals.get("left_panel_right_border_active", "Not found"): + self.left_panel_right_border = "" + @api.multi def _compute_less(self): self.backend_theme_installed = ( @@ -723,6 +766,40 @@ def _compute_backend_theme_installed(self): else False ) + @api.multi + def write(self, vals): + res = super(ThemeContent, self).write(vals) + if not vals.get("content_bg_active", "Not found"): + self.content_bg = "" + if not vals.get("content_button_active", "Not found"): + self.content_button = "" + if not vals.get("content_form_active", "Not found"): + self.content_form = "" + if not vals.get("content_form_text_active", "Not found"): + self.content_form_text = "" + if not vals.get("content_form_title_active", "Not found"): + self.content_form_title = "" + if not vals.get("content_text_active", "Not found"): + self.content_text = "" + if not vals.get("content_form_link_active", "Not found"): + self.content_form_link = "" + if not vals.get("content_loader_active", "Not found"): + self.content_loader = "" + if not vals.get("content_loader_text_active", "Not found"): + self.content_loader_text = "" + if not vals.get("content_statusbar_bg_active", "Not found"): + self.content_statusbar_bg = "" + if not vals.get("content_statusbar_element_active", "Not found"): + self.content_statusbar_element = "" + if not vals.get("content_statusbar_font_color_active", "Not found"): + self.content_statusbar_font_color = "" + if not vals.get("content_main_menu_font_color_active", "Not found"): + self.content_main_menu_font_color = "" + if not vals.get("content_footer_color_active", "Not found"): + self.content_footer_color = "" + if not vals.get("content_required_field_back_color_active", "Not found"): + self.content_required_field_back_color = "" + @api.multi def _compute_less(self): self.backend_theme_installed = ( diff --git a/theme_kit/views/theme.xml b/theme_kit/views/theme.xml index 5539a08ce6..b7ae33ca88 100644 --- a/theme_kit/views/theme.xml +++ b/theme_kit/views/theme.xml @@ -1,648 +1,294 @@ - + - - theme_kit.theme.tree - theme_kit.theme - - - - - - - - theme_kit.theme.form - theme_kit.theme - -
- -
-
- - - + + theme_kit.theme.tree + theme_kit.theme + + + + + + + + + theme_kit.theme.form + theme_kit.theme + + + +
+
+ + + + + + + - - + + + + - - - - + + + + +
+ +
+
+ + theme_kit.top_panel.form + theme_kit.top_panel + +
+ +
+
+ + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- - - - - -
-
-
-
- - theme_kit.top_panel.form - theme_kit.top_panel - -
- -
- -
- - -
-
-
-
- -
-
-
-
-
-
-
-
-
-
- -
-
-
-
+
+
+
+
+ + theme_kit.left_panel.form + theme_kit.left_panel + +
+ +
+
+ + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- -
-
-
-
- - theme_kit.left_panel.form - theme_kit.left_panel - -
- -
- -
- - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+ + theme_kit.content.form + theme_kit.content + +
+ +
+
+ + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
- -
-
-
-
- - theme_kit.content.form - theme_kit.content - -
- -
-
- - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - Color Scheme - ir.actions.act_window - theme_kit.theme - form - tree,form - - - Color Top Panel - ir.actions.act_window - theme_kit.top_panel - form - tree,form - - - Color Left Panel - ir.actions.act_window - theme_kit.left_panel - form - tree,form - - - Color Content - ir.actions.act_window - theme_kit.content - form - tree,form - - - - - - +
+ +
+
+ + + Color Scheme + ir.actions.act_window + theme_kit.theme + form + tree,form + + + + Color Top Panel + ir.actions.act_window + theme_kit.top_panel + form + tree,form + + + + Color Left Panel + ir.actions.act_window + theme_kit.left_panel + form + tree,form + + + + Color Content + ir.actions.act_window + theme_kit.content + form + tree,form + + + + + + + +