[longomatch] Support editing default periods in the dashboards editor



commit ea676f550b1f87fc5624a258104e65b02bda8bb4
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Tue Oct 14 01:24:50 2014 +0200

    Support editing default periods in the dashboards editor

 LongoMatch.GUI.Helpers/Misc.cs                     |    2 +-
 LongoMatch.GUI/Gui/Component/DashboardWidget.cs    |   32 ++++++---
 .../LongoMatch.Gui.Component.DashboardWidget.cs    |   70 ++++++++++++++++----
 LongoMatch.GUI/gtk-gui/gui.stetic                  |   63 +++++++++++++++--
 4 files changed, 136 insertions(+), 31 deletions(-)
---
diff --git a/LongoMatch.GUI.Helpers/Misc.cs b/LongoMatch.GUI.Helpers/Misc.cs
index 975008e..bc4ff61 100644
--- a/LongoMatch.GUI.Helpers/Misc.cs
+++ b/LongoMatch.GUI.Helpers/Misc.cs
@@ -237,7 +237,7 @@ namespace LongoMatch.Gui.Helpers
                /// <param name="name">Icon Name.</param>
                /// <param name="size">Icon Size as a Gtk.IconSize.</param>
                /// <param name="flags">Lookup Flags like ForceSVG.</param>
-               public static Gdk.Pixbuf LoadIcon (string name, Gtk.IconSize size, IconLookupFlags flags)
+               public static Gdk.Pixbuf LoadIcon (string name, Gtk.IconSize size, IconLookupFlags flags = 
IconLookupFlags.ForceSvg)
                {
                        int sz, sy;
                        global::Gtk.Icon.SizeLookup (size, out  sz, out  sy);
diff --git a/LongoMatch.GUI/Gui/Component/DashboardWidget.cs b/LongoMatch.GUI/Gui/Component/DashboardWidget.cs
index bf34a42..f15d9ac 100644
--- a/LongoMatch.GUI/Gui/Component/DashboardWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/DashboardWidget.cs
@@ -20,19 +20,18 @@
 
 using System;
 using System.Collections.Generic;
+using System.Linq;
 using Gtk;
 using LongoMatch.Core.Common;
 using LongoMatch.Core.Handlers;
 using LongoMatch.Core.Store;
 using LongoMatch.Core.Store.Templates;
-using LongoMatch.Gui;
-using Helpers = LongoMatch.Gui.Helpers;
-using LongoMatch.Drawing.Widgets;
 using LongoMatch.Drawing.Cairo;
+using LongoMatch.Drawing.Widgets;
 using Mono.Unix;
-using Image = LongoMatch.Core.Common.Image;
-using LongoMatch.Gui.Helpers;
 using LongoMatch.Gui.Dialog;
+using Helpers = LongoMatch.Gui.Helpers;
+using Image = LongoMatch.Core.Common.Image;
 
 namespace LongoMatch.Gui.Component
 {
@@ -56,11 +55,12 @@ namespace LongoMatch.Gui.Component
                {
                        this.Build();
 
-                       addcatbuttonimage.Pixbuf = Helpers.Misc.LoadIcon ("longomatch-tag-category", 
IconSize.Button, IconLookupFlags.ForceSvg);
-                       addtimerbuttonimage.Pixbuf = Helpers.Misc.LoadIcon ("longomatch-tag-timer", 
IconSize.Button, IconLookupFlags.ForceSvg);
-                       addcardbuttonimage.Pixbuf = Helpers.Misc.LoadIcon ("longomatch-tag-card", 
IconSize.Button, IconLookupFlags.ForceSvg);
-                       addscorebuttonimage.Pixbuf = Helpers.Misc.LoadIcon ("longomatch-tag-score", 
IconSize.Button, IconLookupFlags.ForceSvg);
-                       addtagbuttonimage.Pixbuf = Helpers.Misc.LoadIcon ("longomatch-tag-tag", 
IconSize.Button, IconLookupFlags.ForceSvg);
+                       addcatbuttonimage.Pixbuf = Helpers.Misc.LoadIcon ("longomatch-tag-category", 
IconSize.Button);
+                       addtimerbuttonimage.Pixbuf = Helpers.Misc.LoadIcon ("longomatch-tag-timer", 
IconSize.Button);
+                       addcardbuttonimage.Pixbuf = Helpers.Misc.LoadIcon ("longomatch-tag-card", 
IconSize.Button);
+                       addscorebuttonimage.Pixbuf = Helpers.Misc.LoadIcon ("longomatch-tag-score", 
IconSize.Button);
+                       addtagbuttonimage.Pixbuf = Helpers.Misc.LoadIcon ("longomatch-tag-tag", 
IconSize.Button);
+                       applyimage.Pixbuf = Helpers.Misc.LoadIcon ("longomatch-apply", IconSize.Button);
 
                        tagger = new DashboardCanvas (new WidgetWrapper (drawingarea));
                        tagger.TaggersSelectedEvent += HandleTaggersSelectedEvent;
@@ -81,6 +81,7 @@ namespace LongoMatch.Gui.Component
                        addscorebutton.Clicked += HandleAddClicked;
                        addtagbutton.Clicked += HandleAddClicked;
                        addcardbutton.Clicked += HandleAddClicked;
+                       applybutton.Clicked += HandleApplyClicked;
 
                        FillToolbar ();
                        FitMode = FitMode.Original;
@@ -150,6 +151,7 @@ namespace LongoMatch.Gui.Component
                                fieldimage.Pixbuf = value.FieldBackground.Scale (50, 50).Value;
                                hfieldimage.Pixbuf = value.HalfFieldBackground.Scale (50, 50).Value;
                                goalimage.Pixbuf = value.GoalBackground.Scale (50, 50).Value;
+                               periodsentry.Text = String.Join ("-", template.GamePeriods);
                                Edited = false;
                                // Start with disabled widget until something get selected
                                tagproperties.Tagger = null;
@@ -440,5 +442,15 @@ namespace LongoMatch.Gui.Component
                                tagger.RedrawButton (selected);
                        }
                }
+               
+               void HandleApplyClicked (object sender, EventArgs e)
+               {
+                       try {
+                               template.GamePeriods = periodsentry.Text.Split ('-').ToList ();
+                               Edited = true;
+                       } catch {
+                               Config.GUIToolkit.ErrorMessage (Catalog.GetString ("Could not parse game 
periods."));
+                       }
+               }
        }
 }
diff --git a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.DashboardWidget.cs 
b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.DashboardWidget.cs
index 97509d5..6f4f55e 100644
--- a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.DashboardWidget.cs
+++ b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.DashboardWidget.cs
@@ -51,6 +51,11 @@ namespace LongoMatch.Gui.Component
                private global::Gtk.Label goallabel1;
                private global::Gtk.Label goallabel2;
                private global::Gtk.Button resetgoalbutton;
+               private global::Gtk.HBox hbox1;
+               private global::Gtk.Label periodslabel;
+               private global::Gtk.Entry periodsentry;
+               private global::Gtk.Button applybutton;
+               private global::Gtk.Image applyimage;
                private global::Gtk.ScrolledWindow propertiesscrolledwindow;
                private global::Gtk.Alignment tagpropertiesalignment;
                private global::LongoMatch.Gui.Component.CategoryProperties tagproperties;
@@ -456,14 +461,55 @@ namespace LongoMatch.Gui.Component
                        w68.Expand = false;
                        w68.Fill = false;
                        // Container child vbox10.Gtk.Box+BoxChild
+                       this.hbox1 = new global::Gtk.HBox ();
+                       this.hbox1.Name = "hbox1";
+                       this.hbox1.Spacing = 6;
+                       // Container child hbox1.Gtk.Box+BoxChild
+                       this.periodslabel = new global::Gtk.Label ();
+                       this.periodslabel.Name = "periodslabel";
+                       this.periodslabel.LabelProp = global::Mono.Unix.Catalog.GetString ("Periods");
+                       this.hbox1.Add (this.periodslabel);
+                       global::Gtk.Box.BoxChild w69 = ((global::Gtk.Box.BoxChild)(this.hbox1 
[this.periodslabel]));
+                       w69.Position = 0;
+                       w69.Expand = false;
+                       w69.Fill = false;
+                       // Container child hbox1.Gtk.Box+BoxChild
+                       this.periodsentry = new global::Gtk.Entry ();
+                       this.periodsentry.CanFocus = true;
+                       this.periodsentry.Name = "periodsentry";
+                       this.periodsentry.IsEditable = true;
+                       this.periodsentry.InvisibleChar = '•';
+                       this.hbox1.Add (this.periodsentry);
+                       global::Gtk.Box.BoxChild w70 = ((global::Gtk.Box.BoxChild)(this.hbox1 
[this.periodsentry]));
+                       w70.Position = 1;
+                       // Container child hbox1.Gtk.Box+BoxChild
+                       this.applybutton = new global::Gtk.Button ();
+                       this.applybutton.CanFocus = true;
+                       this.applybutton.Name = "applybutton";
+                       // Container child applybutton.Gtk.Container+ContainerChild
+                       this.applyimage = new global::Gtk.Image ();
+                       this.applyimage.Name = "applyimage";
+                       this.applybutton.Add (this.applyimage);
+                       this.applybutton.Label = null;
+                       this.hbox1.Add (this.applybutton);
+                       global::Gtk.Box.BoxChild w72 = ((global::Gtk.Box.BoxChild)(this.hbox1 
[this.applybutton]));
+                       w72.Position = 2;
+                       w72.Expand = false;
+                       w72.Fill = false;
+                       this.vbox10.Add (this.hbox1);
+                       global::Gtk.Box.BoxChild w73 = ((global::Gtk.Box.BoxChild)(this.vbox10 [this.hbox1]));
+                       w73.Position = 1;
+                       w73.Expand = false;
+                       w73.Fill = false;
+                       // Container child vbox10.Gtk.Box+BoxChild
                        this.propertiesscrolledwindow = new global::Gtk.ScrolledWindow ();
                        this.propertiesscrolledwindow.CanFocus = true;
                        this.propertiesscrolledwindow.Name = "propertiesscrolledwindow";
                        this.propertiesscrolledwindow.HscrollbarPolicy = ((global::Gtk.PolicyType)(2));
                        this.propertiesscrolledwindow.ShadowType = ((global::Gtk.ShadowType)(1));
                        // Container child propertiesscrolledwindow.Gtk.Container+ContainerChild
-                       global::Gtk.Viewport w69 = new global::Gtk.Viewport ();
-                       w69.ShadowType = ((global::Gtk.ShadowType)(0));
+                       global::Gtk.Viewport w74 = new global::Gtk.Viewport ();
+                       w74.ShadowType = ((global::Gtk.ShadowType)(0));
                        // Container child GtkViewport1.Gtk.Container+ContainerChild
                        this.tagpropertiesalignment = new global::Gtk.Alignment (0.5F, 0.5F, 1F, 1F);
                        this.tagpropertiesalignment.Name = "tagpropertiesalignment";
@@ -475,21 +521,21 @@ namespace LongoMatch.Gui.Component
                        this.tagproperties.Name = "tagproperties";
                        this.tagproperties.Edited = false;
                        this.tagpropertiesalignment.Add (this.tagproperties);
-                       w69.Add (this.tagpropertiesalignment);
-                       this.propertiesscrolledwindow.Add (w69);
+                       w74.Add (this.tagpropertiesalignment);
+                       this.propertiesscrolledwindow.Add (w74);
                        this.vbox10.Add (this.propertiesscrolledwindow);
-                       global::Gtk.Box.BoxChild w73 = ((global::Gtk.Box.BoxChild)(this.vbox10 
[this.propertiesscrolledwindow]));
-                       w73.Position = 1;
+                       global::Gtk.Box.BoxChild w78 = ((global::Gtk.Box.BoxChild)(this.vbox10 
[this.propertiesscrolledwindow]));
+                       w78.Position = 2;
                        this.propertiesalignment.Add (this.vbox10);
                        this.propertiesframe.Add (this.propertiesalignment);
                        this.rightbox.Add (this.propertiesframe);
-                       global::Gtk.Box.BoxChild w76 = ((global::Gtk.Box.BoxChild)(this.rightbox 
[this.propertiesframe]));
-                       w76.Position = 0;
+                       global::Gtk.Box.BoxChild w81 = ((global::Gtk.Box.BoxChild)(this.rightbox 
[this.propertiesframe]));
+                       w81.Position = 0;
                        this.hbox2.Add (this.rightbox);
-                       global::Gtk.Box.BoxChild w77 = ((global::Gtk.Box.BoxChild)(this.hbox2 
[this.rightbox]));
-                       w77.Position = 1;
-                       w77.Expand = false;
-                       w77.Fill = false;
+                       global::Gtk.Box.BoxChild w82 = ((global::Gtk.Box.BoxChild)(this.hbox2 
[this.rightbox]));
+                       w82.Position = 1;
+                       w82.Expand = false;
+                       w82.Fill = false;
                        this.Add (this.hbox2);
                        if ((this.Child != null)) {
                                this.Child.ShowAll ();
diff --git a/LongoMatch.GUI/gtk-gui/gui.stetic b/LongoMatch.GUI/gtk-gui/gui.stetic
index 3a43dad..3d0089a 100644
--- a/LongoMatch.GUI/gtk-gui/gui.stetic
+++ b/LongoMatch.GUI/gtk-gui/gui.stetic
@@ -561,6 +561,60 @@
                           </packing>
                         </child>
                         <child>
+                          <widget class="Gtk.HBox" id="hbox1">
+                            <property name="MemberName" />
+                            <property name="Spacing">6</property>
+                            <child>
+                              <widget class="Gtk.Label" id="periodslabel">
+                                <property name="MemberName" />
+                                <property name="LabelProp" translatable="yes">Periods</property>
+                              </widget>
+                              <packing>
+                                <property name="Position">0</property>
+                                <property name="AutoSize">True</property>
+                                <property name="Expand">False</property>
+                                <property name="Fill">False</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="Gtk.Entry" id="periodsentry">
+                                <property name="MemberName" />
+                                <property name="CanFocus">True</property>
+                                <property name="IsEditable">True</property>
+                                <property name="InvisibleChar">•</property>
+                              </widget>
+                              <packing>
+                                <property name="Position">1</property>
+                                <property name="AutoSize">True</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="Gtk.Button" id="applybutton">
+                                <property name="MemberName" />
+                                <property name="CanFocus">True</property>
+                                <property name="Type">Custom</property>
+                                <child>
+                                  <widget class="Gtk.Image" id="applyimage">
+                                    <property name="MemberName" />
+                                  </widget>
+                                </child>
+                              </widget>
+                              <packing>
+                                <property name="Position">2</property>
+                                <property name="AutoSize">True</property>
+                                <property name="Expand">False</property>
+                                <property name="Fill">False</property>
+                              </packing>
+                            </child>
+                          </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>
                           <widget class="Gtk.ScrolledWindow" id="propertiesscrolledwindow">
                             <property name="MemberName" />
                             <property name="CanFocus">True</property>
@@ -588,7 +642,7 @@
                             </child>
                           </widget>
                           <packing>
-                            <property name="Position">1</property>
+                            <property name="Position">2</property>
                             <property name="AutoSize">False</property>
                           </packing>
                         </child>
@@ -784,12 +838,6 @@
         <property name="Sensitive">False</property>
         <property name="ShortLabel" translatable="yes">Show project stats</property>
       </action>
-      <action id="MigrationToolAction">
-        <property name="Type">Action</property>
-        <property name="Label" translatable="yes">Migration Tool</property>
-        <property name="ShortLabel" translatable="yes">Migration Tool</property>
-        <signal name="Activated" handler="OnMigrationToolActionActivated" />
-      </action>
     </action-group>
     <property name="MemberName" />
     <property name="Title" translatable="yes">LongoMatch</property>
@@ -831,7 +879,6 @@
                     </node>
                     <node type="Separator" />
                     <node type="Menuitem" action="VideoConverterToolAction" />
-                    <node type="Menuitem" action="MigrationToolAction" />
                   </node>
                   <node type="Menu" action="ViewAction">
                     <node type="Menuitem" action="FullScreenAction" />


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