comparison libervia/desktop_kivy/plugins/plugin_wid_blog.kv @ 493:b3cedbee561d

refactoring: rename `cagou` to `libervia.desktop_kivy` + update imports and names following backend changes
author Goffi <goffi@goffi.org>
date Fri, 02 Jun 2023 18:26:16 +0200
parents cagou/plugins/plugin_wid_blog.kv@beedff600d2b
children 196483685a63
comparison
equal deleted inserted replaced
492:5114bbb5daa3 493:b3cedbee561d
1 # desktop/mobile frontend for Libervia XMPP client
2 # Copyright (C) 2016-2022 Jérôme Poisson (goffi@goffi.org)
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 date_fmt libervia.backend.tools.common.date_utils.date_fmt
18
19 <SearchButton>:
20 size_hint: None, 1
21 symbol: "search"
22 width: dp(30)
23 font_size: dp(25)
24 color: 0.4, 0.4, 0.4, 1
25
26
27 <NewPostButton>:
28 size_hint: None, 1
29 symbol: "pencil"
30 width: dp(30)
31 font_size: dp(25)
32 color: 0.4, 0.4, 0.4, 1
33
34 <NewPosttMenu>:
35 padding: dp(20)
36 spacing: dp(10)
37 e2ee: e2ee_checkbox
38 Label:
39 size_hint: 1, None
40 color: 1, 1, 1, 1
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)
42 text_size: root.width, None
43 size: self.texture_size
44 halign: "center"
45 bold: True
46 TextInput:
47 id: title
48 size_hint: 1, None
49 height: sp(30)
50 hint_text: _("title of your post (optional)")
51 TextInput:
52 id: content
53 size_hint: 1, None
54 height: sp(300)
55 hint_text: _("body of your post (markdown syntax allowed)")
56 BoxLayout
57 id: e2ee
58 size_hint: 1, None
59 padding_y: None
60 height: dp(25)
61 Widget:
62 CheckBox:
63 id: e2ee_checkbox
64 size_hint: None, 1
65 width: dp(20)
66 active: False
67 color: 1, 1, 1, 1
68 Label:
69 size_hint: None, None
70 text: _("encrypt post")
71 text_size: None, None
72 size: self.texture_size
73 padding_x: dp(10)
74 font_size: sp(15)
75 color: 1, 1, 1, 1
76 Widget:
77 Button:
78 size_hint: 1, None
79 height: sp(50)
80 text: _("publish")
81 on_release: root.publish(title.text, content.text, e2ee=e2ee_checkbox.active)
82 Widget:
83
84
85 <BlogPostAvatar>:
86 size_hint: None, None
87 size: dp(30), dp(30)
88 canvas.before:
89 Color:
90 rgba: (0.87,0.87,0.87,1)
91 RoundedRectangle:
92 radius: [dp(5)]
93 pos: self.pos
94 size: self.size
95
96 <BlogPostWidget>:
97 size_hint: 1, None
98 avatar: avatar
99 header_box: header_box
100 height: self.minimum_height
101 orientation: "vertical"
102 Label:
103 color: 0, 0, 0, 1
104 bold: True
105 font_size: root.title_font_size
106 text_size: None, None
107 size_hint: None, None
108 size: self.texture_size[0], self.texture_size[1] if root.blog_data.get("title") else 0
109 opacity: 1 if root.blog_data.get("title") else 0
110 padding: dp(5), 0
111 text: root.blog_data.get("title", "")
112 BoxLayout:
113 id: header_box
114 size_hint: 1, None
115 height: dp(40)
116 BoxLayout:
117 orientation: 'vertical'
118 width: avatar.width
119 size_hint: None, 1
120 BlogPostAvatar:
121 id: avatar
122 source: app.default_avatar
123 Label:
124 id: created_ts
125 color: (0, 0, 0, 1)
126 font_size: root.font_size
127 text_size: None, None
128 size_hint: None, None
129 size: self.texture_size
130 padding: dp(5), 0
131 markup: True
132 valign: 'middle'
133 text: f"published on [b]{date_fmt(root.blog_data.get('published', 0), 'auto_day')}[/b]"
134 Symbol:
135 size_hint: None, None
136 height: created_ts.height
137 width: self.height
138 id: encrypted
139 symbol: 'lock-filled' if root.blog_data.get("encrypted") else 'lock-open'
140 font_size: created_ts.height
141 opacity: 1 if root.blog_data.get("encrypted") else 0
142 color: 0.29,0.87,0.0,1
143 SimpleXHTMLWidget:
144 size_hint: 1, None
145 height: self.minimum_height
146 xhtml: root.blog_data.get("content_xhtml") or self.escape(root.blog_data.get("content", ""))
147 color: (0, 0, 0, 1)
148 padding: dp(5), dp(5)
149
150
151 <Blog>:
152 float_layout: float_layout
153 orientation: 'vertical'
154 posts_widget: posts_widget
155 FloatLayout:
156 id: float_layout
157 ScrollView:
158 size_hint: 1, 1
159 pos_hint: {'x': 0, 'y': 0}
160 do_scroll_x: False
161 scroll_type: ['bars', 'content']
162 bar_width: dp(6)
163 BoxLayout:
164 id: posts_widget
165 orientation: "vertical"
166 size_hint: 1, None
167 height: self.minimum_height
168 spacing: dp(10)