Class: Watobo::Gui::ProgressInfo
- Inherits:
-
FXVerticalFrame
- Object
- FXVerticalFrame
- Watobo::Gui::ProgressInfo
- Defined in:
- lib/watobo/gui/dashboard.rb
Instance Method Summary collapse
- #finished ⇒ Object
- #increment(i) ⇒ Object
-
#initialize(owner, check_name, num_checks) ⇒ ProgressInfo
constructor
A new instance of ProgressInfo.
- #progress(i) ⇒ Object
- #total(i) ⇒ Object
- #update_bar_color ⇒ Object
Constructor Details
#initialize(owner, check_name, num_checks) ⇒ ProgressInfo
Returns a new instance of ProgressInfo.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/watobo/gui/dashboard.rb', line 46 def initialize(owner, check_name, num_checks) begin super(owner, :opts => LAYOUT_FILL_X|FRAME_GROOVE|LAYOUT_TOP) @lock = Mutex.new @check_name = check_name @label = FXLabel.new(self, check_name, :opts => LAYOUT_LEFT) # puts l @pbar = FXProgressBar.new(self, nil, 0, LAYOUT_FILL_X|FRAME_SUNKEN|FRAME_THICK|PROGRESSBAR_HORIZONTAL) @pbar.progress = 0 @pbar.total = num_checks puts "#{check_name} has #{num_checks} Checks" rescue => bang puts "!!!ERROR: could not add progress info" puts bang puts bang.backtrace if $DEBUG end end |
Instance Method Details
#finished ⇒ Object
40 41 42 43 44 |
# File 'lib/watobo/gui/dashboard.rb', line 40 def finished @lock.synchronize do @progress = @total end end |
#increment(i) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/watobo/gui/dashboard.rb', line 8 def increment(i) @lock.synchronize do @pbar.progress += i #@total += i end end |
#progress(i) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/watobo/gui/dashboard.rb', line 15 def progress(i) @lock.synchronize do @pbar.progress = i end end |
#total(i) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/watobo/gui/dashboard.rb', line 33 def total(i) @lock.synchronize do #@progress = i @pbar.total = i end end |
#update_bar_color ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/watobo/gui/dashboard.rb', line 22 def if @pbar.total == 0 then @pbar. = 'grey' else @pbar. = FXRGB(255, 0, 0) end if @pbar.progress == @pbar.total @pbar. = 'green' end end |