From 4500fdf549d69fed7721f1852317a7c9b914bf88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Cort=C3=A9z?= Date: Thu, 31 Mar 2016 17:27:36 -0600 Subject: [PATCH] Posts displayer shows all reposts --- src/controller/posts.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/controller/posts.py b/src/controller/posts.py index 31ed22f..4483738 100644 --- a/src/controller/posts.py +++ b/src/controller/posts.py @@ -16,11 +16,20 @@ from mysc.thread_utils import call_threaded from wxUI import menus def get_user(id, profiles): + """ Returns an user name and surname based in the id receibed.""" for i in profiles: if i["id"] == id: return u"{0} {1}".format(i["first_name"], i["last_name"]) 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): def __init__(self, session, postObject): super(postController, self).__init__() @@ -68,13 +77,12 @@ class postController(object): title = _(u"Post from {0}").format(from_,) self.dialog.set_title(title) message = u"" - if self.post.has_key("text"): - message = utils.clean_text(self.post["text"]) - if self.post.has_key("copy_history") and message == "": - message = utils.clean_text(self.post["copy_history"][0]["text"]) - if self.post.has_key("attachment"): - print self.post["attachment"].keys() - message = message+session.add_attachment(self.post["attachment"]) + message = get_message(self.post) + if self.post.has_key("copy_history"): + nm = u"\n" + for i in self.post["copy_history"]: + nm += u"{0}: {1}\n\n".format(self.session.get_user_name(i["from_id"]), get_message(i)) + message += nm self.dialog.set_post(message) def load_all_components(self):