comparison cagou/core/cagou_main.py @ 208:c5c1dd7f88e1

root widget: improved notes: - fixed size/text_size - shorten note when necessary - don't erase notes anymore when more that 10 are available
author Goffi <goffi@goffi.org>
date Fri, 25 May 2018 12:06:08 +0200
parents 33ac2d2ce5d7
children 24f8ab7c08be
comparison
equal deleted inserted replaced
207:a8190aecdd79 208:c5c1dd7f88e1
100 title = properties.StringProperty() 100 title = properties.StringProperty()
101 message = properties.StringProperty() 101 message = properties.StringProperty()
102 level = properties.OptionProperty(C.XMLUI_DATA_LVL_DEFAULT, options=list(C.XMLUI_DATA_LVLS)) 102 level = properties.OptionProperty(C.XMLUI_DATA_LVL_DEFAULT, options=list(C.XMLUI_DATA_LVLS))
103 103
104 104
105 class NoteDrop(Note): 105 class NoteDrop(Label):
106 pass 106 title = properties.StringProperty()
107 message = properties.StringProperty()
108 level = properties.OptionProperty(C.XMLUI_DATA_LVL_DEFAULT, options=list(C.XMLUI_DATA_LVLS))
107 109
108 110
109 class NotesDrop(DropDown): 111 class NotesDrop(DropDown):
110 clear_btn = properties.ObjectProperty() 112 clear_btn = properties.ObjectProperty()
111 113
138 self.notifs_icon.addNotif(callback, *args, **kwargs) 140 self.notifs_icon.addNotif(callback, *args, **kwargs)
139 141
140 def addNote(self, title, message, level): 142 def addNote(self, title, message, level):
141 note = Note(title=title, message=message, level=level) 143 note = Note(title=title, message=message, level=level)
142 self.notes.append(note) 144 self.notes.append(note)
143 if len(self.notes) > 10:
144 del self.notes[:-10]
145 if self.notes_event is None: 145 if self.notes_event is None:
146 self.notes_event = Clock.schedule_interval(self._displayNextNote, 5) 146 self.notes_event = Clock.schedule_interval(self._displayNextNote, 5)
147 self._displayNextNote() 147 self._displayNextNote()
148 148
149 def addNotifUI(self, ui): 149 def addNotifUI(self, ui):