Mercurial > libervia-desktop-kivy
changeset 172:7103655647aa
core: hide notifications header on M-n
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 29 Apr 2018 14:56:29 +0200 |
parents | 27b4ceb977c7 |
children | 5cf17930bb09 |
files | cagou/core/cagou_main.py cagou/kv/root_widget.kv |
diffstat | 2 files changed, 15 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/cagou/core/cagou_main.py Sun Apr 29 13:10:14 2018 +0200 +++ b/cagou/core/cagou_main.py Sun Apr 29 14:56:29 2018 +0200 @@ -121,6 +121,7 @@ manager = properties.ObjectProperty() notifs_icon = properties.ObjectProperty() notes = properties.ListProperty() + HEIGHT = dp(35) def __init__(self): super(RootHeadWidget, self).__init__() @@ -174,8 +175,8 @@ def __init__(self, main_widget): super(CagouRootWidget, self).__init__() # header - self._head_widget = RootHeadWidget() - self.root_body.add_widget(self._head_widget) + self.head_widget = RootHeadWidget() + self.root_body.add_widget(self.head_widget) # body self._manager = ScreenManager() # main widgets @@ -215,13 +216,13 @@ def newAction(self, handler, action_data, id_, security_limit, profile): """Add a notification for an action""" - self._head_widget.addNotif(handler, action_data, id_, security_limit, profile) + self.head_widget.addNotif(handler, action_data, id_, security_limit, profile) def addNote(self, title, message, level): - self._head_widget.addNote(title, message, level) + self.head_widget.addNote(title, message, level) def addNotifUI(self, ui): - self._head_widget.addNotifUI(ui) + self.head_widget.addNotifUI(ui) class CagouApp(App): @@ -302,6 +303,14 @@ else: Animation(height=menu.HEIGHT, duration=0.3).start(menu) return True + elif key == 110 and modifier == ['alt']: + # M-n we hide/show notifications + head = self.root.head_widget + if head.height: + Animation(height=0, opacity=0, duration=0.3).start(head) + else: + Animation(height=head.HEIGHT, opacity=1, duration=0.3).start(head) + return True else: return False
--- a/cagou/kv/root_widget.kv Sun Apr 29 13:10:14 2018 +0200 +++ b/cagou/kv/root_widget.kv Sun Apr 29 14:56:29 2018 +0200 @@ -59,7 +59,7 @@ manager: manager notifs_icon: notifs_icon size_hint: 1, None - height: dp(35) + height: self.HEIGHT IconButton: source: app.expand("{media}/icons/muchoslava/png/cagou_profil_bleu_48.png") if root.notes else '' allow_stretch: True