changeset 274:7d5297984191

core, chat: UI improvments: - better aligment of elements on left and right border, using new app.MARGIN_LEFT and app.MARGIN_RIGHT constants - Better sizing of JidItem, avoiding the avatar to touch the bottom border
author Goffi <goffi@goffi.org>
date Wed, 20 Mar 2019 09:29:44 +0100
parents 0ef216091f2b
children 1f88e7781fd0
files cagou/core/cagou_main.py cagou/core/constants.py cagou/kv/cagou_widget.kv cagou/kv/common.kv cagou/kv/root_widget.kv cagou/plugins/plugin_wid_chat.kv
diffstat 6 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/cagou/core/cagou_main.py	Wed Mar 20 09:29:44 2019 +0100
+++ b/cagou/core/cagou_main.py	Wed Mar 20 09:29:44 2019 +0100
@@ -294,6 +294,10 @@
     c_sec = properties.ListProperty(C.COLOR_SEC)
     c_sec_light = properties.ListProperty(C.COLOR_SEC_LIGHT)
     c_sec_dark = properties.ListProperty(C.COLOR_SEC_DARK)
+    # we have to put those constants here and not in core/constants.py
+    # because of the use of dp(), which would import Kivy too early
+    # and prevent the log hack
+    MARGIN_LEFT = MARGIN_RIGHT = dp(10)
 
     def _install_settings_keys(self, window):
         # we don't want default Kivy's behaviour of displaying
--- a/cagou/core/constants.py	Wed Mar 20 09:29:44 2019 +0100
+++ b/cagou/core/constants.py	Wed Mar 20 09:29:44 2019 +0100
@@ -45,3 +45,4 @@
     COLOR_WARNING = (1.0, 1.0, 0.0, 1)
     COLOR_ERROR = (1.0, 0.0, 0.0, 1)
 
+    COLOR_BTN_LIGHT = (0.4, 0.4, 0.4, 1)
--- a/cagou/kv/cagou_widget.kv	Wed Mar 20 09:29:44 2019 +0100
+++ b/cagou/kv/cagou_widget.kv	Wed Mar 20 09:29:44 2019 +0100
@@ -14,6 +14,8 @@
 # You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+#:import C cagou.core.constants.Const
+
 
 <HeaderWidgetChoice>:
     canvas.before:
@@ -59,6 +61,7 @@
         size_hint: 1, None
         height: dp(32)
         spacing: dp(3)
+        padding: app.MARGIN_LEFT, 0, app.MARGIN_RIGHT, 0
         HeaderWidgetCurrent:
             plugin_info: root.plugin_info
             size_hint: None, 1
--- a/cagou/kv/common.kv	Wed Mar 20 09:29:44 2019 +0100
+++ b/cagou/kv/common.kv	Wed Mar 20 09:29:44 2019 +0100
@@ -17,8 +17,9 @@
 
 <JidItem>:
     size_hint: 1, None
-    height: dp(70)
+    height: dp(68)
     avatar: avatar
+    padding: 0, dp(2), 0, dp(2)
     canvas.before:
         Color:
             rgba: self.bg_color
--- a/cagou/kv/root_widget.kv	Wed Mar 20 09:29:44 2019 +0100
+++ b/cagou/kv/root_widget.kv	Wed Mar 20 09:29:44 2019 +0100
@@ -90,6 +90,7 @@
     notifs_icon: notifs_icon
     size_hint: 1, None
     height: self.HEIGHT
+    padding: app.MARGIN_LEFT, 0, app.MARGIN_RIGHT, 0
     IconButton:
         source: app.expand("{media}/icons/muchoslava/png/cagou_profil_bleu_48.png") if root.notes else ''
         allow_stretch: True
--- a/cagou/plugins/plugin_wid_chat.kv	Wed Mar 20 09:29:44 2019 +0100
+++ b/cagou/plugins/plugin_wid_chat.kv	Wed Mar 20 09:29:44 2019 +0100
@@ -82,7 +82,7 @@
                 text: u"[b]{}[/b], {}".format(escape(root.mess_data.nick), root.mess_data.time_text)
             Label:
                 id: delivery
-                color: 0.4, 0.4, 0.4, 1
+                color: C.COLOR_BTN_LIGHT
                 font_size: root.font_size
                 text_size: None, None
                 size_hint: None, None
@@ -115,7 +115,7 @@
         size_hint: 1, None
         height: dp(40)
         spacing: dp(10)
-        padding: [dp(10), 0, dp(15), dp(10)]
+        padding: [app.MARGIN_LEFT, 0, app.MARGIN_RIGHT, dp(10)]
         message_input: message_input
         MessageInputWidget:
             id: message_input