mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2025-02-16 22:44:09 -06:00
Added showing followers and friends timelines
This commit is contained in:
parent
ab08eada81
commit
2bfb53abe1
@ -28,6 +28,8 @@ timelines = list(default=list())
|
||||
tweet_searches = list(default=list())
|
||||
lists = list(default=list())
|
||||
favourites_timelines = list(default=list())
|
||||
followers_timelines = list(default=list())
|
||||
friends_timelines = list(default=list())
|
||||
trending_topic_buffers = list(default=list())
|
||||
muted_buffers = list(default=list())
|
||||
autoread_buffers = list(default=list(mentions, direct_messages, events))
|
||||
|
@ -714,7 +714,7 @@ class eventsBufferController(bufferController):
|
||||
|
||||
class peopleBufferController(baseBufferController):
|
||||
def __init__(self, parent, function, name, sessionObject, account, bufferType=None, *args, **kwargs):
|
||||
super(peopleBufferController, self).__init__(parent, function, name, sessionObject, account, bufferType="peoplePanel")
|
||||
super(peopleBufferController, self).__init__(parent, function, name, sessionObject, account, bufferType="peoplePanel", *args, **kwargs)
|
||||
log.debug("Initializing buffer %s, account %s" % (name, account,))
|
||||
self.compose_function = compose.compose_followers_list
|
||||
log.debug("Compose_function: %s" % (self.compose_function,))
|
||||
@ -722,7 +722,25 @@ class peopleBufferController(baseBufferController):
|
||||
self.url = self.interact
|
||||
|
||||
def remove_buffer(self):
|
||||
return False
|
||||
if "-followers" in self.name:
|
||||
dlg = commonMessageDialogs.remove_buffer()
|
||||
if dlg == widgetUtils.YES:
|
||||
if self.name[:-10] in self.session.settings["other_buffers"]["followers_timelines"]:
|
||||
self.session.settings["other_buffers"]["followers_timelines"].remove(self.name[:-10])
|
||||
return True
|
||||
elif dlg == widgetUtils.NO:
|
||||
return False
|
||||
elif "-friends" in self.name:
|
||||
dlg = commonMessageDialogs.remove_buffer()
|
||||
if dlg == widgetUtils.YES:
|
||||
if self.name[:-8] in self.session.settings["other_buffers"]["friends_timelines"]:
|
||||
self.session.settings["other_buffers"]["friends_timelines"].remove(self.name[:-9])
|
||||
return True
|
||||
elif dlg == widgetUtils.NO:
|
||||
return False
|
||||
else:
|
||||
output.speak(_(u"This buffer is not a timeline; it can't be deleted."), True)
|
||||
return False
|
||||
|
||||
def onFocus(self, ev):
|
||||
pass
|
||||
|
@ -344,6 +344,24 @@ class Controller(object):
|
||||
self.view.insert_buffer(tl.buffer, name=_(u"Likes for {}").format(i,), pos=self.view.search("favs_timelines", session.db["user_name"]))
|
||||
tl.timer = RepeatingTimer(300, tl.start_stream)
|
||||
tl.timer.start()
|
||||
followers_timelines = buffersController.emptyPanel(self.view.nb, "followers_timelines", session.db["user_name"])
|
||||
self.buffers.append(followers_timelines)
|
||||
self.view.insert_buffer(followers_timelines.buffer , name=_(u"Followers' Timelines"), pos=self.view.search(session.db["user_name"], session.db["user_name"]))
|
||||
for i in session.settings["other_buffers"]["followers_timelines"]:
|
||||
tl = buffersController.peopleBufferController(self.view.nb, "get_followers_list", "%s-followers" % (i,), session, session.db["user_name"], screen_name=i)
|
||||
self.buffers.append(tl)
|
||||
self.view.insert_buffer(tl.buffer, name=_(u"Followers for {}").format(i,), pos=self.view.search("favs_timelines", session.db["user_name"]))
|
||||
tl.timer = RepeatingTimer(300, tl.start_stream)
|
||||
tl.timer.start()
|
||||
friends_timelines = buffersController.emptyPanel(self.view.nb, "friends_timelines", session.db["user_name"])
|
||||
self.buffers.append(friends_timelines)
|
||||
self.view.insert_buffer(friends_timelines.buffer , name=_(u"Followers' Timelines"), pos=self.view.search(session.db["user_name"], session.db["user_name"]))
|
||||
for i in session.settings["other_buffers"]["friends_timelines"]:
|
||||
tl = buffersController.peopleBufferController(self.view.nb, "get_friends_list", "%s-friends" % (i,), session, session.db["user_name"], screen_name=i)
|
||||
self.buffers.append(tl)
|
||||
self.view.insert_buffer(tl.buffer, name=_(u"Friends for {}").format(i,), pos=self.view.search("favs_timelines", session.db["user_name"]))
|
||||
tl.timer = RepeatingTimer(300, tl.start_stream)
|
||||
tl.timer.start()
|
||||
lists = buffersController.emptyPanel(self.view.nb, "lists", session.db["user_name"])
|
||||
self.buffers.append(lists)
|
||||
self.view.insert_buffer(lists.buffer , name=_(u"Lists"), pos=self.view.search(session.db["user_name"], session.db["user_name"]))
|
||||
@ -759,7 +777,8 @@ class Controller(object):
|
||||
return
|
||||
answer = commonMessageDialogs.protected_user()
|
||||
if answer == widgetUtils.NO: return
|
||||
if dlg.get_action() == "tweets":
|
||||
tl_type = dlg.get_action()
|
||||
if tl_type == "tweets":
|
||||
if usr["statuses_count"] == 0:
|
||||
commonMessageDialogs.no_tweets()
|
||||
return
|
||||
@ -775,7 +794,7 @@ class Controller(object):
|
||||
buff.session.settings["other_buffers"]["timelines"].append(dlg.get_user())
|
||||
pub.sendMessage("restart-streams", streams=["timelinesStream"], session=buff.session)
|
||||
buff.session.sound.play("create_timeline.ogg")
|
||||
else:
|
||||
elif tl_type == "favourites":
|
||||
if usr["favourites_count"] == 0:
|
||||
commonMessageDialogs.no_favs()
|
||||
return
|
||||
@ -792,6 +811,40 @@ class Controller(object):
|
||||
tl.timer.start()
|
||||
buff.session.settings["other_buffers"]["favourites_timelines"].append(dlg.get_user())
|
||||
buff.session.sound.play("create_timeline.ogg")
|
||||
elif tl_type == "followers":
|
||||
if usr["followers_count"] == 0:
|
||||
commonMessageDialogs.no_followers()
|
||||
return
|
||||
if dlg.get_user() in buff.session.settings["other_buffers"]["followers_timelines"]:
|
||||
commonMessageDialogs.timeline_exist()
|
||||
return
|
||||
tl = buffersController.peopleBufferController(self.view.nb, "get_followers_list", "%s-followers" % (dlg.get_user(),), buff.session, buff.session.db["user_name"], screen_name=dlg.get_user())
|
||||
pos=self.view.search("followers_timelines", buff.session.db["user_name"])
|
||||
self.insert_buffer(tl, pos+1)
|
||||
# self.buffers.insert(pos+1, tl)
|
||||
self.view.insert_buffer(buffer=tl.buffer, name=_(u"Followers for {}").format(dlg.get_user()), pos=pos)
|
||||
tl.start_stream()
|
||||
tl.timer = RepeatingTimer(300, tl.start_stream)
|
||||
tl.timer.start()
|
||||
buff.session.settings["other_buffers"]["followers_timelines"].append(dlg.get_user())
|
||||
buff.session.sound.play("create_timeline.ogg")
|
||||
|
||||
elif tl_type == "friends":
|
||||
if usr["friends_count"] == 0:
|
||||
commonMessageDialogs.no_friends()
|
||||
return
|
||||
if dlg.get_user() in buff.session.settings["other_buffers"]["friends_timelines"]:
|
||||
commonMessageDialogs.timeline_exist()
|
||||
return
|
||||
tl = buffersController.peopleBufferController(self.view.nb, "get_friends_list", "%s-friends" % (dlg.get_user(),), buff.session, buff.session.db["user_name"], screen_name=dlg.get_user())
|
||||
pos=self.view.search("friends_timelines", buff.session.db["user_name"])
|
||||
self.insert_buffer(tl, pos+1)
|
||||
self.view.insert_buffer(buffer=tl.buffer, name=_(u"Friends for {}").format(dlg.get_user()), pos=pos)
|
||||
tl.start_stream()
|
||||
tl.timer = RepeatingTimer(300, tl.start_stream)
|
||||
tl.timer.start()
|
||||
buff.session.settings["other_buffers"]["friends_timelines"].append(dlg.get_user())
|
||||
buff.session.sound.play("create_timeline.ogg")
|
||||
else:
|
||||
commonMessageDialogs.user_not_exist()
|
||||
|
||||
|
@ -278,7 +278,7 @@ class Session(object):
|
||||
tl = self.call_paged(function, sinze_id=last_id, *args, **kwargs)
|
||||
self.order_buffer(name, tl)
|
||||
|
||||
@_require_login
|
||||
# @_require_login
|
||||
def get_cursored_stream(self, name, function, items="users", *args, **kwargs):
|
||||
|
||||
""" Gets items for API calls that require using cursors to paginate the results.
|
||||
|
@ -58,3 +58,9 @@ def no_tweets():
|
||||
|
||||
def no_favs():
|
||||
return wx.MessageDialog(None, _(u"This user has no favorited tweets. {0} can't create a timeline.").format(application.name), _(u"Error"), wx.ICON_ERROR).ShowModal()
|
||||
|
||||
def no_followers():
|
||||
return wx.MessageDialog(None, _(u"This user has no followers. {0} can't create a timeline.").format(application.name), _(u"Error"), wx.ICON_ERROR).ShowModal()
|
||||
|
||||
def no_friends():
|
||||
return wx.MessageDialog(None, _(u"This user has no friends. {0} can't create a timeline.").format(application.name), _(u"Error"), wx.ICON_ERROR).ShowModal()
|
||||
|
@ -18,11 +18,15 @@ class selectUserDialog(wx.Dialog):
|
||||
label2 = wx.StaticText(panel, -1, _(u"Buffer type"))
|
||||
self.tweets = wx.RadioButton(panel, -1, _(u"Tweets"), style=wx.RB_GROUP)
|
||||
self.favourites = wx.RadioButton(panel, -1, _(u"Likes"))
|
||||
self.followers = wx.RadioButton(panel, -1, _(u"Followers"))
|
||||
self.friends = wx.RadioButton(panel, -1, _(u"Friends"))
|
||||
self.setup_default(default)
|
||||
hSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
hSizer.Add(label2, 0, wx.ALL, 5)
|
||||
actionSizer.Add(self.tweets, 0, wx.ALL, 5)
|
||||
actionSizer.Add(self.favourites, 0, wx.ALL, 5)
|
||||
actionSizer.Add(self.followers, 0, wx.ALL, 5)
|
||||
actionSizer.Add(self.friends, 0, wx.ALL, 5)
|
||||
hSizer.Add(actionSizer, 0, wx.ALL, 5)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
ok = wx.Button(panel, wx.ID_OK, _(u"OK"))
|
||||
@ -39,6 +43,8 @@ class selectUserDialog(wx.Dialog):
|
||||
def get_action(self):
|
||||
if self.tweets.GetValue() == True: return "tweets"
|
||||
elif self.favourites.GetValue() == True: return "favourites"
|
||||
elif self.followers.GetValue() == True: return "followers"
|
||||
elif self.friends.GetValue() == True: return "friends"
|
||||
|
||||
def setup_default(self, default):
|
||||
if default == "tweets":
|
||||
|
Loading…
x
Reference in New Issue
Block a user