Sha256: 2c7fe4e77af8878200a95b7acd8143615728cc0d7e05137ba783e136f8bb61b2

Contents?: true

Size: 1.26 KB

Versions: 76

Compression:

Stored size: 1.26 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.window_position = Gtk::Window::POS_CENTER_ALWAYS
    @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

76 entries across 76 versions & 1 rubygems

Version Path
knjrbfw-0.0.116 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.115 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.114 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.113 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.111 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.110 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.109 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.108 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.107 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.105 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.104 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.103 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.102 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.101 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.100 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.99 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.98 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.97 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.96 lib/knj/gtk2_statuswindow.rb
knjrbfw-0.0.95 lib/knj/gtk2_statuswindow.rb