def __init__(self, download): self.download = download self.__get_widgets() self.__connect_widgets() if download.pixbuf: pixbuf = gui.load_icon_from_mime_type(download.mime_type, 48) self.image.set_from_pixbuf(pixbuf) else: self.image.set_from_icon_name(NAME.lower(), gtk.ICON_SIZE_DIALOG) self.uri_label.set_text(download.uri) self.name_label.set_text(download.file_name) self.folder_label.set_text(download.path) self.current_size_label.set_text("%s (%s bytes)" % \ (utils.get_readable_size(download.current_size), download.current_size)) self.total_size_label.set_text("%s (%s bytes)" % \ (utils.get_readable_size(download.total_size), download.total_size)) self.mime_type_label.set_text(download.mime_type) self.date_started_label.set_text(download.get_date_str("started")) self.date_completed_label.set_text(download.get_date_str("completed")) download.connect("update", self.__download_update) download.connect("status-changed", self.__download_status_changed) self.dialog.show()
def __total_size_cell_data_func(self, column, cell, model, iter): """Data function for the file size of downloads.""" download = model.get_value(iter, 0) cell.props.text = utils.get_readable_size(download.total_size)
def __download_update(self, download, block_count, block_size, total_size): self.current_size_label.set_text("%s (%s bytes)" % (utils.get_readable_size(download.current_size), download.current_size))