end
end
+ def get_beautified_name
+ if type == 'image'
+ size = get_image_size(path)
+ return _("%s (%sx%s, %s KB)") % [File.basename(@path).gsub(/\.[^.]+$/, ''),
+ size[:x],
+ size[:y],
+ commify(file_size(path)/1024)]
+ else
+ return _("%s (video - %s KB)") % [File.basename(@path).gsub(/\.[^.]+$/, ''),
+ commify(file_size(path)/1024)]
+ end
+ end
+
private
def cleanup_dir(dir)
Dir.entries(dir).each { |file| file != '.' && file != '..' and File.delete(File.join(dir, file)) }
def load_into_pixbuf_full
if @pixbuf_full.nil?
msg 3, ">>> load_into_pixbuf_full #{path}"
- if type == 'video'
+ if @type == 'video'
tmp = Tempfile.new("boohclassifiertemp")
tmp.close!
Dir.mkdir(dest_dir = tmp.path)
end
if @pixbuf_full
if @angle.nil?
- if type == 'image'
+ if @type == 'image'
@angle = guess_rotate(image_path)
else
@angle = 0
@pixbuf_full = @pixbuf_full.scale(@pixbuf_full.width * (@@max_height.to_f/@pixbuf_full.height), @@max_height, Gdk::Pixbuf::INTERP_BILINEAR)
end
end
- if type == 'video'
+ if @type == 'video'
cleanup_dir(dest_dir)
end
end
else
entry.button = Gtk::Button.new.set_image(entry.image)
end
- tooltips.set_tip(entry.button, basepath = File.basename(entry.path).gsub(/\.[^.]+$/, ''), nil)
+ tooltips.set_tip(entry.button, entry.get_beautified_name, nil)
$imagesline.pack_start(entry.alignment = Gtk::Alignment.new(0.5, 1, 0, 0).add(entry.button).show_all, false, false)
entry.button.signal_connect('clicked') {
if (last_shown = $mainview.get_shown_entry) != entry
$mainview.set_shown_entry(entry)
entry.alignment.set(0.5, 0, 0, 0)
- sb_msg(_("Selected %s") % basepath)
+ sb_msg(_("Selected %s") % entry.get_beautified_name)
last_shown.nil? or last_shown.alignment.set(0.5, 1, 0, 0)
end
}