Chats can be sent by pressing enter in the text box
This commit is contained in:
parent
4491a600f3
commit
4ae167e461
@ -3,6 +3,9 @@
|
|||||||
## Changes in the current build ()
|
## Changes in the current build ()
|
||||||
|
|
||||||
* Added a new menu in the menu bar that allows you to control the audio playback. For some actions (like play, next and back), if you are not focusing an audio buffer, the program will take the song from the "my audios" buffer.
|
* Added a new menu in the menu bar that allows you to control the audio playback. For some actions (like play, next and back), if you are not focusing an audio buffer, the program will take the song from the "my audios" buffer.
|
||||||
|
* Added two more buffers: "Followers" and "I follow", located in the people buffer, under "friendship requests".
|
||||||
|
* Added an experimental photo viewer. Will show options for see the next and previous photo if the current post contains multiple images.
|
||||||
|
* Improved chats, now they should be more stable.
|
||||||
|
|
||||||
## Changes in build 2016.07.08 (08/07/2016)
|
## Changes in build 2016.07.08 (08/07/2016)
|
||||||
|
|
||||||
|
@ -490,7 +490,16 @@ class chatBuffer(baseBuffer):
|
|||||||
def send_chat_to_user(self, *args, **kwargs):
|
def send_chat_to_user(self, *args, **kwargs):
|
||||||
text = self.tab.text.GetValue()
|
text = self.tab.text.GetValue()
|
||||||
if text == "": return
|
if text == "": return
|
||||||
response = self.session.vk.client.messages.send(user_id=self.kwargs["user_id"], message=text)
|
call_threaded(self._send_message, text=text)
|
||||||
|
|
||||||
|
def _send_message(self, text):
|
||||||
|
try:
|
||||||
|
response = self.session.vk.client.messages.send(user_id=self.kwargs["user_id"], message=text)
|
||||||
|
except VkAPIMethodError as ex:
|
||||||
|
if ex.code == 9:
|
||||||
|
output.speak(_(u"You have been sending a message that is already sent. Try to update the buffer if you can't see the new message in the history."))
|
||||||
|
finally:
|
||||||
|
self.tab.text.SetValue("")
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(chatBuffer, self).__init__(*args, **kwargs)
|
super(chatBuffer, self).__init__(*args, **kwargs)
|
||||||
|
@ -2,16 +2,21 @@
|
|||||||
import threading
|
import threading
|
||||||
from vk import longpool
|
from vk import longpool
|
||||||
from pubsub import pub
|
from pubsub import pub
|
||||||
|
from logging import getLogger
|
||||||
|
log = getLogger("controller.longpolThread")
|
||||||
|
|
||||||
class worker(threading.Thread):
|
class worker(threading.Thread):
|
||||||
def __init__(self, session):
|
def __init__(self, session):
|
||||||
super(worker, self).__init__()
|
super(worker, self).__init__()
|
||||||
|
log.debug("Instanciating longPoll server")
|
||||||
self.session = session
|
self.session = session
|
||||||
self.l = longpool.LongPoll(self.session.vk.client)
|
self.l = longpool.LongPoll(self.session.vk.client)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
while self.session.is_logged == True:
|
while self.session.is_logged == True:
|
||||||
|
log.debug("Calling to check...")
|
||||||
p = self.l.check()
|
p = self.l.check()
|
||||||
|
# log.debug("check has returned " + p)
|
||||||
for i in p:
|
for i in p:
|
||||||
# print i.message_id, i.flags, i.from_id, i.user_id, i.mask, i.byself, i.message_flags
|
# print i.message_id, i.flags, i.from_id, i.user_id, i.mask, i.byself, i.message_flags
|
||||||
# if i.flags == 4 or i.flags == 51 or i.flags == 49:
|
# if i.flags == 4 or i.flags == 51 or i.flags == 49:
|
||||||
|
@ -138,6 +138,7 @@ class chatTab(wx.Panel):
|
|||||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||||
sizer.Add(self.create_controls())
|
sizer.Add(self.create_controls())
|
||||||
self.send = wx.Button(self, -1, _(u"Send"))
|
self.send = wx.Button(self, -1, _(u"Send"))
|
||||||
|
self.send.SetDefault()
|
||||||
sizer.Add(self.send, 0, wx.ALL, 5)
|
sizer.Add(self.send, 0, wx.ALL, 5)
|
||||||
self.SetSizer(sizer)
|
self.SetSizer(sizer)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user