本文整理汇总了Python中TriblerGUI.tribler_request_manager.TriblerRequestManager.get_download_details方法的典型用法代码示例。如果您正苦于以下问题:Python TriblerRequestManager.get_download_details方法的具体用法?Python TriblerRequestManager.get_download_details怎么用?Python TriblerRequestManager.get_download_details使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TriblerGUI.tribler_request_manager.TriblerRequestManager
的用法示例。
在下文中一共展示了TriblerRequestManager.get_download_details方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: VideoPlayerFilesMenu
# 需要导入模块: from TriblerGUI.tribler_request_manager import TriblerRequestManager [as 别名]
# 或者: from TriblerGUI.tribler_request_manager.TriblerRequestManager import get_download_details [as 别名]
class VideoPlayerFilesMenu(QWidget):
"""
This class manages the menu to the right of the video player that can be used to choose a different file for
playback.
"""
should_change_playing_file = pyqtSignal(int)
def initialize_file_menu(self):
self.request_manager = TriblerRequestManager()
self.request_manager.received_download_details.connect(self.received_download_details)
self.file_list = self.findChild(QListWidget, 'video_player_files')
self.file_list.itemClicked.connect(self.on_file_item_click)
def load_download_files(self, infohash):
self.request_manager.get_download_details(infohash)
def received_download_details(self, json_result):
self.file_list.clear()
results = json.loads(json_result)
for result in results['download']['files']:
item = QListWidgetItem(self.file_list)
item.setData(Qt.UserRole, result)
is_selected = self.parent().ACTIVE_INDEX == result['index']
widget_item = VideoFileListItem(self.file_list, result, is_selected)
item.setSizeHint(widget_item.sizeHint())
self.file_list.addItem(item)
self.file_list.setItemWidget(item, widget_item)
def on_file_item_click(self, file_list_item):
file_info = file_list_item.data(Qt.UserRole)
self.should_change_playing_file.emit(file_info['index'])
for i in xrange(0, self.file_list.count()):
item = self.file_list.item(i)
self.file_list.itemWidget(item).setDeselected()
self.file_list.itemWidget(file_list_item).setSelected()