def get_menu(self): p = self.get_post() m = menus.audioMenu() widgetUtils.connect_event(m, widgetUtils.MENU, self.open_post, menuitem=m.open) widgetUtils.connect_event(m, widgetUtils.MENU, self.play_audio, menuitem=m.play) widgetUtils.connect_event(m, widgetUtils.MENU, self.move_to_album, menuitem=m.move) # if owner_id is the current user, the audio is added to the user's audios. if p["owner_id"] == self.session.user_id: m.library.SetItemLabel(_(u"&Remove from library")) widgetUtils.connect_event(m, widgetUtils.MENU, self.remove_from_library, menuitem=m.library) else: widgetUtils.connect_event(m, widgetUtils.MENU, self.add_to_library, menuitem=m.library) return m
def get_menu(self): """ We'll use the same menu that is used for audio items, as the options are exactly the same""" p = self.get_post() m = menus.audioMenu() # widgetUtils.connect_event(m, widgetUtils.MENU, self.open_post, menuitem=m.open) # widgetUtils.connect_event(m, widgetUtils.MENU, self.play_audio, menuitem=m.play) widgetUtils.connect_event(m, widgetUtils.MENU, self.move_to_album, menuitem=m.move) # if owner_id is the current user, the audio is added to the user's audios. if p["owner_id"] == self.session.user_id: m.library.SetItemLabel(_(u"&Remove from library")) widgetUtils.connect_event(m, widgetUtils.MENU, self.remove_from_library, menuitem=m.library) else: widgetUtils.connect_event(m, widgetUtils.MENU, self.add_to_library, menuitem=m.library) return m