def on_name_changed(self, *obj): """ Called anytime the filename text window changes. Checks to see if the file exists. If it does, the image is loaded into the preview window. """ fname = self.file_text.get_filename() if not fname: return filename = fname basename = os.path.basename(filename) (root, ext) = os.path.splitext(basename) old_title = self.description.get_text() if old_title == "" or old_title == self.temp_name: self.description.set_text(root) self.temp_name = root filename = find_file(filename) if filename: mtype = get_type(filename) if mtype and mtype.startswith("image"): image = scale_image(filename, THUMBSCALE) else: image = find_mime_type_pixbuf(mtype) self.image.set_from_pixbuf(image)
def on_name_changed(self, *obj): """ Called anytime the filename text window changes. Checks to see if the file exists. If it does, the image is loaded into the preview window. """ fname = self.file_text.get_filename() if not fname: return filename = conv_to_unicode(fname) basename = os.path.basename(filename) (root, ext) = os.path.splitext(basename) old_title = str(self.description.get_text()) if old_title == '' or old_title == self.temp_name: self.description.set_text(root) self.temp_name = root filename = find_file(filename) if filename: mtype = get_type(filename) if mtype and mtype.startswith("image"): image = scale_image(filename, THUMBSCALE) else: image = find_mime_type_pixbuf(mtype) self.image.set_from_pixbuf(image)
def draw_preview(self): mtype = self.obj.get_mime_type() if mtype: pb = get_thumbnail_image(media_path_full(self.db, self.obj.get_path()), mtype) self.pixmap.set_from_pixbuf(pb) else: pb = find_mime_type_pixbuf("text/plain") self.pixmap.set_from_pixbuf(pb)
def draw_preview(self): mtype = self.obj.get_mime_type() if mtype: pb = get_thumbnail_image( media_path_full(self.db, self.obj.get_path()), mtype) self.pixmap.set_from_pixbuf(pb) else: pb = find_mime_type_pixbuf('text/plain') self.pixmap.set_from_pixbuf(pb)
def draw_preview(self): """ Draw the two preview images. This method can be called on eg change of the path. """ mtype = self.source.get_mime_type() if mtype: fullpath = media_path_full(self.db, self.source.get_path()) pb = get_thumbnail_image(fullpath, mtype) self.pixmap.set_from_pixbuf(pb) self.selection.load_image(fullpath) else: pb = find_mime_type_pixbuf("text/plain") self.pixmap.set_from_pixbuf(pb) self.selection.load_image("")
def draw_preview(self): """ Draw the two preview images. This method can be called on eg change of the path. """ mtype = self.source.get_mime_type() if mtype: fullpath = media_path_full(self.db, self.source.get_path()) pb = get_thumbnail_image(fullpath, mtype) self.pixmap.set_from_pixbuf(pb) self.selection.load_image(fullpath) else: pb = find_mime_type_pixbuf('text/plain') self.pixmap.set_from_pixbuf(pb) self.selection.load_image('')