Class: ProgressWithDialog

Inherits:
Progress show all
Defined in:
lib/piggy-gui/progress_with_dialog.rb

Overview

An implementation of Progress which opens and updates a Progress dialog.

Instance Method Summary collapse

Methods inherited from Progress

#cancel, #continue?, #set_progress, #set_task

Constructor Details

#initialize(client) ⇒ ProgressWithDialog

Returns a new instance of ProgressWithDialog.



6
7
8
9
10
# File 'lib/piggy-gui/progress_with_dialog.rb', line 6

def initialize(client)
  super()
  @client = client
  new_dialog
end

Instance Method Details

#finishObject



47
48
49
50
# File 'lib/piggy-gui/progress_with_dialog.rb', line 47

def finish
  @progressDialog.hide
  @progressDialog.destroy
end

#log_progress(message, unit) ⇒ Object



36
37
38
39
40
41
42
43
44
45
# File 'lib/piggy-gui/progress_with_dialog.rb', line 36

def log_progress(message, unit)
  @client.repaint
  if @progressDialog.isCancelled
    cancel
  else
    @progressDialog.setMessage(ruby_2_fox(message))
    @progressDialog.setProgress(@units)
    @progressDialog.repaint
  end
end

#log_taskObject



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/piggy-gui/progress_with_dialog.rb', line 22

def log_task
  @client.repaint
  if(@progressDialog.isCancelled)
    cancel
  else
    @progressDialog.setTitle(ruby_2_fox(@task))
    @progressDialog.setMessage(ruby_2_fox(@task))
    @progressDialog.setProgress(@units)
    @progressDialog.setTotal(@numUnits)
    @progressDialog.repaint
  end
  super
end

#new_dialogObject



12
13
14
15
16
17
18
19
20
# File 'lib/piggy-gui/progress_with_dialog.rb', line 12

def new_dialog
  @progressDialog = Fox::FXProgressDialog.new(@client, @task, @task)
  @progressDialog.setMessage(ruby_2_fox(@task))
  @progressDialog.setProgress(@units)
  @progressDialog.setTotal(@numUnits)
  @progressDialog.create
  @progressDialog.show
  @progressDialog.repaint
end