[longomatch] Set team names in stats



commit 88d39d452fdad7c55c78001a68204c5872e45252
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Tue Aug 6 12:40:07 2013 +0200

    Set team names in stats

 .../Gui/Component/Stats/CategoriesViewer.cs        |    2 +
 .../Gui/Component/Stats/CategoryViewer.cs          |   10 +++++++-
 LongoMatch.GUI/Gui/Component/Stats/Plotter.cs      |   20 +++++++++++++---
 .../Gui/Component/Stats/SubcategoryViewer.cs       |    7 +++++-
 ...ongoMatch.Gui.Component.Stats.CategoryViewer.cs |   24 ++++++++++----------
 LongoMatch.GUI/gtk-gui/gui.stetic                  |    4 +-
 LongoMatch.GUI/gtk-gui/objects.xml                 |   14 ++++++++++-
 7 files changed, 59 insertions(+), 22 deletions(-)
---
diff --git a/LongoMatch.GUI/Gui/Component/Stats/CategoriesViewer.cs 
b/LongoMatch.GUI/Gui/Component/Stats/CategoriesViewer.cs
index ee3c5cb..075f5aa 100644
--- a/LongoMatch.GUI/Gui/Component/Stats/CategoriesViewer.cs
+++ b/LongoMatch.GUI/Gui/Component/Stats/CategoriesViewer.cs
@@ -50,6 +50,8 @@ namespace LongoMatch.Gui.Component.Stats
                        }
                        store.GetIterFirst(out iter);
                        treeview.Selection.SelectIter(iter);
+                       categoryviewer1.HomeName = pstats.LocalTeam;
+                       categoryviewer1.AwayName = pstats.VisitorTeam;
                        categoryviewer1.LoadStats (store.GetValue (iter, 0) as CategoryStats);
                }
                
diff --git a/LongoMatch.GUI/Gui/Component/Stats/CategoryViewer.cs 
b/LongoMatch.GUI/Gui/Component/Stats/CategoryViewer.cs
index 7488bc3..7ba0651 100644
--- a/LongoMatch.GUI/Gui/Component/Stats/CategoryViewer.cs
+++ b/LongoMatch.GUI/Gui/Component/Stats/CategoryViewer.cs
@@ -31,9 +31,17 @@ namespace LongoMatch.Gui.Component.Stats
                public CategoryViewer ()
                {
                        this.Build ();
+                       HomeName = "Home";
+                       AwayName = "Away";
                }
                
+               public string HomeName { get; set; }
+               public string AwayName { get; set; }
+               
                public void LoadStats (CategoryStats stats) {
+                       homeLabel.Text = HomeName;
+                       awayLabel.Text = AwayName;
+                       
                        alltagger.LoadBackgrounds (stats.Field, stats.HalfField, stats.Goal);
                        alltagger.LoadFieldCoordinates (stats.FieldCoordinates);
                        alltagger.LoadHalfFieldCoordinates (stats.HalfFieldCoordinates);
@@ -66,7 +74,7 @@ namespace LongoMatch.Gui.Component.Stats
                        nodatalabel.Visible = stats.SubcategoriesStats.Count == 0;
                        foreach (SubCategoryStat st in stats.SubcategoriesStats) {
                                SubCategoryViewer subcatviewer = new SubCategoryViewer();
-                               subcatviewer.LoadStats (st);
+                               subcatviewer.LoadStats (st, HomeName, AwayName);
                                subcatViewers.Add (subcatviewer);
                                vbox1.PackStart (subcatviewer);
                                vbox1.PackStart (new HSeparator());
diff --git a/LongoMatch.GUI/Gui/Component/Stats/Plotter.cs b/LongoMatch.GUI/Gui/Component/Stats/Plotter.cs
index 5ba529a..4559696 100644
--- a/LongoMatch.GUI/Gui/Component/Stats/Plotter.cs
+++ b/LongoMatch.GUI/Gui/Component/Stats/Plotter.cs
@@ -45,6 +45,18 @@ namespace LongoMatch.Gui.Component.Stats
                        WidthRequest = (int) WIDTH;
                        pieradiobutton.Toggled += HandleToggled;
                        historadiobutton.Toggled += HandleToggled;
+                       HomeName = Catalog.GetString ("Home");
+                       AwayName = Catalog.GetString ("Away");
+               }
+               
+               public string HomeName {
+                       get;
+                       set;
+               }
+               
+               public string AwayName {
+                       get;
+                       set;
                }
 
                public void LoadPie (SubCategoryStat stats) {
@@ -78,10 +90,10 @@ namespace LongoMatch.Gui.Component.Stats
             
                        model.Series.Add(new ColumnSeries { Title = Catalog.GetString ("Total"), ItemsSource 
= stats.OptionStats,
                                ValueField = "TotalCount" });   
-                       model.Series.Add(new ColumnSeries { Title = Catalog.GetString ("Home"), ItemsSource = 
stats.OptionStats,
-                               ValueField = "LocalTeamCount" });       
-                       model.Series.Add(new ColumnSeries { Title = Catalog.GetString ("Away"), ItemsSource = 
stats.OptionStats,
-                               ValueField = "VisitorTeamCount" });     
+                       model.Series.Add(new ColumnSeries { Title = HomeName, ItemsSource = stats.OptionStats,
+                               ValueField = "LocalTeamCount", FillColor = new OxyColor {R=0xFF, G=0x33, 
B=0x0, A=0xFF}});      
+                       model.Series.Add(new ColumnSeries { Title = AwayName, ItemsSource = stats.OptionStats,
+                               ValueField = "VisitorTeamCount",  FillColor = new OxyColor {R=0, G=0x99, 
B=0xFF, A=0xFF} });    
             model.Axes.Add(categoryAxis);
             model.Axes.Add(valueAxis);
             return model;
diff --git a/LongoMatch.GUI/Gui/Component/Stats/SubcategoryViewer.cs 
b/LongoMatch.GUI/Gui/Component/Stats/SubcategoryViewer.cs
index 785fb78..9e02dff 100644
--- a/LongoMatch.GUI/Gui/Component/Stats/SubcategoryViewer.cs
+++ b/LongoMatch.GUI/Gui/Component/Stats/SubcategoryViewer.cs
@@ -37,10 +37,15 @@ namespace LongoMatch.Gui.Component.Stats
                        treeview.AppendColumn (Catalog.GetString("Away"), new Gtk.CellRendererText (), 
"text", 3);
                }
                
-               public void LoadStats (SubCategoryStat stats) {
+               public void LoadStats (SubCategoryStat stats, string homeName, string awayName) {
                        store = new ListStore(typeof(string), typeof(string), typeof(string), typeof(string));
                        treeview.Model = store;
                        
+                       treeview.Columns[2].Title = homeName;
+                       treeview.Columns[3].Title = awayName;
+                       plotter.HomeName = homeName;
+                       plotter.AwayName = awayName;
+                       
                        gtkframe.Markup = String.Format("<b> {0} </b>", stats.Name);
                        plotter.LoadHistogram (stats);
                        
diff --git a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.Stats.CategoryViewer.cs 
b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.Stats.CategoryViewer.cs
index 06244ac..7e56009 100644
--- a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.Stats.CategoryViewer.cs
+++ b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.Stats.CategoryViewer.cs
@@ -14,11 +14,11 @@ namespace LongoMatch.Gui.Component.Stats
                private global::Gtk.Frame homeframe;
                private global::Gtk.Alignment GtkAlignment;
                private global::LongoMatch.Gui.Component.PlaysCoordinatesTagger hometagger;
-               private global::Gtk.Label GtkLabel;
+               private global::Gtk.Label homeLabel;
                private global::Gtk.Frame awayframe;
                private global::Gtk.Alignment GtkAlignment1;
                private global::LongoMatch.Gui.Component.PlaysCoordinatesTagger awaytagger;
-               private global::Gtk.Label GtkLabel1;
+               private global::Gtk.Label awayLabel;
                private global::Gtk.Label nodatalabel;
                
                protected virtual void Build ()
@@ -79,11 +79,11 @@ namespace LongoMatch.Gui.Component.Stats
                        this.hometagger.Name = "hometagger";
                        this.GtkAlignment.Add (this.hometagger);
                        this.homeframe.Add (this.GtkAlignment);
-                       this.GtkLabel = new global::Gtk.Label ();
-                       this.GtkLabel.Name = "GtkLabel";
-                       this.GtkLabel.LabelProp = global::Mono.Unix.Catalog.GetString ("<b>Home</b>");
-                       this.GtkLabel.UseMarkup = true;
-                       this.homeframe.LabelWidget = this.GtkLabel;
+                       this.homeLabel = new global::Gtk.Label ();
+                       this.homeLabel.Name = "homeLabel";
+                       this.homeLabel.LabelProp = global::Mono.Unix.Catalog.GetString ("<b>Home</b>");
+                       this.homeLabel.UseMarkup = true;
+                       this.homeframe.LabelWidget = this.homeLabel;
                        this.hbox1.Add (this.homeframe);
                        global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.hbox1 
[this.homeframe]));
                        w7.Position = 1;
@@ -101,11 +101,11 @@ namespace LongoMatch.Gui.Component.Stats
                        this.awaytagger.Name = "awaytagger";
                        this.GtkAlignment1.Add (this.awaytagger);
                        this.awayframe.Add (this.GtkAlignment1);
-                       this.GtkLabel1 = new global::Gtk.Label ();
-                       this.GtkLabel1.Name = "GtkLabel1";
-                       this.GtkLabel1.LabelProp = global::Mono.Unix.Catalog.GetString ("<b>Away</b>");
-                       this.GtkLabel1.UseMarkup = true;
-                       this.awayframe.LabelWidget = this.GtkLabel1;
+                       this.awayLabel = new global::Gtk.Label ();
+                       this.awayLabel.Name = "awayLabel";
+                       this.awayLabel.LabelProp = global::Mono.Unix.Catalog.GetString ("<b>Away</b>");
+                       this.awayLabel.UseMarkup = true;
+                       this.awayframe.LabelWidget = this.awayLabel;
                        this.hbox1.Add (this.awayframe);
                        global::Gtk.Box.BoxChild w10 = ((global::Gtk.Box.BoxChild)(this.hbox1 
[this.awayframe]));
                        w10.Position = 2;
diff --git a/LongoMatch.GUI/gtk-gui/gui.stetic b/LongoMatch.GUI/gtk-gui/gui.stetic
index e8f8207..453bdf2 100644
--- a/LongoMatch.GUI/gtk-gui/gui.stetic
+++ b/LongoMatch.GUI/gtk-gui/gui.stetic
@@ -8768,7 +8768,7 @@ Defining &lt;b&gt; Game Units &lt;/b&gt; will help you during the analysis to in
                           </widget>
                         </child>
                         <child>
-                          <widget class="Gtk.Label" id="GtkLabel">
+                          <widget class="Gtk.Label" id="homeLabel">
                             <property name="MemberName" />
                             <property name="LabelProp" translatable="yes">&lt;b&gt;Home&lt;/b&gt;</property>
                             <property name="UseMarkup">True</property>
@@ -8802,7 +8802,7 @@ Defining &lt;b&gt; Game Units &lt;/b&gt; will help you during the analysis to in
                           </widget>
                         </child>
                         <child>
-                          <widget class="Gtk.Label" id="GtkLabel1">
+                          <widget class="Gtk.Label" id="awayLabel">
                             <property name="MemberName" />
                             <property name="LabelProp" translatable="yes">&lt;b&gt;Away&lt;/b&gt;</property>
                             <property name="UseMarkup">True</property>
diff --git a/LongoMatch.GUI/gtk-gui/objects.xml b/LongoMatch.GUI/gtk-gui/objects.xml
index fc08eef..bde6b68 100644
--- a/LongoMatch.GUI/gtk-gui/objects.xml
+++ b/LongoMatch.GUI/gtk-gui/objects.xml
@@ -389,11 +389,21 @@
     </signals>
   </object>
   <object type="LongoMatch.Gui.Component.Stats.Plotter" palette-category="General" allow-children="false" 
base-type="Gtk.Bin">
-    <itemgroups />
+    <itemgroups>
+      <itemgroup label="Plotter Properties">
+        <property name="HomeName" />
+        <property name="AwayName" />
+      </itemgroup>
+    </itemgroups>
     <signals />
   </object>
   <object type="LongoMatch.Gui.Component.Stats.CategoryViewer" palette-category="General" 
allow-children="false" base-type="Gtk.Bin">
-    <itemgroups />
+    <itemgroups>
+      <itemgroup label="CategoryViewer Properties">
+        <property name="HomeName" />
+        <property name="AwayName" />
+      </itemgroup>
+    </itemgroups>
     <signals />
   </object>
   <object type="LongoMatch.Gui.Component.Stats.SubCategoryViewer" palette-category="General" 
allow-children="false" base-type="Gtk.Bin">


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]