Mercurial > libervia-desktop-kivy
changeset 416:3e2333a11f61
common: implemented SymbolToggleLabel:
- SymbolLabel doesn't do button behaviour anymore
- SymbolButtonLabel does the button behaviour (to use instead of former SymbolLabel)
- SymbolToggleLabel does toggle button behaviour
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 23 Feb 2020 17:13:15 +0100 |
parents | 5761b5f03c0c |
children | 5b50b7ef2617 |
files | cagou/core/common.py cagou/kv/common.kv cagou/kv/share_widget.kv cagou/plugins/plugin_wid_chat.kv cagou/plugins/plugin_wid_contact_list.kv |
diffstat | 5 files changed, 21 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/cagou/core/common.py Sun Feb 23 15:39:06 2020 +0100 +++ b/cagou/core/common.py Sun Feb 23 17:13:15 2020 +0100 @@ -159,7 +159,7 @@ pass -class SymbolLabel(ButtonBehavior, BoxLayout): +class SymbolLabel(BoxLayout): symbol = properties.StringProperty("") text = properties.StringProperty("") color = properties.ListProperty(C.COLOR_SEC) @@ -168,6 +168,14 @@ label = properties.ObjectProperty() +class SymbolButtonLabel(ButtonBehavior, SymbolLabel): + pass + + +class SymbolToggleLabel(ToggleButtonBehavior, SymbolLabel): + pass + + class ActionSymbol(Symbol): pass
--- a/cagou/kv/common.kv Sun Feb 23 15:39:06 2020 +0100 +++ b/cagou/kv/common.kv Sun Feb 23 17:13:15 2020 +0100 @@ -133,6 +133,15 @@ text: root.text bold: root.bold +<SymbolToggleLabel>: + color: 0, 0, 0, 1 + canvas.before: + Color: + rgba: app.c_sec_light if self.state == 'down' else (0, 0, 0, 0) + RoundedRectangle: + pos: self.pos + size: self.size + <ActionSymbol>: bg_color: 0, 0, 0, 0 color: app.c_sec_light
--- a/cagou/kv/share_widget.kv Sun Feb 23 15:39:06 2020 +0100 +++ b/cagou/kv/share_widget.kv Sun Feb 23 17:13:15 2020 +0100 @@ -107,7 +107,7 @@ size_hint: 1, None height: dp(100) Widget: - SymbolLabel: + SymbolButtonLabel: symbol: "doc" text: Path(root.path).name Widget:
--- a/cagou/plugins/plugin_wid_chat.kv Sun Feb 23 15:39:06 2020 +0100 +++ b/cagou/plugins/plugin_wid_chat.kv Sun Feb 23 17:13:15 2020 +0100 @@ -46,7 +46,7 @@ RoundedRectangle: pos: self.x + dp(1), self.y + dp(1) size: (self.width - dp(2)) * root.progress / 100, self.height - dp(2) - SymbolLabel: + SymbolButtonLabel: symbol: root.get_symbol(root.data) color: 0, 0, 0, 1 text: root.data.get('name', _('unnamed'))
--- a/cagou/plugins/plugin_wid_contact_list.kv Sun Feb 23 15:39:06 2020 +0100 +++ b/cagou/plugins/plugin_wid_contact_list.kv Sun Feb 23 17:13:15 2020 +0100 @@ -84,7 +84,7 @@ width: dp(35) font_size: dp(30) Widget: - SymbolLabel: + SymbolButtonLabel: symbol: 'plus-circled' text: _("add a contact") on_release: root.addContactMenu()