Class: Cosmos::CanvasimageWidget
- Includes:
- Widget
- Defined in:
- lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
Instance Attribute Summary
Attributes included from Widget
#item, #item_name, #limits_set, #limits_state, #packet, #packet_name, #polling_period, #screen, #settings, #target_name, #value, #value_type
Instance Method Summary collapse
- #dispose ⇒ Object
-
#initialize(parent_layout, filename, x, y) ⇒ CanvasimageWidget
constructor
A new instance of CanvasimageWidget.
- #paint(painter) ⇒ Object
Methods included from Widget
#context_menu, #get_tooltip_text, included, #process_settings, #set_setting, #set_subsetting, #shutdown, #update_widget
Constructor Details
#initialize(parent_layout, filename, x, y) ⇒ CanvasimageWidget
Returns a new instance of CanvasimageWidget.
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb', line 18 def initialize(parent_layout, filename, x, y) super() @x = x.to_i @y = y.to_i @image = nil filename = File.join(::Cosmos::USERPATH, 'config', 'data', filename) unless File.exist?(filename) raise "Can't find the file #{filename} in #{::Cosmos::USERPATH}/config/data" end @image = Qt::Image.new(filename) parent_layout.add_repaint(self) end |
Instance Method Details
#dispose ⇒ Object
35 36 37 38 |
# File 'lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb', line 35 def dispose super() @image.dispose end |
#paint(painter) ⇒ Object
31 32 33 |
# File 'lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb', line 31 def paint(painter) painter.drawImage(@x, @y, @image) if @image end |