Mercurial > libervia-desktop-kivy
annotate libervia/desktop_kivy/core/share_widget.py @ 508:d87b9a6b0b69
doc (calls): updated documentation to describe the new UI features:
fix 425
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 25 Oct 2023 15:29:33 +0200 |
parents | b3cedbee561d |
children | 196483685a63 |
rev | line source |
---|---|
348
38fd457b2158
core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
1 #!/usr/bin/env python3 |
336
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
2 |
493
b3cedbee561d
refactoring: rename `cagou` to `libervia.desktop_kivy` + update imports and names following backend changes
Goffi <goffi@goffi.org>
parents:
491
diff
changeset
|
3 #Libervia Desktop-Kivy |
461 | 4 # Copyright (C) 2016-2021 Jérôme Poisson (goffi@goffi.org) |
336
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
5 |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
6 # This program is free software: you can redistribute it and/or modify |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
7 # it under the terms of the GNU Affero General Public License as published by |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
8 # the Free Software Foundation, either version 3 of the License, or |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
9 # (at your option) any later version. |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
10 |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
11 # This program is distributed in the hope that it will be useful, |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
14 # GNU Affero General Public License for more details. |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
15 |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
16 # You should have received a copy of the GNU Affero General Public License |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
18 |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
19 |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
20 from pathlib import Path |
348
38fd457b2158
core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
21 from functools import partial |
493
b3cedbee561d
refactoring: rename `cagou` to `libervia.desktop_kivy` + update imports and names following backend changes
Goffi <goffi@goffi.org>
parents:
491
diff
changeset
|
22 from libervia.backend.core import log as logging |
b3cedbee561d
refactoring: rename `cagou` to `libervia.desktop_kivy` + update imports and names following backend changes
Goffi <goffi@goffi.org>
parents:
491
diff
changeset
|
23 from libervia.backend.core.i18n import _ |
b3cedbee561d
refactoring: rename `cagou` to `libervia.desktop_kivy` + update imports and names following backend changes
Goffi <goffi@goffi.org>
parents:
491
diff
changeset
|
24 from libervia.backend.tools.common import data_format |
b3cedbee561d
refactoring: rename `cagou` to `libervia.desktop_kivy` + update imports and names following backend changes
Goffi <goffi@goffi.org>
parents:
491
diff
changeset
|
25 from libervia.frontends.tools import jid |
336
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
26 from kivy.uix.boxlayout import BoxLayout |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
27 from kivy.properties import StringProperty, DictProperty, ObjectProperty |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
28 from kivy.metrics import dp |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
29 from .constants import Const as C |
493
b3cedbee561d
refactoring: rename `cagou` to `libervia.desktop_kivy` + update imports and names following backend changes
Goffi <goffi@goffi.org>
parents:
491
diff
changeset
|
30 from libervia.desktop_kivy import G |
336
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
31 |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
32 |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
33 log = logging.getLogger(__name__) |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
34 |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
35 |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
36 PLUGIN_INFO = { |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
37 "name": _("share"), |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
38 "main": "Share", |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
39 "description": _("share a file"), |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
40 "icon_symbol": "share", |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
41 } |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
42 |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
43 |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
44 class TextPreview(BoxLayout): |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
45 """Widget previewing shared text""" |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
46 text = StringProperty() |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
47 |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
48 |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
49 class ImagePreview(BoxLayout): |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
50 """Widget previewing shared image""" |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
51 path = StringProperty() |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
52 reduce_layout = ObjectProperty() |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
53 reduce_checkbox = ObjectProperty() |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
54 |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
55 def _check_image_cb(self, report_raw): |
336
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
56 self.report = data_format.deserialise(report_raw) |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
57 if self.report['too_large']: |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
58 self.reduce_layout.opacity = 1 |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
59 self.reduce_layout.height = self.reduce_layout.minimum_height + dp(10) |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
60 self.reduce_layout.padding = [0, dp(5)] |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
61 |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
62 def _check_image_eb(self, failure_): |
336
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
63 log.error(f"Can't check image: {failure_}") |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
64 |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
65 def on_path(self, wid, path): |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
66 G.host.bridge.image_check( |
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
67 path, callback=self._check_image_cb, errback=self._check_image_eb) |
336
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
68 |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
69 def resize_image(self, data, callback, errback): |
336
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
70 |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
71 def image_resize_cb(new_path): |
336
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
72 new_path = Path(new_path) |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
73 log.debug(f"image {data['path']} resized at {new_path}") |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
74 data['path'] = new_path |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
75 data['cleaning_cb'] = lambda: new_path.unlink() |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
76 callback(data) |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
77 |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
78 path = data['path'] |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
79 width, height = self.report['recommended_size'] |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
80 G.host.bridge.image_resize( |
336
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
81 path, width, height, |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
82 callback=image_resize_cb, |
336
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
83 errback=errback |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
84 ) |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
85 |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
86 def get_filter(self): |
336
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
87 if self.report['too_large'] and self.reduce_checkbox.active: |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
88 return self.resize_image |
336
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
89 else: |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
90 return lambda data, callback, errback: callback(data) |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
91 |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
92 |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
93 class GenericPreview(BoxLayout): |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
94 """Widget previewing shared image""" |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
95 path = StringProperty() |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
96 |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
97 |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
98 class ShareWidget(BoxLayout): |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
99 media_type = StringProperty() |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
100 data = DictProperty() |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
101 preview_box = ObjectProperty() |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
102 |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
103 def on_kv_post(self, wid): |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
104 self.type, self.subtype = self.media_type.split('/') |
383
a90f26e89a4a
share widget: fixed crash when a text content is shared without `text` in data:
Goffi <goffi@goffi.org>
parents:
378
diff
changeset
|
105 if self.type == 'text' and 'text' in self.data: |
336
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
106 self.preview_box.add_widget(TextPreview(text=self.data['text'])) |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
107 elif self.type == 'image': |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
108 self.preview_box.add_widget(ImagePreview(path=self.data['path'])) |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
109 else: |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
110 self.preview_box.add_widget(GenericPreview(path=self.data['path'])) |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
111 |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
112 def close(self): |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
113 G.host.close_ui() |
336
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
114 |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
115 def get_filtered_data(self, callback, errback): |
336
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
116 """Apply filter if suitable, and call callback with with modified data""" |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
117 try: |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
118 get_filter = self.preview_box.children[0].get_filter |
336
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
119 except AttributeError: |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
120 callback(self.data) |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
121 else: |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
122 filter_ = get_filter() |
336
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
123 filter_(self.data, callback=callback, errback=errback) |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
124 |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
125 def filter_data_cb(self, data, contact_jid, profile): |
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
126 chat_wid = G.host.do_action('chat', contact_jid, [profile]) |
348
38fd457b2158
core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
127 |
383
a90f26e89a4a
share widget: fixed crash when a text content is shared without `text` in data:
Goffi <goffi@goffi.org>
parents:
378
diff
changeset
|
128 if self.type == 'text' and 'text' in self.data: |
348
38fd457b2158
core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
129 text = self.data['text'] |
38fd457b2158
core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
130 chat_wid.message_input.text += text |
38fd457b2158
core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
131 else: |
38fd457b2158
core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
132 path = self.data['path'] |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
133 chat_wid.transfer_file(path, cleaning_cb=data.get('cleaning_cb')) |
348
38fd457b2158
core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
134 self.close() |
38fd457b2158
core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
135 |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
136 def filter_data_eb(self, failure_): |
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
137 G.host.add_note( |
348
38fd457b2158
core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
138 _("file filter error"), |
38fd457b2158
core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
139 _("Can't apply filter to file: {msg}").format(msg=failure_), |
38fd457b2158
core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
140 level=C.XMLUI_DATA_LVL_ERROR) |
38fd457b2158
core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
141 |
38fd457b2158
core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
142 def on_select(self, contact_button): |
38fd457b2158
core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
143 contact_jid = jid.JID(contact_button.jid) |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
144 self.get_filtered_data( |
348
38fd457b2158
core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
145 partial( |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
146 self.filter_data_cb, |
348
38fd457b2158
core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
147 contact_jid=contact_jid, |
38fd457b2158
core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
148 profile=contact_button.profile), |
491
203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
461
diff
changeset
|
149 self.filter_data_eb |
348
38fd457b2158
core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
150 ) |
38fd457b2158
core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents:
336
diff
changeset
|
151 |
336
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
152 def key_input(self, window, key, scancode, codepoint, modifier): |
b0c9017a1db7
core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
153 if key == 27: |
357
4d3a0c4f2430
core: better back key (ESC) management:
Goffi <goffi@goffi.org>
parents:
348
diff
changeset
|
154 return G.local_platform.on_key_back_share(self) |