Class: JLDrill::Gtk::ProblemView
Instance Attribute Summary collapse
#itemHints
#context
Instance Method Summary
collapse
#removingViewFrom, #viewAddedTo
#addView, #removeView, #removingViewFrom, #viewAddedTo
Constructor Details
#initialize(context) ⇒ ProblemView
Returns a new instance of ProblemView.
12
13
14
15
16
17
18
|
# File 'lib/jldrill/views/gtk/ProblemView.rb', line 12
def initialize(context)
super(context)
@problemDisplay = ProblemDisplay.new(self)
@problemDisplay.expandWidgetWidth
@problemDisplay.expandWidgetHeight
@timeoutID = nil
end
|
Instance Attribute Details
#problemDisplay ⇒ Object
Returns the value of attribute problemDisplay.
10
11
12
|
# File 'lib/jldrill/views/gtk/ProblemView.rb', line 10
def problemDisplay
@problemDisplay
end
|
Instance Method Details
#expire ⇒ Object
59
60
61
|
# File 'lib/jldrill/views/gtk/ProblemView.rb', line 59
def expire
@problemDisplay.expire
end
|
20
21
22
|
# File 'lib/jldrill/views/gtk/ProblemView.rb', line 20
def getWidget
@problemDisplay
end
|
#mainWindow ⇒ Object
24
25
26
|
# File 'lib/jldrill/views/gtk/ProblemView.rb', line 24
def mainWindow
getWidget.gtkWidgetMainWindow
end
|
#newProblem(problem) ⇒ Object
45
46
47
48
49
50
51
52
|
# File 'lib/jldrill/views/gtk/ProblemView.rb', line 45
def newProblem(problem)
super(problem)
@problemDisplay.newProblem(problem)
stopTimer
if !problem.nil?
startTimer(problem.item.itemStats.timeLimit)
end
end
|
#showAnswer ⇒ Object
54
55
56
57
|
# File 'lib/jldrill/views/gtk/ProblemView.rb', line 54
def showAnswer
@problemDisplay.showAnswer
stopTimer
end
|
#showBusy(bool) ⇒ Object
72
73
74
|
# File 'lib/jldrill/views/gtk/ProblemView.rb', line 72
def showBusy(bool)
@problemDisplay.showBusy(bool)
end
|
#startTimer(timeLimit) ⇒ Object
35
36
37
38
39
40
41
42
43
|
# File 'lib/jldrill/views/gtk/ProblemView.rb', line 35
def startTimer(timeLimit)
if timeLimit != 0.0 && @timeoutID.nil?
@timeoutID = Gtk.timeout_add((timeLimit * 1000).to_i) do
@timeoutID = nil
expire
false
end
end
end
|
#stopTimer ⇒ Object
28
29
30
31
32
33
|
# File 'lib/jldrill/views/gtk/ProblemView.rb', line 28
def stopTimer
if !@timeoutID.nil?
Gtk.timeout_remove(@timeoutID)
@timeoutID = nil
end
end
|
#updateProblem(problem) ⇒ Object
63
64
65
66
67
68
69
70
|
# File 'lib/jldrill/views/gtk/ProblemView.rb', line 63
def updateProblem(problem)
super(problem)
@problemDisplay.updateProblem(problem)
stopTimer
if !problem.nil?
startTimer(problem.item.itemStats.timeLimit)
end
end
|