Changed favourites for likes

This commit is contained in:
Manuel Cortez 2015-11-03 10:07:06 -06:00
parent fa1b8bfde3
commit 8e67ed025c
11 changed files with 32 additions and 24 deletions

View File

@ -307,7 +307,7 @@ class Controller(object):
favourites = buffersController.baseBufferController(self.view.nb, "get_favorites", "favourites", session, session.db["user_name"])
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':
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)
@ -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"]))
favs_timelines = buffersController.emptyPanel(self.view.nb, "favs_timelines", session.db["user_name"])
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"]:
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.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.start()
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"])
self.insert_buffer(tl, pos+1)
# 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.timer = RepeatingTimer(300, tl.start_stream)
tl.timer.start()
@ -1274,7 +1274,7 @@ class Controller(object):
if buffer == "favourites":
favourites = buffersController.baseBufferController(self.view.nb, "get_favorites", "favourites", buff.session, buff.session.db["user_name"])
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()
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"])

View File

@ -168,9 +168,9 @@ class viewTweet(basicTweet):
text = ""
for i in xrange(0, len(tweetList)):
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:
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"])
favs_count = str(tweet["favorite_count"])
if text == "":
@ -178,6 +178,7 @@ class viewTweet(basicTweet):
text = "rt @%s: %s" % (tweet["retweeted_status"]["user"]["screen_name"], tweet["retweeted_status"]["text"])
else:
text = tweet["text"]
text = self.clear_text(text)
self.message = message.viewTweet(text, rt_count, favs_count)
self.message.set_title(len(text))
else:
@ -194,3 +195,10 @@ class viewTweet(basicTweet):
if len(utils.find_urls_in_text(self.message.get_text())) > 0:
return True
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

View File

@ -95,7 +95,7 @@ class profileController(object):
else: verified = _(u"No")
string = string+ _(u"Verified: %s\n") % (verified)
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
def visit_url(self, *args, **kwargs):

View File

@ -7,8 +7,8 @@ actions = reverse_sort.reverse_sort([ ("audio", _(u"Audio tweet.")),
("dm_received", _(u"Direct message received.")),
("dm_sent", _(u"Direct message sent.")),
("error", _(u"Error.")),
("favourite", _(u"Tweet favourited.")),
("favourites_timeline_updated", _(u"Favourites buffer updated.")),
("favourite", _(u"Tweet liked.")),
("favourites_timeline_updated", _(u"Likes buffer updated.")),
("geo", _(u"Geotweet.")),
("limit", _(u"Boundary reached.")),
("list_tweet", _(u"List updated.")),

View File

@ -11,8 +11,8 @@ actions = {
"post_reply": _(u"Reply"),
"post_retweet": _(u"Retweet"),
"send_dm": _(u"Send direct message"),
"add_to_favourites": _(u"Mark as favourite"),
"remove_from_favourites": _(u"Remove from favourites"),
"add_to_favourites": _(u"Like a tweet"),
"remove_from_favourites": _(u"Unlike a tweet"),
"follow": _(u"Open the user actions dialogue"),
"user_details": _(u"See user details"),
"view_item": _(u"Show tweet"),

View File

@ -123,12 +123,12 @@ def compose_event(data, username):
event = _(u"You've unfollowed %s (@%s)") % (data["target"]["name"], data["target"]["screen_name"])
elif data["event"] == "favorite":
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:
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":
if data["source"]["screen_name"] == username: event = _(u"You've removed from favourites: %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"])
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 unliked: %s") % (data["source"]["name"], data["source"]["screen_name"], data["target_object"]["text"])
elif data["event"] == "list_created":
event = _(u"You've created the list %s") % (data["target_object"]["name"])
elif data["event"] == "list_destroyed":

View File

@ -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()
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():
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)

View File

@ -265,7 +265,7 @@ class viewTweet(widgetUtils.BaseDialog):
rtBox = wx.BoxSizer(wx.HORIZONTAL)
rtBox.Add(rtCountLabel, 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)
favsBox = wx.BoxSizer(wx.HORIZONTAL)
favsBox.Add(favsCountLabel, 0, wx.ALL, 5)

View File

@ -17,7 +17,7 @@ class selectUserDialog(wx.Dialog):
actionSizer = wx.BoxSizer(wx.VERTICAL)
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"Favourites"))
self.favourites = wx.RadioButton(panel, -1, _(u"Likes"))
self.setup_default(default)
hSizer = wx.BoxSizer(wx.HORIZONTAL)
hSizer.Add(label2, 0, wx.ALL, 5)

View File

@ -8,9 +8,9 @@ class basePanelMenu(wx.Menu):
self.AppendItem(self.retweet)
self.reply = wx.MenuItem(self, wx.NewId(), _(u"Re&ply"))
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.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.openUrl = wx.MenuItem(self, wx.NewId(), _(u"&Open URL"))
self.AppendItem(self.openUrl)

View File

@ -27,8 +27,8 @@ class mainFrame(wx.Frame):
self.compose = tweet.Append(wx.NewId(), _(u"&Tweet"))
self.reply = tweet.Append(wx.NewId(), _(u"Re&ply"))
self.retweet = tweet.Append(wx.NewId(), _(u"&Retweet"))
self.fav = tweet.Append(wx.NewId(), _(u"Add to &favourites"))
self.unfav = tweet.Append(wx.NewId(), _(u"Remove from favo&urites"))
self.fav = tweet.Append(wx.NewId(), _(u"&Like"))
self.unfav = tweet.Append(wx.NewId(), _(u"&Unlike"))
self.view = tweet.Append(wx.NewId(), _(u"&Show tweet"))
self.view_coordinates = tweet.Append(wx.NewId(), _(u"View &address"))
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.viewLists = user.Append(wx.NewId(), _(u"&View lists"))
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 = wx.Menu()