def query_tooltip_icon_view_cb(self, widget, x, y, keyboard_tip, tooltip): context = widget.get_tooltip_context(x, y, keyboard_tip) if not context: return False model, path, iter = context name = model[iter][BASENAME_COL] file = self.dir.file(name) mtime = file.mtime() if mtime: mdate = datetime.datetime.fromtimestamp( file.mtime()).strftime('%c') # TODO: fix datetime format else: mdate = _( 'Unknown') # T: unspecified value for file modification time size = format_file_size(file.size()) pixbuf = self.thumbman.get_thumbnail(file, THUMB_SIZE_LARGE) if not pixbuf: # No thumbnail, use icon, but use it at normal size pixbuf = get_mime_icon(file, THUMB_SIZE_NORMAL) \ or self._file_icon_tooltip mtype = file.get_mimetype() mtype_desc = get_mime_description(mtype) if mtype_desc: mtype_desc = mtype_desc + " (%s)" % mtype # E.g. "PDF document (application/pdf)" f_label = _('Name') # T: label for file name t_label = _('Type') # T: label for file type s_label = _('Size') # T: label for file size m_label = _('Modified') # T: label for file modification date tooltip.set_markup( "%s\n\n<b>%s:</b> %s\n<b>%s:</b> %s\n<b>%s:</b>\n%s" % ( name, t_label, mtype_desc or mtype, s_label, size, m_label, mdate, )) tooltip.set_icon(pixbuf) widget.set_tooltip_item(tooltip, path) return True
def query_tooltip_icon_view_cb(self, widget, x, y, keyboard_tip, tooltip): context = widget.get_tooltip_context(x, y, keyboard_tip) if not context: return False model, path, iter = context name = model[iter][BASENAME_COL] file = self.dir.file(name) mtime = file.mtime() if mtime: mdate = datetime.datetime.fromtimestamp(file.mtime()).strftime('%c') # TODO: fix datetime format else: mdate = _('Unknown') # T: unspecified value for file modification time size = format_file_size(file.size()) pixbuf = self.thumbman.get_thumbnail(file, THUMB_SIZE_LARGE) if not pixbuf: # No thumbnail, use icon, but use it at normal size pixbuf = get_mime_icon(file, THUMB_SIZE_NORMAL) \ or self._file_icon_tooltip mtype = file.get_mimetype() mtype_desc = get_mime_description(mtype) if mtype_desc: mtype_desc = mtype_desc + " (%s)" % mtype # E.g. "PDF document (application/pdf)" f_label = _('Name') # T: label for file name t_label = _('Type') # T: label for file type s_label = _('Size') # T: label for file size m_label = _('Modified') # T: label for file modification date tooltip.set_markup( "%s\n\n<b>%s:</b> %s\n<b>%s:</b> %s\n<b>%s:</b>\n%s" % ( name, t_label, mtype_desc or mtype, s_label, size, m_label, mdate, )) tooltip.set_icon(pixbuf) widget.set_tooltip_item(tooltip, path) return True
def size(self): return format_file_size(self._path.size())
def size(self): return format_file_size(self._file.size())