diff cagou/kv/root_widget.kv @ 247:cf61a011f731

core (notes), common (symbol): added an icon showing note level: because of Symbol binding, it was difficult to precisely set the icon position, so Symbol has been modified to remove bindings. Added consts for INFO, WARNING and ERROR colors.
author Goffi <goffi@goffi.org>
date Sat, 26 Jan 2019 20:24:48 +0100
parents c5c1dd7f88e1
children ff1efdeff53f
line wrap: on
line diff
--- a/cagou/kv/root_widget.kv	Fri Jan 04 13:20:29 2019 +0100
+++ b/cagou/kv/root_widget.kv	Sat Jan 26 20:24:48 2019 +0100
@@ -15,6 +15,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 #:import IconButton cagou.core.common.IconButton
+#:import C cagou.core.constants.Const
 
 # <NotifIcon>:
 #     source: app.expand("{media}/icons/muchoslava/png/cagou_profil_bleu_32.png")
@@ -30,23 +31,46 @@
     shorten_from: 'right'
 
 <NoteDrop>:
+    orientation: 'horizontal'
+    size_hint: 1, None
+    height: label.height
+    symbol: symbol
     canvas.before:
         BorderImage:
             pos: self.pos
             size: self.size
             source: 'atlas://data/images/defaulttheme/button'
-    size_hint: 1, None
-    color: 1, 1, 1, 1
-    text: self.message
-    text_size: self.width, None
-    halign: 'center'
-    size: self.texture_size
-    padding: dp(2), dp(10)
+    Widget:
+        size_hint: None, 1
+        width: dp(20)
+    Symbol:
+        id: symbol
+        size_hint: None, None
+        width: dp(30)
+        height: label.height
+        padding_y: dp(10)
+        valign: 'top'
+        haligh: 'right'
+        symbol: root.level
+        color:
+            {C.XMLUI_DATA_LVL_INFO: app.c_prim_light,\
+            C.XMLUI_DATA_LVL_WARNING: C.COLOR_WARNING,\
+            C.XMLUI_DATA_LVL_ERROR: C.COLOR_ERROR}[root.level]
+    Label:
+        id: label
+        size_hint: 1, None
+        color: 1, 1, 1, 1
+        text: root.message
+        text_size: self.width, None
+        halign: 'center'
+        size: self.texture_size
+        padding: dp(2), dp(10)
 
 <NotesDrop>:
     clear_btn: clear_btn.__self__
     auto_width: False
-    size_hint: 0.8, None
+    size_hint: 0.9, None
+    size_hint_max_x: dp(400)
     canvas.before:
         Color:
             rgba: 0.8, 0.8, 0.8, 1