Name | Total Lines | Lines of Code | Total Coverage | Code Coverage |
---|---|---|---|---|
lib/jldrill/views/gtk/widgets/VocabularyHintBox.rb | 103 | 87 | 93.20%
|
91.95%
|
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 'gtk2' |
2 require 'jldrill/model/items/Vocabulary' |
3 require 'Context/Gtk/Widget' |
4 |
5 module JLDrill::Gtk |
6 class VocabularyHintBox < Gtk::HBox |
7 include Context::Gtk::Widget |
8 |
9 def initialize |
10 super |
11 @uk = Gtk::Label.new |
12 @humble = Gtk::Label.new |
13 @honourific = Gtk::Label.new |
14 @pol = Gtk::Label.new |
15 @vs = Gtk::Label.new |
16 @vi = Gtk::Label.new |
17 @differs = Gtk::Label.new |
18 pack_start(@uk, true, true, 0) |
19 pack_start(@humble, true, true, 0) |
20 pack_start(@honourific, true, true, 0) |
21 pack_start(@pol, true, true, 0) |
22 pack_start(@vs, true, true, 0) |
23 pack_start(@vi, true, true, 0) |
24 pack_start(@differs, true, true, 0) |
25 clear |
26 setupWidget |
27 expandWidgetWidth |
28 end |
29 |
30 def gtkAddWidget(widget) |
31 pack_start(widget, |
32 widget.expandWidgetHeight?, |
33 widget.expandWidgetWidth?) |
34 end |
35 |
36 def gtkRemoveWidget(widget) |
37 remove(widget) |
38 end |
39 |
40 def clear |
41 self.uk = false |
42 self.humble = false |
43 self.honourific = false |
44 self.pol = false |
45 self.vs = false |
46 self.vi = false |
47 self.differs = false |
48 end |
49 |
50 def set(vocab, differs=false) |
51 self.uk = vocab.markers.include?("uk") |
52 self.humble = vocab.markers.include?("hum") |
53 self.honourific = vocab.markers.include?("hon") |
54 self.pol = vocab.markers.include?("pol") |
55 self.vs = vocab.markers.include?("vs") |
56 self.vi = vocab.markers.include?("vi") |
57 self.differs = differs |
58 end |
59 |
60 def getSpan(label, state) |
61 if state |
62 span = %Q[<span foreground = "white" background="red" weight="bold">] |
63 else |
64 span = "<span>" |
65 end |
66 span = span + label + "</span>" |
67 |
68 return span |
69 end |
70 |
71 def getMarkup(label, state) |
72 "<markup>" + getSpan(label, state) + "</markup>" |
73 end |
74 |
75 def uk=(state) |
76 @uk.set_markup(getMarkup(" Usually Kana ", state)) |
77 end |
78 |
79 def humble=(state) |
80 @humble.set_markup(getMarkup(" Humble ", state)) |
81 end |
82 |
83 def honourific=(state) |
84 @honourific.set_markup(getMarkup(" Honourific ", state)) |
85 end |
86 |
87 def pol=(state) |
88 @pol.set_markup(getMarkup(" Polite ", state)) |
89 end |
90 |
91 def vs=(state) |
92 @vs.set_markup(getMarkup(" Suru Noun ", state)) |
93 end |
94 |
95 def vi=(state) |
96 @vi.set_markup(getMarkup(" Intransitive ", state)) |
97 end |
98 |
99 def differs=(state) |
100 @differs.set_markup(getMarkup(" Differs ", state)) |
101 end |
102 end |
103 end |
Generated on Mon May 23 16:17:47 +0900 2011 with rcov 0.9.8