diff --git a/src/controller/buffers.py b/src/controller/buffers.py index d7fd1a3..37051a3 100644 --- a/src/controller/buffers.py +++ b/src/controller/buffers.py @@ -179,6 +179,21 @@ class feedBuffer(baseBuffer): [self.insert(i) for i in self.session.db[self.name]["items"][:num]] return retrieved + def remove_buffer(self, mandatory=False): + if "me_feed" == self.name: + output.speak(_(u"This buffer can't be deleted")) + return False + else: + if mandatory == False: + dlg = commonMessages.remove_buffer() + else: + dlg = widgetUtils.YES + if dlg == widgetUtils.YES: + self.session.db.pop(self.name) + return True + else: + return False + class audioBuffer(feedBuffer): def create_tab(self, parent): self.tab = home.audioTab(parent) @@ -206,7 +221,7 @@ class audioBuffer(feedBuffer): audios = [i for i in self.session.db[self.name]["items"][selected:]] pub.sendMessage("play-audios", audios=audios) - def remove_buffer(self, mandatory): + def remove_buffer(self, mandatory=False): if "me_audio" == self.name or "popular_audio" == self.name or "recommended_audio" == self.name: output.speak(_(u"This buffer can't be deleted")) return False @@ -236,4 +251,4 @@ class empty(object): def get_more_items(self, *args, **kwargs): output.speak(_(u"This buffer doesn't support getting more items.")) - def remove_buffer(self, mandatory): return False + def remove_buffer(self, mandatory=False): return False diff --git a/src/controller/mainController.py b/src/controller/mainController.py index 1c8a57e..84691a0 100644 --- a/src/controller/mainController.py +++ b/src/controller/mainController.py @@ -171,7 +171,7 @@ class Controller(object): def update_status_bar(self, status): self.window.change_status(status) - def remove_buffer(self, mandatory=False, *args, **kwargs): + def remove_buffer(self, event, mandatory=False, *args, **kwargs): buffer = self.get_current_buffer() buff = self.window.search(buffer.name) answer = buffer.remove_buffer(mandatory) @@ -215,9 +215,13 @@ class Controller(object): commonMessages.no_user_exist() return if buffertype == "audio": - audio = buffers.audioBuffer(parent=self.window.tb, name="{0}_audio".format(user_id,), composefunc="compose_audio", session=self.session, endpoint="get", parent_endpoint="audio", full_list=True, count=self.session.settings["buffers"]["count_for_audio_buffers"], user_id=user_id) - self.buffers.append(audio) - call_threaded(self.complete_buffer_creation, buffer=audio, name_=_(u"{0}'s audios").format(user,), position=self.window.search("timelines")) + buffer = buffers.audioBuffer(parent=self.window.tb, name="{0}_audio".format(user_id,), composefunc="compose_audio", session=self.session, endpoint="get", parent_endpoint="audio", full_list=True, count=self.session.settings["buffers"]["count_for_audio_buffers"], user_id=user_id) + name_ = _(u"{0}'s audios").format(user,) + elif buffertype == "wall": + buffer = buffers.feedBuffer(parent=self.window.tb, name="{0}_feed".format(user_id,), composefunc="compose_status", session=self.session, endpoint="get", parent_endpoint="wall", extended=1, count=self.session.settings["buffers"]["count_for_wall_buffers"], owner_id=user_id) + name_ = _(u"{0}'s wall posts").format(user,) + self.buffers.append(buffer) + call_threaded(self.complete_buffer_creation, buffer=buffer, name_=name_, position=self.window.search("timelines")) def complete_buffer_creation(self, buffer, name_, position): answer = buffer.get_items() diff --git a/src/controller/posts.py b/src/controller/posts.py index facaa12..90e2baf 100644 --- a/src/controller/posts.py +++ b/src/controller/posts.py @@ -59,9 +59,13 @@ class postController(object): if self.post.has_key("source_id"): self.user_identifier = "source_id" self.post_identifier = "post_id" -# print self.post["type"] else: - self.user_identifier = "from_id" + # In wall's posts, if someone has posted in user's wall, owner_id should be used instead from_id + # This will help for retrieving comments, do likes, etc. + if not self.post.has_key("owner_id"): + self.user_identifier = "from_id" + else: + self.user_identifier = "owner_id" self.post_identifier = "id" self.dialog = postDialogs.post() # self.dialog.comments.list.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.show_comment) @@ -97,7 +101,10 @@ class postController(object): if self.post.has_key("copy_history"): title = _(u"repost from {0}").format(from_,) else: - title = _(u"Post from {0}").format(from_,) + if self.post.has_key("from_id") and self.post.has_key("owner_id"): + title = _(u"Post from {0} in the {1}'s wall").format(self.session.get_user_name(self.post["from_id"]), self.session.get_user_name(self.post["owner_id"])) + else: + title = _(u"Post from {0}").format(from_,) self.dialog.set_title(title) message = u"" message = get_message(self.post) diff --git a/src/wxUI/dialogs/timeline.py b/src/wxUI/dialogs/timeline.py index ac26294..c198f9a 100644 --- a/src/wxUI/dialogs/timeline.py +++ b/src/wxUI/dialogs/timeline.py @@ -15,8 +15,10 @@ class timelineDialog(widgetUtils.BaseDialog): userSizer.Add(userLabel, 0, wx.ALL, 5) userSizer.Add(self.cb, 0, wx.ALL, 5) actionsstatic = wx.StaticBox(panel, label=_(u"Buffer type")) - self.audio = wx.RadioButton(panel, wx.NewId(), _(u"&Audios"), style=wx.RB_GROUP) + self.wall = wx.RadioButton(panel, wx.NewId(), _(u"&Wall posts"), style=wx.RB_GROUP) + self.audio = wx.RadioButton(panel, wx.NewId(), _(u"&Audio")) radioSizer = wx.StaticBoxSizer(actionsstatic, wx.HORIZONTAL) + radioSizer.Add(self.wall, 0, wx.ALL, 5) radioSizer.Add(self.audio, 0, wx.ALL, 5) sizer.Add(radioSizer, 0, wx.ALL, 5) ok = wx.Button(panel, wx.ID_OK, _(u"&OK")) @@ -34,4 +36,6 @@ class timelineDialog(widgetUtils.BaseDialog): def get_buffer_type(self): if self.audio.GetValue() == True: - return "audio" \ No newline at end of file + return "audio" + elif self.wall.GetValue() == True: + return "wall" \ No newline at end of file