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.13 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.12 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.11 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.10 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.9 lib/knj/gtk2_statuswindow.rb