Cannot set emblems on files with previews that have a high aspect ratio.
I have an extension which puts emblems on files in Nautilus.
A user has reported a bug against the extension in which emblems are not displayed for some files.
I am fairly sure my extension isn't doing anything wrong here, so I suspect this might be an issue with Nautilus. The issue appears to show itself with high-aspect ratio images when previewing is enabled.
To reproduce, here is a minimal nautilus-python extension that adds emblems to all files. Make sure you have nautilus-python installed, save the extension as ~/.local/share/nautilus-python/extensions/bug.py
, then restart nautilus, enable file previews, and browse to a folder with images of various sizes.
import gi
from gi.repository import GObject
gi.require_version('Nautilus', '3.0')
from gi.repository import Nautilus
class InfoProvider(GObject.GObject, Nautilus.InfoProvider):
def update_file_info(self, file):
file.add_emblem('emblem-generic')
The result is that most files get an emblem, but for some previewed image files, there is no emblem:
The image files for which it fails appear to be ones with an aspect ratio of greater than about 2:1 in either direction. You can find such an image file here if you don't have one at hand.
Nautilus also outputs the following error upon the extension setting an emblem:
(nautilus:18489): GdkPixbuf-CRITICAL **: 21:45:25.049: gdk_pixbuf_composite: assertion 'dest_y >= 0 && dest_y + dest_height <= dest->height' failed