annotate cagou/plugins/plugin_wid_blog.kv @ 489:8f3cb8cd84d6

plugin (chat): fix `fileSend` call
author Goffi <goffi@goffi.org>
date Fri, 07 Apr 2023 15:22:31 +0200
parents beedff600d2b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
488
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
1 # desktop/mobile frontend for Libervia XMPP client
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
2 # Copyright (C) 2016-2022 Jérôme Poisson (goffi@goffi.org)
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
3
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
4 # This program is free software: you can redistribute it and/or modify
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
5 # it under the terms of the GNU Affero General Public License as published by
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
6 # the Free Software Foundation, either version 3 of the License, or
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
7 # (at your option) any later version.
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
8
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
9 # This program is distributed in the hope that it will be useful,
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
12 # GNU Affero General Public License for more details.
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
13
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
14 # You should have received a copy of the GNU Affero General Public License
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
16
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
17 #:import date_fmt sat.tools.common.date_utils.date_fmt
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
18
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
19 <SearchButton>:
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
20 size_hint: None, 1
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
21 symbol: "search"
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
22 width: dp(30)
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
23 font_size: dp(25)
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
24 color: 0.4, 0.4, 0.4, 1
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
25
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
26
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
27 <NewPostButton>:
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
28 size_hint: None, 1
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
29 symbol: "pencil"
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
30 width: dp(30)
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
31 font_size: dp(25)
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
32 color: 0.4, 0.4, 0.4, 1
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
33
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
34 <NewPosttMenu>:
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
35 padding: dp(20)
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
36 spacing: dp(10)
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
37 e2ee: e2ee_checkbox
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
38 Label:
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
39 size_hint: 1, None
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
40 color: 1, 1, 1, 1
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
41 text: _("Publish a new post on {node} node of {service}").format(node=root.blog.node or "personal blog", service=root.blog.service or root.blog.profile)
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
42 text_size: root.width, None
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
43 size: self.texture_size
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
44 halign: "center"
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
45 bold: True
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
46 TextInput:
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
47 id: title
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
48 size_hint: 1, None
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
49 height: sp(30)
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
50 hint_text: _("title of your post (optional)")
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
51 TextInput:
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
52 id: content
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
53 size_hint: 1, None
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
54 height: sp(300)
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
55 hint_text: _("body of your post (markdown syntax allowed)")
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
56 BoxLayout
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
57 id: e2ee
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
58 size_hint: 1, None
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
59 padding_y: None
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
60 height: dp(25)
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
61 Widget:
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
62 CheckBox:
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
63 id: e2ee_checkbox
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
64 size_hint: None, 1
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
65 width: dp(20)
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
66 active: False
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
67 color: 1, 1, 1, 1
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
68 Label:
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
69 size_hint: None, None
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
70 text: _("encrypt post")
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
71 text_size: None, None
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
72 size: self.texture_size
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
73 padding_x: dp(10)
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
74 font_size: sp(15)
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
75 color: 1, 1, 1, 1
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
76 Widget:
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
77 Button:
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
78 size_hint: 1, None
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
79 height: sp(50)
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
80 text: _("publish")
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
81 on_release: root.publish(title.text, content.text, e2ee=e2ee_checkbox.active)
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
82 Widget:
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
83
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
84
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
85 <BlogPostAvatar>:
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
86 size_hint: None, None
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
87 size: dp(30), dp(30)
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
88 canvas.before:
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
89 Color:
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
90 rgba: (0.87,0.87,0.87,1)
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
91 RoundedRectangle:
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
92 radius: [dp(5)]
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
93 pos: self.pos
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
94 size: self.size
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
95
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
96 <BlogPostWidget>:
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
97 size_hint: 1, None
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
98 avatar: avatar
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
99 header_box: header_box
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
100 height: self.minimum_height
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
101 orientation: "vertical"
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
102 Label:
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
103 color: 0, 0, 0, 1
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
104 bold: True
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
105 font_size: root.title_font_size
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
106 text_size: None, None
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
107 size_hint: None, None
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
108 size: self.texture_size[0], self.texture_size[1] if root.blog_data.get("title") else 0
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
109 opacity: 1 if root.blog_data.get("title") else 0
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
110 padding: dp(5), 0
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
111 text: root.blog_data.get("title", "")
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
112 BoxLayout:
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
113 id: header_box
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
114 size_hint: 1, None
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
115 height: dp(40)
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
116 BoxLayout:
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
117 orientation: 'vertical'
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
118 width: avatar.width
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
119 size_hint: None, 1
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
120 BlogPostAvatar:
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
121 id: avatar
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
122 source: app.default_avatar
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
123 Label:
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
124 id: created_ts
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
125 color: (0, 0, 0, 1)
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
126 font_size: root.font_size
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
127 text_size: None, None
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
128 size_hint: None, None
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
129 size: self.texture_size
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
130 padding: dp(5), 0
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
131 markup: True
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
132 valign: 'middle'
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
133 text: f"published on [b]{date_fmt(root.blog_data.get('published', 0), 'auto_day')}[/b]"
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
134 Symbol:
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
135 size_hint: None, None
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
136 height: created_ts.height
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
137 width: self.height
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
138 id: encrypted
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
139 symbol: 'lock-filled' if root.blog_data.get("encrypted") else 'lock-open'
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
140 font_size: created_ts.height
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
141 opacity: 1 if root.blog_data.get("encrypted") else 0
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
142 color: 0.29,0.87,0.0,1
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
143 SimpleXHTMLWidget:
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
144 size_hint: 1, None
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
145 height: self.minimum_height
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
146 xhtml: root.blog_data.get("content_xhtml") or self.escape(root.blog_data.get("content", ""))
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
147 color: (0, 0, 0, 1)
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
148 padding: dp(5), dp(5)
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
149
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
150
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
151 <Blog>:
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
152 float_layout: float_layout
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
153 orientation: 'vertical'
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
154 posts_widget: posts_widget
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
155 FloatLayout:
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
156 id: float_layout
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
157 ScrollView:
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
158 size_hint: 1, 1
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
159 pos_hint: {'x': 0, 'y': 0}
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
160 do_scroll_x: False
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
161 scroll_type: ['bars', 'content']
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
162 bar_width: dp(6)
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
163 BoxLayout:
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
164 id: posts_widget
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
165 orientation: "vertical"
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
166 size_hint: 1, None
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
167 height: self.minimum_height
beedff600d2b blog: blog widget implementation:
Goffi <goffi@goffi.org>
parents:
diff changeset
168 spacing: dp(10)