Class: QDA::GUI::StageProgressDialog

Inherits:
Wx::ProgressDialog
  • Object
show all
Defined in:
lib/weft/wxgui/dialogs.rb

Constant Summary collapse

PT_STYLE =
Wx::PD_APP_MODAL|Wx::PD_AUTO_HIDE|Wx::PD_CAN_ABORT
FIXED_PROGRESS =
200

Instance Method Summary collapse

Constructor Details

#initialize(parent, title, msg) ⇒ StageProgressDialog

Returns a new instance of StageProgressDialog.



6
7
8
9
10
# File 'lib/weft/wxgui/dialogs.rb', line 6

def initialize(parent, title, msg)
  super(title, msg, FIXED_PROGRESS, parent, PT_STYLE)
  @progress = 0.0
  @step = FIXED_PROGRESS.to_f / 10.0
end

Instance Method Details

#finishObject



26
27
28
# File 'lib/weft/wxgui/dialogs.rb', line 26

def finish()
  update(@progress = FIXED_PROGRESS)
end

#retarget(new_target) ⇒ Object



21
22
23
24
# File 'lib/weft/wxgui/dialogs.rb', line 21

def retarget(new_target)
  remaining = FIXED_PROGRESS - @progress
  @step = remaining / new_target.to_f
end

#step(msg = nil) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/weft/wxgui/dialogs.rb', line 12

def step(msg = nil)
  @progress = @progress + @step
  result = msg ? update(@progress.to_i, msg) : 
                 update(@progress.to_i)
  if not result
    Kernel.raise UserAbortedException.new('Document import cancelled')
  end
end