Mercurial > libervia-desktop-kivy
comparison cagou/core/cagou_main.py @ 172:7103655647aa
core: hide notifications header on M-n
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 29 Apr 2018 14:56:29 +0200 |
parents | 37220459e93d |
children | 620f69e4e378 |
comparison
equal
deleted
inserted
replaced
171:27b4ceb977c7 | 172:7103655647aa |
---|---|
119 class RootHeadWidget(BoxLayout): | 119 class RootHeadWidget(BoxLayout): |
120 """Notifications widget""" | 120 """Notifications widget""" |
121 manager = properties.ObjectProperty() | 121 manager = properties.ObjectProperty() |
122 notifs_icon = properties.ObjectProperty() | 122 notifs_icon = properties.ObjectProperty() |
123 notes = properties.ListProperty() | 123 notes = properties.ListProperty() |
124 HEIGHT = dp(35) | |
124 | 125 |
125 def __init__(self): | 126 def __init__(self): |
126 super(RootHeadWidget, self).__init__() | 127 super(RootHeadWidget, self).__init__() |
127 self.notes_last = None | 128 self.notes_last = None |
128 self.notes_event = None | 129 self.notes_event = None |
172 root_body = properties.ObjectProperty | 173 root_body = properties.ObjectProperty |
173 | 174 |
174 def __init__(self, main_widget): | 175 def __init__(self, main_widget): |
175 super(CagouRootWidget, self).__init__() | 176 super(CagouRootWidget, self).__init__() |
176 # header | 177 # header |
177 self._head_widget = RootHeadWidget() | 178 self.head_widget = RootHeadWidget() |
178 self.root_body.add_widget(self._head_widget) | 179 self.root_body.add_widget(self.head_widget) |
179 # body | 180 # body |
180 self._manager = ScreenManager() | 181 self._manager = ScreenManager() |
181 # main widgets | 182 # main widgets |
182 main_screen = Screen(name='main') | 183 main_screen = Screen(name='main') |
183 main_screen.add_widget(main_widget) | 184 main_screen.add_widget(main_widget) |
213 self._manager.transition = RiseInTransition() | 214 self._manager.transition = RiseInTransition() |
214 self._manager.current = screen | 215 self._manager.current = screen |
215 | 216 |
216 def newAction(self, handler, action_data, id_, security_limit, profile): | 217 def newAction(self, handler, action_data, id_, security_limit, profile): |
217 """Add a notification for an action""" | 218 """Add a notification for an action""" |
218 self._head_widget.addNotif(handler, action_data, id_, security_limit, profile) | 219 self.head_widget.addNotif(handler, action_data, id_, security_limit, profile) |
219 | 220 |
220 def addNote(self, title, message, level): | 221 def addNote(self, title, message, level): |
221 self._head_widget.addNote(title, message, level) | 222 self.head_widget.addNote(title, message, level) |
222 | 223 |
223 def addNotifUI(self, ui): | 224 def addNotifUI(self, ui): |
224 self._head_widget.addNotifUI(ui) | 225 self.head_widget.addNotifUI(ui) |
225 | 226 |
226 | 227 |
227 class CagouApp(App): | 228 class CagouApp(App): |
228 """Kivy App for Cagou""" | 229 """Kivy App for Cagou""" |
229 | 230 |
300 if menu.height: | 301 if menu.height: |
301 Animation(height=0, duration=0.3).start(menu) | 302 Animation(height=0, duration=0.3).start(menu) |
302 else: | 303 else: |
303 Animation(height=menu.HEIGHT, duration=0.3).start(menu) | 304 Animation(height=menu.HEIGHT, duration=0.3).start(menu) |
304 return True | 305 return True |
306 elif key == 110 and modifier == ['alt']: | |
307 # M-n we hide/show notifications | |
308 head = self.root.head_widget | |
309 if head.height: | |
310 Animation(height=0, opacity=0, duration=0.3).start(head) | |
311 else: | |
312 Animation(height=head.HEIGHT, opacity=1, duration=0.3).start(head) | |
313 return True | |
305 else: | 314 else: |
306 return False | 315 return False |
307 | 316 |
308 | 317 |
309 class Cagou(QuickApp): | 318 class Cagou(QuickApp): |