Class: MittensUi::FilePicker
- Inherits:
-
Object
- Object
- MittensUi::FilePicker
- Defined in:
- lib/mittens_ui/file_picker.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ FilePicker
constructor
A new instance of FilePicker.
- #render ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ FilePicker
Returns a new instance of FilePicker.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/mittens_ui/file_picker.rb', line 5 def initialize(={}) @path = "" = { title: "Select File", parent: $app_window, action: [:action] || :open, buttons: [ [Gtk::Stock::OPEN, Gtk::ResponseType::ACCEPT], [Gtk::Stock::CANCEL, Gtk::ResponseType::CANCEL] ] }.freeze @dialog = Gtk::FileChooserDialog.new() end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/mittens_ui/file_picker.rb', line 3 def path @path end |
Instance Method Details
#render ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/mittens_ui/file_picker.rb', line 21 def render if @dialog.run == :accept @path = @dialog.filename end @dialog.destroy end |