Name | Total Lines | Lines of Code | Total Coverage | Code Coverage |
---|---|---|---|---|
lib/jldrill/views/gtk/widgets/VocabPopup.rb | 68 | 61 | 13.24%
|
9.84%
|
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 'jldrill/views/gtk/widgets/Popup' |
2 require 'gtk2' |
3 |
4 module JLDrill::Gtk |
5 class VocabPopup < Popup |
6 |
7 def initialize(char, jwords, mainWindow, x, y) |
8 super(char, mainWindow, x, y) |
9 |
10 color = Gdk::Color.parse("lightblue1") |
11 @strokes = Gtk::TextView.new |
12 @strokes.wrap_mode = Gtk::TextTag::WRAP_CHAR |
13 @strokes.editable = false |
14 @strokes.cursor_visible = false |
15 @strokes.set_pixels_above_lines(0) |
16 @strokes.set_pixels_below_lines(0) |
17 @strokes.modify_base(Gtk::STATE_NORMAL, color) |
18 |
19 @strokeBuffer = @strokes.buffer |
20 @strokeBuffer.create_tag("kanji", |
21 "size" => 32 * Pango::SCALE, |
22 "justification" => Gtk::JUSTIFY_CENTER) |
23 @strokeBuffer.insert(@strokeBuffer.start_iter, |
24 char, "kanji") |
25 @hbox.add(@strokes) |
26 spacer = Gtk::TextView.new |
27 spacer.set_width_request(10) |
28 spacer.modify_base(Gtk::STATE_NORMAL, color) |
29 @hbox.add(spacer) |
30 |
31 if !jwords.empty? |
32 @contents = Gtk::TextView.new |
33 @contents.wrap_mode = Gtk::TextTag::WRAP_WORD |
34 @contents.editable = false |
35 @contents.cursor_visible = false |
36 @contents.set_pixels_above_lines(0) |
37 @contents.modify_base(Gtk::STATE_NORMAL, color) |
38 @contents.set_width_request(420) |
39 |
40 @buffer = @contents.buffer |
41 @buffer.create_tag("japanese", |
42 "size" => 12 * Pango::SCALE, |
43 "justification" => Gtk::JUSTIFY_LEFT) |
44 @buffer.create_tag("definition", |
45 "size" => 8 * Pango::SCALE, |
46 "justification" => Gtk::JUSTIFY_LEFT) |
47 jwords.each do |word| |
48 if !word.kanji.nil? |
49 @buffer.insert(@buffer.end_iter, word.kanji, "japanese") |
50 @buffer.insert(@buffer.end_iter, " ", "japanese") |
51 end |
52 @buffer.insert(@buffer.end_iter, word.reading, "japanese") |
53 @buffer.insert(@buffer.end_iter, "\n", "japanese") |
54 @buffer.insert(@buffer.end_iter, word.toMeaning, |
55 "definition") |
56 @buffer.insert(@buffer.end_iter, "\n", "definition") |
57 end |
58 @hbox.add(@contents) |
59 end |
60 @popup.set_default_size(450, 30) |
61 display |
62 end |
63 |
64 def close |
65 @popup.destroy |
66 end |
67 end |
68 end |
Generated on Mon May 23 16:17:47 +0900 2011 with rcov 0.9.8