changeset 364:4cf735b40304

browser_side: hide the syntax label when wysiwyg edtion is active
author souliane <souliane@mailoo.org>
date Wed, 19 Feb 2014 17:52:39 +0100
parents 187126b63170
children a74a2dfbe4f5
files browser_side/richtext.py public/libervia.css
diffstat 2 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/browser_side/richtext.py	Wed Feb 19 16:42:37 2014 +0100
+++ b/browser_side/richtext.py	Wed Feb 19 17:52:39 2014 +0100
@@ -153,13 +153,13 @@
             self.toolbar.addStyleName(self.style['toolbar'])
             for key in composition.RICH_SYNTAXES[syntax].keys():
                 self.addToolbarButton(syntax, key)
-            label = Label(_("Syntax: %s") % syntax)
-            label.addStyleName("richTextSyntaxLabel")
-            self.toolbar.add(label)
             self.wysiwyg_button = CheckBox('Wysiwyg edition')
             wysiywgCb = lambda sender: self.setWysiwyg(sender.getChecked())
             self.wysiwyg_button.addClickListener(wysiywgCb)
             self.toolbar.add(self.wysiwyg_button)
+            self.syntax_label = Label(_("Syntax: %s") % syntax)
+            self.syntax_label.addStyleName("richTextSyntaxLabel")
+            self.toolbar.add(self.syntax_label)
             self.getFlexCellFormatter().setColSpan(self.toolbar_offset + count, 0, 2)
             self.setWidget(self.toolbar_offset + count, 0, self.toolbar)
             count += 1
@@ -170,8 +170,17 @@
         @param init: set to True to re-init without switching the widgets."""
         def setWysiwyg():
             self.wysiwyg = wysiwyg
-            if hasattr(self, 'wysiwyg_button'):
+            try:
                 self.wysiwyg_button.setChecked(wysiwyg)
+            except TypeError:
+                pass
+            try:
+                if wysiwyg:
+                    self.syntax_label.addStyleName('transparent')
+                else:
+                    self.syntax_label.removeStyleName('transparent')
+            except TypeError:
+                pass
             if not wysiwyg:
                 self.display.removeStyleName('richTextWysiwyg')
 
--- a/public/libervia.css	Wed Feb 19 16:42:37 2014 +0100
+++ b/public/libervia.css	Wed Feb 19 17:52:39 2014 +0100
@@ -1241,6 +1241,10 @@
     margin: auto;
 }
 
+.transparent {
+    opacity: 0;
+}
+
 /* URLs */
 
 a.url {