Exemplo n.º 1
0
    def __init__(self, cover_thread_count=2, detail_thread_count=4):
        QAbstractItemModel.__init__(self)

        self.DRM_LOCKED_ICON = QPixmap(I('drm-locked.png')).scaledToHeight(
            64, Qt.SmoothTransformation)
        self.DRM_UNLOCKED_ICON = QPixmap(I('drm-unlocked.png')).scaledToHeight(
            64, Qt.SmoothTransformation)
        self.DRM_UNKNOWN_ICON = QPixmap(
            I('dialog_question.png')).scaledToHeight(64,
                                                     Qt.SmoothTransformation)
        self.DONATE_ICON = QPixmap(I('donate.png')).scaledToHeight(
            16, Qt.SmoothTransformation)
        self.DOWNLOAD_ICON = QPixmap(I('arrow-down.png')).scaledToHeight(
            16, Qt.SmoothTransformation)

        # All matches. Used to determine the order to display
        # self.matches because the SearchFilter returns
        # matches unordered.
        self.all_matches = []
        # Only the showing matches.
        self.matches = []
        self.query = ''
        self.filterable_query = False
        self.search_filter = SearchFilter()
        self.cover_pool = CoverThreadPool(cover_thread_count)
        self.details_pool = DetailsThreadPool(detail_thread_count)

        self.filter_results_dispatcher = FunctionDispatcher(
            self.filter_results)
        self.got_result_details_dispatcher = FunctionDispatcher(
            self.got_result_details)

        self.sort_col = 2
        self.sort_order = Qt.AscendingOrder