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 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 wait_func(self, wait=0): """ Non-blocking wait (thread-sleep). """ while True: if self.stop_flag or self.error_flag: return True elif not wait: # 0 = False = None return False time.sleep(1) #segundos wait -= 1 status = "{0}: {1}".format("Wait", misc.time_format(wait)) self.status_msg = status
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 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