def on_download_selected(self):
        current_path = self.cb.currentText()
        self.cb_remove(current_path)
        self.cb.insertItem(0, current_path)
        if current_path in self.paths_list:
            self.paths_list.remove(current_path)
        self.paths_list.append(current_path)
        if len(self.paths_list) > 5:
            self.paths_list.pop(0)
            self.cb.removeItem(5)
        self.cb.setCurrentIndex(0)
        conf.set_save_dl_paths(self.paths_list)
        
        id_items_list = []
        iters = []
        for row in self.items:
            if row[1]: # and row[4] != cons.UNSUPPORTED: #tmp
                iters.append(row)
                id_item = row[0]
                id_items_list.append(id_item)
                del self.rows_buffer[id_item]
        [self.__model.remove(self.items.index(iter)) for iter in iters]
        
        item_list = api.pop_checking_items(id_items_list)
        api.downloader_init(item_list, current_path)
        signals.store_items.emit(item_list)

        if conf.get_auto_switch_tab():
            signals.switch_tab.emit(0)
Example #2
0
    def on_download_selected(self):
        # save the selected path
        current_path = self.cb.currentText()
        self.cb_remove(current_path)
        self.cb.insertItem(0, current_path)

        if current_path in self.paths_list:
            self.paths_list.remove(current_path)

        self.paths_list.append(current_path)

        if len(self.paths_list) > 5:
            self.paths_list.pop(0)
            self.cb.removeItem(5)

        self.cb.setCurrentIndex(0)
        conf.set_save_dl_paths(self.paths_list)

        # move selected items to downloads tab
        id_items_list = []
        iters = []

        for row in self.items:
            if row[1]:
                iters.append(row)
                id_item = row[0]
                id_items_list.append(id_item)
                del self.rows_buffer[id_item]

        [self.__model.remove(self.items.index(iter)) for iter in iters]
        
        item_list = api.pop_checking_items(id_items_list)
        for download_item in item_list:
            download_item.path = current_path

        signals.add_to_downloader.emit(item_list)