mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-29 22:23:12 -06:00
Changed favourites for likes
This commit is contained in:
parent
fa1b8bfde3
commit
8e67ed025c
@ -307,7 +307,7 @@ class Controller(object):
|
|||||||
favourites = buffersController.baseBufferController(self.view.nb, "get_favorites", "favourites", session, session.db["user_name"])
|
favourites = buffersController.baseBufferController(self.view.nb, "get_favorites", "favourites", session, session.db["user_name"])
|
||||||
self.buffers.append(favourites)
|
self.buffers.append(favourites)
|
||||||
|
|
||||||
self.view.insert_buffer(favourites.buffer, name=_(u"Favourites"), pos=self.view.search(session.db["user_name"], session.db["user_name"]))
|
self.view.insert_buffer(favourites.buffer, name=_(u"Likes"), pos=self.view.search(session.db["user_name"], session.db["user_name"]))
|
||||||
elif i == 'followers':
|
elif i == 'followers':
|
||||||
followers = buffersController.peopleBufferController(self.view.nb, "get_followers_list", "followers", session, session.db["user_name"], screen_name=session.db["user_name"])
|
followers = buffersController.peopleBufferController(self.view.nb, "get_followers_list", "followers", session, session.db["user_name"], screen_name=session.db["user_name"])
|
||||||
self.buffers.append(followers)
|
self.buffers.append(followers)
|
||||||
@ -337,11 +337,11 @@ class Controller(object):
|
|||||||
self.view.insert_buffer(tl.buffer, name=_(u"Timeline for {}").format(i,), pos=self.view.search("timelines", session.db["user_name"]))
|
self.view.insert_buffer(tl.buffer, name=_(u"Timeline for {}").format(i,), pos=self.view.search("timelines", session.db["user_name"]))
|
||||||
favs_timelines = buffersController.emptyPanel(self.view.nb, "favs_timelines", session.db["user_name"])
|
favs_timelines = buffersController.emptyPanel(self.view.nb, "favs_timelines", session.db["user_name"])
|
||||||
self.buffers.append(favs_timelines)
|
self.buffers.append(favs_timelines)
|
||||||
self.view.insert_buffer(favs_timelines.buffer , name=_(u"Favourites timelines"), pos=self.view.search(session.db["user_name"], session.db["user_name"]))
|
self.view.insert_buffer(favs_timelines.buffer , name=_(u"Likes timelines"), pos=self.view.search(session.db["user_name"], session.db["user_name"]))
|
||||||
for i in session.settings["other_buffers"]["favourites_timelines"]:
|
for i in session.settings["other_buffers"]["favourites_timelines"]:
|
||||||
tl = buffersController.baseBufferController(self.view.nb, "get_favorites", "%s-favorite" % (i,), session, session.db["user_name"], bufferType=None, screen_name=i)
|
tl = buffersController.baseBufferController(self.view.nb, "get_favorites", "%s-favorite" % (i,), session, session.db["user_name"], bufferType=None, screen_name=i)
|
||||||
self.buffers.append(tl)
|
self.buffers.append(tl)
|
||||||
self.view.insert_buffer(tl.buffer, name=_(u"Favourites timeline for {}").format(i,), pos=self.view.search("favs_timelines", session.db["user_name"]))
|
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 = RepeatingTimer(300, tl.start_stream)
|
||||||
tl.timer.start()
|
tl.timer.start()
|
||||||
lists = buffersController.emptyPanel(self.view.nb, "lists", session.db["user_name"])
|
lists = buffersController.emptyPanel(self.view.nb, "lists", session.db["user_name"])
|
||||||
@ -786,7 +786,7 @@ class Controller(object):
|
|||||||
pos=self.view.search("favs_timelines", buff.session.db["user_name"])
|
pos=self.view.search("favs_timelines", buff.session.db["user_name"])
|
||||||
self.insert_buffer(tl, pos+1)
|
self.insert_buffer(tl, pos+1)
|
||||||
# self.buffers.insert(pos+1, tl)
|
# self.buffers.insert(pos+1, tl)
|
||||||
self.view.insert_buffer(buffer=tl.buffer, name=_(u"Favourites timeline for {}").format(dlg.get_user()), pos=pos)
|
self.view.insert_buffer(buffer=tl.buffer, name=_(u"Likes for {}").format(dlg.get_user()), pos=pos)
|
||||||
tl.start_stream()
|
tl.start_stream()
|
||||||
tl.timer = RepeatingTimer(300, tl.start_stream)
|
tl.timer = RepeatingTimer(300, tl.start_stream)
|
||||||
tl.timer.start()
|
tl.timer.start()
|
||||||
@ -1274,7 +1274,7 @@ class Controller(object):
|
|||||||
if buffer == "favourites":
|
if buffer == "favourites":
|
||||||
favourites = buffersController.baseBufferController(self.view.nb, "get_favorites", "favourites", buff.session, buff.session.db["user_name"])
|
favourites = buffersController.baseBufferController(self.view.nb, "get_favorites", "favourites", buff.session, buff.session.db["user_name"])
|
||||||
self.buffers.append(favourites)
|
self.buffers.append(favourites)
|
||||||
self.view.insert_buffer(favourites.buffer, name=_(u"Favourites"), pos=self.view.search(buff.session.db["user_name"], buff.session.db["user_name"]))
|
self.view.insert_buffer(favourites.buffer, name=_(u"Likes"), pos=self.view.search(buff.session.db["user_name"], buff.session.db["user_name"]))
|
||||||
favourites.start_stream()
|
favourites.start_stream()
|
||||||
if buffer == "followers":
|
if buffer == "followers":
|
||||||
followers = buffersController.peopleBufferController(self.view.nb, "get_followers_list", "followers", buff.session, buff.session.db["user_name"], screen_name=buff.session.db["user_name"])
|
followers = buffersController.peopleBufferController(self.view.nb, "get_followers_list", "followers", buff.session, buff.session.db["user_name"], screen_name=buff.session.db["user_name"])
|
||||||
|
@ -168,9 +168,9 @@ class viewTweet(basicTweet):
|
|||||||
text = ""
|
text = ""
|
||||||
for i in xrange(0, len(tweetList)):
|
for i in xrange(0, len(tweetList)):
|
||||||
if tweetList[i].has_key("retweeted_status"):
|
if tweetList[i].has_key("retweeted_status"):
|
||||||
text = text + "rt @%s: %s\n\n" % (tweetList[i]["retweeted_status"]["user"]["screen_name"], tweetList[i]["retweeted_status"]["text"])
|
text = text + "rt @%s: %s\n" % (tweetList[i]["retweeted_status"]["user"]["screen_name"], tweetList[i]["retweeted_status"]["text"])
|
||||||
else:
|
else:
|
||||||
text = text + "@%s: %s\n\n" % (tweetList[i]["user"]["screen_name"], tweetList[i]["text"])
|
text = text + "@%s: %s\n" % (tweetList[i]["user"]["screen_name"], tweetList[i]["text"])
|
||||||
rt_count = str(tweet["retweet_count"])
|
rt_count = str(tweet["retweet_count"])
|
||||||
favs_count = str(tweet["favorite_count"])
|
favs_count = str(tweet["favorite_count"])
|
||||||
if text == "":
|
if text == "":
|
||||||
@ -178,6 +178,7 @@ class viewTweet(basicTweet):
|
|||||||
text = "rt @%s: %s" % (tweet["retweeted_status"]["user"]["screen_name"], tweet["retweeted_status"]["text"])
|
text = "rt @%s: %s" % (tweet["retweeted_status"]["user"]["screen_name"], tweet["retweeted_status"]["text"])
|
||||||
else:
|
else:
|
||||||
text = tweet["text"]
|
text = tweet["text"]
|
||||||
|
text = self.clear_text(text)
|
||||||
self.message = message.viewTweet(text, rt_count, favs_count)
|
self.message = message.viewTweet(text, rt_count, favs_count)
|
||||||
self.message.set_title(len(text))
|
self.message.set_title(len(text))
|
||||||
else:
|
else:
|
||||||
@ -194,3 +195,10 @@ class viewTweet(basicTweet):
|
|||||||
if len(utils.find_urls_in_text(self.message.get_text())) > 0:
|
if len(utils.find_urls_in_text(self.message.get_text())) > 0:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def clear_text(self, text):
|
||||||
|
urls = utils.find_urls_in_text(text)
|
||||||
|
for i in urls:
|
||||||
|
if "https://twitter.com/" in i:
|
||||||
|
text = text.replace(i, "")
|
||||||
|
return text
|
||||||
|
@ -95,7 +95,7 @@ class profileController(object):
|
|||||||
else: verified = _(u"No")
|
else: verified = _(u"No")
|
||||||
string = string+ _(u"Verified: %s\n") % (verified)
|
string = string+ _(u"Verified: %s\n") % (verified)
|
||||||
string = string+ _(u"Tweets: %s\n") % (self.data["statuses_count"])
|
string = string+ _(u"Tweets: %s\n") % (self.data["statuses_count"])
|
||||||
string = string+ _(u"Favourites: %s") % (self.data["favourites_count"])
|
string = string+ _(u"Likes: %s") % (self.data["favourites_count"])
|
||||||
return string
|
return string
|
||||||
|
|
||||||
def visit_url(self, *args, **kwargs):
|
def visit_url(self, *args, **kwargs):
|
||||||
|
@ -7,8 +7,8 @@ actions = reverse_sort.reverse_sort([ ("audio", _(u"Audio tweet.")),
|
|||||||
("dm_received", _(u"Direct message received.")),
|
("dm_received", _(u"Direct message received.")),
|
||||||
("dm_sent", _(u"Direct message sent.")),
|
("dm_sent", _(u"Direct message sent.")),
|
||||||
("error", _(u"Error.")),
|
("error", _(u"Error.")),
|
||||||
("favourite", _(u"Tweet favourited.")),
|
("favourite", _(u"Tweet liked.")),
|
||||||
("favourites_timeline_updated", _(u"Favourites buffer updated.")),
|
("favourites_timeline_updated", _(u"Likes buffer updated.")),
|
||||||
("geo", _(u"Geotweet.")),
|
("geo", _(u"Geotweet.")),
|
||||||
("limit", _(u"Boundary reached.")),
|
("limit", _(u"Boundary reached.")),
|
||||||
("list_tweet", _(u"List updated.")),
|
("list_tweet", _(u"List updated.")),
|
||||||
|
@ -11,8 +11,8 @@ actions = {
|
|||||||
"post_reply": _(u"Reply"),
|
"post_reply": _(u"Reply"),
|
||||||
"post_retweet": _(u"Retweet"),
|
"post_retweet": _(u"Retweet"),
|
||||||
"send_dm": _(u"Send direct message"),
|
"send_dm": _(u"Send direct message"),
|
||||||
"add_to_favourites": _(u"Mark as favourite"),
|
"add_to_favourites": _(u"Like a tweet"),
|
||||||
"remove_from_favourites": _(u"Remove from favourites"),
|
"remove_from_favourites": _(u"Unlike a tweet"),
|
||||||
"follow": _(u"Open the user actions dialogue"),
|
"follow": _(u"Open the user actions dialogue"),
|
||||||
"user_details": _(u"See user details"),
|
"user_details": _(u"See user details"),
|
||||||
"view_item": _(u"Show tweet"),
|
"view_item": _(u"Show tweet"),
|
||||||
|
@ -123,12 +123,12 @@ def compose_event(data, username):
|
|||||||
event = _(u"You've unfollowed %s (@%s)") % (data["target"]["name"], data["target"]["screen_name"])
|
event = _(u"You've unfollowed %s (@%s)") % (data["target"]["name"], data["target"]["screen_name"])
|
||||||
elif data["event"] == "favorite":
|
elif data["event"] == "favorite":
|
||||||
if data["source"]["screen_name"] == username:
|
if data["source"]["screen_name"] == username:
|
||||||
event = _(u"You've added to favourites: %s, %s") % (data["target"]["name"], data["target_object"]["text"])
|
event = _(u"You've liked: %s, %s") % (data["target"]["name"], data["target_object"]["text"])
|
||||||
else:
|
else:
|
||||||
event = _(u"%s(@%s) has marked as favourite: %s") % (data["source"]["name"], data["source"]["screen_name"], data["target_object"]["text"])
|
event = _(u"%s(@%s) has liked: %s") % (data["source"]["name"], data["source"]["screen_name"], data["target_object"]["text"])
|
||||||
elif data["event"] == "unfavorite":
|
elif data["event"] == "unfavorite":
|
||||||
if data["source"]["screen_name"] == username: event = _(u"You've removed from favourites: %s, %s") % (data["target"]["name"], data["target_object"]["text"])
|
if data["source"]["screen_name"] == username: event = _(u"You've unliked: %s, %s") % (data["target"]["name"], data["target_object"]["text"])
|
||||||
else: event = _(u"%s(@%s) has removed from favourites: %s") % (data["source"]["name"], data["source"]["screen_name"], data["target_object"]["text"])
|
else: event = _(u"%s(@%s) has unliked: %s") % (data["source"]["name"], data["source"]["screen_name"], data["target_object"]["text"])
|
||||||
elif data["event"] == "list_created":
|
elif data["event"] == "list_created":
|
||||||
event = _(u"You've created the list %s") % (data["target_object"]["name"])
|
event = _(u"You've created the list %s") % (data["target_object"]["name"])
|
||||||
elif data["event"] == "list_destroyed":
|
elif data["event"] == "list_destroyed":
|
||||||
|
@ -47,7 +47,7 @@ def protected_user():
|
|||||||
return wx.MessageDialog(None, _(u"This is a protected Twitter user, which means you can't open a timeline using the Streaming API. The user's tweets will not update due to a twitter policy. Do you want to continue?"), _(u"Warning"), wx.ICON_WARNING|wx.YES_NO).ShowModal()
|
return wx.MessageDialog(None, _(u"This is a protected Twitter user, which means you can't open a timeline using the Streaming API. The user's tweets will not update due to a twitter policy. Do you want to continue?"), _(u"Warning"), wx.ICON_WARNING|wx.YES_NO).ShowModal()
|
||||||
|
|
||||||
def no_following():
|
def no_following():
|
||||||
return wx.MessageDialog(None, _(u"This is a protected user account, you need to follow this user to view their tweets or favorites."), _(u"Error"), wx.ICON_ERROR).ShowModal()
|
return wx.MessageDialog(None, _(u"This is a protected user account, you need to follow this user to view their tweets or likes."), _(u"Error"), wx.ICON_ERROR).ShowModal()
|
||||||
|
|
||||||
def donation():
|
def donation():
|
||||||
dlg = wx.MessageDialog(None, _(u"If you like {0} we need your help to keep it going. Help us by donating to the project. This will help us pay for the server, the domain and some other things to ensure that {0} will be actively maintained. Your donation will give us the means to continue the development of {0}, and to keep {0} free. Would you like to donate now?").format(application.name), _(u"We need your help"), wx.ICON_QUESTION|wx.YES_NO)
|
dlg = wx.MessageDialog(None, _(u"If you like {0} we need your help to keep it going. Help us by donating to the project. This will help us pay for the server, the domain and some other things to ensure that {0} will be actively maintained. Your donation will give us the means to continue the development of {0}, and to keep {0} free. Would you like to donate now?").format(application.name), _(u"We need your help"), wx.ICON_QUESTION|wx.YES_NO)
|
||||||
|
@ -265,7 +265,7 @@ class viewTweet(widgetUtils.BaseDialog):
|
|||||||
rtBox = wx.BoxSizer(wx.HORIZONTAL)
|
rtBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
rtBox.Add(rtCountLabel, 0, wx.ALL, 5)
|
rtBox.Add(rtCountLabel, 0, wx.ALL, 5)
|
||||||
rtBox.Add(rtCount, 0, wx.ALL, 5)
|
rtBox.Add(rtCount, 0, wx.ALL, 5)
|
||||||
favsCountLabel = wx.StaticText(panel, -1, _(u"Favourites: "))
|
favsCountLabel = wx.StaticText(panel, -1, _(u"Likes: "))
|
||||||
favsCount = wx.TextCtrl(panel, -1, favs_count, size=wx.DefaultSize, style=wx.TE_READONLY|wx.TE_MULTILINE)
|
favsCount = wx.TextCtrl(panel, -1, favs_count, size=wx.DefaultSize, style=wx.TE_READONLY|wx.TE_MULTILINE)
|
||||||
favsBox = wx.BoxSizer(wx.HORIZONTAL)
|
favsBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
favsBox.Add(favsCountLabel, 0, wx.ALL, 5)
|
favsBox.Add(favsCountLabel, 0, wx.ALL, 5)
|
||||||
|
@ -17,7 +17,7 @@ class selectUserDialog(wx.Dialog):
|
|||||||
actionSizer = wx.BoxSizer(wx.VERTICAL)
|
actionSizer = wx.BoxSizer(wx.VERTICAL)
|
||||||
label2 = wx.StaticText(panel, -1, _(u"Buffer type"))
|
label2 = wx.StaticText(panel, -1, _(u"Buffer type"))
|
||||||
self.tweets = wx.RadioButton(panel, -1, _(u"Tweets"), style=wx.RB_GROUP)
|
self.tweets = wx.RadioButton(panel, -1, _(u"Tweets"), style=wx.RB_GROUP)
|
||||||
self.favourites = wx.RadioButton(panel, -1, _(u"Favourites"))
|
self.favourites = wx.RadioButton(panel, -1, _(u"Likes"))
|
||||||
self.setup_default(default)
|
self.setup_default(default)
|
||||||
hSizer = wx.BoxSizer(wx.HORIZONTAL)
|
hSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
hSizer.Add(label2, 0, wx.ALL, 5)
|
hSizer.Add(label2, 0, wx.ALL, 5)
|
||||||
|
@ -8,9 +8,9 @@ class basePanelMenu(wx.Menu):
|
|||||||
self.AppendItem(self.retweet)
|
self.AppendItem(self.retweet)
|
||||||
self.reply = wx.MenuItem(self, wx.NewId(), _(u"Re&ply"))
|
self.reply = wx.MenuItem(self, wx.NewId(), _(u"Re&ply"))
|
||||||
self.AppendItem(self.reply)
|
self.AppendItem(self.reply)
|
||||||
self.fav = wx.MenuItem(self, wx.NewId(), _(u"Add to &favourites"))
|
self.fav = wx.MenuItem(self, wx.NewId(), _(u"&Like"))
|
||||||
self.AppendItem(self.fav)
|
self.AppendItem(self.fav)
|
||||||
self.unfav = wx.MenuItem(self, wx.NewId(), _(u"Remove from favo&urites"))
|
self.unfav = wx.MenuItem(self, wx.NewId(), _(u"&Unlike"))
|
||||||
self.AppendItem(self.unfav)
|
self.AppendItem(self.unfav)
|
||||||
self.openUrl = wx.MenuItem(self, wx.NewId(), _(u"&Open URL"))
|
self.openUrl = wx.MenuItem(self, wx.NewId(), _(u"&Open URL"))
|
||||||
self.AppendItem(self.openUrl)
|
self.AppendItem(self.openUrl)
|
||||||
|
@ -27,8 +27,8 @@ class mainFrame(wx.Frame):
|
|||||||
self.compose = tweet.Append(wx.NewId(), _(u"&Tweet"))
|
self.compose = tweet.Append(wx.NewId(), _(u"&Tweet"))
|
||||||
self.reply = tweet.Append(wx.NewId(), _(u"Re&ply"))
|
self.reply = tweet.Append(wx.NewId(), _(u"Re&ply"))
|
||||||
self.retweet = tweet.Append(wx.NewId(), _(u"&Retweet"))
|
self.retweet = tweet.Append(wx.NewId(), _(u"&Retweet"))
|
||||||
self.fav = tweet.Append(wx.NewId(), _(u"Add to &favourites"))
|
self.fav = tweet.Append(wx.NewId(), _(u"&Like"))
|
||||||
self.unfav = tweet.Append(wx.NewId(), _(u"Remove from favo&urites"))
|
self.unfav = tweet.Append(wx.NewId(), _(u"&Unlike"))
|
||||||
self.view = tweet.Append(wx.NewId(), _(u"&Show tweet"))
|
self.view = tweet.Append(wx.NewId(), _(u"&Show tweet"))
|
||||||
self.view_coordinates = tweet.Append(wx.NewId(), _(u"View &address"))
|
self.view_coordinates = tweet.Append(wx.NewId(), _(u"View &address"))
|
||||||
self.view_conversation = tweet.Append(wx.NewId(), _(u"View conversa&tion"))
|
self.view_conversation = tweet.Append(wx.NewId(), _(u"View conversa&tion"))
|
||||||
@ -43,7 +43,7 @@ class mainFrame(wx.Frame):
|
|||||||
self.removeFromList = user.Append(wx.NewId(), _(u"R&emove from list"))
|
self.removeFromList = user.Append(wx.NewId(), _(u"R&emove from list"))
|
||||||
self.viewLists = user.Append(wx.NewId(), _(u"&View lists"))
|
self.viewLists = user.Append(wx.NewId(), _(u"&View lists"))
|
||||||
self.details = user.Append(wx.NewId(), _(u"Show user &profile"))
|
self.details = user.Append(wx.NewId(), _(u"Show user &profile"))
|
||||||
self.favs = user.Append(wx.NewId(), _(u"V&iew favourites"))
|
self.favs = user.Append(wx.NewId(), _(u"V&iew likes"))
|
||||||
|
|
||||||
# buffer menu
|
# buffer menu
|
||||||
buffer = wx.Menu()
|
buffer = wx.Menu()
|
||||||
|
Loading…
Reference in New Issue
Block a user