Sha256: 62acde6bbff698c41c3cc27cb20b2d107ef30a7e45bc895ef798a83927cf74ac

Contents?: true

Size: 1.2 KB

Versions: 25

Compression:

Stored size: 1.2 KB

Contents

class Knj::Gtk2::StatusWindow
  def initialize(opts = {})
    @opts = opts
    
    @window = Gtk::Window.new("Status")
    @window.modal = true
    @window.border_width = 8
    @window.set_frame_dimensions(3, 3, 3, 3)
    @window.signal_connect("destroy") do
      destroy
    end
    
    if opts["transient_for"]
      @window.transient_for = @opts["transient_for"]
    end
    
    @label = Gtk::Label.new("Loading...")
    @pbar = Gtk::ProgressBar.new
    
    @vbox = Gtk::VBox.new
    @vbox.spacing = 4
    @vbox.pack_start(@label, false, true)
    @vbox.pack_start(@pbar, false, true)
    
    @window.add(@vbox)
    
    @window.show_all
  end
  
  def label=(newlabel)
    if @label
      @label.label = newlabel
    end
  end
  
  def setStatus(perc, newlabel, temp = nil)
    if !perc
      perc = 0
    end
    
    self.percent = perc
    self.label = newlabel.to_s
  end
  
  def percent=(newperc)
    if @pbar
      @pbar.fraction = newperc
    end
  end
  
  def destroy
    if @window
      @window.destroy
    end
    
    @window = nil
    @vbox = nil
    @pbar = nil
    @label = nil
    @opts = nil
  end
  
  alias closeWindow destroy
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
knjrbfw-0.0.33 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.32 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.31 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.30 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.29 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.28 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.27 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.26 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.25 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.24 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.23 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.22 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.21 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.20 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.19 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.18 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.17 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.16 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.15 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.14 lib/knj/gtk2_statuswindow.rb