annotate cagou/core/share_widget.py @ 352:434f770fe55b

core (Cagou): add debug log for widget visibility + ignore_missing: - debug log are now use to show which widget are made (in)visible, and to show the list of currently visible widgets - "ignore_missing" can be used in _removeVisibleWidget when we can expect that a widget is missing in visible widgets list.
author Goffi <goffi@goffi.org>
date Fri, 17 Jan 2020 18:44:35 +0100
parents 38fd457b2158
children 4d3a0c4f2430
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
3 # Cagou: desktop/mobile frontend for Salut à Toi XMPP client
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
4 # Copyright (C) 2016-2019 Jérôme Poisson (goffi@goffi.org)
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
336
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
22 from sat.core import log as logging
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
23 from sat.core.i18n import _
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
24 from sat.tools.common import data_format
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
25 from sat_frontends.tools import jid
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.core.window import Window
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
29 from kivy.metrics import dp
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
30 from .constants import Const as C
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
31 from cagou import G
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
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
34 log = logging.getLogger(__name__)
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
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
37 PLUGIN_INFO = {
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
38 "name": _("share"),
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
39 "main": "Share",
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
40 "description": _("share a file"),
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
41 "icon_symbol": "share",
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
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
45 class TextPreview(BoxLayout):
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
46 """Widget previewing shared text"""
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
47 text = StringProperty()
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
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
50 class ImagePreview(BoxLayout):
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
51 """Widget previewing shared image"""
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
52 path = StringProperty()
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
53 reduce_layout = ObjectProperty()
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
54 reduce_checkbox = ObjectProperty()
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
55
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
56 def _checkImageCb(self, report_raw):
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
57 self.report = data_format.deserialise(report_raw)
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
58 if self.report['too_large']:
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
59 self.reduce_layout.opacity = 1
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
60 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
61 self.reduce_layout.padding = [0, dp(5)]
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
62
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
63 def _checkImageEb(self, failure_):
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
64 log.error(f"Can't check image: {failure_}")
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
65
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
66 def on_path(self, wid, path):
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
67 G.host.bridge.imageCheck(
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
68 path, callback=self._checkImageCb, errback=self._checkImageEb)
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
69
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
70 def resizeImage(self, data, callback, errback):
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
71
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
72 def imageResizeCb(new_path):
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
73 new_path = Path(new_path)
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
74 log.debug(f"image {data['path']} resized at {new_path}")
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
75 data['path'] = new_path
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
76 data['cleaning_cb'] = lambda: new_path.unlink()
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
77 callback(data)
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
78
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
79 path = data['path']
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
80 width, height = self.report['recommended_size']
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
81 G.host.bridge.imageResize(
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
82 path, width, height,
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
83 callback=imageResizeCb,
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
84 errback=errback
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
85 )
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
86
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
87 def getFilter(self):
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
88 if self.report['too_large'] and self.reduce_checkbox.active:
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
89 return self.resizeImage
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
90 else:
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
91 return lambda data, callback, errback: callback(data)
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
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
94 class GenericPreview(BoxLayout):
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
95 """Widget previewing shared image"""
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
96 path = StringProperty()
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
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
99 class ShareWidget(BoxLayout):
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
100 media_type = StringProperty()
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
101 data = DictProperty()
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
102 preview_box = ObjectProperty()
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
103
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
104 def __init__(self, **kwargs):
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
105 super().__init__(**kwargs)
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
106 Window.bind(on_keyboard=self.key_input)
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
107
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
108 def on_kv_post(self, wid):
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
109 self.type, self.subtype = self.media_type.split('/')
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
110 if self.type == 'text':
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
111 self.preview_box.add_widget(TextPreview(text=self.data['text']))
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
112 elif self.type == 'image':
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
113 self.preview_box.add_widget(ImagePreview(path=self.data['path']))
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
114 else:
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
115 self.preview_box.add_widget(GenericPreview(path=self.data['path']))
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
116
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
117 def close(self):
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
118 G.host.closeUI()
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
119
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
120 def getFilteredData(self, callback, errback):
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
121 """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
122 try:
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
123 getFilter = self.preview_box.children[0].getFilter
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
124 except AttributeError:
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
125 callback(self.data)
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
126 else:
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
127 filter_ = getFilter()
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
128 filter_(self.data, callback=callback, errback=errback)
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
129
348
38fd457b2158 core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents: 336
diff changeset
130 def filterDataCb(self, data, contact_jid, profile):
38fd457b2158 core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents: 336
diff changeset
131 G.host.doAction('chat', contact_jid, [profile])
38fd457b2158 core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents: 336
diff changeset
132 chat_wid = G.host.selected_widget
38fd457b2158 core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents: 336
diff changeset
133
38fd457b2158 core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents: 336
diff changeset
134 if self.type == 'text':
38fd457b2158 core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents: 336
diff changeset
135 text = self.data['text']
38fd457b2158 core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents: 336
diff changeset
136 chat_wid.message_input.text += text
38fd457b2158 core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents: 336
diff changeset
137 else:
38fd457b2158 core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents: 336
diff changeset
138 path = self.data['path']
38fd457b2158 core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents: 336
diff changeset
139 chat_wid.transferFile(path, cleaning_cb=data.get('cleaning_cb'))
38fd457b2158 core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents: 336
diff changeset
140 self.close()
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 filterDataEb(self, failure_):
38fd457b2158 core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents: 336
diff changeset
143 G.host.addNote(
38fd457b2158 core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents: 336
diff changeset
144 _("file filter error"),
38fd457b2158 core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents: 336
diff changeset
145 _("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
146 level=C.XMLUI_DATA_LVL_ERROR)
38fd457b2158 core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents: 336
diff changeset
147
38fd457b2158 core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents: 336
diff changeset
148 def on_select(self, contact_button):
38fd457b2158 core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents: 336
diff changeset
149 contact_jid = jid.JID(contact_button.jid)
38fd457b2158 core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents: 336
diff changeset
150 self.getFilteredData(
38fd457b2158 core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents: 336
diff changeset
151 partial(
38fd457b2158 core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents: 336
diff changeset
152 self.filterDataCb,
38fd457b2158 core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents: 336
diff changeset
153 contact_jid=contact_jid,
38fd457b2158 core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents: 336
diff changeset
154 profile=contact_button.profile),
38fd457b2158 core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents: 336
diff changeset
155 self.filterDataEb
38fd457b2158 core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents: 336
diff changeset
156 )
38fd457b2158 core (common, share_widget): new JidSelector widget:
Goffi <goffi@goffi.org>
parents: 336
diff changeset
157
336
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
158 def key_input(self, window, key, scancode, codepoint, modifier):
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
159 if key == 27:
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
160 self.close()
b0c9017a1db7 core: added forgotten share_widget module
Goffi <goffi@goffi.org>
parents:
diff changeset
161 return True