Class: MultiProgress
- Inherits:
-
Gtk::HBox
- Object
- Gtk::HBox
- MultiProgress
- Defined in:
- lib/SB/ListProgress.rb
Instance Method Summary collapse
- #all_done? ⇒ Boolean
- #done(list_id) ⇒ Object
-
#initialize ⇒ MultiProgress
constructor
A new instance of MultiProgress.
- #killed(list_id) ⇒ Object
- #pulse(list_id) ⇒ Object
- #step(list_id, new_value) ⇒ Object
- #to_s ⇒ Object
- #zero(list_id, rowcount, list_name = nil, visible_steps = 15) ⇒ Object
Constructor Details
#initialize ⇒ MultiProgress
Returns a new instance of MultiProgress.
78 79 80 81 82 83 |
# File 'lib/SB/ListProgress.rb', line 78 def initialize @max=0 super() @progresses=Hash.new signal_connect("destroy"){|me| @progresses.each_value{|progress| progress.destroy} } end |
Instance Method Details
#all_done? ⇒ Boolean
141 142 143 144 145 |
# File 'lib/SB/ListProgress.rb', line 141 def all_done? d=0 @progresses.each_value{|progress| d+=1 if progress.done} @progresses.size == d end |
#done(list_id) ⇒ Object
120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/SB/ListProgress.rb', line 120 def done(list_id) @progresses[list_id].done=true if @progresses.has_key?(list_id) if all_done? @progresses.each_value{|progress| remove(progress) progress.destroy } @progresses.clear end SB.instance.show unless SB.instance.visible? end |
#killed(list_id) ⇒ Object
132 133 134 135 136 137 138 139 |
# File 'lib/SB/ListProgress.rb', line 132 def killed(list_id) if @progresses.has_key?(list_id) pr=@progresses.delete(list_id) remove(pr) pr.destroy p pr.destroyed? end end |
#pulse(list_id) ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/SB/ListProgress.rb', line 85 def pulse(list_id) #init the progress unless @progresses.has_key?(list_id) @progresses[list_id]=MyListProgress.new pack_start(@progresses[list_id]) @progresses[list_id].show end SB.instance.show @progresses[list_id].start_pulse end |
#step(list_id, new_value) ⇒ Object
111 112 113 114 115 116 117 118 |
# File 'lib/SB/ListProgress.rb', line 111 def step(list_id,new_value) if @progresses.has_key?(list_id) @progresses[list_id].set_counter(new_value) unless @progresses[list_id].destroyed? SB.instance.show unless SB.instance.visible? end # sleep 0.1 self end |
#to_s ⇒ Object
146 147 148 |
# File 'lib/SB/ListProgress.rb', line 146 def to_s "MultiProgress" end |
#zero(list_id, rowcount, list_name = nil, visible_steps = 15) ⇒ Object
97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/SB/ListProgress.rb', line 97 def zero(list_id,rowcount,list_name=nil,visible_steps=15) #init the progress unless @progresses.has_key?(list_id) @progresses[list_id]=MyListProgress.new @progresses[list_id].set_visible_steps(visible_steps) pack_start(@progresses[list_id]) @progresses[list_id].show end @progresses[list_id].zero(rowcount,list_name) unless @progresses[list_id].destroyed? SB.instance.show self end |