def update(self): downloads_list = api.get_status() for download_item in downloads_list: try: row = self.rows_buffer[download_item.id] #row[0] = download_item.id #this column is hidden and wont be modificated. row[1] = self.icons_dict[download_item.status] #col 1 row[2] = download_item.name #col 2 #row[3][0] = download_item.host #download_item.host #col 3 row[3][1] = self.icons_dict[ cons. DL_RESUME] if download_item.can_resume else None #download_item.host #col 3 row[3][2] = self.icons_dict[ cons. DL_PREMIUM] if download_item.is_premium else None #download_item.host #col 3 row[4] = misc.size_format( download_item.size) if download_item.size else None row[5] = misc.size_format( download_item.size_complete ) if download_item.size_complete else None row[6] = download_item.progress row[7] = misc.time_format( download_item.time) if download_item.time else None row[8] = misc.time_format( download_item.time_remain ) if download_item.time_remain else None row[9] = misc.speed_format( download_item.speed) if download_item.speed else None row[10] = self.get_status_msg(download_item) except KeyError as err: logger.debug(err) #uncomment if model doesnt get upated. self.__model.refresh()
def store_items(self, item_list): """ Agregar nuevos items a las columnas """ #self.dnd_flag = False #no afectar metodo dragndrop for download_item in item_list: #in self.download_manager.pending_downloads: self.get_status() #iniciar update_list del gui size_file = misc.size_format( download_item.size) if download_item.size else None size_complete = misc.size_format( download_item.size_complete ) if download_item.size_complete else None time = misc.time_format( download_item.time) if download_item.time else None host_icon = self.get_host_icon(download_item.host) self.store.append( [ download_item.id, self.icons_dict[download_item.status], download_item.name, host_icon, None, None, size_file, size_complete, download_item.progress, time, None, None, download_item.status_msg ] ) #store.append([act[0], act[1], act[2]], ) futura lista con tamanio de archivo, icono, etc self.rows_buffer[download_item.id] = self.store[ -1] #row just added
def update_status(self): """""" downloads_list = api.get_status() for download_item in downloads_list: try: row = self.rows_buffer[download_item.id] #row[0] = download_item.id #this column is hidden and wont be modificated. row[1] = self.icons_dict[download_item.status] #col 1 row[2] = download_item.name #col 2 #row[3] = download_item.host #download_item.host #col 3 row[4] = self.icons_dict[cons.DL_RESUME] if download_item.can_resume else None #download_item.host #col 3 row[5] = self.icons_dict[cons.DL_PREMIUM] if download_item.is_premium else None #download_item.host #col 3 row[6] = misc.size_format(download_item.size) if download_item.size else None row[7] = misc.size_format(download_item.size_complete) if download_item.size_complete else None row[8] = download_item.progress row[9] = misc.time_format(download_item.time) if download_item.time else None row[10] = misc.time_format(download_item.time_remain) if download_item.time_remain else None row[11] = misc.speed_format(download_item.speed) if download_item.speed else None row[12] = download_item.status_msg if not download_item.fail_count else "{0} ({1} #{2})".format(download_item.status_msg,_("Retry"), download_item.fail_count) except KeyError as err: logger.debug(err) #if not self.download_manager.active_downloads + self.download_manager.queue_downloads + self.download_manager.stopped_downloads: #si ya no hay mas descargas activas o en cola detener este loop. #logger.debug("list_update = False") #self.update_flag = False #cuando update_flag = False, sabemos que ya no esta corriendo... #return False return True #hace que se actualicen los valores mas de una vez (hasta el final).
def store_items(self, item_list): for download_item in item_list: size_file = misc.size_format(download_item.size) if download_item.size else None size_complete = misc.size_format(download_item.size_complete) if download_item.size_complete else None time = misc.time_format(download_item.time) if download_item.time else None host_icon = self.get_host_icon(download_item.host) item = [download_item.id, self.icons_dict[download_item.status], download_item.name, [host_icon, None, None], size_file, size_complete, download_item.progress, time, None, None, download_item.status_msg] self.__model.append(item) self.rows_buffer[item[0]] = item
def on_load_items(self): #TEST when the items are 50, 51 """""" self.validate_request() self.btn_next.setEnabled(True) self.btn_pre.setEnabled(True) match_term = self.search_entry.text() data_list = self.history_cls.get_data(self.offset, self.limit, match_term) self.__model.clear() [self.__model.append((id, name, misc.size_format(size), misc.size_format(complete), date_.strftime("%d-%m-%y %H:%M"), link, path)) for id, name, link, size, complete, path, date_ in data_list] if len(data_list) < self.limit: self.btn_next.setEnabled(False) if self.offset == 0: self.btn_pre.setEnabled(False)
def on_load_items(self, widget=None): #TEST when the items are 50, 51 """""" self.validate_request() self.button_next.set_sensitive(True) self.button_pre.set_sensitive(True) match_term = self.search_entry.get_text() data_list = self.history_cls.get_data(self.offset, self.limit, match_term) self.store.clear() [self.store.append((name, misc.size_format(size), misc.size_format(complete), date_.strftime("%d-%m-%y %H:%M"), link, path)) for id, name, link, size, complete, path, date_ in data_list] if len(data_list) < self.limit: self.button_next.set_sensitive(False) if self.offset == 0: self.button_pre.set_sensitive(False) if data_list: self.offset += self.limit
def store_items(self, item_list): """ Agregar nuevos items a las columnas """ #self.dnd_flag = False #no afectar metodo dragndrop for download_item in item_list: #in self.download_manager.pending_downloads: self.get_status() #iniciar update_list del gui size_file = misc.size_format(download_item.size) if download_item.size else None size_complete = misc.size_format(download_item.size_complete) if download_item.size_complete else None time = misc.time_format(download_item.time) if download_item.time else None host_icon = self.get_host_icon(download_item.host) self.store.append([download_item.id, self.icons_dict[download_item.status], download_item.name, host_icon, None, None, size_file, size_complete, download_item.progress, time, None, None, download_item.status_msg]) #store.append([act[0], act[1], act[2]], ) futura lista con tamanio de archivo, icono, etc self.rows_buffer[download_item.id] = self.store[-1] #row just added
def store_items(self, item_list): for download_item in item_list: size_file = misc.size_format( download_item.size) if download_item.size else None size_complete = misc.size_format( download_item.size_complete ) if download_item.size_complete else None time = misc.time_format( download_item.time) if download_item.time else None host_icon = self.get_host_icon(download_item.host) item = [ download_item.id, self.icons_dict[download_item.status], download_item.name, [host_icon, None, None], size_file, size_complete, download_item.progress, time, None, None, download_item.status_msg ] self.__model.append(item) self.rows_buffer[item[0]] = item
def update_status(self): """""" downloads_list = api.get_status() for download_item in downloads_list: try: row = self.rows_buffer[download_item.id] #row[0] = download_item.id #this column is hidden and wont be modificated. row[1] = self.icons_dict[download_item.status] #col 1 row[2] = download_item.name #col 2 #row[3] = download_item.host #download_item.host #col 3 row[4] = self.icons_dict[ cons. DL_RESUME] if download_item.can_resume else None #download_item.host #col 3 row[5] = self.icons_dict[ cons. DL_PREMIUM] if download_item.is_premium else None #download_item.host #col 3 row[6] = misc.size_format( download_item.size) if download_item.size else None row[7] = misc.size_format( download_item.size_complete ) if download_item.size_complete else None row[8] = download_item.progress row[9] = misc.time_format( download_item.time) if download_item.time else None row[10] = misc.time_format( download_item.time_remain ) if download_item.time_remain else None row[11] = misc.speed_format( download_item.speed) if download_item.speed else None row[12] = download_item.status_msg if not download_item.fail_count else "{0} ({1} #{2})".format( download_item.status_msg, _("Retry"), download_item.fail_count) except KeyError as err: logger.debug(err) #if not self.download_manager.active_downloads + self.download_manager.queue_downloads + self.download_manager.stopped_downloads: #si ya no hay mas descargas activas o en cola detener este loop. #logger.debug("list_update = False") #self.update_flag = False #cuando update_flag = False, sabemos que ya no esta corriendo... #return False return True #hace que se actualicen los valores mas de una vez (hasta el final).
def update(self): downloads_list = api.get_status() for download_item in downloads_list: try: row = self.rows_buffer[download_item.id] #row[0] = download_item.id #this column is hidden and wont be modificated. row[1] = self.icons_dict[download_item.status] #col 1 row[2] = download_item.name #col 2 #row[3][0] = download_item.host #download_item.host #col 3 row[3][1] = self.icons_dict[cons.DL_RESUME] if download_item.can_resume else None #download_item.host #col 3 row[3][2] = self.icons_dict[cons.DL_PREMIUM] if download_item.is_premium else None #download_item.host #col 3 row[4] = misc.size_format(download_item.size) if download_item.size else None row[5] = misc.size_format(download_item.size_complete) if download_item.size_complete else None row[6] = download_item.progress row[7] = misc.time_format(download_item.time) if download_item.time else None row[8] = misc.time_format(download_item.time_remain) if download_item.time_remain else None row[9] = misc.speed_format(download_item.speed) if download_item.speed else None row[10] = self.get_status_msg(download_item) except KeyError as err: logger.debug(err) #uncomment if model doesnt get upated. self.__model.refresh()
def update(self): #this method steals cycles, its not a new thread items_list = api.get_checking_update() for download_item in items_list: try: row = self.rows_buffer[download_item.id] row[1] = True if download_item.link_status != cons.LINK_DEAD else False row[2] = download_item.link_status row[3] = download_item.name row[4] = download_item.host row[5] = misc.size_format(download_item.size) row[6] = download_item.link_status_msg except KeyError as err: logger.debug(err) self.__model.refresh()
def update_(self): checking_downloads = api.get_checking_downloads() api.update_checking_downloads() for download_item in checking_downloads.itervalues(): try: row = self.rows_buffer[download_item.id] row[1] = True if download_item.link_status != cons.LINK_DEAD else False row[2] = self.icons_dict[download_item.link_status] row[3] = download_item.name row[4] = download_item.host row[5] = misc.size_format(download_item.size) row[6] = download_item.link_status_msg except KeyError as err: logger.debug(err) self.__model.refresh()
def update_checking_status(self): #this method steals cycles, its not a new thread """""" #self.download_manager.clear_pending() #Erase pending_downloads list. items_list = api.get_checking_update() for download_item in items_list: #link_status, file_name, host, size = self.download_manager.plugin_link_checking(download_item) for row in self.store: if row[0] == download_item.id: row[2] = download_item.link_status row[3] = download_item.name row[4] = download_item.host row[5] = misc.size_format(download_item.size) row[6] = download_item.link_status_msg #if not self.download_manager.pending_downloads: #return False return True #keep it updating,
def update_checking_status( self): #this method steals cycles, its not a new thread """""" #self.download_manager.clear_pending() #Erase pending_downloads list. items_list = api.get_checking_update() for download_item in items_list: #link_status, file_name, host, size = self.download_manager.plugin_link_checking(download_item) for row in self.store: if row[0] == download_item.id: row[2] = download_item.link_status row[3] = download_item.name row[4] = download_item.host row[5] = misc.size_format(download_item.size) row[6] = download_item.link_status_msg #if not self.download_manager.pending_downloads: #return False return True #keep it updating,