Mercurial > libervia-desktop-kivy
annotate cagou/kv/root_widget.kv @ 225:a3162b29cda1
plugin chat: fixed AttributeError when message is receved and a corresponding ChatWidget is not created yet
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 27 Jun 2018 22:23:20 +0200 |
parents | c5c1dd7f88e1 |
children | cf61a011f731 |
rev | line source |
---|---|
29 | 1 # Cagou: desktop/mobile frontend for Salut à Toi XMPP client |
126 | 2 # Copyright (C) 2016-2018 Jérôme Poisson (goffi@goffi.org) |
29 | 3 |
4 # This program is free software: you can redistribute it and/or modify | |
5 # it under the terms of the GNU Affero General Public License as published by | |
6 # the Free Software Foundation, either version 3 of the License, or | |
7 # (at your option) any later version. | |
8 | |
9 # This program is distributed in the hope that it will be useful, | |
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 # GNU Affero General Public License for more details. | |
13 | |
14 # You should have received a copy of the GNU Affero General Public License | |
15 # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | |
17 #:import IconButton cagou.core.common.IconButton | |
18 | |
19 # <NotifIcon>: | |
20 # source: app.expand("{media}/icons/muchoslava/png/cagou_profil_bleu_32.png") | |
21 # size_hint: None, None | |
22 # size: self.texture_size | |
23 | |
24 <Note>: | |
25 text: self.message | |
208 | 26 text_size: self.parent.size if self.parent else (100, 100) |
27 halign: 'center' | |
28 padding_x: dp(5) | |
29 shorten: True | |
30 shorten_from: 'right' | |
29 | 31 |
32 <NoteDrop>: | |
33 canvas.before: | |
34 BorderImage: | |
35 pos: self.pos | |
36 size: self.size | |
37 source: 'atlas://data/images/defaulttheme/button' | |
38 size_hint: 1, None | |
151
3a05dfa27f5e
core (notifs): use white for notifications text
Goffi <goffi@goffi.org>
parents:
147
diff
changeset
|
39 color: 1, 1, 1, 1 |
208 | 40 text: self.message |
114
15434a7787ed
core (notifications): notification now grow in height with text size
Goffi <goffi@goffi.org>
parents:
113
diff
changeset
|
41 text_size: self.width, None |
15434a7787ed
core (notifications): notification now grow in height with text size
Goffi <goffi@goffi.org>
parents:
113
diff
changeset
|
42 halign: 'center' |
208 | 43 size: self.texture_size |
114
15434a7787ed
core (notifications): notification now grow in height with text size
Goffi <goffi@goffi.org>
parents:
113
diff
changeset
|
44 padding: dp(2), dp(10) |
29 | 45 |
46 <NotesDrop>: | |
47 clear_btn: clear_btn.__self__ | |
48 auto_width: False | |
49 size_hint: 0.8, None | |
113
c439c271ecdd
core (notifications), CagouWidget: a backround rectangle is drawned behind drop boxes
Goffi <goffi@goffi.org>
parents:
85
diff
changeset
|
50 canvas.before: |
c439c271ecdd
core (notifications), CagouWidget: a backround rectangle is drawned behind drop boxes
Goffi <goffi@goffi.org>
parents:
85
diff
changeset
|
51 Color: |
c439c271ecdd
core (notifications), CagouWidget: a backround rectangle is drawned behind drop boxes
Goffi <goffi@goffi.org>
parents:
85
diff
changeset
|
52 rgba: 0.8, 0.8, 0.8, 1 |
c439c271ecdd
core (notifications), CagouWidget: a backround rectangle is drawned behind drop boxes
Goffi <goffi@goffi.org>
parents:
85
diff
changeset
|
53 Rectangle: |
c439c271ecdd
core (notifications), CagouWidget: a backround rectangle is drawned behind drop boxes
Goffi <goffi@goffi.org>
parents:
85
diff
changeset
|
54 pos: self.pos |
c439c271ecdd
core (notifications), CagouWidget: a backround rectangle is drawned behind drop boxes
Goffi <goffi@goffi.org>
parents:
85
diff
changeset
|
55 size: self.size |
29 | 56 Button: |
57 id: clear_btn | |
58 text: "clear" | |
59 bold: True | |
60 size_hint: 1, None | |
36
bd3ecac18870
cagou widget, root widget: used of dp to specify distances
Goffi <goffi@goffi.org>
parents:
33
diff
changeset
|
61 height: dp(50) |
29 | 62 on_release: del root.notes[:]; root.dismiss() |
63 | |
64 <RootHeadWidget>: | |
65 manager: manager | |
33
c21d1be2e54c
core: XMLUI notifications coming from backend are handled:
Goffi <goffi@goffi.org>
parents:
29
diff
changeset
|
66 notifs_icon: notifs_icon |
29 | 67 size_hint: 1, None |
172
7103655647aa
core: hide notifications header on M-n
Goffi <goffi@goffi.org>
parents:
166
diff
changeset
|
68 height: self.HEIGHT |
29 | 69 IconButton: |
147
11d134eb51d7
core: fixed icon size hiding when notifs are reset + size adjust
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
70 source: app.expand("{media}/icons/muchoslava/png/cagou_profil_bleu_48.png") if root.notes else '' |
62 | 71 allow_stretch: True |
147
11d134eb51d7
core: fixed icon size hiding when notifs are reset + size adjust
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
72 size_hint: None, None |
11d134eb51d7
core: fixed icon size hiding when notifs are reset + size adjust
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
73 pos_hint: {'center_y': .5} |
11d134eb51d7
core: fixed icon size hiding when notifs are reset + size adjust
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
74 height: dp(25) |
81
3608fef1857d
core: use norm_image_size for headers'icons
Goffi <goffi@goffi.org>
parents:
62
diff
changeset
|
75 width: self.norm_image_size[0] |
29 | 76 on_release: root.notes_drop.open(self) if root.notes else None |
77 ScreenManager: | |
78 id: manager | |
33
c21d1be2e54c
core: XMLUI notifications coming from backend are handled:
Goffi <goffi@goffi.org>
parents:
29
diff
changeset
|
79 NotifsIcon: |
c21d1be2e54c
core: XMLUI notifications coming from backend are handled:
Goffi <goffi@goffi.org>
parents:
29
diff
changeset
|
80 id: notifs_icon |
62 | 81 allow_stretch: True |
207
a8190aecdd79
root widget: use mirror version of cagou profile for NotifsIcon
Goffi <goffi@goffi.org>
parents:
183
diff
changeset
|
82 source: app.expand("{media}/icons/muchoslava/png/cagou_profil_bleu_miroir_48.png") if self.notifs else '' |
147
11d134eb51d7
core: fixed icon size hiding when notifs are reset + size adjust
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
83 size_hint: None, None |
11d134eb51d7
core: fixed icon size hiding when notifs are reset + size adjust
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
84 pos_hint: {'center_y': .5} |
11d134eb51d7
core: fixed icon size hiding when notifs are reset + size adjust
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
85 height: dp(25) |
183
6f09bc00a9e7
root widget: fixed notif icon width
Goffi <goffi@goffi.org>
parents:
172
diff
changeset
|
86 width: self.norm_image_size[0] |
33
c21d1be2e54c
core: XMLUI notifications coming from backend are handled:
Goffi <goffi@goffi.org>
parents:
29
diff
changeset
|
87 |
85
c2a7234d13d2
menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents:
81
diff
changeset
|
88 <RootMenus>: |
c2a7234d13d2
menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents:
81
diff
changeset
|
89 size_hint: 1, None |
c2a7234d13d2
menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents:
81
diff
changeset
|
90 pos_hint: {'top': 1} |
c2a7234d13d2
menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents:
81
diff
changeset
|
91 |
c2a7234d13d2
menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents:
81
diff
changeset
|
92 <CagouRootWidget>: |
c2a7234d13d2
menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents:
81
diff
changeset
|
93 root_body: root_body |
c2a7234d13d2
menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents:
81
diff
changeset
|
94 root_menus: root_menus |
c2a7234d13d2
menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents:
81
diff
changeset
|
95 # main body |
c2a7234d13d2
menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents:
81
diff
changeset
|
96 RootBody: |
c2a7234d13d2
menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents:
81
diff
changeset
|
97 id: root_body |
c2a7234d13d2
menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents:
81
diff
changeset
|
98 orientation: "vertical" |
c2a7234d13d2
menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents:
81
diff
changeset
|
99 size_hint: 1, None |
c2a7234d13d2
menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents:
81
diff
changeset
|
100 height: root.height - root_menus.height |
c2a7234d13d2
menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents:
81
diff
changeset
|
101 # general menus |
c2a7234d13d2
menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents:
81
diff
changeset
|
102 # need to be added at the end so it's drawed above other widgets |
c2a7234d13d2
menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents:
81
diff
changeset
|
103 RootMenus: |
c2a7234d13d2
menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents:
81
diff
changeset
|
104 id: root_menus |
166
37220459e93d
core: hide/show menu on M-m + disable menu on Android
Goffi <goffi@goffi.org>
parents:
151
diff
changeset
|
105 height: self.HEIGHT |