[longomatch] Fix tagging of players subcategories with both teams
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Fix tagging of players subcategories with both teams
- Date: Fri, 27 Jan 2012 22:09:05 +0000 (UTC)
commit 41b817072736cb338f38777457784702fccf68c1
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Fri Jan 27 22:54:37 2012 +0100
Fix tagging of players subcategories with both teams
LongoMatch.GUI/Gui/Component/PlayersTagger.cs | 32 ++++--
.../Gui/Component/PlayersTaggerWidget.cs | 7 +-
LongoMatch.GUI/Gui/Dialog/TaggerDialog.cs | 12 +--
.../LongoMatch.Gui.Component.PlayersTagger.cs | 38 ++++++-
LongoMatch.GUI/gtk-gui/gui.stetic | 113 +++++++++++++++-----
5 files changed, 148 insertions(+), 54 deletions(-)
---
diff --git a/LongoMatch.GUI/Gui/Component/PlayersTagger.cs b/LongoMatch.GUI/Gui/Component/PlayersTagger.cs
index 004d877..27f90ec 100644
--- a/LongoMatch.GUI/Gui/Component/PlayersTagger.cs
+++ b/LongoMatch.GUI/Gui/Component/PlayersTagger.cs
@@ -29,7 +29,7 @@ namespace LongoMatch.Gui.Component
public partial class PlayersTagger : Gtk.Bin
{
PlayerSubCategory subcat;
- TeamTemplate template;
+ TeamTemplate local, visitor;
PlayersTagStore players;
Dictionary<CheckButton, PlayerTag> checkButtonsDict;
RadioButton firstRB;
@@ -40,31 +40,39 @@ namespace LongoMatch.Gui.Component
this.Build ();
}
- public void Load (PlayerSubCategory subcat, TeamTemplate template,
- PlayersTagStore players)
+ public void Load (PlayerSubCategory subcat, TeamTemplate local,
+ TeamTemplate visitor, PlayersTagStore players)
{
this.subcat = subcat;
- this.template = template;
+ this.local = local;
+ this.visitor = visitor;
this.players = players;
SetPlayersInfo();
UpdateSelectedPlayers();
}
- private void UpdateSelectedPlayers () {
+ void UpdateSelectedPlayers () {
foreach(var pair in checkButtonsDict) {
pair.Key.Active = players.Contains(pair.Value);
}
}
- private void SetPlayersInfo() {
+ void SetPlayersInfo() {
+ checkButtonsDict = new Dictionary<CheckButton, PlayerTag>();
+ if (local != null)
+ SetPlayersInfo(localtable, local);
+ if (visitor != null)
+ SetPlayersInfo(visitortable, visitor);
+ }
+
+ void SetPlayersInfo(Table table, TeamTemplate template) {
List<PlayerTag> playersList;
int i=0;
- checkButtonsDict = new Dictionary<CheckButton, PlayerTag>();
playersList = template.PlayingPlayersList.Select(p => new PlayerTag {Value=p, SubCategory=subcat}).ToList();
- table1.NRows =(uint)(playersList.Count/DEFAULT_WIDTH);
- table1.NColumns =(uint) DEFAULT_WIDTH;
+ table.NRows =(uint)(playersList.Count/DEFAULT_WIDTH);
+ table.NColumns =(uint) DEFAULT_WIDTH;
foreach(PlayerTag player in playersList) {
CheckButton button;
@@ -82,12 +90,12 @@ namespace LongoMatch.Gui.Component
button.Toggled += OnButtonToggled;
button.Show();
- uint row_top =(uint)(i%table1.NRows);
+ uint row_top =(uint)(i%localtable.NRows);
uint row_bottom = (uint) row_top+1 ;
- uint col_left = (uint) i/table1.NRows;
+ uint col_left = (uint) i/localtable.NRows;
uint col_right = (uint) col_left+1 ;
- table1.Attach(button,col_left,col_right,row_top,row_bottom);
+ table.Attach(button,col_left,col_right,row_top,row_bottom);
checkButtonsDict.Add(button, player);
i++;
}
diff --git a/LongoMatch.GUI/Gui/Component/PlayersTaggerWidget.cs b/LongoMatch.GUI/Gui/Component/PlayersTaggerWidget.cs
index 1b6de2a..5a5e7d4 100644
--- a/LongoMatch.GUI/Gui/Component/PlayersTaggerWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/PlayersTaggerWidget.cs
@@ -30,12 +30,13 @@ namespace LongoMatch.Gui.Component
{
PlayersTagger tagger;
- public PlayersTaggerWidget (PlayerSubCategory subcat, TeamTemplate template,
- PlayersTagStore players) {
+ public PlayersTaggerWidget (PlayerSubCategory subcat, TeamTemplate local,
+ TeamTemplate visitor, PlayersTagStore players)
+ {
this.Build ();
CategoryLabel.Markup = "<b>" + subcat.Name + "</b>";
tagger = new PlayersTagger();
- tagger.Load(subcat, template, players);
+ tagger.Load(subcat, local, visitor, players);
tagger.Show();
GtkAlignment.Add(tagger);
}
diff --git a/LongoMatch.GUI/Gui/Dialog/TaggerDialog.cs b/LongoMatch.GUI/Gui/Dialog/TaggerDialog.cs
index 0f1c5be..12a1524 100644
--- a/LongoMatch.GUI/Gui/Dialog/TaggerDialog.cs
+++ b/LongoMatch.GUI/Gui/Dialog/TaggerDialog.cs
@@ -78,18 +78,16 @@ namespace LongoMatch.Gui.Dialog
}
public void AddPlayerSubcategory (PlayerSubCategory subcat, PlayersTagStore tags){
- TeamTemplate template;
+ TeamTemplate local=null, visitor=null;
/* the notebook starts invisible */
playersnotebook.Visible = true;
if (subcat.Contains(Team.LOCAL))
- template = localTeamTemplate;
- /* FIXME: Add support for subcategories with both teams */
- //else if (subcat.Contains(Team.VISITOR))
- else
- template = visitorTeamTemplate;
+ local = localTeamTemplate;
+ if (subcat.Contains(Team.VISITOR))
+ visitor = visitorTeamTemplate;
- PlayersTaggerWidget widget = new PlayersTaggerWidget(subcat, template, tags);
+ PlayersTaggerWidget widget = new PlayersTaggerWidget(subcat, local, visitor, tags);
widget.Show();
playersbox.PackStart(widget, true, true, 0);
}
diff --git a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.PlayersTagger.cs b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.PlayersTagger.cs
index 462c6c3..a26cf48 100644
--- a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.PlayersTagger.cs
+++ b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.PlayersTagger.cs
@@ -4,7 +4,10 @@ namespace LongoMatch.Gui.Component
{
public partial class PlayersTagger
{
- private global::Gtk.Table table1;
+ private global::Gtk.VBox vbox4;
+ private global::Gtk.Table localtable;
+ private global::Gtk.HSeparator hseparator1;
+ private global::Gtk.Table visitortable;
protected virtual void Build ()
{
@@ -13,11 +16,34 @@ namespace LongoMatch.Gui.Component
global::Stetic.BinContainer.Attach (this);
this.Name = "LongoMatch.Gui.Component.PlayersTagger";
// Container child LongoMatch.Gui.Component.PlayersTagger.Gtk.Container+ContainerChild
- this.table1 = new global::Gtk.Table (((uint)(3)), ((uint)(3)), false);
- this.table1.Name = "table1";
- this.table1.RowSpacing = ((uint)(6));
- this.table1.ColumnSpacing = ((uint)(6));
- this.Add (this.table1);
+ this.vbox4 = new global::Gtk.VBox ();
+ this.vbox4.Name = "vbox4";
+ this.vbox4.Spacing = 6;
+ // Container child vbox4.Gtk.Box+BoxChild
+ this.localtable = new global::Gtk.Table (((uint)(3)), ((uint)(3)), false);
+ this.localtable.Name = "localtable";
+ this.localtable.RowSpacing = ((uint)(6));
+ this.localtable.ColumnSpacing = ((uint)(6));
+ this.vbox4.Add (this.localtable);
+ global::Gtk.Box.BoxChild w1 = ((global::Gtk.Box.BoxChild)(this.vbox4 [this.localtable]));
+ w1.Position = 0;
+ // Container child vbox4.Gtk.Box+BoxChild
+ this.hseparator1 = new global::Gtk.HSeparator ();
+ this.hseparator1.Name = "hseparator1";
+ this.vbox4.Add (this.hseparator1);
+ global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.vbox4 [this.hseparator1]));
+ w2.Position = 1;
+ w2.Expand = false;
+ w2.Fill = false;
+ // Container child vbox4.Gtk.Box+BoxChild
+ this.visitortable = new global::Gtk.Table (((uint)(3)), ((uint)(3)), false);
+ this.visitortable.Name = "visitortable";
+ this.visitortable.RowSpacing = ((uint)(6));
+ this.visitortable.ColumnSpacing = ((uint)(6));
+ this.vbox4.Add (this.visitortable);
+ global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.vbox4 [this.visitortable]));
+ w3.Position = 2;
+ this.Add (this.vbox4);
if ((this.Child != null)) {
this.Child.ShowAll ();
}
diff --git a/LongoMatch.GUI/gtk-gui/gui.stetic b/LongoMatch.GUI/gtk-gui/gui.stetic
index 09cd5c1..082b60a 100644
--- a/LongoMatch.GUI/gtk-gui/gui.stetic
+++ b/LongoMatch.GUI/gtk-gui/gui.stetic
@@ -6760,38 +6760,99 @@ Defining <b> Game Units </b> will help you during the analysis to in
<property name="MemberName" />
<property name="Visible">False</property>
<child>
- <widget class="Gtk.Table" id="table1">
+ <widget class="Gtk.VBox" id="vbox4">
<property name="MemberName" />
- <property name="NRows">3</property>
- <property name="NColumns">3</property>
- <property name="RowSpacing">6</property>
- <property name="ColumnSpacing">6</property>
- <child>
- <placeholder />
- </child>
- <child>
- <placeholder />
- </child>
- <child>
- <placeholder />
- </child>
- <child>
- <placeholder />
- </child>
- <child>
- <placeholder />
- </child>
- <child>
- <placeholder />
- </child>
+ <property name="Spacing">6</property>
<child>
- <placeholder />
+ <widget class="Gtk.Table" id="localtable">
+ <property name="MemberName" />
+ <property name="NRows">3</property>
+ <property name="NColumns">3</property>
+ <property name="RowSpacing">6</property>
+ <property name="ColumnSpacing">6</property>
+ <child>
+ <placeholder />
+ </child>
+ <child>
+ <placeholder />
+ </child>
+ <child>
+ <placeholder />
+ </child>
+ <child>
+ <placeholder />
+ </child>
+ <child>
+ <placeholder />
+ </child>
+ <child>
+ <placeholder />
+ </child>
+ <child>
+ <placeholder />
+ </child>
+ <child>
+ <placeholder />
+ </child>
+ <child>
+ <placeholder />
+ </child>
+ </widget>
+ <packing>
+ <property name="Position">0</property>
+ <property name="AutoSize">True</property>
+ </packing>
</child>
<child>
- <placeholder />
+ <widget class="Gtk.HSeparator" id="hseparator1">
+ <property name="MemberName" />
+ </widget>
+ <packing>
+ <property name="Position">1</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
</child>
<child>
- <placeholder />
+ <widget class="Gtk.Table" id="visitortable">
+ <property name="MemberName" />
+ <property name="NRows">3</property>
+ <property name="NColumns">3</property>
+ <property name="RowSpacing">6</property>
+ <property name="ColumnSpacing">6</property>
+ <child>
+ <placeholder />
+ </child>
+ <child>
+ <placeholder />
+ </child>
+ <child>
+ <placeholder />
+ </child>
+ <child>
+ <placeholder />
+ </child>
+ <child>
+ <placeholder />
+ </child>
+ <child>
+ <placeholder />
+ </child>
+ <child>
+ <placeholder />
+ </child>
+ <child>
+ <placeholder />
+ </child>
+ <child>
+ <placeholder />
+ </child>
+ </widget>
+ <packing>
+ <property name="Position">2</property>
+ <property name="AutoSize">True</property>
+ </packing>
</child>
</widget>
</child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]