diff cagou/plugins/plugin_wid_chat.kv @ 242:c2503168fab7

plugin chat (encryption): added a button to display trust management UI.
author Goffi <goffi@goffi.org>
date Thu, 03 Jan 2019 10:52:57 +0100
parents ba8f3a4a5ac7
children 5bd94bc08f5c
line wrap: on
line diff
--- a/cagou/plugins/plugin_wid_chat.kv	Thu Jan 03 10:42:43 2019 +0100
+++ b/cagou/plugins/plugin_wid_chat.kv	Thu Jan 03 10:52:57 2019 +0100
@@ -134,16 +134,29 @@
     color: self.getColor()
     symbol: self.getSymbol()
 
+<TrustManagementButton>:
+    symbol: "shield"
+    padding: dp(5), dp(10)
+    bg_color: app.c_prim_dark
+    size_hint: None, 1
+    width: dp(30)
+    on_release: self.parent.dispatch("on_trust_release")
+
 <EncryptionButton>:
-    group: 'encryption'
     size_hint: None, None
-    width: max(self.texture_size[0], self.parent.minimum_width if self.parent else 0)
-    height: self.texture_size[1]
-    padding: dp(5), dp(10)
-    color: 0, 0, 0, 1
-    bold: True
-    background_normal: app.expand('{media}/misc/borders/border_filled_black.png')
-    background_color: app.c_sec if self.selected else app.c_prim_dark
+    width: self.parent.parent.best_width if self.parent is not None else 30
+    height: dp(30)
+    on_best_width: self.parent.parent.best_width = max(self.parent.parent.best_width, args[1])
+    Button:
+        text: root.text
+        size_hint: 1, 1
+        padding: dp(5), dp(10)
+        color: 0, 0, 0, 1
+        bold: True
+        background_normal: app.expand('{media}/misc/borders/border_filled_black.png')
+        background_color: app.c_sec if root.selected else app.c_prim_dark
+        on_release: root.dispatch("on_release")
+        on_texture_size: root.best_width = self.texture_size[0] + (dp(30) if root.trust_button else 0)
 
 <EncryptionMenu>:
     size_hint_x: None