Required Files
Methods
Constants
WINDOW_HEIGHT = 600
  Define some constants
WINDOW_WIDTH = 800
BLANK_LABEL = ' '
Public Instance methods
label_for(team, round = 1, game = 1)
    # File bin/gui.rb, line 62
62:   def label_for(team, round = 1, game = 1)
63:     label = if Tournament::Bracket::UNKNOWN_TEAM == team
64:       "r:%d g:%d" % [round, game]
65:     else
66:       if round == 1 || round > 4
67:         "%2d %s (%s)" % [team.seed, team.name, team.short_name]
68:       else
69:         "%4s" % team.short_name
70:       end
71:     end
72:   end
load_data()
    # File bin/gui.rb, line 12
12:   def load_data
13:     @entry  = YAML::load_file(@save_file)
14:   end
make_pick(region_idx, round, team_num, real_game)
     # File bin/gui.rb, line 97
 97:   def make_pick(region_idx, round, team_num, real_game)
 98:     team = @teams[region_idx][round-1][team_num]
 99:     return if team == Tournament::Bracket::UNKNOWN_TEAM
100: 
101:     matchup = @entry.picks.matchup(round,real_game).reject{|t| t == team}[0]
102: 
103:     if round == 4
104:       @champ[region_idx].replace label_for(team, 6, 1)
105:       #@labels[0][4][region_idx].replace label_for(team, 6, 1)
106:     end
107: 
108:     if round == 6
109:       @overall_champ.replace label_for(team, 6, 1)
110:     end
111: 
112:     forward_round = round
113:     forward_idx = team_num / 2
114:     forward_team = @teams[region_idx][forward_round][forward_idx] rescue nil
115:     while forward_team == matchup
116:       ri = forward_round > 4 ? 0 : region_idx
117:       @labels[ri][forward_round][forward_idx].replace BLANK_LABEL
118:       forward_round += 1
119:       forward_idx /= 2
120:       if forward_round == 4
121:         @champ[region_idx].replace 'Regional Champ'
122:       end
123:       if forward_round == 6
124:         @overall_champ.replace 'NCAA Champion'
125:       end
126:       ri = forward_round > 4 ? 0 : region_idx
127:       fi = forward_round == 5 ? region_idx : forward_idx
128:       forward_team = @teams[ri][forward_round][fi] rescue nil
129:     end
130: 
131:     ri = round >= 4 ? 0 : region_idx
132:     ti = team_num / 2
133:     if round == 4
134:       ti = region_idx
135:     end
136:     @entry.picks.set_winner(round, real_game, team)
137:     return if round >= 6
138:     begin
139:       @labels[ri][round][ti].replace label_for(team, round+1, real_game)
140:       @teams[ri][round][ti] = team
141:     rescue Exception => e
142:       alert "got error for ri #{ri} round #{round} team_num #{team_num}: #{e}"
143:     end
144:   end
matchup_flow(region_idx, round, game, real_game, bc, gap)
    # File bin/gui.rb, line 74
74:   def matchup_flow(region_idx, round, game, real_game, bc, gap)
75:     @entry.picks.matchup(round,real_game).each_with_index do |team, idx|
76:       flow do
77:         background bc
78:         flow_idx = (game-1)*2 + idx
79:         @teams[region_idx][round-1][flow_idx] = team
80:         stack :width => (width - 26) do
81:           @labels[region_idx][round-1][flow_idx] = para label_for(team, round, game), :height => 26, :width => 175, :font => "Monospace 10px"
82:         end
83:         stack :width => 26 do
84:           @buttons[region_idx][round-1][flow_idx] = button ">", :width => 26, :height => 26, :font => "Monospace 6px", :margin => 1 do
85:             make_pick(region_idx, round, flow_idx, real_game)
86:           end
87:         end
88:       end
89:       if gap > 0 && idx == 0
90:         stack :height => gap, :width => width do
91:           background bc
92:         end
93:       end
94:     end
95:   end
round_stack(region_idx, round, games_per_round, gap, top, width)
    # File bin/gui.rb, line 42
42:   def round_stack(region_idx, round, games_per_round, gap, top, width)
43:     stack :width => width do
44:       if top > 0
45:         stack :height => top, :width => 26 do
46:           background white
47:         end
48:       end
49:       1.upto(games_per_round) do |game|
50:         bc = game % 2 == 0 || round > 1 ? lightgreen : white
51:         real_game = game + region_idx * games_per_round
52:         matchup_flow(region_idx, round, game, real_game, bc, gap)
53:         if gap > 0
54:           stack :height => gap, :width => width do
55:             background white
56:           end
57:         end
58:       end
59:     end
60:   end
save_data()
    # File bin/gui.rb, line 16
16:   def save_data
17:     @entry.name = @name.text
18:     @entry.tie_breaker = @tie_break.text.to_i
19:     File.open(@save_file, "w") do |f|
20:       YAML::dump(@entry, f)
21:     end
22:   end
scrub_save_file()
     # File bin/gui.rb, line 146
146:   def scrub_save_file
147:     unless '.yml' == File.extname(@save_file)
148:       @save_file += '.yml'
149:     end
150:   end