comparison cagou/core/share_widget.py @ 361:f20ec8462493

share widget: removed global keyboard binding
author Goffi <goffi@goffi.org>
date Sat, 18 Jan 2020 23:12:52 +0100
parents 4d3a0c4f2430
children 4d660b252487
comparison
equal deleted inserted replaced
360:a77386b73e55 361:f20ec8462493
23 from sat.core.i18n import _ 23 from sat.core.i18n import _
24 from sat.tools.common import data_format 24 from sat.tools.common import data_format
25 from sat_frontends.tools import jid 25 from sat_frontends.tools import jid
26 from kivy.uix.boxlayout import BoxLayout 26 from kivy.uix.boxlayout import BoxLayout
27 from kivy.properties import StringProperty, DictProperty, ObjectProperty 27 from kivy.properties import StringProperty, DictProperty, ObjectProperty
28 from kivy.core.window import Window
29 from kivy.metrics import dp 28 from kivy.metrics import dp
30 from .constants import Const as C 29 from .constants import Const as C
31 from cagou import G 30 from cagou import G
32 31
33 32
99 class ShareWidget(BoxLayout): 98 class ShareWidget(BoxLayout):
100 media_type = StringProperty() 99 media_type = StringProperty()
101 data = DictProperty() 100 data = DictProperty()
102 preview_box = ObjectProperty() 101 preview_box = ObjectProperty()
103 102
104 def __init__(self, **kwargs):
105 super().__init__(**kwargs)
106 Window.bind(on_keyboard=self.key_input)
107
108 def on_kv_post(self, wid): 103 def on_kv_post(self, wid):
109 self.type, self.subtype = self.media_type.split('/') 104 self.type, self.subtype = self.media_type.split('/')
110 if self.type == 'text': 105 if self.type == 'text':
111 self.preview_box.add_widget(TextPreview(text=self.data['text'])) 106 self.preview_box.add_widget(TextPreview(text=self.data['text']))
112 elif self.type == 'image': 107 elif self.type == 'image':