Class: Druzy::LittleFrame::FileChooser

Inherits:
MVC::Controller
  • Object
show all
Defined in:
lib/druzy/little_frame/file_chooser.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ FileChooser

Returns a new instance of FileChooser.



8
9
10
11
12
13
14
15
# File 'lib/druzy/little_frame/file_chooser.rb', line 8

def initialize(args)
  if (args[:model]==nil)
    initialize(:model => FileChooserModel.new(args))
  else
    super(args[:model])
    add_view(FileChooserView.new(self))
  end
end

Instance Method Details

#notify_action(view, action, args = {}) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/druzy/little_frame/file_chooser.rb', line 17

def notify_action(view,action,args={})
  if action == :destroy
    @model.result = :cancel
    view.close
  elsif action == :open_clicked
    @model.files = args[:files]
    @model.result = :open
    view.close          
  end    
end

#resultObject



28
29
30
31
32
33
34
35
# File 'lib/druzy/little_frame/file_chooser.rb', line 28

def result
  if @model.result == nil
    @model.stopped_thread=Thread.current
    Thread.stop
  end
 
  return @model.result
end