annotate cagou/kv/root_widget.kv @ 488:beedff600d2b

blog: blog widget implementation: this patch implements a basic blog widget. The search bare can be used to change node (only node for now, will be improved to do search and all). Publication on current node can be done by pressing the pencil icon. A checkbox can be activated to use end-to-end encryption. No pagination or comments are supported for now. Due to lack of HTML rendering in Kivy, only simple formatting is supported. If item is end-2-end encrypted, a green closed locker is shown next to publication date. rel 380
author Goffi <goffi@goffi.org>
date Sat, 15 Oct 2022 20:20:10 +0200
parents 3c9ba4a694ef
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
29
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
1 # Cagou: desktop/mobile frontend for Salut à Toi XMPP client
461
3c9ba4a694ef dates update
Goffi <goffi@goffi.org>
parents: 373
diff changeset
2 # Copyright (C) 2016-2021 Jérôme Poisson (goffi@goffi.org)
29
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
3
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
4 # This program is free software: you can redistribute it and/or modify
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
5 # it under the terms of the GNU Affero General Public License as published by
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
6 # the Free Software Foundation, either version 3 of the License, or
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
7 # (at your option) any later version.
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
8
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
9 # This program is distributed in the hope that it will be useful,
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
12 # GNU Affero General Public License for more details.
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
13
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
14 # You should have received a copy of the GNU Affero General Public License
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
16
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
17 #:import IconButton cagou.core.common.IconButton
247
cf61a011f731 core (notes), common (symbol): added an icon showing note level:
Goffi <goffi@goffi.org>
parents: 208
diff changeset
18 #:import C cagou.core.constants.Const
29
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
19
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
20 # <NotifIcon>:
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
21 # source: app.expand("{media}/icons/muchoslava/png/cagou_profil_bleu_32.png")
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
22 # size_hint: None, None
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
23 # size: self.texture_size
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
24
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
25 <Note>:
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
26 text: self.message
208
c5c1dd7f88e1 root widget: improved notes:
Goffi <goffi@goffi.org>
parents: 207
diff changeset
27 text_size: self.parent.size if self.parent else (100, 100)
c5c1dd7f88e1 root widget: improved notes:
Goffi <goffi@goffi.org>
parents: 207
diff changeset
28 halign: 'center'
c5c1dd7f88e1 root widget: improved notes:
Goffi <goffi@goffi.org>
parents: 207
diff changeset
29 padding_x: dp(5)
c5c1dd7f88e1 root widget: improved notes:
Goffi <goffi@goffi.org>
parents: 207
diff changeset
30 shorten: True
c5c1dd7f88e1 root widget: improved notes:
Goffi <goffi@goffi.org>
parents: 207
diff changeset
31 shorten_from: 'right'
29
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
32
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
33 <NoteDrop>:
247
cf61a011f731 core (notes), common (symbol): added an icon showing note level:
Goffi <goffi@goffi.org>
parents: 208
diff changeset
34 orientation: 'horizontal'
cf61a011f731 core (notes), common (symbol): added an icon showing note level:
Goffi <goffi@goffi.org>
parents: 208
diff changeset
35 size_hint: 1, None
250
ff1efdeff53f core: notifs can now have a custom icon and be clickable:
Goffi <goffi@goffi.org>
parents: 247
diff changeset
36 height: max(label.height, dp(45))
247
cf61a011f731 core (notes), common (symbol): added an icon showing note level:
Goffi <goffi@goffi.org>
parents: 208
diff changeset
37 symbol: symbol
29
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
38 canvas.before:
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
39 BorderImage:
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
40 pos: self.pos
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
41 size: self.size
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
42 source: 'atlas://data/images/defaulttheme/button'
247
cf61a011f731 core (notes), common (symbol): added an icon showing note level:
Goffi <goffi@goffi.org>
parents: 208
diff changeset
43 Widget:
cf61a011f731 core (notes), common (symbol): added an icon showing note level:
Goffi <goffi@goffi.org>
parents: 208
diff changeset
44 size_hint: None, 1
cf61a011f731 core (notes), common (symbol): added an icon showing note level:
Goffi <goffi@goffi.org>
parents: 208
diff changeset
45 width: dp(20)
cf61a011f731 core (notes), common (symbol): added an icon showing note level:
Goffi <goffi@goffi.org>
parents: 208
diff changeset
46 Symbol:
cf61a011f731 core (notes), common (symbol): added an icon showing note level:
Goffi <goffi@goffi.org>
parents: 208
diff changeset
47 id: symbol
250
ff1efdeff53f core: notifs can now have a custom icon and be clickable:
Goffi <goffi@goffi.org>
parents: 247
diff changeset
48 size_hint: None, 1
247
cf61a011f731 core (notes), common (symbol): added an icon showing note level:
Goffi <goffi@goffi.org>
parents: 208
diff changeset
49 width: dp(30)
cf61a011f731 core (notes), common (symbol): added an icon showing note level:
Goffi <goffi@goffi.org>
parents: 208
diff changeset
50 padding_y: dp(10)
cf61a011f731 core (notes), common (symbol): added an icon showing note level:
Goffi <goffi@goffi.org>
parents: 208
diff changeset
51 valign: 'top'
cf61a011f731 core (notes), common (symbol): added an icon showing note level:
Goffi <goffi@goffi.org>
parents: 208
diff changeset
52 haligh: 'right'
250
ff1efdeff53f core: notifs can now have a custom icon and be clickable:
Goffi <goffi@goffi.org>
parents: 247
diff changeset
53 symbol: root.symbol or root.level
247
cf61a011f731 core (notes), common (symbol): added an icon showing note level:
Goffi <goffi@goffi.org>
parents: 208
diff changeset
54 color:
250
ff1efdeff53f core: notifs can now have a custom icon and be clickable:
Goffi <goffi@goffi.org>
parents: 247
diff changeset
55 C.COLOR_PRIM_LIGHT if root.symbol is None else \
247
cf61a011f731 core (notes), common (symbol): added an icon showing note level:
Goffi <goffi@goffi.org>
parents: 208
diff changeset
56 {C.XMLUI_DATA_LVL_INFO: app.c_prim_light,\
cf61a011f731 core (notes), common (symbol): added an icon showing note level:
Goffi <goffi@goffi.org>
parents: 208
diff changeset
57 C.XMLUI_DATA_LVL_WARNING: C.COLOR_WARNING,\
cf61a011f731 core (notes), common (symbol): added an icon showing note level:
Goffi <goffi@goffi.org>
parents: 208
diff changeset
58 C.XMLUI_DATA_LVL_ERROR: C.COLOR_ERROR}[root.level]
cf61a011f731 core (notes), common (symbol): added an icon showing note level:
Goffi <goffi@goffi.org>
parents: 208
diff changeset
59 Label:
cf61a011f731 core (notes), common (symbol): added an icon showing note level:
Goffi <goffi@goffi.org>
parents: 208
diff changeset
60 id: label
cf61a011f731 core (notes), common (symbol): added an icon showing note level:
Goffi <goffi@goffi.org>
parents: 208
diff changeset
61 size_hint: 1, None
cf61a011f731 core (notes), common (symbol): added an icon showing note level:
Goffi <goffi@goffi.org>
parents: 208
diff changeset
62 color: 1, 1, 1, 1
cf61a011f731 core (notes), common (symbol): added an icon showing note level:
Goffi <goffi@goffi.org>
parents: 208
diff changeset
63 text: root.message
cf61a011f731 core (notes), common (symbol): added an icon showing note level:
Goffi <goffi@goffi.org>
parents: 208
diff changeset
64 text_size: self.width, None
cf61a011f731 core (notes), common (symbol): added an icon showing note level:
Goffi <goffi@goffi.org>
parents: 208
diff changeset
65 halign: 'center'
cf61a011f731 core (notes), common (symbol): added an icon showing note level:
Goffi <goffi@goffi.org>
parents: 208
diff changeset
66 size: self.texture_size
cf61a011f731 core (notes), common (symbol): added an icon showing note level:
Goffi <goffi@goffi.org>
parents: 208
diff changeset
67 padding: dp(2), dp(10)
29
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
68
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
69 <NotesDrop>:
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
70 clear_btn: clear_btn.__self__
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
71 auto_width: False
247
cf61a011f731 core (notes), common (symbol): added an icon showing note level:
Goffi <goffi@goffi.org>
parents: 208
diff changeset
72 size_hint: 0.9, None
cf61a011f731 core (notes), common (symbol): added an icon showing note level:
Goffi <goffi@goffi.org>
parents: 208
diff changeset
73 size_hint_max_x: dp(400)
113
c439c271ecdd core (notifications), CagouWidget: a backround rectangle is drawned behind drop boxes
Goffi <goffi@goffi.org>
parents: 85
diff changeset
74 canvas.before:
c439c271ecdd core (notifications), CagouWidget: a backround rectangle is drawned behind drop boxes
Goffi <goffi@goffi.org>
parents: 85
diff changeset
75 Color:
c439c271ecdd core (notifications), CagouWidget: a backround rectangle is drawned behind drop boxes
Goffi <goffi@goffi.org>
parents: 85
diff changeset
76 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
77 Rectangle:
c439c271ecdd core (notifications), CagouWidget: a backround rectangle is drawned behind drop boxes
Goffi <goffi@goffi.org>
parents: 85
diff changeset
78 pos: self.pos
c439c271ecdd core (notifications), CagouWidget: a backround rectangle is drawned behind drop boxes
Goffi <goffi@goffi.org>
parents: 85
diff changeset
79 size: self.size
29
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
80 Button:
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
81 id: clear_btn
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
82 text: "clear"
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
83 bold: True
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
84 size_hint: 1, None
36
bd3ecac18870 cagou widget, root widget: used of dp to specify distances
Goffi <goffi@goffi.org>
parents: 33
diff changeset
85 height: dp(50)
29
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
86 on_release: del root.notes[:]; root.dismiss()
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
87
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
88 <RootHeadWidget>:
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
89 manager: manager
33
c21d1be2e54c core: XMLUI notifications coming from backend are handled:
Goffi <goffi@goffi.org>
parents: 29
diff changeset
90 notifs_icon: notifs_icon
29
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
91 size_hint: 1, None
172
7103655647aa core: hide notifications header on M-n
Goffi <goffi@goffi.org>
parents: 166
diff changeset
92 height: self.HEIGHT
274
7d5297984191 core, chat: UI improvments:
Goffi <goffi@goffi.org>
parents: 250
diff changeset
93 padding: app.MARGIN_LEFT, 0, app.MARGIN_RIGHT, 0
29
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
94 IconButton:
347
bf9474e164f3 core (RootWidget): a red "plug" symbol is now shown when profile is not connected.
Goffi <goffi@goffi.org>
parents: 282
diff changeset
95 source: app.expand("{media}/icons/muchoslava/png/cagou_profil_bleu_48.png")
62
1922506846be design fixes:
Goffi <goffi@goffi.org>
parents: 36
diff changeset
96 allow_stretch: True
147
11d134eb51d7 core: fixed icon size hiding when notifs are reset + size adjust
Goffi <goffi@goffi.org>
parents: 131
diff changeset
97 size_hint: None, None
11d134eb51d7 core: fixed icon size hiding when notifs are reset + size adjust
Goffi <goffi@goffi.org>
parents: 131
diff changeset
98 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
99 height: dp(25)
347
bf9474e164f3 core (RootWidget): a red "plug" symbol is now shown when profile is not connected.
Goffi <goffi@goffi.org>
parents: 282
diff changeset
100 width: dp(35) if root.notes else 0
bf9474e164f3 core (RootWidget): a red "plug" symbol is now shown when profile is not connected.
Goffi <goffi@goffi.org>
parents: 282
diff changeset
101 opacity: 1 if root.notes else 0
29
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
102 on_release: root.notes_drop.open(self) if root.notes else None
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
103 ScreenManager:
8b5827c43155 notes first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
104 id: manager
33
c21d1be2e54c core: XMLUI notifications coming from backend are handled:
Goffi <goffi@goffi.org>
parents: 29
diff changeset
105 NotifsIcon:
c21d1be2e54c core: XMLUI notifications coming from backend are handled:
Goffi <goffi@goffi.org>
parents: 29
diff changeset
106 id: notifs_icon
62
1922506846be design fixes:
Goffi <goffi@goffi.org>
parents: 36
diff changeset
107 allow_stretch: True
347
bf9474e164f3 core (RootWidget): a red "plug" symbol is now shown when profile is not connected.
Goffi <goffi@goffi.org>
parents: 282
diff changeset
108 source: app.expand("{media}/icons/muchoslava/png/cagou_profil_bleu_miroir_48.png")
147
11d134eb51d7 core: fixed icon size hiding when notifs are reset + size adjust
Goffi <goffi@goffi.org>
parents: 131
diff changeset
109 size_hint: None, None
11d134eb51d7 core: fixed icon size hiding when notifs are reset + size adjust
Goffi <goffi@goffi.org>
parents: 131
diff changeset
110 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
111 height: dp(25)
347
bf9474e164f3 core (RootWidget): a red "plug" symbol is now shown when profile is not connected.
Goffi <goffi@goffi.org>
parents: 282
diff changeset
112 width: dp(35) if self.notifs else 0
bf9474e164f3 core (RootWidget): a red "plug" symbol is now shown when profile is not connected.
Goffi <goffi@goffi.org>
parents: 282
diff changeset
113 opacity: 1 if self.notifs else 0
bf9474e164f3 core (RootWidget): a red "plug" symbol is now shown when profile is not connected.
Goffi <goffi@goffi.org>
parents: 282
diff changeset
114 Symbol:
bf9474e164f3 core (RootWidget): a red "plug" symbol is now shown when profile is not connected.
Goffi <goffi@goffi.org>
parents: 282
diff changeset
115 id: disconnected_icon
bf9474e164f3 core (RootWidget): a red "plug" symbol is now shown when profile is not connected.
Goffi <goffi@goffi.org>
parents: 282
diff changeset
116 size_hint: None, 1
bf9474e164f3 core (RootWidget): a red "plug" symbol is now shown when profile is not connected.
Goffi <goffi@goffi.org>
parents: 282
diff changeset
117 pos_hint: {'center_y': .5}
bf9474e164f3 core (RootWidget): a red "plug" symbol is now shown when profile is not connected.
Goffi <goffi@goffi.org>
parents: 282
diff changeset
118 font_size: dp(23)
bf9474e164f3 core (RootWidget): a red "plug" symbol is now shown when profile is not connected.
Goffi <goffi@goffi.org>
parents: 282
diff changeset
119 width: 0 if app.connected else dp(30)
bf9474e164f3 core (RootWidget): a red "plug" symbol is now shown when profile is not connected.
Goffi <goffi@goffi.org>
parents: 282
diff changeset
120 opacity: 0 if app.connected else 1
bf9474e164f3 core (RootWidget): a red "plug" symbol is now shown when profile is not connected.
Goffi <goffi@goffi.org>
parents: 282
diff changeset
121 symbol: "plug"
bf9474e164f3 core (RootWidget): a red "plug" symbol is now shown when profile is not connected.
Goffi <goffi@goffi.org>
parents: 282
diff changeset
122 color: 0.80, 0.0, 0.0, 1
33
c21d1be2e54c core: XMLUI notifications coming from backend are handled:
Goffi <goffi@goffi.org>
parents: 29
diff changeset
123
85
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 81
diff changeset
124 <CagouRootWidget>:
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 81
diff changeset
125 root_body: root_body
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 81
diff changeset
126 RootBody:
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 81
diff changeset
127 id: root_body
c2a7234d13d2 menu: use of garden's contextmenu for menus
Goffi <goffi@goffi.org>
parents: 81
diff changeset
128 orientation: "vertical"