Example #1
0
        public EpisodeEditorGui()
        {
            this.Build();
            #region setup the actors datagrid
            store = new NodeStore(typeof(ActorNode));

            CellRendererText nameRender = new CellRendererText()
            {
                Editable = true,
            };
            nameRender.Edited += delegate(object o, EditedArgs args) {
                // update the text
                ActorNode node = (ActorNode)store.GetNode(new Gtk.TreePath(args.Path));
                node.Name = args.NewText;
            };
            nvActors.AppendColumn("Name", nameRender, "text", 0);
            CellRendererText roleRender = new CellRendererText()
            {
                Editable = true,
            };
            roleRender.Edited += delegate(object o, EditedArgs args) {
                // update the text
                ActorNode node = (ActorNode)store.GetNode(new Gtk.TreePath(args.Path));
                node.Role = args.NewText;
            };
            nvActors.AppendColumn("Role", roleRender, "text", 1);

            nvActors.NodeStore = store;

            btnActorsRemove.Clicked += delegate
            {
                ActorNode node = nvActors.NodeSelection.SelectedNode as ActorNode;
                if (node != null)
                {
                    store.RemoveNode(node);
                }
            };
            btnActorsAdd.Clicked += delegate {
                var node = new ActorNode();
                store.AddNode(node);
                nvActors.NodeSelection.SelectNode(node);
                int _n         = 0;
                var enumerator = store.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    _n++;
                }
                nvActors.ScrollToCell(new TreePath(new int[] { _n - 1 }), null, false, 0, 0);
            };
            #endregion
        }
Example #2
0
        public void Save()
        {
            EpisodeMeta.Title     = txtEpisodeName.Text;
            EpisodeMeta.Studio    = txtStudio.Text;
            EpisodeMeta.Plot      = txtPlot.Buffer.Text;
            EpisodeMeta.Mpaa      = txtMpaa.Text;
            EpisodeMeta.Writers   = txtWriters.Text.ToStringArray();
            EpisodeMeta.Directors = txtDirectors.Text.ToStringArray();
            if (((int)EpisodeMeta.Rating) != ratingwidget1.Value) // check if the rating was changed
            {
                EpisodeMeta.Rating = ratingwidget1.Value;
            }
            if (!String.IsNullOrEmpty(txtAired.Text))
            {
                EpisodeMeta.Aired = DateTime.ParseExact(txtAired.Text, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture);
            }
            if (!String.IsNullOrEmpty(txtPremiered.Text))
            {
                EpisodeMeta.Premiered = DateTime.ParseExact(txtPremiered.Text, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture);
            }
            EpisodeMeta.Episode        = (int)numEpisode.Value;
            EpisodeMeta.Season         = (int)numSeason.Value;
            EpisodeMeta.DisplayEpisode = (int)numDisplayEpisode.Value;
            EpisodeMeta.DisplaySeason  = (int)numDisplaySeason.Value;
            //EpisodeMeta.EpBookmark = (int)DateTime.ParseExact(mtbEpisodeStart.Text, "HH:mm:ss", CultureInfo.InvariantCulture).TimeOfDay.TotalSeconds;

            /*
             * List<KeyValuePair<string, string>> actors = new List<KeyValuePair<string,string>>();
             *
             * var enumerator = store.GetEnumerator();
             * while(enumerator.MoveNext())
             * {
             *      var actor = (ActorNode)enumerator.Current;
             *      if(!String.IsNullOrWhiteSpace(actor.Name.Trim()))
             *              actors.Add(new KeyValuePair<string, string>(actor.Name, actor.Role));
             * }
             * EpisodeMeta.Actors = actors.ToArray();*/
            EpisodeMeta.Actors = ActorNode.GetActors(store);
        }
Example #3
0
        public MovieEditor(iMetaLibrary.Metadata.MovieMeta Meta)
        {
            this.Build ();
            this.Meta = Meta;
            #region setup the actors datagrid
            store = new NodeStore(typeof(ActorNode));

            CellRendererText nameRender = new CellRendererText(){ Editable = true, };
            nameRender.Edited += delegate(object o, EditedArgs args) {
                // update the text
                ActorNode node = (ActorNode)store.GetNode(new Gtk.TreePath(args.Path));
                node.Name = args.NewText;
            };
            nvActors.AppendColumn("Name", nameRender, "text", 0);
            CellRendererText roleRender = new CellRendererText(){ Editable = true, };
            roleRender.Edited += delegate(object o, EditedArgs args) {
                // update the text
                ActorNode node = (ActorNode)store.GetNode(new Gtk.TreePath(args.Path));
                node.Role = args.NewText;
            };
            nvActors.AppendColumn("Role", roleRender, "text", 1);

            nvActors.NodeStore = store;

            btnActorsRemove.Clicked += delegate
            {
                ActorNode node = nvActors.NodeSelection.SelectedNode as ActorNode;
                if(node != null)
                    store.RemoveNode(node);
            };
            btnActorsAdd.Clicked += delegate {
                var node = new ActorNode();
                store.AddNode(node);
                nvActors.NodeSelection.SelectNode(node);
                int _n = 0;
                var enumerator = store.GetEnumerator();
                while(enumerator.MoveNext()) _n++;
                nvActors.ScrollToCell(new TreePath(new int[] {_n-1}), null, false, 0, 0);
            };
            #endregion

            if(Meta.Actors != null){
                foreach(var actor in Meta.Actors)
                    store.AddNode(new ActorNode() { Name = actor.Key, Role = actor.Value});
            }

            txtTitle.Text = Meta.Title ?? "";
            txtSortTitle.Text = Meta.SortTitle ?? "";
            txtSet.Text = Meta.Set ?? "";
            txtTagline.Text = Meta.TagLine ?? "";
            txtGenres.Text = String.Join(", ", Meta.Genres ?? new string[] {});
            txtDirectors.Text = String.Join(", ", Meta.Directors ?? new string[] {});
            txtWriters.Text = String.Join(", ", Meta.Writers ?? new string[] {});
            txtTrailer.Text = Meta.Trailer ?? "";
            txtImdbId.Text = Meta.Id ?? "";
            txtMpaa.Text = Meta.Mpaa ?? "";
            txtReleaseDate.Text = Meta.ReleaseDate > new DateTime(1850, 1,1) ? Meta.ReleaseDate.ToString("yyyy-MM-dd") : "";
            txtPlot.Buffer.Text = Meta.Plot ?? "";
            numRuntime.Value = Meta.Runtime / 60; // convert seconds to minutes
            ratingwidget.Value = (int)Meta.Rating;

            Poster = GuiHelper.ImageToPixbuf(Meta.LoadThumbnail(290, 1000));

            //ratingwidget.Visible  = false;

            buttonOk.Clicked += delegate {
                Save ();
            };

            eventPoster.ButtonPressEvent +=	delegate{
                BrowseForNewPoster();
            };
        }
Example #4
0
        public MovieEditor(iMetaLibrary.Metadata.MovieMeta Meta)
        {
            this.Build();
            this.Meta = Meta;
            #region setup the actors datagrid
            store = new NodeStore(typeof(ActorNode));

            CellRendererText nameRender = new CellRendererText()
            {
                Editable = true,
            };
            nameRender.Edited += delegate(object o, EditedArgs args) {
                // update the text
                ActorNode node = (ActorNode)store.GetNode(new Gtk.TreePath(args.Path));
                node.Name = args.NewText;
            };
            nvActors.AppendColumn("Name", nameRender, "text", 0);
            CellRendererText roleRender = new CellRendererText()
            {
                Editable = true,
            };
            roleRender.Edited += delegate(object o, EditedArgs args) {
                // update the text
                ActorNode node = (ActorNode)store.GetNode(new Gtk.TreePath(args.Path));
                node.Role = args.NewText;
            };
            nvActors.AppendColumn("Role", roleRender, "text", 1);

            nvActors.NodeStore = store;

            btnActorsRemove.Clicked += delegate
            {
                ActorNode node = nvActors.NodeSelection.SelectedNode as ActorNode;
                if (node != null)
                {
                    store.RemoveNode(node);
                }
            };
            btnActorsAdd.Clicked += delegate {
                var node = new ActorNode();
                store.AddNode(node);
                nvActors.NodeSelection.SelectNode(node);
                int _n         = 0;
                var enumerator = store.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    _n++;
                }
                nvActors.ScrollToCell(new TreePath(new int[] { _n - 1 }), null, false, 0, 0);
            };
            #endregion

            if (Meta.Actors != null)
            {
                foreach (var actor in Meta.Actors)
                {
                    store.AddNode(new ActorNode()
                    {
                        Name = actor.Key, Role = actor.Value
                    });
                }
            }

            txtTitle.Text       = Meta.Title ?? "";
            txtSortTitle.Text   = Meta.SortTitle ?? "";
            txtSet.Text         = Meta.Set ?? "";
            txtTagline.Text     = Meta.TagLine ?? "";
            txtGenres.Text      = String.Join(", ", Meta.Genres ?? new string[] {});
            txtDirectors.Text   = String.Join(", ", Meta.Directors ?? new string[] {});
            txtWriters.Text     = String.Join(", ", Meta.Writers ?? new string[] {});
            txtTrailer.Text     = Meta.Trailer ?? "";
            txtImdbId.Text      = Meta.Id ?? "";
            txtMpaa.Text        = Meta.Mpaa ?? "";
            txtReleaseDate.Text = Meta.ReleaseDate > new DateTime(1850, 1, 1) ? Meta.ReleaseDate.ToString("yyyy-MM-dd") : "";
            txtPlot.Buffer.Text = Meta.Plot ?? "";
            numRuntime.Value    = Meta.Runtime / 60;          // convert seconds to minutes
            ratingwidget.Value  = (int)Meta.Rating;

            Poster = GuiHelper.ImageToPixbuf(Meta.LoadThumbnail(290, 1000));

            //ratingwidget.Visible  = false;

            buttonOk.Clicked += delegate {
                Save();
            };

            eventPoster.ButtonPressEvent += delegate {
                BrowseForNewPoster();
            };
        }