Posts displayer shows all reposts
This commit is contained in:
parent
3d91408c9c
commit
4500fdf549
@ -16,11 +16,20 @@ from mysc.thread_utils import call_threaded
|
|||||||
from wxUI import menus
|
from wxUI import menus
|
||||||
|
|
||||||
def get_user(id, profiles):
|
def get_user(id, profiles):
|
||||||
|
""" Returns an user name and surname based in the id receibed."""
|
||||||
for i in profiles:
|
for i in profiles:
|
||||||
if i["id"] == id:
|
if i["id"] == id:
|
||||||
return u"{0} {1}".format(i["first_name"], i["last_name"])
|
return u"{0} {1}".format(i["first_name"], i["last_name"])
|
||||||
return _(u"Unknown username")
|
return _(u"Unknown username")
|
||||||
|
|
||||||
|
def get_message(status):
|
||||||
|
message = ""
|
||||||
|
message = utils.clean_text(status["text"])
|
||||||
|
if status.has_key("attachment"):
|
||||||
|
print status["attachment"].keys()
|
||||||
|
message = message+session.add_attachment(status["attachment"])
|
||||||
|
return message
|
||||||
|
|
||||||
class postController(object):
|
class postController(object):
|
||||||
def __init__(self, session, postObject):
|
def __init__(self, session, postObject):
|
||||||
super(postController, self).__init__()
|
super(postController, self).__init__()
|
||||||
@ -68,13 +77,12 @@ class postController(object):
|
|||||||
title = _(u"Post from {0}").format(from_,)
|
title = _(u"Post from {0}").format(from_,)
|
||||||
self.dialog.set_title(title)
|
self.dialog.set_title(title)
|
||||||
message = u""
|
message = u""
|
||||||
if self.post.has_key("text"):
|
message = get_message(self.post)
|
||||||
message = utils.clean_text(self.post["text"])
|
if self.post.has_key("copy_history"):
|
||||||
if self.post.has_key("copy_history") and message == "":
|
nm = u"\n"
|
||||||
message = utils.clean_text(self.post["copy_history"][0]["text"])
|
for i in self.post["copy_history"]:
|
||||||
if self.post.has_key("attachment"):
|
nm += u"{0}: {1}\n\n".format(self.session.get_user_name(i["from_id"]), get_message(i))
|
||||||
print self.post["attachment"].keys()
|
message += nm
|
||||||
message = message+session.add_attachment(self.post["attachment"])
|
|
||||||
self.dialog.set_post(message)
|
self.dialog.set_post(message)
|
||||||
|
|
||||||
def load_all_components(self):
|
def load_all_components(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user