Chat messages should be able to be send with enter in the edit box

This commit is contained in:
Manuel Cortez 2018-12-11 09:26:14 -06:00
parent e0eb0eefce
commit 6f9a5ce8d2
2 changed files with 6 additions and 1 deletions

View File

@ -672,8 +672,14 @@ class chatBuffer(baseBuffer):
def connect_events(self):
widgetUtils.connect_event(self.tab.send, widgetUtils.BUTTON_PRESSED, self.send_chat_to_user)
widgetUtils.connect_event(self.tab.attachment, widgetUtils.BUTTON_PRESSED, self.add_attachment)
widgetUtils.connect_event(self.tab.text, widgetUtils.KEYPRESS, self.catch_enter)
self.tab.set_focus_function(self.onFocus)
def catch_enter(self, event, *args, **kwargs):
if event.GetKeyCode() == wx.WXK_RETURN:
self.send_chat_to_user()
event.Skip()
def get_items(self, show_nextpage=False):
if self.can_get_items == False: return
retrieved = True # Control variable for handling unauthorised/connection errors.

View File

@ -146,7 +146,6 @@ class chatTab(wx.Panel):
self.attachment = wx.Button(self, wx.NewId(), _(u"Add"))
sizer.Add(self.attachment, 0, wx.ALL, 5)
self.send = wx.Button(self, -1, _(u"Send"))
self.send.SetDefault()
sizer.Add(self.send, 0, wx.ALL, 5)
self.SetSizer(sizer)