Skip to content
Browse files

qt image

  • Loading branch information...
1 parent 51eb472 commit 37b86a6145bcbd68359dc803b14f39a650d64a37 andrea@VEGETA committed Nov 13, 2009
View
2 Rakefile
@@ -9,7 +9,7 @@ require 'rake/testtask'
spec = Gem::Specification.new do |s|
s.name = 'freightrain'
- s.version = '0.3.3'
+ s.version = '0.3.4'
s.has_rdoc = false
s.summary = 'ruby desktop development made easy'
s.description = s.summary
View
19 lib/freightrain/binding/converters/pixbuf_converter.rb
@@ -1,19 +0,0 @@
-
-
-module Freightrain
-
- class PixbufConverter
-
- def initialize(identifier = self.object_id)
- @identifier = identifier
- end
-
- def from(value)
- file = File.new(File.join(Dir.tmpdir,"tempimg#{@identifier}.jpg"),'w')
- file << value
- file.close
- return Gdk::Pixbuf.new(File.join(Dir.tmpdir,"tempimg#{@identifier}.jpg"))
- end
-
- end
-end
View
13 lib/freightrain/toolkit_extensions/gtk/widgets/gtk_image.rb
@@ -3,13 +3,12 @@ module Gtk
class Image
- def bind(options)
- if options[:property] == :pixbuf
- options[:converter] = PixbufConverter.new
- end
- super(options)
+ def image=(value)
+ file = File.new(File.join(Dir.tmpdir,"tempimg#{self.object_id.to_s}"),'w')
+ file << value
+ file.close
+ return Gdk::Pixbuf.new(File.join(Dir.tmpdir,"tempimg#{self.object_id.to_s}"))
end
-
-
+
end
end
View
18 lib/freightrain/toolkit_extensions/qt/widgets/qt_label.rb
@@ -0,0 +1,18 @@
+
+
+module Qt
+
+ class Label
+
+ def image=(value)
+ file = File.new(File.join(Dir.tmpdir,"tempimg#{self.object_id.to_s}"),'w')
+ file << value
+ file.close
+ image = Qt::Image.new(File.join(Dir.tmpdir,"tempimg#{self.object_id.to_s}"))
+ self.pixmap = image
+ self.resize(self.pixmap.size)
+ end
+
+ end
+
+end
View
5 lib/freightrain/toolkit_extensions/qt/widgets/qt_widget.rb
@@ -5,7 +5,6 @@ module Qt
class Widget
def elements=(enumerable)
- begin
delta = enumerable.length - @elements.length
@height_factor = @control.new.control.height unless @height_factor
height = @elements.length
@@ -37,10 +36,6 @@ def elements=(enumerable)
@elements.each do |element|
element.value = enumerable[@elements.index(element)]
end
- rescue Exception => ex
- p ex.message
- p ex.backtrace
- end
end
def elements()

0 comments on commit 37b86a6

Please sign in to comment.
Something went wrong with that request. Please try again.