Ejemplo n.º 1
0
 public StringTaggerWidget(TagSubCategory subcategory, StringTagStore tags)
 {
     this.Build();
     this.subcategory = subcategory;
     this.tags        = tags;
     PopulateGui();
     UpdateTags();
 }
Ejemplo n.º 2
0
        public void AddSubCategory(TagSubCategory subcat, StringTagStore tags)
        {
            StringTaggerWidget tagger = new StringTaggerWidget(subcat, tags);

            table1.Attach(tagger, 0, 1, table1.NRows - 1, table1.NRows);
            table1.NRows++;
            tagger.Show();
        }
Ejemplo n.º 3
0
 public StringTaggerWidget(TagSubCategory subcategory, StringTagStore tags)
 {
     this.Build ();
     this.subcategory = subcategory;
     this.tags = tags;
     PopulateGui();
     UpdateTags();
 }
Ejemplo n.º 4
0
        public void AddDefaultItem(int index)
        {
            PlayerSubCategory localplayers, visitorplayers;
            TagSubCategory    period;
            TeamSubCategory   team;
            Color             c = new Color((Byte)255, (Byte)0, (Byte)0);
            HotKey            h = new HotKey();

            team = new TeamSubCategory {
                Name          = Catalog.GetString("Team"),
                AllowMultiple = false,
                FastTag       = true
            };
            team.Add(Team.LOCAL);
            team.Add(Team.VISITOR);

            localplayers = new PlayerSubCategory {
                Name          = Catalog.GetString("Local Team Players"),
                AllowMultiple = true,
                FastTag       = true
            };
            localplayers.Add(Team.LOCAL);

            visitorplayers = new PlayerSubCategory {
                Name          = Catalog.GetString("Visitor Team Players"),
                AllowMultiple = true,
                FastTag       = true
            };
            visitorplayers.Add(Team.VISITOR);

            period = new TagSubCategory {
                Name          = Catalog.GetString("Period"),
                AllowMultiple = false,
                FastTag       = true,
            };
            period.Add("1");
            period.Add("2");

            Category cat = new Category {
                Name  = "Category " + index,
                Color = c,
                Start = new Time {
                    Seconds = 10
                },
                Stop = new Time {
                    Seconds = 10
                },
                SortMethod = SortMethodType.SortByStartTime,
                HotKey     = h,
                Position   = index - 1,
            };

            cat.SubCategories.Add(team);
            cat.SubCategories.Add(localplayers);
            cat.SubCategories.Add(visitorplayers);
            cat.SubCategories.Add(period);
            Insert(index, cat);
        }
Ejemplo n.º 5
0
 public void AddSubCategory(TagSubCategory subcat, StringTagStore tags)
 {
     if (subcat.Count == 0)
         return;
     StringTaggerWidget tagger = new StringTaggerWidget(subcat, tags);
     table1.Attach(tagger,0, 1, table1.NRows-1, table1.NRows);
     table1.NRows ++;
     tagger.Show();
 }
Ejemplo n.º 6
0
 public StringTaggerWidget(TagSubCategory subcategory, StringTagStore tags)
 {
     this.Build();
     this.subcategory = subcategory;
     this.tags        = tags;
     count            = 0;
     table.NColumns   = 3;
     PopulateGui();
     UpdateTags();
 }
Ejemplo n.º 7
0
 public StringTaggerWidget(TagSubCategory subcategory, StringTagStore tags)
 {
     this.Build ();
     this.subcategory = subcategory;
     this.tags = tags;
     count = 0;
     table.NColumns = 5;
     PopulateGui();
     UpdateTags();
 }
Ejemplo n.º 8
0
        public void AddDefaultSubcategories(Category cat)
        {
            TagSubCategory resultsubcat;

            resultsubcat = new TagSubCategory {
                Name          = Catalog.GetString("Outcome"),
                AllowMultiple = false,
            };
            resultsubcat.Add(Catalog.GetString("Success"));
            resultsubcat.Add(Catalog.GetString("Failure"));
            cat.SubCategories.Add(resultsubcat);
        }
Ejemplo n.º 9
0
 public SubCategoryTagsEditor(TagSubCategory template, List <string> templates)
 {
     this.Build();
     Gdk.Color.Parse("red", ref templateExistsColor);
     this.templates            = templates;
     tagsDict                  = new Dictionary <string, Widget>();
     addtagbutton.Clicked     += OnAddTag;
     tagentry.Activated       += OnAddTag;
     nameentry.Changed        += OnNameChanged;
     multicheckbutton.Toggled += OnMultiToggled;
     fastcheckbutton.Toggled  += OnFastToggled;
     Template                  = template;
 }
 public SubCategoryTagsEditor(TagSubCategory template, List<string> templates)
 {
     this.Build ();
     Gdk.Color.Parse("red", ref templateExistsColor);
     this.templates = templates;
     tagsDict = new Dictionary<string, Widget>();
     addtagbutton.Clicked += OnAddTag;
     tagentry.Activated += OnAddTag;
     nameentry.Changed += OnNameChanged;
     multicheckbutton.Toggled += OnMultiToggled;
     fastcheckbutton.Toggled += OnFastToggled;
     Template = template;
 }
Ejemplo n.º 11
0
        void MigrateCat_2_0(Categories cats)
        {
            /*
             * Migrate templates: in this version game periods are a common
             * tag for all sub-categories. We need to remove the old Period
             * string tag from all categories and add a GamePeriod string list
             * with the same values
             */
            List <string> periods = null;

            Log.Information("Migrating categories template " + cats.Name + " to 2.1");
            foreach (Category cat in cats)
            {
                ISubCategory toDelete = null;

                foreach (ISubCategory subcat in cat.SubCategories)
                {
                    TagSubCategory tagSubcat = subcat as TagSubCategory;

                    if (tagSubcat == null)
                    {
                        continue;
                    }

                    if (subcat.Name == Catalog.GetString("Period"))
                    {
                        if (periods == null)
                        {
                            periods = new List <string>();
                            foreach (string tag in tagSubcat)
                            {
                                periods.Add(tag);
                            }
                        }
                        toDelete = subcat;
                        Log.Debug("Migrated Period for category " + cat.Name);
                        break;
                    }
                }
                if (toDelete != null)
                {
                    cat.SubCategories.Remove(toDelete);
                }
            }
            cats.Version = new Version(2, 1);
            templates.CategoriesTemplateProvider.Update(cats);
            Log.Information("Migration to 2.1 done");
        }
Ejemplo n.º 12
0
        private TagSubCategory EditSubCategoryTags(TagSubCategory template, bool checkName)
        {
            SubCategoryTagsEditor se = new SubCategoryTagsEditor(template, subcategoriesTemplates.TemplatesNames);

            se.CheckName = checkName;
            int ret = se.Run();

            var t = se.Template;

            se.Destroy();

            if (ret != (int)ResponseType.Ok)
            {
                return(null);
            }
            return(t);
        }
Ejemplo n.º 13
0
 public void AddTagSubcategory(TagSubCategory subcat, StringTagStore tags)
 {
     /* the notebook starts invisible */
     tagsnotebook.Visible = true;
     taggerwidget1.AddSubCategory(subcat, tags);
 }
Ejemplo n.º 14
0
        void ExportCategory(Category cat)
        {
            string      headers;
            List <Play> plays;

            output.Add("CATEGORY: " + cat.Name);
            plays = project.PlaysInCategory(cat);

            /* Write Headers for this category */
            headers = "Name;Start;Stop;Team";
            foreach (ISubCategory subcat in cat.SubCategories)
            {
                TagSubCategory ts = subcat as TagSubCategory;
                if (ts == null)
                {
                    continue;
                }

                foreach (string desc in ts.ElementsDesc())
                {
                    headers += String.Format(";{0}:{1}", ts.Name, desc);
                }
            }

            /* Players subcategories */
            foreach (ISubCategory subcat in cat.SubCategories)
            {
                PlayerSubCategory ps = subcat as PlayerSubCategory;
                if (ps == null)
                {
                    continue;
                }
                headers += ";" + ps.Name;
            }
            output.Add(headers);

            foreach (Play play in plays.OrderBy(p => p.Start))
            {
                string line;

                line = String.Format("{0};{1};{2};{3}", play.Name,
                                     play.Start.ToMSecondsString(),
                                     play.Stop.ToMSecondsString(),
                                     play.Team);

                /* Strings Tags */
                foreach (ISubCategory subcat in cat.SubCategories)
                {
                    TagSubCategory ts = subcat as TagSubCategory;
                    if (ts == null)
                    {
                        continue;
                    }

                    foreach (string desc in ts.ElementsDesc())
                    {
                        StringTag t = new StringTag {
                            SubCategory = subcat, Value = desc
                        };
                        line += ";" + (play.Tags.Contains(t) ? "1" : "0");
                    }
                }

                /* Player Tags */
                foreach (ISubCategory subcat in cat.SubCategories)
                {
                    PlayerSubCategory ps = subcat as PlayerSubCategory;
                    if (ps == null)
                    {
                        continue;
                    }

                    line += ";";
                    foreach (PlayerTag p in play.Players.GetTags(ps))
                    {
                        line += p.Value.Name + " ";
                    }
                }
                output.Add(line);
            }
            output.Add("");
        }
Ejemplo n.º 15
0
 public void AddTagSubcategory(TagSubCategory subcat, StringTagStore tags)
 {
     /* the notebook starts invisible */
     tagsnotebook.Visible = true;
     taggerwidget1.AddSubCategory(subcat, tags);
 }
Ejemplo n.º 16
0
        private TagSubCategory EditSubCategoryTags(TagSubCategory template, bool checkName)
        {
            SubCategoryTagsEditor se =  new SubCategoryTagsEditor(template, subcategoriesProvider.TemplatesNames);

            se.CheckName = checkName;
            int ret = se.Run();

            var t = se.Template;
            se.Destroy();

            if (ret != (int)ResponseType.Ok)
                return null;
            return t;
        }