Пример #1
0
 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()
Пример #2
0
 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).
Пример #3
0
    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).
Пример #4
0
 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()