예제 #1
0
        void LoadColumnTwo(object state = null)
        {
            ColumnTwo.CloseAndRemoveAllChildren();

            double buildHeight = ActiveSliceSettings.Instance.BuildHeight;

#if NEW_TWO_COLUMN_MODE
            PartPreviewContent partViewContent = new PartPreviewContent(PrinterConnectionAndCommunication.Instance.ActivePrintItem, true, View3DWidget.AutoRotate.Enabled, false);
            partViewContent.AnchorAll();

            ColumnTwo.AddChild(partViewContent);
#else
            part3DView = new View3DWidget(PrinterConnectionAndCommunication.Instance.ActivePrintItem,
                                          new Vector3(ActiveSliceSettings.Instance.BedSize, buildHeight),
                                          ActiveSliceSettings.Instance.BedCenter,
                                          ActiveSliceSettings.Instance.BedShape,
                                          View3DWidget.WindowType.Embeded,
                                          View3DWidget.AutoRotate.Enabled);
            part3DView.Margin = new BorderDouble(bottom: 4);
            part3DView.AnchorAll();

            partGcodeView = new ViewGcodeBasic(PrinterConnectionAndCommunication.Instance.ActivePrintItem,
                                               new Vector3(ActiveSliceSettings.Instance.BedSize, buildHeight),
                                               ActiveSliceSettings.Instance.BedCenter,
                                               ActiveSliceSettings.Instance.BedShape,
                                               false);
            partGcodeView.AnchorAll();

            ColumnTwo.AddChild(part3DView);
            ColumnTwo.AddChild(partGcodeView);
#endif

            ColumnTwo.AnchorAll();
        }
        public void SetBreadCrumbs(object sender, EventArgs e)
        {
            breadCrumbDisplayHolder.CloseAndRemoveAllChildren();
            LibraryProvider currentProvider = LibraryDataView.CurrentLibraryProvider;
            bool            first           = true;

            while (currentProvider != null)
            {
                if (!first)
                {
                    GuiWidget separator = new TextWidget(">", textColor: ActiveTheme.Instance.PrimaryTextColor);
                    separator.VAnchor = VAnchor.ParentCenter;
                    separator.Margin  = new BorderDouble(3, 0);
                    breadCrumbDisplayHolder.AddChild(separator);
                }

                Button          installUpdateLink    = textImageButtonFactory.Generate(currentProvider.Name);
                LibraryProvider localCurrentProvider = currentProvider;
                installUpdateLink.Click += (sender2, e2) =>
                {
                    UiThread.RunOnIdle(() => {
                        LibraryDataView.CurrentLibraryProvider = localCurrentProvider;
                        libraryDataView.RebuildView();
                    });
                };
                breadCrumbDisplayHolder.AddChild(installUpdateLink);
                first           = false;
                currentProvider = currentProvider.ParentLibraryProvider;
            }

            libraryDataView.ClearSelectedItems();
        }
예제 #3
0
        void LoadColumnThree(object state = null)
        {
            ColumnThree.CloseAndRemoveAllChildren();
            ThirdPanelTabView thirdPanelTabView = new ThirdPanelTabView();

            thirdPanelTabView.Name = "For - WideScreenPanel {0}".FormatWith(ColumnThreeCount++);
            ColumnThree.AddChild(thirdPanelTabView);
            ColumnThree.Width = ColumnTheeFixedWidth; //Ordering here matters - must go after children are added
        }
예제 #4
0
        private void LoadColumnTwo()
        {
            ColumnTwo.CloseAndRemoveAllChildren();

            PartPreviewContent partViewContent = new PartPreviewContent(PrinterConnectionAndCommunication.Instance.ActivePrintItem, View3DWidget.WindowMode.Embeded, View3DWidget.AutoRotate.Enabled);

            partViewContent.AnchorAll();

            ColumnTwo.AddChild(partViewContent);

            ColumnTwo.AnchorAll();
        }
예제 #5
0
        private void AddDisplayControls(FlowLayoutWidget buttonPanel)
        {
            buttonPanel.CloseAndRemoveAllChildren();

            double oldWidth = textImageButtonFactory.FixedWidth;

            textImageButtonFactory.FixedWidth = 44;

            FlowLayoutWidget layerInfoContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);

            layerInfoContainer.HAnchor = HAnchor.ParentLeftRight;
            layerInfoContainer.Padding = new BorderDouble(5);

            // put in a show grid check box
            {
                CheckBox showGrid = new CheckBox(LocalizedString.Get("Grid"), textColor: ActiveTheme.Instance.PrimaryTextColor);
                showGrid.Checked              = gcodeViewWidget.RenderGrid;
                meshViewerWidget.RenderBed    = showGrid.Checked;
                showGrid.CheckedStateChanged += (sender, e) =>
                {
                    gcodeViewWidget.RenderGrid = showGrid.Checked;
                    meshViewerWidget.RenderBed = showGrid.Checked;
                };
                layerInfoContainer.AddChild(showGrid);
            }

            // put in a show moves checkbox
            {
                CheckBox showMoves = new CheckBox(LocalizedString.Get("Moves"), textColor: ActiveTheme.Instance.PrimaryTextColor);
                showMoves.Checked              = gcodeViewWidget.RenderMoves;
                showMoves.CheckedStateChanged += (sender, e) =>
                {
                    gcodeViewWidget.RenderMoves = showMoves.Checked;
                };
                layerInfoContainer.AddChild(showMoves);
            }

            // put in a show Retractions checkbox
            {
                CheckBox showRetractions = new CheckBox(LocalizedString.Get("Retractions"), textColor: ActiveTheme.Instance.PrimaryTextColor);
                showRetractions.Checked              = gcodeViewWidget.RenderRetractions;
                showRetractions.CheckedStateChanged += (sender, e) =>
                {
                    gcodeViewWidget.RenderRetractions = showRetractions.Checked;
                };
                layerInfoContainer.AddChild(showRetractions);
            }

            // put in a show speed checkbox
            {
                CheckBox showSpeeds = new CheckBox(LocalizedString.Get("Speeds"), textColor: ActiveTheme.Instance.PrimaryTextColor);
                showSpeeds.Checked              = gcodeViewWidget.RenderSpeeds;
                showSpeeds.CheckedStateChanged += (sender, e) =>
                {
                    gcodeViewWidget.RenderSpeeds = showSpeeds.Checked;
                };
                layerInfoContainer.AddChild(showSpeeds);
            }

            // put in a simulate extrusion checkbox
            {
                CheckBox simulateExtrusion = new CheckBox(LocalizedString.Get("Extrusion"), textColor: ActiveTheme.Instance.PrimaryTextColor);
                simulateExtrusion.Checked              = gcodeViewWidget.SimulateExtrusion;
                simulateExtrusion.CheckedStateChanged += (sender, e) =>
                {
                    gcodeViewWidget.SimulateExtrusion = simulateExtrusion.Checked;
                };
                layerInfoContainer.AddChild(simulateExtrusion);
            }

            // put in a simulate extrusion checkbox
            if (ActiveSliceSettings.Instance.ExtruderCount > 1)
            {
                CheckBox hideExtruderOffsets = new CheckBox("Hide Offsets", textColor: ActiveTheme.Instance.PrimaryTextColor);
                hideExtruderOffsets.Checked              = gcodeViewWidget.HideExtruderOffsets;
                hideExtruderOffsets.CheckedStateChanged += (sender, e) =>
                {
                    gcodeViewWidget.HideExtruderOffsets = hideExtruderOffsets.Checked;
                };
                layerInfoContainer.AddChild(hideExtruderOffsets);
            }

            // put in a show 3D view checkbox
            {
                viewControlsToggle.twoDimensionButton.CheckedStateChanged += (sender, e) =>
                {
                    SetLayerViewType();
                };
                viewControlsToggle.threeDimensionButton.CheckedStateChanged += (sender, e) =>
                {
                    SetLayerViewType();
                };
                SetLayerViewType();
            }

            // Put in the sync to print checkbox
            if (!widgetHasCloseButton)
            {
                syncToPrint                      = new CheckBox("Sync To Print".Localize(), textColor: ActiveTheme.Instance.PrimaryTextColor);
                syncToPrint.Checked              = (UserSettings.Instance.get("LayerViewSyncToPrint") == "True");
                syncToPrint.CheckedStateChanged += (sender, e) =>
                {
                    UserSettings.Instance.set("LayerViewSyncToPrint", syncToPrint.Checked.ToString());
                    SetSyncToPrintVisibility();
                };
                layerInfoContainer.AddChild(syncToPrint);

                // The idea here is we just got asked to rebuild the window (and it is being created now)
                // because the gcode finished creating for the print that is printing.
                // We don't want to be notified if any other updates happen to this gcode while it is printing.
                if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting &&
                    PrinterConnectionAndCommunication.Instance.ActivePrintItem == printItem)
                {
                    printItem.SlicingOutputMessage.UnregisterEvent(sliceItem_SlicingOutputMessage, ref unregisterEvents);
                    printItem.SlicingDone.UnregisterEvent(sliceItem_Done, ref unregisterEvents);

                    generateGCodeButton.Visible = false;

                    // However if the print finished or is canceled we are going to want to get updates again. So, hook the status event
                    PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(HookUpGCodeMessagesWhenDonePrinting, ref unregisterEvents);
                    UiThread.RunOnIdle((state) =>
                    {
                        SetSyncToPrintVisibility();
                    });
                }
            }

            //layerInfoContainer.AddChild(new CheckBox("Show Retractions", textColor: ActiveTheme.Instance.PrimaryTextColor));

            buttonPanel.AddChild(layerInfoContainer);

            textImageButtonFactory.FixedWidth = oldWidth;
        }
예제 #6
0
        private void AddModelInfo(FlowLayoutWidget buttonPanel)
        {
            buttonPanel.CloseAndRemoveAllChildren();

            double oldWidth = textImageButtonFactory.FixedWidth;

            textImageButtonFactory.FixedWidth = 44;

            FlowLayoutWidget modelInfoContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);

            modelInfoContainer.HAnchor = HAnchor.ParentLeftRight;
            modelInfoContainer.Padding = new BorderDouble(5);

            string printTimeLabel     = "Print Time".Localize().ToUpper();
            string printTimeLabelFull = string.Format("{0}:", printTimeLabel);

            // put in the print time
            modelInfoContainer.AddChild(new TextWidget(printTimeLabelFull, textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 10));
            {
                string timeRemainingText = "---";

                if (gcodeViewWidget != null && gcodeViewWidget.LoadedGCode != null)
                {
                    int secondsRemaining = (int)gcodeViewWidget.LoadedGCode.Instruction(0).secondsToEndFromHere;
                    int hoursRemaining   = (int)(secondsRemaining / (60 * 60));
                    int minutesRemaining = (int)((secondsRemaining + 30) / 60 - hoursRemaining * 60); // +30 for rounding
                    secondsRemaining = secondsRemaining % 60;
                    if (hoursRemaining > 0)
                    {
                        timeRemainingText = string.Format("{0} h, {1} min", hoursRemaining, minutesRemaining);
                    }
                    else
                    {
                        timeRemainingText = string.Format("{0} min", minutesRemaining);
                    }
                }

                GuiWidget estimatedPrintTime = new TextWidget(string.Format("{0}", timeRemainingText), textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 14);
                //estimatedPrintTime.HAnchor = Agg.UI.HAnchor.ParentLeft;
                estimatedPrintTime.Margin = new BorderDouble(0, 9, 0, 3);
                modelInfoContainer.AddChild(estimatedPrintTime);
            }

            //modelInfoContainer.AddChild(new TextWidget("Size:", textColor: ActiveTheme.Instance.PrimaryTextColor));

            string filamentLengthLabel     = "Filament Length".Localize().ToUpper();
            string filamentLengthLabelFull = string.Format("{0}:", filamentLengthLabel);

            // show the filament used
            modelInfoContainer.AddChild(new TextWidget(filamentLengthLabelFull, textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 9));
            {
                double filamentUsed = gcodeViewWidget.LoadedGCode.GetFilamentUsedMm(ActiveSliceSettings.Instance.NozzleDiameter);

                GuiWidget estimatedPrintTime = new TextWidget(string.Format("{0:0.0} mm", filamentUsed), pointSize: 14, textColor: ActiveTheme.Instance.PrimaryTextColor);
                //estimatedPrintTime.HAnchor = Agg.UI.HAnchor.ParentLeft;
                estimatedPrintTime.Margin = new BorderDouble(0, 9, 0, 3);
                modelInfoContainer.AddChild(estimatedPrintTime);
            }

            string filamentVolumeLabel     = "Filament Volume".Localize().ToUpper();
            string filamentVolumeLabelFull = string.Format("{0}:", filamentVolumeLabel);

            modelInfoContainer.AddChild(new TextWidget(filamentVolumeLabelFull, textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 9));
            {
                double filamentMm3 = gcodeViewWidget.LoadedGCode.GetFilamentCubicMm(ActiveSliceSettings.Instance.FilamentDiameter);

                GuiWidget estimatedPrintTime = new TextWidget(string.Format("{0:0.00} cm3", filamentMm3 / 1000), pointSize: 14, textColor: ActiveTheme.Instance.PrimaryTextColor);
                //estimatedPrintTime.HAnchor = Agg.UI.HAnchor.ParentLeft;
                estimatedPrintTime.Margin = new BorderDouble(0, 9, 0, 3);
                modelInfoContainer.AddChild(estimatedPrintTime);
            }

            string weightLabel     = "Est. Weight".Localize().ToUpper();
            string weightLabelFull = string.Format("{0}:", weightLabel);

            modelInfoContainer.AddChild(new TextWidget(weightLabelFull, pointSize: 9, textColor: ActiveTheme.Instance.PrimaryTextColor));
            {
                var    density      = 1.0;
                string filamentType = "PLA";
                if (filamentType == "ABS")
                {
                    density = 1.04;
                }
                else if (filamentType == "PLA")
                {
                    density = 1.24;
                }

                double filamentWeightGrams = gcodeViewWidget.LoadedGCode.GetFilamentWeightGrams(ActiveSliceSettings.Instance.FilamentDiameter, density);

                GuiWidget estimatedPrintTime = new TextWidget(string.Format("{0:0.00} g", filamentWeightGrams), pointSize: 14, textColor: ActiveTheme.Instance.PrimaryTextColor);
                //estimatedPrintTime.HAnchor = Agg.UI.HAnchor.ParentLeft;
                estimatedPrintTime.Margin = new BorderDouble(0, 9, 0, 3);
                modelInfoContainer.AddChild(estimatedPrintTime);
            }

            //modelInfoContainer.AddChild(new TextWidget("Layer Count:", textColor: ActiveTheme.Instance.PrimaryTextColor));

            buttonPanel.AddChild(modelInfoContainer);

            textImageButtonFactory.FixedWidth = oldWidth;
        }