当前位置: 首页>>代码示例>>Python>>正文


Python TriblerRequestManager.get_subscribed_channels方法代码示例

本文整理汇总了Python中TriblerGUI.tribler_request_manager.TriblerRequestManager.get_subscribed_channels方法的典型用法代码示例。如果您正苦于以下问题:Python TriblerRequestManager.get_subscribed_channels方法的具体用法?Python TriblerRequestManager.get_subscribed_channels怎么用?Python TriblerRequestManager.get_subscribed_channels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TriblerGUI.tribler_request_manager.TriblerRequestManager的用法示例。


在下文中一共展示了TriblerRequestManager.get_subscribed_channels方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TriblerWindow

# 需要导入模块: from TriblerGUI.tribler_request_manager import TriblerRequestManager [as 别名]
# 或者: from TriblerGUI.tribler_request_manager.TriblerRequestManager import get_subscribed_channels [as 别名]

#.........这里部分代码省略.........
        self.search_results_page.initialize_search_results_page()
        self.settings_page.initialize_settings_page()
        self.my_channel_page.initialize_my_channel_page()
        self.downloads_page.initialize_downloads_page()

        self.stackedWidget.setCurrentIndex(PAGE_HOME)

        self.show()

    def received_free_space(self, free_space):
        self.statusBar.set_free_space(free_space)

    def received_subscribed_channels(self, results):
        items = []
        for result in results['subscribed']:
            items.append((ChannelListItem, result))
        self.subscribed_channels_list.set_data_items(items)

    def received_torrents_in_channel(self, results):
        items = []
        for result in results['torrents']:
            items.append((ChannelTorrentListItem, result))
        self.channel_torrents_list.set_data_items(items)

    def received_variables(self, variables):
        self.left_menu_home_button.selectMenuButton()
        self.video_player_page.video_player_port = variables["ports"]["video~port"]

    def on_top_search_button_click(self):
        self.clicked_menu_button("-")
        self.stackedWidget.setCurrentIndex(PAGE_SEARCH_RESULTS)
        self.search_results_page.perform_search(self.top_search_bar.text())
        self.search_request_mgr = TriblerRequestManager()
        self.search_request_mgr.search_channels(self.top_search_bar.text(),
                                                self.search_results_page.received_search_results)

    def on_top_menu_button_click(self):
        if self.left_menu.isHidden():
            self.left_menu.show()
        else:
            self.left_menu.hide()

    def on_channel_tab_button_clicked(self, button_name):
        if button_name == "channel_content_button":
            self.channel_stacked_widget.setCurrentIndex(PAGE_CHANNEL_CONTENT)
        elif button_name == "channel_comments_button":
            self.channel_stacked_widget.setCurrentIndex(PAGE_CHANNEL_COMMENTS)
        elif button_name == "channel_activity_button":
            self.channel_stacked_widget.setCurrentIndex(PAGE_CHANNEL_ACTIVITY)

    def clicked_menu_button(self, menu_button_name):
        # Deselect menu buttons
        for button in self.menu_buttons:
            button.unselectMenuButton()

        if menu_button_name == "left_menu_home_button":
            self.left_menu_home_button.selectMenuButton()
            self.stackedWidget.setCurrentIndex(PAGE_HOME)
        elif menu_button_name == "left_menu_my_channel_button":
            self.left_menu_my_channel_button.selectMenuButton()
            self.stackedWidget.setCurrentIndex(PAGE_MY_CHANNEL)
            self.my_channel_page.load_my_channel_overview()
        elif menu_button_name == "left_menu_videoplayer_button":
            self.left_menu_videoplayer_button.selectMenuButton()
            self.stackedWidget.setCurrentIndex(PAGE_VIDEO_PLAYER)
        elif menu_button_name == "left_menu_downloads_button":
            self.left_menu_downloads_button.selectMenuButton()
            self.stackedWidget.setCurrentIndex(PAGE_DOWNLOADS)
        elif menu_button_name == "left_menu_settings_button":
            self.left_menu_settings_button.selectMenuButton()
            self.stackedWidget.setCurrentIndex(PAGE_SETTINGS)
            self.settings_page.load_settings()
        elif menu_button_name == "left_menu_subscribed_button":
            self.left_menu_subscribed_button.selectMenuButton()
            self.subscribed_channels_request_manager = TriblerRequestManager()
            self.subscribed_channels_request_manager.get_subscribed_channels(self.received_subscribed_channels)
            self.stackedWidget.setCurrentIndex(PAGE_SUBSCRIBED_CHANNELS)
        self.navigation_stack = []

    def on_channel_item_click(self, channel_list_item):
        channel_info = channel_list_item.data(Qt.UserRole)
        self.get_torents_in_channel_manager = TriblerRequestManager()
        self.get_torents_in_channel_manager.get_torrents_in_channel(str(channel_info['id']), self.received_torrents_in_channel)
        self.navigation_stack.append(self.stackedWidget.currentIndex())
        self.stackedWidget.setCurrentIndex(PAGE_CHANNEL_DETAILS)

        # initialize the page about a channel
        channel_detail_pane = self.findChild(QWidget, "channel_details")
        channel_name_label = channel_detail_pane.findChild(QLabel, "channel_name_label")
        channel_num_subs_label = channel_detail_pane.findChild(QLabel, "channel_num_subs_label")

        channel_name_label.setText(channel_info['name'])
        channel_num_subs_label.setText(str(channel_info['votes']))

    def on_page_back_clicked(self):
        prev_page = self.navigation_stack.pop()
        self.stackedWidget.setCurrentIndex(prev_page)

    def resizeEvent(self, event):
        self.resize_event.emit()
开发者ID:devos50,项目名称:TriblerGUI,代码行数:104,代码来源:Main.py


注:本文中的TriblerGUI.tribler_request_manager.TriblerRequestManager.get_subscribed_channels方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。