*** empty log message ***
authorgc <gc>
Sun, 5 Aug 2007 11:58:58 +0000 (11:58 +0000)
committergc <gc>
Sun, 5 Aug 2007 11:58:58 +0000 (11:58 +0000)
bin/booh-classifier

index ac5d036f83034fc358a28ee118ea823647cff662..6b61a95732586707cce0e89f4c16be00afc5d952 100644 (file)
@@ -343,6 +343,19 @@ class Entry
         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)) }
@@ -352,7 +365,7 @@ class Entry
     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)
@@ -373,7 +386,7 @@ class Entry
             end
             if @pixbuf_full
                 if @angle.nil?
-                    if type == 'image'
+                    if @type == 'image'
                         @angle = guess_rotate(image_path)
                     else
                         @angle = 0
@@ -388,7 +401,7 @@ class Entry
                     @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
@@ -841,13 +854,13 @@ def real_show_entry(entry, tooltips, grab_focus)
         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
         }