mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-26 20:53:13 -06:00
Retrieve user objects from the users list stored in SqlDict as opposed to loading it from tweet objects
This commit is contained in:
parent
ab1a13f886
commit
4ad01d7833
@ -413,7 +413,8 @@ class baseBufferController(baseBuffers.buffer):
|
|||||||
@_tweets_exist
|
@_tweets_exist
|
||||||
def reply(self, *args, **kwargs):
|
def reply(self, *args, **kwargs):
|
||||||
tweet = self.get_right_tweet()
|
tweet = self.get_right_tweet()
|
||||||
screen_name = tweet.user.screen_name
|
user = self.session.get_user(tweet.user)
|
||||||
|
screen_name = user.screen_name
|
||||||
id = tweet.id
|
id = tweet.id
|
||||||
twishort_enabled = hasattr(tweet, "twishort")
|
twishort_enabled = hasattr(tweet, "twishort")
|
||||||
users = utils.get_all_mentioned(tweet, self.session.db, field="screen_name")
|
users = utils.get_all_mentioned(tweet, self.session.db, field="screen_name")
|
||||||
@ -466,8 +467,8 @@ class baseBufferController(baseBuffers.buffer):
|
|||||||
screen_name = tweet.screen_name
|
screen_name = tweet.screen_name
|
||||||
users = [screen_name]
|
users = [screen_name]
|
||||||
else:
|
else:
|
||||||
screen_name = tweet.user.screen_name
|
screen_name = self.session.get_user(tweet.user).screen_name
|
||||||
users = utils.get_all_users(tweet, self.session.db)
|
users = utils.get_all_users(tweet, self.session)
|
||||||
dm = messages.dm(self.session, _(u"Direct message to %s") % (screen_name,), _(u"New direct message"), users)
|
dm = messages.dm(self.session, _(u"Direct message to %s") % (screen_name,), _(u"New direct message"), users)
|
||||||
if dm.message.get_response() == widgetUtils.OK:
|
if dm.message.get_response() == widgetUtils.OK:
|
||||||
screen_name = dm.message.get("cb")
|
screen_name = dm.message.get("cb")
|
||||||
@ -508,12 +509,12 @@ class baseBufferController(baseBuffers.buffer):
|
|||||||
comments = tweet.full_text
|
comments = tweet.full_text
|
||||||
else:
|
else:
|
||||||
comments = tweet.text
|
comments = tweet.text
|
||||||
retweet = messages.tweet(self.session, _(u"Quote"), _(u"Add your comment to the tweet"), u"“@%s: %s ”" % (tweet.user.screen_name, comments), max=256, messageType="retweet")
|
retweet = messages.tweet(self.session, _(u"Quote"), _(u"Add your comment to the tweet"), u"“@%s: %s ”" % (self.session.get_user(tweet.user).screen_name, comments), max=256, messageType="retweet")
|
||||||
if comment != '':
|
if comment != '':
|
||||||
retweet.message.set_text(comment)
|
retweet.message.set_text(comment)
|
||||||
if retweet.message.get_response() == widgetUtils.OK:
|
if retweet.message.get_response() == widgetUtils.OK:
|
||||||
text = retweet.message.get_text()
|
text = retweet.message.get_text()
|
||||||
text = text+" https://twitter.com/{0}/status/{1}".format(tweet.user.screen_name, id)
|
text = text+" https://twitter.com/{0}/status/{1}".format(self.session.get_user(tweet.user).screen_name, id)
|
||||||
if retweet.image == None:
|
if retweet.image == None:
|
||||||
item = self.session.api_call(call_name="update_status", _sound="retweet_send.ogg", status=text, in_reply_to_status_id=id, tweet_mode="extended")
|
item = self.session.api_call(call_name="update_status", _sound="retweet_send.ogg", status=text, in_reply_to_status_id=id, tweet_mode="extended")
|
||||||
if item != None:
|
if item != None:
|
||||||
@ -616,7 +617,7 @@ class baseBufferController(baseBuffers.buffer):
|
|||||||
elif self.type == "people":
|
elif self.type == "people":
|
||||||
users = [tweet.screen_name]
|
users = [tweet.screen_name]
|
||||||
else:
|
else:
|
||||||
users = utils.get_all_users(tweet, self.session.db)
|
users = utils.get_all_users(tweet, self.session)
|
||||||
dlg = dialogs.utils.selectUserDialog(title=_(u"User details"), users=users)
|
dlg = dialogs.utils.selectUserDialog(title=_(u"User details"), users=users)
|
||||||
if dlg.get_response() == widgetUtils.OK:
|
if dlg.get_response() == widgetUtils.OK:
|
||||||
user.profileController(session=self.session, user=dlg.get_user())
|
user.profileController(session=self.session, user=dlg.get_user())
|
||||||
@ -634,7 +635,7 @@ class baseBufferController(baseBuffers.buffer):
|
|||||||
def open_in_browser(self, *args, **kwargs):
|
def open_in_browser(self, *args, **kwargs):
|
||||||
tweet = self.get_tweet()
|
tweet = self.get_tweet()
|
||||||
output.speak(_(u"Opening item in web browser..."))
|
output.speak(_(u"Opening item in web browser..."))
|
||||||
url = "https://twitter.com/{screen_name}/status/{tweet_id}".format(screen_name=tweet.user.screen_name, tweet_id=tweet.id)
|
url = "https://twitter.com/{screen_name}/status/{tweet_id}".format(screen_name=self.session.get_user(tweet.user).screen_name, tweet_id=tweet.id)
|
||||||
webbrowser.open(url)
|
webbrowser.open(url)
|
||||||
|
|
||||||
class directMessagesController(baseBufferController):
|
class directMessagesController(baseBufferController):
|
||||||
|
@ -530,7 +530,7 @@ class Controller(object):
|
|||||||
elif buff.type == "dm":
|
elif buff.type == "dm":
|
||||||
users = [buff.session.get_user(tweet.message_create["sender_id"]).screen_name]
|
users = [buff.session.get_user(tweet.message_create["sender_id"]).screen_name]
|
||||||
else:
|
else:
|
||||||
users = utils.get_all_users(tweet, buff.session.db)
|
users = utils.get_all_users(tweet, buff.session)
|
||||||
dlg = dialogs.utils.selectUserDialog(_(u"Select the user"), users)
|
dlg = dialogs.utils.selectUserDialog(_(u"Select the user"), users)
|
||||||
if dlg.get_response() == widgetUtils.OK:
|
if dlg.get_response() == widgetUtils.OK:
|
||||||
user = dlg.get_user()
|
user = dlg.get_user()
|
||||||
@ -547,7 +547,7 @@ class Controller(object):
|
|||||||
elif buff.type == "dm":
|
elif buff.type == "dm":
|
||||||
users = [buff.session.get_user(tweet.message_create["sender_id"]).screen_name]
|
users = [buff.session.get_user(tweet.message_create["sender_id"]).screen_name]
|
||||||
else:
|
else:
|
||||||
users = utils.get_all_users(tweet, buff.session.db)
|
users = utils.get_all_users(tweet, buff.session)
|
||||||
dlg = dialogs.utils.selectUserDialog(_(u"Select the user"), users)
|
dlg = dialogs.utils.selectUserDialog(_(u"Select the user"), users)
|
||||||
if dlg.get_response() == widgetUtils.OK:
|
if dlg.get_response() == widgetUtils.OK:
|
||||||
user = dlg.get_user()
|
user = dlg.get_user()
|
||||||
@ -575,7 +575,7 @@ class Controller(object):
|
|||||||
elif buff.type == "dm":
|
elif buff.type == "dm":
|
||||||
users = [buff.session.get_user(tweet.message_create["sender_id"]).screen_name]
|
users = [buff.session.get_user(tweet.message_create["sender_id"]).screen_name]
|
||||||
else:
|
else:
|
||||||
users = utils.get_all_users(tweet, buff.session.db)
|
users = utils.get_all_users(tweet, buff.session)
|
||||||
dlg = dialogs.utils.selectUserDialog(_(u"Select the user"), users)
|
dlg = dialogs.utils.selectUserDialog(_(u"Select the user"), users)
|
||||||
if dlg.get_response() == widgetUtils.OK:
|
if dlg.get_response() == widgetUtils.OK:
|
||||||
user = dlg.get_user()
|
user = dlg.get_user()
|
||||||
@ -669,7 +669,7 @@ class Controller(object):
|
|||||||
elif buff.type == "dm":
|
elif buff.type == "dm":
|
||||||
users = [buff.session.get_user(tweet.message_create["sender_id"]).screen_name]
|
users = [buff.session.get_user(tweet.message_create["sender_id"]).screen_name]
|
||||||
else:
|
else:
|
||||||
users = utils.get_all_users(tweet, buff.session.db)
|
users = utils.get_all_users(tweet, buff.session)
|
||||||
u = userActionsController.userActionsController(buff, users)
|
u = userActionsController.userActionsController(buff, users)
|
||||||
|
|
||||||
def unfollow(self, *args, **kwargs):
|
def unfollow(self, *args, **kwargs):
|
||||||
@ -681,7 +681,7 @@ class Controller(object):
|
|||||||
elif buff.type == "dm":
|
elif buff.type == "dm":
|
||||||
users = [buff.session.get_user(tweet.message_create["sender_id"]).screen_name]
|
users = [buff.session.get_user(tweet.message_create["sender_id"]).screen_name]
|
||||||
else:
|
else:
|
||||||
users = utils.get_all_users(tweet, buff.session.db)
|
users = utils.get_all_users(tweet, buff.session)
|
||||||
u = userActionsController.userActionsController(buff, users, "unfollow")
|
u = userActionsController.userActionsController(buff, users, "unfollow")
|
||||||
|
|
||||||
def mute(self, *args, **kwargs):
|
def mute(self, *args, **kwargs):
|
||||||
@ -693,7 +693,7 @@ class Controller(object):
|
|||||||
elif buff.type == "dm":
|
elif buff.type == "dm":
|
||||||
users = [buff.session.get_user(tweet.message_create["sender_id"]).screen_name]
|
users = [buff.session.get_user(tweet.message_create["sender_id"]).screen_name]
|
||||||
else:
|
else:
|
||||||
users = utils.get_all_users(tweet, buff.session.db)
|
users = utils.get_all_users(tweet, buff.session)
|
||||||
u = userActionsController.userActionsController(buff, users, "mute")
|
u = userActionsController.userActionsController(buff, users, "mute")
|
||||||
|
|
||||||
def unmute(self, *args, **kwargs):
|
def unmute(self, *args, **kwargs):
|
||||||
@ -705,7 +705,7 @@ class Controller(object):
|
|||||||
elif buff.type == "dm":
|
elif buff.type == "dm":
|
||||||
users = [buff.session.get_user(tweet.message_create["sender_id"]).screen_name]
|
users = [buff.session.get_user(tweet.message_create["sender_id"]).screen_name]
|
||||||
else:
|
else:
|
||||||
users = utils.get_all_users(tweet, buff.session.db)
|
users = utils.get_all_users(tweet, buff.session)
|
||||||
u = userActionsController.userActionsController(buff, users, "unmute")
|
u = userActionsController.userActionsController(buff, users, "unmute")
|
||||||
|
|
||||||
def block(self, *args, **kwargs):
|
def block(self, *args, **kwargs):
|
||||||
@ -717,7 +717,7 @@ class Controller(object):
|
|||||||
elif buff.type == "dm":
|
elif buff.type == "dm":
|
||||||
users = [buff.session.get_user(tweet.message_create["sender_id"]).screen_name]
|
users = [buff.session.get_user(tweet.message_create["sender_id"]).screen_name]
|
||||||
else:
|
else:
|
||||||
users = utils.get_all_users(tweet, buff.session.db)
|
users = utils.get_all_users(tweet, buff.session)
|
||||||
u = userActionsController.userActionsController(buff, users, "block")
|
u = userActionsController.userActionsController(buff, users, "block")
|
||||||
|
|
||||||
def unblock(self, *args, **kwargs):
|
def unblock(self, *args, **kwargs):
|
||||||
@ -729,7 +729,7 @@ class Controller(object):
|
|||||||
elif buff.type == "dm":
|
elif buff.type == "dm":
|
||||||
users = [buff.session.get_user(tweet.message_create["sender_id"]).screen_name]
|
users = [buff.session.get_user(tweet.message_create["sender_id"]).screen_name]
|
||||||
else:
|
else:
|
||||||
users = utils.get_all_users(tweet, buff.session.db)
|
users = utils.get_all_users(tweet, buff.session)
|
||||||
u = userActionsController.userActionsController(buff, users, "unblock")
|
u = userActionsController.userActionsController(buff, users, "unblock")
|
||||||
|
|
||||||
def report(self, *args, **kwargs):
|
def report(self, *args, **kwargs):
|
||||||
@ -741,7 +741,7 @@ class Controller(object):
|
|||||||
elif buff.type == "dm":
|
elif buff.type == "dm":
|
||||||
users = [buff.session.get_user(tweet.message_create["sender_id"]).screen_name]
|
users = [buff.session.get_user(tweet.message_create["sender_id"]).screen_name]
|
||||||
else:
|
else:
|
||||||
users = utils.get_all_users(tweet, buff.session.db)
|
users = utils.get_all_users(tweet, buff.session)
|
||||||
u = userActionsController.userActionsController(buff, users, "report")
|
u = userActionsController.userActionsController(buff, users, "report")
|
||||||
|
|
||||||
def post_tweet(self, event=None):
|
def post_tweet(self, event=None):
|
||||||
@ -828,7 +828,7 @@ class Controller(object):
|
|||||||
elif buff.type == "dm":
|
elif buff.type == "dm":
|
||||||
users = [buff.session.get_user(tweet.message_create["sender_id"]).screen_name]
|
users = [buff.session.get_user(tweet.message_create["sender_id"]).screen_name]
|
||||||
else:
|
else:
|
||||||
users = utils.get_all_users(tweet, buff.session.db)
|
users = utils.get_all_users(tweet, buff.session)
|
||||||
dlg = dialogs.userSelection.selectUserDialog(users=users, default=default)
|
dlg = dialogs.userSelection.selectUserDialog(users=users, default=default)
|
||||||
if dlg.get_response() == widgetUtils.OK:
|
if dlg.get_response() == widgetUtils.OK:
|
||||||
usr = utils.if_user_exists(buff.session.twitter, dlg.get_user())
|
usr = utils.if_user_exists(buff.session.twitter, dlg.get_user())
|
||||||
@ -924,7 +924,7 @@ class Controller(object):
|
|||||||
def open_conversation(self, *args, **kwargs):
|
def open_conversation(self, *args, **kwargs):
|
||||||
buffer = self.get_current_buffer()
|
buffer = self.get_current_buffer()
|
||||||
id = buffer.get_right_tweet().id_str
|
id = buffer.get_right_tweet().id_str
|
||||||
user = buffer.get_right_tweet().user.screen_name
|
user = buff.session.get_user(buffer.get_right_tweet().user).screen_name
|
||||||
search = twitterBuffers.conversationBufferController(self.view.nb, "search", "%s-searchterm" % (id,), buffer.session, buffer.session.db["user_name"], bufferType="searchPanel", sound="search_updated.ogg", since_id=id, q="@{0}".format(user,))
|
search = twitterBuffers.conversationBufferController(self.view.nb, "search", "%s-searchterm" % (id,), buffer.session, buffer.session.db["user_name"], bufferType="searchPanel", sound="search_updated.ogg", since_id=id, q="@{0}".format(user,))
|
||||||
search.tweet = buffer.get_right_tweet()
|
search.tweet = buffer.get_right_tweet()
|
||||||
search.start_stream(start=True)
|
search.start_stream(start=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user