# HG changeset patch # User Goffi # Date 1527242768 -7200 # Node ID c5c1dd7f88e16ad203776942a46fb17464c5ffc0 # Parent a8190aecdd79ad3a11de748ef5e30960cde7abb1 root widget: improved notes: - fixed size/text_size - shorten note when necessary - don't erase notes anymore when more that 10 are available diff -r a8190aecdd79 -r c5c1dd7f88e1 cagou/core/cagou_main.py --- a/cagou/core/cagou_main.py Fri May 25 12:04:20 2018 +0200 +++ b/cagou/core/cagou_main.py Fri May 25 12:06:08 2018 +0200 @@ -102,8 +102,10 @@ level = properties.OptionProperty(C.XMLUI_DATA_LVL_DEFAULT, options=list(C.XMLUI_DATA_LVLS)) -class NoteDrop(Note): - pass +class NoteDrop(Label): + title = properties.StringProperty() + message = properties.StringProperty() + level = properties.OptionProperty(C.XMLUI_DATA_LVL_DEFAULT, options=list(C.XMLUI_DATA_LVLS)) class NotesDrop(DropDown): @@ -140,8 +142,6 @@ def addNote(self, title, message, level): note = Note(title=title, message=message, level=level) self.notes.append(note) - if len(self.notes) > 10: - del self.notes[:-10] if self.notes_event is None: self.notes_event = Clock.schedule_interval(self._displayNextNote, 5) self._displayNextNote() diff -r a8190aecdd79 -r c5c1dd7f88e1 cagou/kv/root_widget.kv --- a/cagou/kv/root_widget.kv Fri May 25 12:04:20 2018 +0200 +++ b/cagou/kv/root_widget.kv Fri May 25 12:06:08 2018 +0200 @@ -23,6 +23,11 @@ : text: self.message + text_size: self.parent.size if self.parent else (100, 100) + halign: 'center' + padding_x: dp(5) + shorten: True + shorten_from: 'right' : canvas.before: @@ -32,9 +37,10 @@ source: 'atlas://data/images/defaulttheme/button' size_hint: 1, None color: 1, 1, 1, 1 + text: self.message text_size: self.width, None halign: 'center' - height: self.texture_size[1] + size: self.texture_size padding: dp(2), dp(10) :