Class: Knj::Gtk2::StatusWindow
Instance Method Summary collapse
- #destroy ⇒ Object (also: #closeWindow)
-
#initialize(opts = {}) ⇒ StatusWindow
constructor
A new instance of StatusWindow.
- #label=(newlabel) ⇒ Object
- #percent=(newperc) ⇒ Object
- #setStatus(perc, newlabel, temp = nil) ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ StatusWindow
Returns a new instance of StatusWindow.
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/knj/gtk2_statuswindow.rb', line 2 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 |
Instance Method Details
#destroy ⇒ Object Also known as: closeWindow
52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/knj/gtk2_statuswindow.rb', line 52 def destroy if @window @window.destroy end @window = nil @vbox = nil @pbar = nil @label = nil @opts = nil end |
#label=(newlabel) ⇒ Object
31 32 33 34 35 |
# File 'lib/knj/gtk2_statuswindow.rb', line 31 def label=(newlabel) if @label @label.label = newlabel end end |
#percent=(newperc) ⇒ Object
46 47 48 49 50 |
# File 'lib/knj/gtk2_statuswindow.rb', line 46 def percent=(newperc) if @pbar @pbar.fraction = newperc end end |
#setStatus(perc, newlabel, temp = nil) ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/knj/gtk2_statuswindow.rb', line 37 def setStatus(perc, newlabel, temp = nil) if !perc perc = 0 end self.percent = perc self.label = newlabel.to_s end |