Class: MittensUi::Loader
Instance Attribute Summary
Attributes inherited from Core
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Loader
constructor
A new instance of Loader.
- #render ⇒ Object
- #start(&block) ⇒ Object
Methods inherited from Core
#hidden?, #hide, #remove, #show
Methods included from Helpers
#icon_map, #list_system_icons, #set_margin_from_opts_for
Constructor Details
#initialize(options = {}) ⇒ Loader
Returns a new instance of Loader.
5 6 7 8 9 10 11 12 13 |
# File 'lib/mittens_ui/loader.rb', line 5 def initialize(={}) @spinner = Gtk::Spinner.new @processing = false super(@spinner, ) self.hide end |
Instance Method Details
#render ⇒ Object
27 28 29 30 |
# File 'lib/mittens_ui/loader.rb', line 27 def render $vertical_box.pack_end(@spinner) return self end |
#start(&block) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/mittens_ui/loader.rb', line 15 def start(&block) return if @processing return if @worker_thread && @worker_thread.alive? self.show @spinner.start @worker_thread = Thread.new { yield; self.remove; @processing = true } end |