Name | Total Lines | Lines of Code | Total Coverage | Code Coverage |
---|---|---|---|---|
lib/jldrill/views/gtk/widgets/ToolBarWidget.rb | 80 | 70 | 85.00%
|
82.86%
|
Code reported as executed by Ruby looks like this...and this: this line is also marked as covered.Lines considered as run by rcov, but not reported by Ruby, look like this,and this: these lines were inferred by rcov (using simple heuristics).Finally, here's a line marked as not executed.
1 require 'Context/Gtk/Widget' |
2 require 'jldrill/contexts/RunCommandContext' |
3 require 'gtk2' |
4 |
5 module JLDrill::Gtk |
6 |
7 class CommandView < JLDrill::RunCommandContext::CommandView |
8 class ReviewModeButton < Gtk::ToggleButton |
9 def initialize(view) |
10 super('Review Mode') |
11 @view = view |
12 @context = @view.context |
13 connectSignals unless @view.nil? |
14 set_active(false) |
15 end |
16 |
17 def connectSignals |
18 signal_connect('toggled') do |
19 changeMode |
20 end |
21 end |
22 |
23 def changeMode |
24 @context.setReviewMode(active?) |
25 end |
26 |
27 def update |
28 set_active(@context.getReviewMode) |
29 end |
30 end |
31 |
32 class ToolBar < Gtk::Toolbar |
33 def initialize(view) |
34 @view = view |
35 @context = @view.context |
36 super() |
37 @reviewModeButton = ReviewModeButton.new(@view) |
38 |
39 checkImage = Gtk::Image.new(Gtk::Stock::SPELL_CHECK, |
40 Gtk::IconSize::SMALL_TOOLBAR) |
41 incorrectImage = Gtk::Image.new(Gtk::Stock::NO, |
42 Gtk::IconSize::SMALL_TOOLBAR) |
43 correctImage = Gtk::Image.new(Gtk::Stock::YES, |
44 Gtk::IconSize::SMALL_TOOLBAR) |
45 refreshImage = Gtk::Image.new(Gtk::Stock::REFRESH, |
46 Gtk::IconSize::SMALL_TOOLBAR) |
47 |
48 # toolbar.set_toolbar_style(Gtk::Toolbar::BOTH) |
49 self.append(Gtk::Stock::SAVE, |
50 "Save a Drill file" |
51 ) do @context.save end |
52 self.append(Gtk::Stock::OPEN, |
53 "Open a Edict file" |
54 ) do @context.open end |
55 self.append(Gtk::Stock::QUIT, |
56 "Quit GTK LDrill" |
57 ) do @context.quit end |
58 self.append_space |
59 self.append("Check (Z)", "Check", |
60 "Check the result", checkImage |
61 ) do @context.check end |
62 self.append("Incorrect (X)", "Incorrect", |
63 "Answer was incorrect", incorrectImage |
64 ) do @context.incorrect end |
65 self.append("Correct (C)", "Correct", |
66 "Answer was correct", correctImage |
67 ) do @context.correct end |
68 self.append("Next (N)", "Next Problem", |
69 "Go to a new problem without answering the current one", refreshImage |
70 ) do @context.drill end |
71 self.append_space |
72 self.append(@reviewModeButton) |
73 end |
74 |
75 def update |
76 @reviewModeButton.update |
77 end |
78 end |
79 end |
80 end |
Generated on Mon May 23 16:17:47 +0900 2011 with rcov 0.9.8