Class: KeepYourHead::DialogQuestionStart

Inherits:
Object
  • Object
show all
Defined in:
lib/Keepyourhead/gui/DialogTrainStart.rb

Constant Summary collapse

Widgets =
["spinbutton_max_questions", "spinbutton_max_minutes"]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDialogQuestionStart

Returns a new instance of DialogQuestionStart.



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/Keepyourhead/gui/DialogTrainStart.rb', line 25

def initialize( )
	@glade = GladeXML.new(Resources::system("glade/DialogTrainStart.glade")) { |handler| method(handler) }

	Widgets.each { |name|
		widget = @glade.get_widget(name)
		assert widget
		eval("@#{name} = widget")
	}

	@widget = @glade.get_widget("dialog_train_start")
end

Instance Attribute Details

#widgetObject (readonly)

Returns the value of attribute widget.



23
24
25
# File 'lib/Keepyourhead/gui/DialogTrainStart.rb', line 23

def widget
  @widget
end

Instance Method Details

#destroyObject



50
51
52
# File 'lib/Keepyourhead/gui/DialogTrainStart.rb', line 50

def destroy
	@widget.destroy
end

#max_minutesObject



57
58
59
# File 'lib/Keepyourhead/gui/DialogTrainStart.rb', line 57

def max_minutes
	@spinbutton_max_minutes.value.to_i
end

#max_questionsObject



54
55
56
# File 'lib/Keepyourhead/gui/DialogTrainStart.rb', line 54

def max_questions
	@spinbutton_max_questions.value.to_i
end

#runObject



37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/Keepyourhead/gui/DialogTrainStart.rb', line 37

def run
	@widget.show
	response = @widget.run

	case response
	when Gtk::Dialog::RESPONSE_OK
		return true
	else
	end

	false
end