Sha256: 51f5f520b9237f42089edb0dfe140501f1a7baea7ceaed07337517031af02e6e
Contents?: true
Size: 1.63 KB
Versions: 1
Compression:
Stored size: 1.63 KB
Contents
require 'jldrill/contexts/DisplayProblemContext' require 'jldrill/views/gtk/widgets/ProblemDisplay' require 'gtk2' module JLDrill::Gtk class ProblemView < JLDrill::DisplayProblemContext::ProblemView attr_reader :problemDisplay def initialize(context) super(context) @problemDisplay = ProblemDisplay.new(self) @problemDisplay.expandWidgetWidth @problemDisplay.expandWidgetHeight @timeoutID = nil end def getWidget @problemDisplay end def mainWindow getWidget.gtkWidgetMainWindow end def stopTimer if !@timeoutID.nil? Gtk.timeout_remove(@timeoutID) @timeoutID = nil end end 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 def newProblem(problem) super(problem) @problemDisplay.newProblem(problem) stopTimer if !problem.nil? startTimer(problem.item.itemStats.timeLimit) end end def showAnswer @problemDisplay.showAnswer stopTimer end def expire @problemDisplay.expire end def updateProblem(problem) super(problem) @problemDisplay.updateProblem(problem) stopTimer if !problem.nil? startTimer(problem.item.itemStats.timeLimit) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jldrill-0.5.1.7 | lib/jldrill/views/gtk/ProblemView.rb |