mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-22 19:28:09 -06:00
Basic conversation support, a jaws fix
This commit is contained in:
parent
89e541be95
commit
75dfaec727
@ -22,7 +22,7 @@ class Jaws (Output):
|
||||
self.object.RunFunction("BrailleString(\"%s\")" % text)
|
||||
|
||||
def speak(self, text, interrupt=False):
|
||||
self.object.SayString(' %s' % text, interrupt)
|
||||
self.object.SayString(' %s' % text, True)
|
||||
|
||||
def is_active(self):
|
||||
try:
|
||||
|
@ -18,6 +18,7 @@ left = string(default="control+win+left")
|
||||
right = string(default="control+win+right")
|
||||
next_account = string(default="control+win+shift+right")
|
||||
previous_account = string(default="control+win+shift+left")
|
||||
open_conversation = string(default="control+win+c")
|
||||
conversation_up = string(default="control+win+shift+up")
|
||||
conversation_down = string(default="control+win+shift+down")
|
||||
show_hide = string(default="control+win+m")
|
||||
|
@ -692,3 +692,31 @@ class trendsBufferController(bufferController):
|
||||
|
||||
def url(self, *args, **kwargs):
|
||||
self.searchfunction(value=self.get_message())
|
||||
|
||||
class conversationBufferController(searchBufferController):
|
||||
|
||||
def start_stream(self, start=False):
|
||||
if start == True:
|
||||
self.statuses = []
|
||||
self.ids = []
|
||||
self.statuses.append(self.tweet)
|
||||
self.ids.append(self.tweet["id"])
|
||||
tweet = self.tweet
|
||||
while tweet["in_reply_to_status_id"] != None:
|
||||
tweet = self.session.twitter.twitter.show_status(id=tweet["in_reply_to_status_id"])
|
||||
self.statuses.insert(0, tweet)
|
||||
self.ids.append(tweet["id"])
|
||||
if tweet["in_reply_to_status_id"] == None:
|
||||
self.kwargs["since_id"] = tweet["id"]
|
||||
self.ids.append(tweet["id"])
|
||||
val2 = getattr(self.session.twitter.twitter, self.function)(*self.args, **self.kwargs)
|
||||
for i in val2["statuses"]:
|
||||
if i["in_reply_to_status_id"] in self.ids:
|
||||
self.statuses.append(i)
|
||||
self.ids.append(i["id"])
|
||||
tweet = i
|
||||
number_of_items = self.session.order_buffer(self.name, self.statuses)
|
||||
log.debug("Number of items retrieved: %d" % (number_of_items,))
|
||||
self.put_items_on_list(number_of_items)
|
||||
if number_of_items > 0:
|
||||
self.session.sound.play("search_updated.ogg")
|
||||
|
@ -649,6 +649,18 @@ class Controller(object):
|
||||
else:
|
||||
commonMessageDialogs.user_not_exist()
|
||||
|
||||
def open_conversation(self, *args, **kwargs):
|
||||
buffer = self.get_current_buffer()
|
||||
id = buffer.get_right_tweet()["id_str"]
|
||||
user = buffer.get_right_tweet()["user"]["screen_name"]
|
||||
search = buffersController.conversationBufferController(self.view.nb, "search", "%s-searchterm" % (id,), buffer.session, buffer.session.db["user_name"], bufferType="searchPanel", since_id=id, q="@{0}".format(user,), count=100)
|
||||
search.tweet = buffer.get_right_tweet()
|
||||
search.start_stream(start=True)
|
||||
self.buffers.append(search)
|
||||
self.view.insert_buffer(search.buffer, name=_(u"Conversation with {0}".format(user)), pos=self.view.search("searches", buffer.session.db["user_name"]))
|
||||
search.timer = RepeatingTimer(300, search.start_stream)
|
||||
search.timer.start()
|
||||
|
||||
def show_hide(self, *args, **kwargs):
|
||||
km = self.create_invisible_keyboard_shorcuts()
|
||||
if self.showing == True:
|
||||
|
@ -47,4 +47,5 @@ actions = {
|
||||
"reverse_geocode": _(u"Get location of any tweet"),
|
||||
"view_reverse_geocode": _(u"Displays the tweet's location in a dialog"),
|
||||
"get_trending_topics": _(u"Creates a buffer for displaying trends for a desired place"),
|
||||
"open_conversation": _(u"Opens up a conversation buffer"),
|
||||
}
|
@ -21,7 +21,9 @@ class list(object):
|
||||
self.list.SetColumnWidth(column, x)
|
||||
|
||||
def set_size(self):
|
||||
self.list.SetSize(self.list.GetBestSize())
|
||||
# self.list.SetSize(self.list.GetBestSize())
|
||||
# print self.list.GetBestSize()
|
||||
self.list.SetSize((1439, 1000))
|
||||
|
||||
def create_list(self, parent):
|
||||
if self.system == "Windows":
|
||||
|
@ -28,8 +28,9 @@ class basePanel(wx.Panel):
|
||||
btnSizer.Add(self.reply, 0, wx.ALL, 5)
|
||||
btnSizer.Add(self.dm, 0, wx.ALL, 5)
|
||||
self.sizer.Add(btnSizer, 0, wx.ALL, 5)
|
||||
self.sizer.Add(self.list.list, 0, wx.ALL, 5)
|
||||
self.sizer.Add(self.list.list, 0, wx.ALL|wx.EXPAND, 5)
|
||||
self.SetSizer(self.sizer)
|
||||
self.SetClientSize(self.sizer.CalcMin())
|
||||
|
||||
def set_position(self, reversed=False):
|
||||
if reversed == False:
|
||||
|
@ -132,6 +132,8 @@ class mainFrame(wx.Frame):
|
||||
def prepare(self):
|
||||
self.sizer.Add(self.nb, 0, wx.ALL, 5)
|
||||
self.panel.SetSizer(self.sizer)
|
||||
# self.Maximize()
|
||||
self.sizer.Layout()
|
||||
self.SetClientSize(self.sizer.CalcMin())
|
||||
|
||||
def search(self, name_, account):
|
||||
|
Loading…
Reference in New Issue
Block a user