# HG changeset patch # User Goffi # Date 1525006589 -7200 # Node ID 7103655647aac8bfcbc192cf32772d7ea8aac0b8 # Parent 27b4ceb977c7a775a6ec842726ffc1c0b8fce039 core: hide notifications header on M-n diff -r 27b4ceb977c7 -r 7103655647aa cagou/core/cagou_main.py --- 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 diff -r 27b4ceb977c7 -r 7103655647aa cagou/kv/root_widget.kv --- 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