Class: JLDrill::Gtk::SelectorWindow
- Inherits:
-
Gtk::FileChooserDialog
- Object
- Gtk::FileChooserDialog
- JLDrill::Gtk::SelectorWindow
- Includes:
- Context::Gtk::Widget
- Defined in:
- lib/jldrill/views/gtk/widgets/SelectorWindow.rb
Instance Attribute Summary collapse
-
#chosenDirectory ⇒ Object
Returns the value of attribute chosenDirectory.
-
#chosenFilename ⇒ Object
Returns the value of attribute chosenFilename.
Attributes included from Context::Gtk::Widget
Instance Method Summary collapse
- #execute ⇒ Object
- #getCurrentFolder ⇒ Object
-
#getFilename ⇒ Object
The following 2 routines are only here because I couldn’t figure out a way to set the filename and folder in my tests.
-
#initialize(type) ⇒ SelectorWindow
constructor
A new instance of SelectorWindow.
Methods included from Context::Gtk::Widget
#addToThisWidget, #afterWidgetIsAdded, #afterWidgetIsRemoved, #expandWidgetHeight, #expandWidgetHeight?, #expandWidgetWidth, #expandWidgetWidth?, #gtkAddWidget, #gtkRemoveWidget, #isAMainWindow, #isInTests?, #removeFromThisWidget, #setupWidget, #widgetWasAddedTo, #widgetWasRemovedFrom
Constructor Details
#initialize(type) ⇒ SelectorWindow
Returns a new instance of SelectorWindow.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/jldrill/views/gtk/widgets/SelectorWindow.rb', line 13 def initialize(type) @chosenFilename = nil @chosenDirectory = nil if (type == JLDrill::GetFilenameContext::SAVE) super("Save File", nil, Gtk::FileChooser::ACTION_SAVE, nil, [Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL], [Gtk::Stock::OPEN, Gtk::Dialog::RESPONSE_ACCEPT]) else super("Open File", nil, Gtk::FileChooser::ACTION_OPEN, nil, [Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL], [Gtk::Stock::OPEN, Gtk::Dialog::RESPONSE_ACCEPT]) end end |
Instance Attribute Details
#chosenDirectory ⇒ Object
Returns the value of attribute chosenDirectory.
10 11 12 |
# File 'lib/jldrill/views/gtk/widgets/SelectorWindow.rb', line 10 def chosenDirectory @chosenDirectory end |
#chosenFilename ⇒ Object
Returns the value of attribute chosenFilename.
10 11 12 |
# File 'lib/jldrill/views/gtk/widgets/SelectorWindow.rb', line 10 def chosenFilename @chosenFilename end |
Instance Method Details
#execute ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/jldrill/views/gtk/widgets/SelectorWindow.rb', line 39 def execute if run == Gtk::Dialog::RESPONSE_ACCEPT @chosenFilename = getFilename @chosenDirectory = getCurrentFolder return @chosenFilename else return nil end end |
#getCurrentFolder ⇒ Object
35 36 37 |
# File 'lib/jldrill/views/gtk/widgets/SelectorWindow.rb', line 35 def getCurrentFolder self.current_folder end |
#getFilename ⇒ Object
The following 2 routines are only here because I couldn’t figure out a way to set the filename and folder in my tests.
31 32 33 |
# File 'lib/jldrill/views/gtk/widgets/SelectorWindow.rb', line 31 def getFilename self.filename end |