Sha256: d240b47872409647b08e6dd6bde247702480d3d3b555f9900bce2fe566bdf051

Contents?: true

Size: 1.14 KB

Versions: 23

Compression:

Stored size: 1.14 KB

Contents

# encoding: ascii-8bit

# Copyright 2014 Ball Aerospace & Technologies Corp.
# All Rights Reserved.
#
# This program is free software; you can modify and/or redistribute it
# under the terms of the GNU General Public License
# as published by the Free Software Foundation; version 3 with
# attribution addendums as found in the LICENSE.txt

require 'cosmos/tools/tlm_viewer/widgets/widget'
require 'cosmos/tools/tlm_viewer/widgets/canvas_clickable'

module Cosmos
  class CanvasimageWidget
    include Widget
    include CanvasClickable

    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)
      @x_end = @x + @image.width
      @y_end = @y + @image.height
    end

    def paint(painter)
      painter.drawImage(@x, @y, @image) if @image
    end

    def dispose
      super()
      @image.dispose
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
cosmos-4.3.0-java lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-4.3.0 lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-4.2.4-java lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-4.2.4 lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-4.2.3-java lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-4.2.3 lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-4.2.2-java lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-4.2.2 lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-4.2.1-java lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-4.2.1 lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-4.2.0-java lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-4.2.0 lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-4.1.1-java lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-4.1.1 lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-4.1.0-java lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-4.1.0 lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-4.0.3-java lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-4.0.3-universal-java-1.8 lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-4.0.3 lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-4.0.2-universal-java-1.8 lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb