Class: Swat::StatBox

Inherits:
Object
  • Object
show all
Defined in:
lib/stat_box.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(meta_data) ⇒ StatBox

Returns a new instance of StatBox.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/stat_box.rb', line 4

def initialize()
  @meta_data = 
  @vbox_container = Gtk::VBox.new
  stat_label = Gtk::Label.new
  stat_label.xalign = 0.02
  stat_label.set_markup("<span underline='double' weight='bold' style='oblique'> Stats </span>\n")

  @vbox_container.pack_start(stat_label,false,false)

  set_today_label
  @vbox_container.pack_start(@today_label,false,false)

  set_yesterday_label
  @vbox_container.pack_start(@yesterday_label,false,false)

  set_lastweek_label
  @vbox_container.pack_start(@lastweek_label,false,false)
end

Instance Attribute Details

#meta_dataObject

Returns the value of attribute meta_data.



3
4
5
# File 'lib/stat_box.rb', line 3

def 
  @meta_data
end

#vbox_containerObject

Returns the value of attribute vbox_container.



3
4
5
# File 'lib/stat_box.rb', line 3

def vbox_container
  @vbox_container
end

Instance Method Details

#hide_allObject



50
51
52
# File 'lib/stat_box.rb', line 50

def hide_all
  @vbox_container.hide_all
end

#set_lastweek_labelObject



68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/stat_box.rb', line 68

def set_lastweek_label
  lastweek_heading = Gtk::Label.new
  lastweek_heading.xalign = 0.02
  lastweek_heading.set_markup("<span foreground='#6d0835' style='oblique'> Lastweek </span>")
  @vbox_container.pack_start(lastweek_heading,false,false)

  @lastweek_label = Gtk::Label.new
  @lastweek_label.xalign = 0
  lastweek_str = <<-EOD
<small> Done : <span foreground='#206d08'> #{@meta_data.tasks_done_lastweek} </span>, Added : <span foreground='red'> #{@meta_data.tasks_added_lastweek}</span> </small>
EOD
  @lastweek_label.set_markup(lastweek_str)
end

#set_today_label(p_meta_data = nil) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/stat_box.rb', line 23

def set_today_label( = nil)
  @meta_data =  if 
  today_heading = Gtk::Label.new
  today_heading.xalign = 0.02
  today_heading.set_markup("<span foreground='#6d0835' style='oblique' > Today </span>")
  @vbox_container.pack_start(today_heading,false,false)

  @today_label = Gtk::Label.new
  @today_label.xalign = 0
  today_str = <<-EOD
<small> Done : <span foreground='#206d08'>#{@meta_data.tasks_done_today}</span>, Added : <span foreground='red'>#{@meta_data.tasks_added_today}</span> </small>
EOD
  @today_label.set_markup(today_str)
end

#set_yesterday_labelObject



54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/stat_box.rb', line 54

def set_yesterday_label
  yesterday_heading = Gtk::Label.new
  yesterday_heading.xalign = 0.02
  yesterday_heading.set_markup("<span foreground='#6d0835' style='oblique'> Yesterday </span>")
  @vbox_container.pack_start(yesterday_heading,false,false)

  @yesterday_label = Gtk::Label.new
  @yesterday_label.xalign = 0
  yesterday_str = <<-EOD
<small> Done : <span foreground='#206d08'>#{@meta_data.tasks_done_yesterday}</span>, Added : <span foreground='red'>#{@meta_data.tasks_added_yesterday}</span> </small>
EOD
  @yesterday_label.set_markup(yesterday_str)
end

#show_allObject



46
47
48
# File 'lib/stat_box.rb', line 46

def show_all
  @vbox_container.show_all
end

#update_today_label(p_meta_data = nil) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/stat_box.rb', line 38

def update_today_label( = nil)
  @meta_data =  if 
  today_str = <<-EOD
<small> Done : <span foreground='#206d08'>#{@meta_data.tasks_done_today}</span>, Added : <span foreground='red'>#{@meta_data.tasks_added_today}</span> </small>
EOD
  @today_label.set_markup(today_str)
end