Class: Shoes::Swt::Download

Inherits:
Object
  • Object
show all
Defined in:
shoes-swt/lib/shoes/swt/download.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_dsl, _app) ⇒ Download

Returns a new instance of Download


7
8
9
# File 'shoes-swt/lib/shoes/swt/download.rb', line 7

def initialize(_dsl, _app)
  @busy = false
end

Instance Attribute Details

#busyObject

Returns the value of attribute busy


6
7
8
# File 'shoes-swt/lib/shoes/swt/download.rb', line 6

def busy
  @busy
end

Instance Method Details

#actually_run_block(blk, result) ⇒ Object

Why a separate method? So RedrawingAspect can target it!


20
21
22
23
# File 'shoes-swt/lib/shoes/swt/download.rb', line 20

def actually_run_block(blk, result)
  blk.call result
  @busy = false
end

#busy?Boolean

Returns:

  • (Boolean)

25
26
27
# File 'shoes-swt/lib/shoes/swt/download.rb', line 25

def busy?
  @busy
end

#eval_block(blk, result) ⇒ Object

This exists to guarantee the callback block for download completion executes on the main UI thread. Without it we get thread access errors.


13
14
15
16
17
# File 'shoes-swt/lib/shoes/swt/download.rb', line 13

def eval_block(blk, result)
  ::Swt.display.asyncExec do
    actually_run_block(blk, result)
  end
end