Mercurial > libervia-desktop-kivy
comparison src/cagou/plugins/plugin_wid_chat.py @ 37:6cf08d0ee460
chat: forbid scrolling on X axis + don't delete widget until explicitly requested (with force attribute)
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 28 Aug 2016 15:27:45 +0200 |
parents | 20b04c58868f |
children | 7cac2d1a6f20 |
comparison
equal
deleted
inserted
replaced
36:bd3ecac18870 | 37:6cf08d0ee460 |
---|---|
94 | 94 |
95 def __init__(self, host, target, type_=C.CHAT_ONE2ONE, occupants=None, subject=None, profiles=None): | 95 def __init__(self, host, target, type_=C.CHAT_ONE2ONE, occupants=None, subject=None, profiles=None): |
96 quick_chat.QuickChat.__init__(self, host, target, type_, occupants, subject, profiles=profiles) | 96 quick_chat.QuickChat.__init__(self, host, target, type_, occupants, subject, profiles=profiles) |
97 cagou_widget.CagouWidget.__init__(self) | 97 cagou_widget.CagouWidget.__init__(self) |
98 self.header_input.hint_text = u"You are talking with {}".format(target) | 98 self.header_input.hint_text = u"You are talking with {}".format(target) |
99 scroll_view = ScrollView(size_hint=(1,0.8), scroll_y=0) | 99 scroll_view = ScrollView(size_hint=(1,0.8), scroll_y=0, do_scroll_x=False) |
100 self.messages_widget = MessagesWidget() | 100 self.messages_widget = MessagesWidget() |
101 scroll_view.add_widget(self.messages_widget) | 101 scroll_view.add_widget(self.messages_widget) |
102 self.add_widget(scroll_view) | 102 self.add_widget(scroll_view) |
103 message_input = MessageInputWidget() | 103 message_input = MessageInputWidget() |
104 message_input.bind(on_text_validate=self.onSend) | 104 message_input.bind(on_text_validate=self.onSend) |
163 def discoEb(failure): | 163 def discoEb(failure): |
164 log.warning(u"Disco failure, ignore this text: {}".format(failure)) | 164 log.warning(u"Disco failure, ignore this text: {}".format(failure)) |
165 | 165 |
166 G.host.bridge.discoInfos(jid_.domain, self.profile, callback=discoCb, errback=discoEb) | 166 G.host.bridge.discoInfos(jid_.domain, self.profile, callback=discoCb, errback=discoEb) |
167 | 167 |
168 def onDelete(self, force=False): | |
169 if force==True: | |
170 return True | |
171 if len(list(G.host.widgets.getWidgets(self.__class__, self.target, profiles=self.profiles))) > 1: | |
172 # we don't keep duplicate widgets | |
173 return True | |
174 return False | |
168 | 175 |
169 | 176 |
170 PLUGIN_INFO["factory"] = Chat.factory | 177 PLUGIN_INFO["factory"] = Chat.factory |
171 quick_widgets.register(quick_chat.QuickChat, Chat) | 178 quick_widgets.register(quick_chat.QuickChat, Chat) |