mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-22 19:28:09 -06:00
Added favorites buffer, and actions to add, remove and toggle favorite for toots
This commit is contained in:
parent
b405e384c8
commit
62d6ae2277
@ -88,7 +88,7 @@ class BaseBuffer(base.Buffer):
|
|||||||
count = self.session.settings["general"]["max_toots_per_call"]
|
count = self.session.settings["general"]["max_toots_per_call"]
|
||||||
min_id = None
|
min_id = None
|
||||||
# toDo: Implement reverse timelines properly here.
|
# toDo: Implement reverse timelines properly here.
|
||||||
if self.name in self.session.db and len(self.session.db[self.name]) > 0:
|
if self.name != "favorites" and self.name in self.session.db and len(self.session.db[self.name]) > 0:
|
||||||
min_id = self.session.db[self.name][-1].id
|
min_id = self.session.db[self.name][-1].id
|
||||||
try:
|
try:
|
||||||
results = getattr(self.session.api, self.function)(min_id=min_id, limit=count, *self.args, **self.kwargs)
|
results = getattr(self.session.api, self.function)(min_id=min_id, limit=count, *self.args, **self.kwargs)
|
||||||
@ -433,16 +433,26 @@ class BaseBuffer(base.Buffer):
|
|||||||
webbrowser.open(url)
|
webbrowser.open(url)
|
||||||
|
|
||||||
def add_to_favorites(self):
|
def add_to_favorites(self):
|
||||||
id = self.get_item().id
|
item = self.get_item()
|
||||||
pass
|
if item.reblog != None:
|
||||||
|
item = item.reblog
|
||||||
|
call_threaded(self.session.api_call, call_name="status_favourite", preexec_message=_("Adding to favorites..."), _sound="favourite.ogg", id=item.id)
|
||||||
|
|
||||||
def remove_from_favorites(self):
|
def remove_from_favorites(self):
|
||||||
id = self.get_item().id
|
item = self.get_item()
|
||||||
pass
|
if item.reblog != None:
|
||||||
|
item = item.reblog
|
||||||
|
call_threaded(self.session.api_call, call_name="status_unfavourite", preexec_message=_("Removing from favorites..."), _sound="favourite.ogg", id=item.id)
|
||||||
|
|
||||||
def toggle_favorite(self):
|
def toggle_favorite(self):
|
||||||
id = self.get_toot().id
|
item = self.get_item()
|
||||||
pass
|
if item.reblog != None:
|
||||||
|
item = item.reblog
|
||||||
|
item = self.session.api.status(item.id)
|
||||||
|
if item.favourited == False:
|
||||||
|
call_threaded(self.session.api_call, call_name="status_favourite", preexec_message=_("Adding to favorites..."), _sound="favourite.ogg", id=item.id)
|
||||||
|
else:
|
||||||
|
call_threaded(self.session.api_call, call_name="status_unfavourite", preexec_message=_("Removing from favorites..."), _sound="favourite.ogg", id=item.id)
|
||||||
|
|
||||||
def view_item(self):
|
def view_item(self):
|
||||||
toot = self.get_item()
|
toot = self.get_item()
|
||||||
|
@ -32,8 +32,8 @@ class Handler(object):
|
|||||||
# pub.sendMessage("createBuffer", buffer_type="SentDirectMessagesBuffer", session_type=session.type, buffer_title=_("Sent direct messages"), parent_tab=root_position, start=False, kwargs=dict(parent=controller.view.nb, function=None, name="sent_direct_messages", sessionObject=session, account=session.db["user_name"], bufferType="dmPanel", compose_func="compose_direct_message"))
|
# pub.sendMessage("createBuffer", buffer_type="SentDirectMessagesBuffer", session_type=session.type, buffer_title=_("Sent direct messages"), parent_tab=root_position, start=False, kwargs=dict(parent=controller.view.nb, function=None, name="sent_direct_messages", sessionObject=session, account=session.db["user_name"], bufferType="dmPanel", compose_func="compose_direct_message"))
|
||||||
# elif i == 'sent_tweets':
|
# elif i == 'sent_tweets':
|
||||||
# pub.sendMessage("createBuffer", buffer_type="BaseBuffer", session_type=session.type, buffer_title=_("Sent tweets"), parent_tab=root_position, start=False, kwargs=dict(parent=controller.view.nb, function="user_timeline", name="sent_tweets", sessionObject=session, account=session.db["user_name"], screen_name=session.db["user_name"], include_ext_alt_text=True, tweet_mode="extended"))
|
# pub.sendMessage("createBuffer", buffer_type="BaseBuffer", session_type=session.type, buffer_title=_("Sent tweets"), parent_tab=root_position, start=False, kwargs=dict(parent=controller.view.nb, function="user_timeline", name="sent_tweets", sessionObject=session, account=session.db["user_name"], screen_name=session.db["user_name"], include_ext_alt_text=True, tweet_mode="extended"))
|
||||||
# elif i == 'favorites':
|
elif i == 'favorites':
|
||||||
# pub.sendMessage("createBuffer", buffer_type="BaseBuffer", session_type=session.type, buffer_title=_("Likes"), parent_tab=root_position, start=False, kwargs=dict(parent=controller.view.nb, function="get_favorites", name="favourites", sessionObject=session, account=session.db["user_name"], sound="favourite.ogg", include_ext_alt_text=True, tweet_mode="extended"))
|
pub.sendMessage("createBuffer", buffer_type="BaseBuffer", session_type=session.type, buffer_title=_("Favorites"), parent_tab=root_position, start=False, kwargs=dict(parent=controller.view.nb, function="favourites", name="favorites", sessionObject=session, account=session.db["user_name"], sound="favourite.ogg"))
|
||||||
# elif i == 'followers':
|
# elif i == 'followers':
|
||||||
# pub.sendMessage("createBuffer", buffer_type="PeopleBuffer", session_type=session.type, buffer_title=_("Followers"), parent_tab=root_position, start=False, kwargs=dict(parent=controller.view.nb, function="get_followers", name="followers", sessionObject=session, account=session.db["user_name"], sound="update_followers.ogg", screen_name=session.db["user_name"]))
|
# pub.sendMessage("createBuffer", buffer_type="PeopleBuffer", session_type=session.type, buffer_title=_("Followers"), parent_tab=root_position, start=False, kwargs=dict(parent=controller.view.nb, function="get_followers", name="followers", sessionObject=session, account=session.db["user_name"], sound="update_followers.ogg", screen_name=session.db["user_name"]))
|
||||||
# elif i == 'friends':
|
# elif i == 'friends':
|
||||||
|
@ -93,7 +93,7 @@ class Session(base.baseSession):
|
|||||||
def check_streams(self):
|
def check_streams(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def order_buffer(self, name, data, ignore_older=True):
|
def order_buffer(self, name, data, ignore_older=False):
|
||||||
num = 0
|
num = 0
|
||||||
last_id = None
|
last_id = None
|
||||||
if self.db.get(name) == None:
|
if self.db.get(name) == None:
|
||||||
|
Loading…
Reference in New Issue
Block a user