示例#1
0
 /// <summary>Construtor</summary>
 public MapView(ViewBase owner) : base(owner)
 {
 }
示例#2
0
        /// <summary>
        /// Constructor
        /// </summary>
        public UpgradeView(ViewBase owner) : base(owner)
        {
            Builder builder = ViewBase.MasterView.BuilderFromResource("ApsimNG.Resources.Glade.UpgradeView.glade");

            window1         = (Window)builder.GetObject("window1");
            button1         = (Button)builder.GetObject("button1");
            button2         = (Button)builder.GetObject("button2");
            table1          = (Table)builder.GetObject("table1");
            table2          = (Table)builder.GetObject("table2");
            firstNameBox    = (Entry)builder.GetObject("firstNameBox");
            lastNameBox     = (Entry)builder.GetObject("lastNameBox");
            organisationBox = (Entry)builder.GetObject("organisationBox");
            emailBox        = (Entry)builder.GetObject("emailBox");
            address1Box     = (Entry)builder.GetObject("address1Box");
            address2Box     = (Entry)builder.GetObject("address2Box");
            cityBox         = (Entry)builder.GetObject("cityBox");
            stateBox        = (Entry)builder.GetObject("stateBox");
            countryBox      = (Entry)builder.GetObject("countryBox");
            postcodeBox     = (Entry)builder.GetObject("postcodeBox");
            label1          = (Label)builder.GetObject("label1");
            HTMLalign       = (Alignment)builder.GetObject("HTMLalign");
            checkbutton1    = (CheckButton)builder.GetObject("checkbutton1");
            listview1       = (Gtk.TreeView)builder.GetObject("listview1");
            alignment3      = (Alignment)builder.GetObject("alignment3");
            alignment4      = (Alignment)builder.GetObject("alignment4");
            alignment5      = (Alignment)builder.GetObject("alignment5");
            alignment6      = (Alignment)builder.GetObject("alignment6");
            alignment7      = (Alignment)builder.GetObject("alignment7");

            listview1.Model = listmodel;

            CellRendererText textRender = new Gtk.CellRendererText();

            textRender.Editable = false;

            TreeViewColumn column0 = new TreeViewColumn("Version", textRender, "text", 0);

            listview1.AppendColumn(column0);
            column0.Sizing    = TreeViewColumnSizing.Autosize;
            column0.Resizable = true;

            TreeViewColumn column1 = new TreeViewColumn("Description", textRender, "text", 1);

            listview1.AppendColumn(column1);
            column1.Sizing    = TreeViewColumnSizing.Autosize;
            column1.Resizable = true;

            // Make the tab order a little more sensible than the defaults
            table1.FocusChain = new Widget[] { alignment7, button1, button2 };
            table2.FocusChain = new Widget[] { firstNameBox, lastNameBox, organisationBox, emailBox,
                                               alignment3, alignment4, cityBox, alignment5, countryBox, alignment6 };

            HTMLview = new HTMLView(new ViewBase(null));
            HTMLalign.Add(HTMLview.MainWidget);
            tabbedExplorerView   = owner as IMainView;
            window1.TransientFor = owner.MainWidget.Toplevel as Window;
            button1.Clicked     += OnUpgrade;
            button2.Clicked     += OnViewMoreDetail;
            window1.Destroyed   += OnFormClosing;
            window1.MapEvent    += OnShown;
        }
示例#3
0
        /// <summary>Initializes a new instance of the <see cref="SeriesView" /> class</summary>
        public SeriesView(ViewBase owner) : base(owner)
        {
            Builder builder = BuilderFromResource("ApsimNG.Resources.Glade.SeriesView.glade");

            vbox1       = (VBox)builder.GetObject("vbox1");
            table1      = (Table)builder.GetObject("table1");
            label4      = (Label)builder.GetObject("label4");
            label5      = (Label)builder.GetObject("label5");
            _mainWidget = vbox1;

            graphView1 = new GraphView(this);
            vbox1.PackStart(graphView1.MainWidget, true, true, 0);

            dropDownView1  = new DropDownView(this);
            dropDownView2  = new DropDownView(this);
            dropDownView3  = new DropDownView(this);
            dropDownView4  = new DropDownView(this);
            dropDownView5  = new DropDownView(this);
            dropDownView6  = new DropDownView(this);
            dropDownView7  = new DropDownView(this);
            dropDownView8  = new DropDownView(this);
            dropDownView9  = new ColourDropDownView(this);
            dropDownView10 = new DropDownView(this);
            dropDownView11 = new DropDownView(this);

            checkBoxView1             = new CheckBoxView(this);
            checkBoxView1.TextOfLabel = "on top?";
            checkBoxView2             = new CheckBoxView(this);
            checkBoxView2.TextOfLabel = "on right?";
            checkBoxView3             = new CheckBoxView(this);
            checkBoxView3.TextOfLabel = "cumulative?";
            checkBoxView4             = new CheckBoxView(this);
            checkBoxView4.TextOfLabel = "cumulative?";
            checkBoxView5             = new CheckBoxView(this);
            checkBoxView5.TextOfLabel = "Show in legend?";
            checkBoxView6             = new CheckBoxView(this);
            checkBoxView6.TextOfLabel = "Include series name in legend?";

            editView1 = new EditView(this);

            table1.Attach(dropDownView1.MainWidget, 1, 2, 0, 1, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(dropDownView2.MainWidget, 1, 2, 1, 2, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(dropDownView3.MainWidget, 1, 2, 2, 3, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(dropDownView5.MainWidget, 1, 2, 3, 4, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(dropDownView4.MainWidget, 1, 2, 4, 5, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(dropDownView6.MainWidget, 1, 2, 5, 6, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(dropDownView7.MainWidget, 1, 2, 6, 7, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(dropDownView8.MainWidget, 1, 2, 7, 8, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(dropDownView9.MainWidget, 1, 2, 8, 9, AttachOptions.Fill, 0, 10, 2);
            Image    helpImage = new Image(null, "ApsimNG.Resources.help.png");
            EventBox ebHelp    = new EventBox();

            ebHelp.Add(helpImage);
            ebHelp.ButtonPressEvent += Help_ButtonPressEvent;
            HBox filterBox = new HBox();

            filterBox.PackStart(editView1.MainWidget, true, true, 0);
            filterBox.PackEnd(ebHelp, false, true, 0);

            //table1.Attach(editView1.MainWidget, 1, 2, 9, 10, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(filterBox, 1, 2, 9, 10, AttachOptions.Fill, 0, 10, 2);

            table1.Attach(checkBoxView1.MainWidget, 2, 3, 1, 2, AttachOptions.Fill, 0, 0, 0);
            table1.Attach(checkBoxView2.MainWidget, 2, 3, 2, 3, AttachOptions.Fill, 0, 0, 0);
            table1.Attach(checkBoxView3.MainWidget, 3, 4, 1, 2, AttachOptions.Fill, 0, 0, 0);
            table1.Attach(checkBoxView4.MainWidget, 3, 4, 2, 3, AttachOptions.Fill, 0, 0, 0);

            table1.Attach(checkBoxView5.MainWidget, 2, 4, 8, 9, AttachOptions.Fill, 0, 0, 0);
            table1.Attach(checkBoxView6.MainWidget, 2, 4, 9, 10, AttachOptions.Fill, 0, 0, 0);

            table1.Attach(dropDownView10.MainWidget, 3, 4, 6, 7, AttachOptions.Fill, 0, 0, 5);
            table1.Attach(dropDownView11.MainWidget, 3, 4, 7, 8, AttachOptions.Fill, 0, 0, 5);
            _mainWidget.Destroyed += _mainWidget_Destroyed;
        }
示例#4
0
        public SupplementView(ViewBase owner) : base(owner)
        {
            Builder builder = BuilderFromResource("ApsimNG.Resources.Glade.SupplementView.glade");

            table1         = (Table)builder.GetObject("table1");
            tbSulph        = (Entry)builder.GetObject("tbSulph");
            tbPhos         = (Entry)builder.GetObject("tbPhos");
            tbADIP2CP      = (Entry)builder.GetObject("tbADIP2CP");
            tbProtDegrad   = (Entry)builder.GetObject("tbProtDegrad");
            tbEE           = (Entry)builder.GetObject("tbEE");
            tbCP           = (Entry)builder.GetObject("tbCP");
            tbME           = (Entry)builder.GetObject("tbME");
            tbDMD          = (Entry)builder.GetObject("tbDMD");
            tbDM           = (Entry)builder.GetObject("tbDM");
            cbxRoughage    = (CheckButton)builder.GetObject("cbxRoughage");
            tbAmount       = (Entry)builder.GetObject("tbAmount");
            tbName         = (Entry)builder.GetObject("tbName");
            btnResetAll    = (Button)builder.GetObject("btnResetAll");
            btnReset       = (Button)builder.GetObject("btnReset");
            btnDelete      = (Button)builder.GetObject("btnDelete");
            btnAdd         = (Button)builder.GetObject("btnAdd");
            lbDefaultNames = (IconView)builder.GetObject("lbDefaultNames");
            lvSupps        = (TreeView)builder.GetObject("lvSupps");
            _mainWidget    = table1;

            entryLookup.Add(tbDM, TSupplement.TSuppAttribute.spaDMP);
            entryLookup.Add(tbDMD, TSupplement.TSuppAttribute.spaDMD);
            entryLookup.Add(tbME, TSupplement.TSuppAttribute.spaMEDM);
            entryLookup.Add(tbEE, TSupplement.TSuppAttribute.spaEE);
            entryLookup.Add(tbCP, TSupplement.TSuppAttribute.spaCP);
            entryLookup.Add(tbProtDegrad, TSupplement.TSuppAttribute.spaDG);
            entryLookup.Add(tbADIP2CP, TSupplement.TSuppAttribute.spaADIP);
            entryLookup.Add(tbPhos, TSupplement.TSuppAttribute.spaPH);
            entryLookup.Add(tbSulph, TSupplement.TSuppAttribute.spaSU);

            lvSupps.Model                    = suppList;
            lbDefaultNames.Model             = defNameList;
            lbDefaultNames.TextColumn        = 0;
            lbDefaultNames.ItemActivated    += lbDefaultNames_Click;
            lbDefaultNames.LeaveNotifyEvent += lbDefaultNames_Leave;

            CellRendererText textRender = new Gtk.CellRendererText();
            TreeViewColumn   column     = new TreeViewColumn("Supplement Names", textRender, "text", 0);

            lvSupps.AppendColumn(column);
            lvSupps.HeadersVisible = false;

            tbName.Changed                  += tbName_Validating;
            tbDM.Changed                    += RealEditValidator;
            tbDMD.Changed                   += RealEditValidator;
            tbME.Changed                    += RealEditValidator;
            tbEE.Changed                    += RealEditValidator;
            tbCP.Changed                    += RealEditValidator;
            tbProtDegrad.Changed            += RealEditValidator;
            tbADIP2CP.Changed               += RealEditValidator;
            tbPhos.Changed                  += RealEditValidator;
            tbSulph.Changed                 += RealEditValidator;
            tbAmount.Changed                += tbAmount_Validating;
            btnAdd.Clicked                  += btnAdd_Click;
            btnDelete.Clicked               += btnDelete_Click;
            btnReset.Clicked                += btnReset_Click;
            btnResetAll.Clicked             += btnResetAll_Click;
            cbxRoughage.Toggled             += cbxRoughage_CheckedChanged;
            lbDefaultNames.LeaveNotifyEvent += lbDefaultNames_Leave;
            lbDefaultNames.Visible           = false;
            lvSupps.CursorChanged           += lvSupps_SelectedIndexChanged;
            _mainWidget.Destroyed           += _mainWidget_Destroyed;
        }
示例#5
0
 /// <summary>Constructor</summary>
 public EditView(ViewBase owner, Entry e) : base(owner)
 {
     Initialise(owner, e);
 }
示例#6
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="information">Error information to be displayed.</param>
        /// <param name="owner"></param>
        public ErrorView(string information, ViewBase owner = null) : base(owner)
        {
            errorWindow = new Window("Error Information")
            {
                TransientFor   = owner.MainWidget.Toplevel as Window,
                WindowPosition = WindowPosition.CenterAlways,
                // Set a default size of 1280x480.
                // Without a default size, the window will resize to fit all of the text in the TextView, which is
                // a bad thing if the text is very long (the window may be bigger than the screen).
                // If we put the text in a ScrolledWindow, we get around this issue, but the window will be tiny.
                // The best solution seems to be a compromise: put the text in a ScrolledWindow,
                // but also set a minimum size for the window.
                WidthRequest  = 1280,
                HeightRequest = 480
            };
            // Capture Keypress events, so the user can close the form via the escape key
            errorWindow.KeyPressEvent += OnKeyPress;

            textArea = new TextView()
            {
                Editable = false,
            };

            ScrolledWindow scroll = new ScrolledWindow()
            {
                HscrollbarPolicy = PolicyType.Automatic,
                VscrollbarPolicy = PolicyType.Automatic,
            };

            scroll.Add(textArea);
            Error = information;

            BtnClose          = new Button("Close");
            BtnClose.Clicked += Close;
            Alignment alignCloseButton = new Alignment(1, 1, 0, 0)
            {
                BtnClose
            };

            BtnCopy          = new Button("Copy");
            BtnCopy.Clicked += Copy;
            Alignment alignCopyButton = new Alignment(0, 1, 0, 0)
            {
                BtnCopy
            };

            HBox buttonContainer = new HBox();

            buttonContainer.PackStart(alignCopyButton, false, false, 0);
            buttonContainer.PackEnd(alignCloseButton, false, false, 0);

            VBox primaryContainer = new VBox()
            {
                Name        = "primaryContainer",
                BorderWidth = 20
            };

            primaryContainer.PackStart(scroll, true, true, 0);
            primaryContainer.PackStart(buttonContainer, false, false, 0);

            errorWindow.Add(primaryContainer);
        }
示例#7
0
        /// <summary>
        /// Constructor. Initialises the jobs TreeView and the controls associated with it.
        /// </summary>
        /// <param name="owner"></param>
        public CloudJobView(ViewBase owner) : base(owner)
        {
            dl           = new CloudDownloadView(this);
            dl.Download += OnDoDownload;
            dl.Visible   = false;

            // Give the ListStore 1 more column than the tree view.
            // This last column displays the job owner but is not shown by the TreeView in its own column.
            store = new ListStore(Enumerable.Repeat(typeof(string), Enum.GetValues(typeof(Columns)).Length + 1).ToArray());
            tree  = new Gtk.TreeView()
            {
                CanFocus = true, RubberBanding = true
            };
            tree.Selection.Mode = SelectionMode.Multiple;

            for (int i = 0; i < columnTitles.Length; i++)
            {
                TreeViewColumn col = new TreeViewColumn
                {
                    Title        = columnTitles[i],
                    SortColumnId = i,
                    Resizable    = true,
                    Sizing       = TreeViewColumnSizing.GrowOnly
                };
                CellRendererText cell = new CellRendererText();
                col.PackStart(cell, false);
                col.AddAttribute(cell, "text", i);
                col.SetCellDataFunc(cell, OnSetCellData);
                tree.AppendColumn(col);
            }

            // this filter holds the model (data) and is used to filter jobs based on whether
            // they were submitted by the user
            filterOwner = new TreeModelFilter(store, null)
            {
                VisibleFunc = FilterOwnerFunc
            };
            filterOwner.Refilter();

            // the filter then goes into this TreeModelSort, which is used to sort results when
            // the user clicks on a column header
            sort = new TreeModelSort(filterOwner)
            {
                // By default, sort by start time descending.
                DefaultSortFunc = (model, a, b) => - 1 * SortData(model, a, b, (int)Columns.StartTime)
            };
            for (int i = 0; i < columnTitles.Length; i++)
            {
                sort.SetSortFunc(i, (model, a, b) => SortData(model, a, b, i));
            }

            // the tree holds the sorted, filtered data
            tree.Model = sort;

            // the tree goes into this ScrolledWindow, allowing users to scroll down
            // to view more jobs
            ScrolledWindow scroll = new ScrolledWindow();

            scroll.Add(tree);

            // never allow horizontal scrolling, and only allow vertical scrolling when needed
            scroll.HscrollbarPolicy = PolicyType.Automatic;
            scroll.VscrollbarPolicy = PolicyType.Automatic;

            // The scrolled window goes into this frame to distinguish the job view
            // from the controls beside it.
            Frame treeContainer = new Frame("Cloud Jobs");

            treeContainer.Add(scroll);

            chkMyJobsOnly          = new CheckButton("Display my jobs only");
            chkMyJobsOnly.Toggled += OnToggleFilter;
            // Display only the user's jobs by default.
            chkMyJobsOnly.Active = true;
            chkMyJobsOnly.Yalign = 0;

            downloadProgress          = new ProgressBar(new Adjustment(0, 0, 1, 0.01, 0.01, 1));
            downloadProgressContainer = new HBox();
            downloadProgressContainer.PackStart(new Label("Downloading: "), false, false, 0);
            downloadProgressContainer.PackStart(downloadProgress, false, false, 0);

            loadingProgress = new ProgressBar(new Adjustment(0, 0, 100, 0.01, 0.01, 100));
            loadingProgress.Adjustment.Lower = 0;
            loadingProgress.Adjustment.Upper = 100;

            btnChangeDownloadDir          = new Button("Change Download Directory");
            btnChangeDownloadDir.Clicked += OnChangeDownloadPath;

            Table tblButtonContainer = new Table(1, 1, false);

            tblButtonContainer.Attach(btnChangeDownloadDir, 0, 1, 0, 1, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);

            btnDownload          = new Button("Download");
            btnDownload.Clicked += OnDownloadJobs;
            HBox downloadButtonContainer = new HBox();

            downloadButtonContainer.PackStart(btnDownload, false, true, 0);

            btnDelete          = new Button("Delete Job(s)");
            btnDelete.Clicked += OnDeleteJobs;
            HBox deleteButtonContainer = new HBox();

            deleteButtonContainer.PackStart(btnDelete, false, true, 0);

            btnStop          = new Button("Stop Job(s)");
            btnStop.Clicked += OnStopJobs;
            HBox stopButtonContainer = new HBox();

            stopButtonContainer.PackStart(btnStop, false, true, 0);

            btnSetup          = new Button("Credentials");
            btnSetup.Clicked += OnSetupClicked;
            HBox setupButtonContainer = new HBox();

            setupButtonContainer.PackStart(btnSetup, false, true, 0);

            jobLoadProgressContainer = new HBox();
            jobLoadProgressContainer.PackStart(new Label("Loading Jobs: "), false, false, 0);
            jobLoadProgressContainer.PackStart(loadingProgress, false, false, 0);

            VBox controlsContainer = new VBox();

            controlsContainer.PackStart(chkMyJobsOnly, false, false, 0);
            controlsContainer.PackStart(downloadButtonContainer, false, false, 0);
            controlsContainer.PackStart(stopButtonContainer, false, false, 0);
            controlsContainer.PackStart(deleteButtonContainer, false, false, 0);
            controlsContainer.PackStart(setupButtonContainer, false, false, 0);
            controlsContainer.PackEnd(tblButtonContainer, false, false, 0);

            HBox hboxPrimary = new HBox();

            hboxPrimary.PackStart(treeContainer, true, true, 0);
            hboxPrimary.PackStart(controlsContainer, false, true, 0);


            VBox vboxPrimary = new VBox();

            vboxPrimary.PackStart(hboxPrimary);
            vboxPrimary.PackEnd(jobLoadProgressContainer, false, false, 0);
            vboxPrimary.PackEnd(downloadProgressContainer, false, false, 0);

            mainWidget            = vboxPrimary;
            mainWidget.Destroyed += OnDestroyed;
            vboxPrimary.ShowAll();

            downloadProgressContainer.HideAll();
            HideLoadingProgressBar();
        }
示例#8
0
 /// <summary>Constructor</summary>
 public EditView(ViewBase owner) : base(owner)
 {
     Initialise(owner, new Entry());
 }
示例#9
0
 /// <summary>Constructor</summary>
 public LabelView(ViewBase owner, Label l) : base(owner)
 {
     label      = l;
     mainWidget = label;
 }
示例#10
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        public CloudDownloadView(ViewBase owner) : base(owner)
        {
            window = new Window("Download cloud jobs");
            window.TransientFor   = (MasterView as ViewBase).MainWidget.Toplevel as Window;
            window.WindowPosition = WindowPosition.CenterOnParent;
            vboxPrimary           = new VBox();
            HBox outputPathContainer = new HBox();

            // Checkbox initialisation
            includeDebugFiles = new CheckButton("Include Debugging Files");

            chkDownloadResults = new CheckButton("Download results")
            {
                Active      = true,
                TooltipText = "Results will be downloaded if and only if this option is enabled."
            };
            chkDownloadResults.Toggled += OnToggleDownloadResults;

            extractResults = new CheckButton("Unzip results")
            {
                Active      = true,
                TooltipText = "Check this option to automatically unzip the results."
            };
            extractResults.Toggled += OnToggleExtractResults;

            generateCsv = new CheckButton("Collate Results")
            {
                Active      = true,
                TooltipText = "Check this option to automatically combine results into a CSV file."
            };
            generateCsv.Toggled += OnToggleGenerateCsv;

            keepRawOutputs = new CheckButton("Keep raw output files")
            {
                Active      = true,
                TooltipText = "By default, the raw output files are deleted after being combined into a CSV. Check this option to keep the raw outputs."
            };

            extractResults.Active = false;

            // Button initialisation
            btnDownload          = new Button("Download");
            btnDownload.Clicked += OnDownload;

            btnChangeOutputDir          = new Button("...");
            btnChangeOutputDir.Clicked += OnChangeOutputDir;

            entryOutputDir            = new Entry();
            entryOutputDir.Sensitive  = false;
            entryOutputDir.WidthChars = entryOutputDir.Text.Length;

            outputPathContainer.PackStart(new Label("Output Directory: "), false, false, 0);
            outputPathContainer.PackStart(entryOutputDir, true, true, 0);
            outputPathContainer.PackStart(btnChangeOutputDir, false, false, 0);

            // Put all form controls into the primary vbox
            vboxPrimary.PackStart(includeDebugFiles);
            vboxPrimary.PackStart(chkDownloadResults);
            vboxPrimary.PackStart(extractResults);
            vboxPrimary.PackStart(generateCsv);
            vboxPrimary.PackStart(keepRawOutputs);
            vboxPrimary.PackStart(outputPathContainer);

            // This empty label will put a gap between the controls above it and below it.
            vboxPrimary.PackStart(new Label(""));

            vboxPrimary.PackEnd(btnDownload, false, false, 0);

            Frame primaryContainer = new Frame("Download Settings");

            primaryContainer.Add(vboxPrimary);
            window.Add(primaryContainer);
            window.HideAll();

            window.Destroyed   += OnDestroyed;
            window.DeleteEvent += OnDelete;
        }
示例#11
0
        public ModelDetailsWrapperView(ViewBase owner) : base(owner)
        {
            hbox  = new HBox();
            vbox1 = new VBox();

            modelTypeLabel = new Label
            {
                Xalign = 0.0f,
                Xpad   = 3
            };
            Pango.FontDescription font = new Pango.FontDescription
            {
                Size   = Convert.ToInt32(16 * Pango.Scale.PangoScale, CultureInfo.InvariantCulture),
                Weight = Pango.Weight.Semibold
            };
            modelTypeLabel.ModifyFont(font);

            modelDescriptionLabel = new Label()
            {
                Xalign = 0.0f,
                Xpad   = 4
            };
            modelDescriptionLabel.LineWrapMode = Pango.WrapMode.Word;
            modelDescriptionLabel.Wrap         = true;
            modelDescriptionLabel.ModifyBg(StateType.Normal, new Gdk.Color(131, 0, 131));

            modelHelpLinkLabel = new LinkButton("", "")
            {
                Xalign = 0.0f,
            };
            modelHelpLinkLabel.Clicked += ModelHelpLinkLabel_Clicked;
            modelHelpLinkLabel.ModifyBase(StateType.Normal, new Gdk.Color(131, 0, 131));
            modelHelpLinkLabel.Visible = false;

            Gtk.CellRendererPixbuf pixbufRender = new CellRendererPixbuf();
            pixbufRender.Pixbuf = new Gdk.Pixbuf(null, "ApsimNG.Resources.MenuImages.Help.png");
            pixbufRender.Xalign = 0.5f;
            Gtk.Image img = new Image(pixbufRender.Pixbuf);
            modelHelpLinkLabel.Image         = img;
            modelHelpLinkLabel.Image.Visible = true;

            modelVersionLabel = new Label()
            {
                Xalign = 0.0f,
                Xpad   = 4
            };
            font = new Pango.FontDescription
            {
                Size   = Convert.ToInt32(8 * Pango.Scale.PangoScale, CultureInfo.InvariantCulture),
                Weight = Pango.Weight.Normal,
            };
            modelVersionLabel.ModifyFont(font);
            modelVersionLabel.ModifyFg(StateType.Normal, new Gdk.Color(150, 150, 150));
            modelVersionLabel.LineWrapMode = Pango.WrapMode.Word;
            modelVersionLabel.Wrap         = true;
            modelVersionLabel.ModifyBg(StateType.Normal, new Gdk.Color(131, 0, 131));

            bottomView = new Viewport
            {
                ShadowType = ShadowType.None
            };

            hbox.PackStart(modelTypeLabel, false, true, 0);
            hbox.PackStart(modelHelpLinkLabel, false, false, 0);

            vbox1.PackStart(hbox, false, true, 0);
            vbox1.PackStart(modelTypeLabel, false, true, 0);
            vbox1.PackStart(modelDescriptionLabel, false, true, 0);
            vbox1.PackStart(modelVersionLabel, false, true, 4);
            vbox1.Add(bottomView);
            vbox1.SizeAllocated += Vbox1_SizeAllocated;

            mainWidget            = vbox1;
            mainWidget.Destroyed += _mainWidget_Destroyed;
        }
示例#12
0
        /// <summary>
        /// Constructor
        /// </summary>
        public UpgradeView(ViewBase owner) : base(owner)
        {
            Builder builder = BuilderFromResource("ApsimNG.Resources.Glade.UpgradeView.glade");

            window1         = (Window)builder.GetObject("window1");
            button1         = (Button)builder.GetObject("button1");
            button2         = (Button)builder.GetObject("button2");
            table1          = (Table)builder.GetObject("table1");
            table2          = (Table)builder.GetObject("table2");
            firstNameBox    = (Entry)builder.GetObject("firstNameBox");
            lastNameBox     = (Entry)builder.GetObject("lastNameBox");
            organisationBox = (Entry)builder.GetObject("organisationBox");
            emailBox        = (Entry)builder.GetObject("emailBox");
            countryBox      = (ComboBox)builder.GetObject("countryBox");
            label1          = (Label)builder.GetObject("label1");
            htmlAlign       = (Alignment)builder.GetObject("HTMLalign");
            checkbutton1    = (CheckButton)builder.GetObject("checkbutton1");
            listview1       = (Gtk.TreeView)builder.GetObject("listview1");
            alignment7      = (Alignment)builder.GetObject("alignment7");
            oldVersions     = (CheckButton)builder.GetObject("checkbutton2");
            listview1.Model = listmodel;

            CellRendererText textRender = new Gtk.CellRendererText();

            textRender.Editable = false;

            TreeViewColumn column0 = new TreeViewColumn("Version", textRender, "text", 0);

            listview1.AppendColumn(column0);
            column0.Sizing    = TreeViewColumnSizing.Autosize;
            column0.Resizable = true;

            TreeViewColumn column1 = new TreeViewColumn("Description", textRender, "text", 1);

            listview1.AppendColumn(column1);
            column1.Sizing    = TreeViewColumnSizing.Autosize;
            column1.Resizable = true;

            // Populate the combo box with a list of valid country names.
            ListStore countries = new ListStore(typeof(string));

            foreach (string country in Constants.Countries)
            {
                countries.AppendValues(country);
            }
            countryBox.Model = countries;

            // Add a cell renderer to the combo box.
            CellRendererText cell = new CellRendererText();

            countryBox.PackStart(cell, false);
            countryBox.AddAttribute(cell, "text", 0);

            // Make the tab order a little more sensible than the defaults
            table1.FocusChain = new Widget[] { alignment7, button1, button2 };
            table2.FocusChain = new Widget[] { firstNameBox, lastNameBox, emailBox, organisationBox, countryBox };

            htmlView = new HTMLView(new ViewBase(null));
            htmlAlign.Add(htmlView.MainWidget);
            tabbedExplorerView   = owner as IMainView;
            window1.TransientFor = owner.MainWidget.Toplevel as Window;
            window1.Modal        = true;
            oldVersions.Toggled += OnShowOldVersionsToggled;
            button1.Clicked     += OnUpgrade;
            button2.Clicked     += OnViewMoreDetail;
            window1.Destroyed   += OnFormClosing;
            window1.MapEvent    += OnShown;
        }
示例#13
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="owner">The owning view.</param>
 public PropertyMultiModelView(ViewBase owner) : base(owner)
 {
 }