Sha256: d2bb782f5b9fdc7974631ca611cd7ff03d4a963a765420585f16ff62ee761943

Contents?: true

Size: 1.01 KB

Versions: 29

Compression:

Stored size: 1.01 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'

module Cosmos

  class CanvasimageWidget
    include Widget

    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

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

    def dispose
      super()
      @image.dispose
    end
  end

end # module Cosmos

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
cosmos-4.0.0-universal-java-1.8 lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-4.0.0 lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-3.9.2 lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-3.9.1 lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-3.8.3 lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-3.8.2 lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-3.8.1 lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-3.8.0 lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-3.7.1 lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-3.7.0 lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-3.6.3 lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-3.6.2 lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-3.6.1 lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-3.6.0 lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-3.5.3 lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-3.5.2 lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-3.5.0 lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-3.4.2 lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-3.4.1 lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
cosmos-3.4.0 lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb