Пример #1
0
        private void AddSettingsTabBar(GuiWidget parent, GuiWidget widgetTodockTo)
        {
            sideBar = new DockingTabControl(widgetTodockTo, DockSide.Right, printer, theme)
            {
                Name            = "DockingTabControl",
                ControlIsPinned = printer.ViewState.SliceSettingsTabPinned
            };
            sideBar.PinStatusChanged += (s, e) =>
            {
                printer.ViewState.SliceSettingsTabPinned = sideBar.ControlIsPinned;
            };
            parent.AddChild(sideBar);

            sideBar.AddPage(
                "Slice Settings".Localize(),
                sliceSettingsWidget = new SliceSettingsWidget(
                    printer,
                    new SettingsContext(
                        printer,
                        null,
                        NamedSettingsLayers.All),
                    theme));

            sideBar.AddPage("Controls".Localize(), new ManualPrinterControls(printer, theme));

            sideBar.AddPage("Terminal".Localize(), new TerminalWidget(printer, theme)
            {
                VAnchor = VAnchor.Stretch,
                HAnchor = HAnchor.Stretch
            });

            this.ProcessOptionalTab();
        }
Пример #2
0
        private void AddSettingsTabBar(GuiWidget parent, GuiWidget widgetTodockTo)
        {
            sideBar = new DockingTabControl(widgetTodockTo, DockSide.Right, printer, theme)
            {
                Name            = "DockingTabControl",
                ControlIsPinned = printer.ViewState.SliceSettingsTabPinned,
                MinDockingWidth = 400 * (int)GuiWidget.DeviceScale
            };
            sideBar.PinStatusChanged += (s, e) =>
            {
                printer.ViewState.SliceSettingsTabPinned = sideBar.ControlIsPinned;
            };
            parent.AddChild(sideBar);

            sideBar.AddPage(
                "Slice Settings",
                "Slice Settings".Localize(),
                sliceSettingsWidget = new SliceSettingsWidget(
                    printer,
                    new SettingsContext(
                        printer,
                        null,
                        NamedSettingsLayers.All),
                    theme));

            this.ProcessOptionalTabs();
        }
Пример #3
0
        public ViewGcodeBasic(PrintItemWrapper printItem, Vector3 viewerVolume, Vector2 bedCenter, MeshViewerWidget.BedShape bedShape, bool addCloseButton)
        {
            this.viewerVolume    = viewerVolume;
            this.bedShape        = bedShape;
            this.bedCenter       = bedCenter;
            widgetHasCloseButton = addCloseButton;
            this.printItem       = printItem;

            if (ActiveTheme.Instance.DisplayMode == ActiveTheme.ApplicationDisplayType.Touchscreen)
            {
                sliderWidth = 20;
            }
            else
            {
                sliderWidth = 10;
            }

            CreateAndAddChildren(null);

            SliceSettingsWidget.RegisterForSettingsChange("bed_size", RecreateBedAndPartPosition, ref unregisterEvents);
            SliceSettingsWidget.RegisterForSettingsChange("print_center", RecreateBedAndPartPosition, ref unregisterEvents);
            SliceSettingsWidget.RegisterForSettingsChange("build_height", RecreateBedAndPartPosition, ref unregisterEvents);
            SliceSettingsWidget.RegisterForSettingsChange("bed_shape", RecreateBedAndPartPosition, ref unregisterEvents);
            SliceSettingsWidget.RegisterForSettingsChange("center_part_on_bed", RecreateBedAndPartPosition, ref unregisterEvents);

            SliceSettingsWidget.RegisterForSettingsChange("extruder_offset", Clear3DGCode, ref unregisterEvents);

            ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent(RecreateBedAndPartPosition, ref unregisterEvents);
        }
Пример #4
0
 public SliceSettingsWidgetUiState(SliceSettingsWidget settingsWidgetToCopyFrom)
 {
     if (settingsWidgetToCopyFrom != null)
     {
         settingsWidgetToCopyFrom.CurrentlyActiveCategory(out selectedCategory.index, out selectedCategory.name);
         settingsWidgetToCopyFrom.CurrentlyActiveGroup(out selectedGroup.index, out selectedGroup.name);
     }
 }
 public SliceSettingsWidgetUiState(SliceSettingsWidget settingsWidgetToCopyFrom)
 {
     if (settingsWidgetToCopyFrom != null)
     {
         settingsWidgetToCopyFrom.CurrentlyActiveCategory(out selectedCategory.index, out selectedCategory.name);
         settingsWidgetToCopyFrom.CurrentlyActiveGroup(out selectedGroup.index, out selectedGroup.name);
     }
 }
        public void CheckIfShouldBeShownParseTests()
        {
            {
                string[] settings = new string[] { SettingsKey.has_heated_bed, "0" };
                var      profile  = GettProfile(settings);
                Assert.IsFalse(SliceSettingsWidget.ParseShowString("has_heated_bed", profile, null));
                Assert.IsTrue(SliceSettingsWidget.ParseShowString("!has_heated_bed", profile, null));
            }

            {
                string[] settings = new string[] { SettingsKey.has_heated_bed, "1" };
                var      profile  = GettProfile(settings);
                Assert.IsTrue(SliceSettingsWidget.ParseShowString("has_heated_bed", profile, null));
                Assert.IsFalse(SliceSettingsWidget.ParseShowString("!has_heated_bed", profile, null));
            }

            {
                string[] settings = new string[] { SettingsKey.has_heated_bed, "0", SettingsKey.auto_connect, "0" };
                var      profile  = GettProfile(settings);
                Assert.IsTrue(!SliceSettingsWidget.ParseShowString("has_heated_bed&auto_connect", profile, null));
                Assert.IsTrue(!SliceSettingsWidget.ParseShowString("has_heated_bed&!auto_connect", profile, null));
                Assert.IsTrue(!SliceSettingsWidget.ParseShowString("!has_heated_bed&auto_connect", profile, null));
                Assert.IsTrue(SliceSettingsWidget.ParseShowString("!has_heated_bed&!auto_connect", profile, null));
            }
            {
                string[] settings = new string[] { SettingsKey.has_heated_bed, "0", SettingsKey.auto_connect, "1" };
                var      profile  = GettProfile(settings);
                Assert.IsTrue(!SliceSettingsWidget.ParseShowString("has_heated_bed&auto_connect", profile, null));
                Assert.IsTrue(!SliceSettingsWidget.ParseShowString("has_heated_bed&!auto_connect", profile, null));
                Assert.IsTrue(SliceSettingsWidget.ParseShowString("!has_heated_bed&auto_connect", profile, null));
                Assert.IsTrue(!SliceSettingsWidget.ParseShowString("!has_heated_bed&!auto_connect", profile, null));
            }
            {
                string[] settings = new string[] { SettingsKey.has_heated_bed, "1", SettingsKey.auto_connect, "0" };
                var      profile  = GettProfile(settings);
                Assert.IsTrue(!SliceSettingsWidget.ParseShowString("has_heated_bed&auto_connect", profile, null));
                Assert.IsTrue(SliceSettingsWidget.ParseShowString("has_heated_bed&!auto_connect", profile, null));
                Assert.IsTrue(!SliceSettingsWidget.ParseShowString("!has_heated_bed&auto_connect", profile, null));
                Assert.IsTrue(!SliceSettingsWidget.ParseShowString("!has_heated_bed&!auto_connect", profile, null));
            }
            {
                string[] settings = new string[] { SettingsKey.has_heated_bed, "1", SettingsKey.auto_connect, "1" };
                var      profile  = GettProfile(settings);
                Assert.IsTrue(SliceSettingsWidget.ParseShowString("has_heated_bed&auto_connect", profile, null));
                Assert.IsTrue(!SliceSettingsWidget.ParseShowString("has_heated_bed&!auto_connect", profile, null));
                Assert.IsTrue(!SliceSettingsWidget.ParseShowString("!has_heated_bed&auto_connect", profile, null));
                Assert.IsTrue(!SliceSettingsWidget.ParseShowString("!has_heated_bed&!auto_connect", profile, null));
            }

            {
                string[] settings = new string[] { SettingsKey.has_heated_bed, "1", SettingsKey.auto_connect, "1", SettingsKey.has_fan, "1" };
                var      profile  = GettProfile(settings);
                Assert.IsTrue(SliceSettingsWidget.ParseShowString("has_heated_bed&auto_connect&has_fan", profile, null));
                Assert.IsTrue(!SliceSettingsWidget.ParseShowString("has_heated_bed&auto_connect&!has_fan", profile, null));
                Assert.IsTrue(!SliceSettingsWidget.ParseShowString("has_heated_bed&!auto_connect&has_fan", profile, null));
                Assert.IsTrue(!SliceSettingsWidget.ParseShowString("!has_heated_bed&auto_connect&has_fan", profile, null));
            }
        }
        public PartPreview3DWidget()
        {
            SliceSettingsWidget.RegisterForSettingsChange("bed_size", RecreateBedAndPartPosition, ref unregisterEvents);
            SliceSettingsWidget.RegisterForSettingsChange("print_center", RecreateBedAndPartPosition, ref unregisterEvents);
            SliceSettingsWidget.RegisterForSettingsChange("build_height", RecreateBedAndPartPosition, ref unregisterEvents);
            SliceSettingsWidget.RegisterForSettingsChange("bed_shape", RecreateBedAndPartPosition, ref unregisterEvents);
            SliceSettingsWidget.RegisterForSettingsChange("center_part_on_bed", RecreateBedAndPartPosition, ref unregisterEvents);
#if false
            "extruder_offset",
#endif

            ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent(RecreateBedAndPartPosition, ref unregisterEvents);
        }
Пример #8
0
        public PartPreview3DWidget()
        {
            SliceSettingsWidget.RegisterForSettingsChange("bed_size", SetFlagToRecreateBedAndPartPosition, ref unregisterEvents);
            SliceSettingsWidget.RegisterForSettingsChange("print_center", SetFlagToRecreateBedAndPartPosition, ref unregisterEvents);
            SliceSettingsWidget.RegisterForSettingsChange("build_height", SetFlagToRecreateBedAndPartPosition, ref unregisterEvents);
            SliceSettingsWidget.RegisterForSettingsChange("bed_shape", SetFlagToRecreateBedAndPartPosition, ref unregisterEvents);
            SliceSettingsWidget.RegisterForSettingsChange("center_part_on_bed", SetFlagToRecreateBedAndPartPosition, ref unregisterEvents);

            ApplicationController.Instance.ReloadAdvancedControlsPanelTrigger.RegisterEvent(SetFlagToRecreateBedAndPartPosition, ref unregisterEvents);
#if false
            "extruder_offset",
#endif

            ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent(SetFlagToRecreateBedAndPartPosition, ref unregisterEvents);
        }
Пример #9
0
        public void CheckIfShouldBeShownParseTests()
        {
            StaticData.Instance = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
            MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4));

            {
                string[] settings = new string[] { SettingsKey.has_heated_bed, "0" };
                var      profile  = GetProfile(settings);
                Assert.IsFalse(SliceSettingsWidget.ParseShowString("has_heated_bed", profile, null));
                Assert.IsTrue(SliceSettingsWidget.ParseShowString("!has_heated_bed", profile, null));
            }

            {
                string[] settings = new string[] { SettingsKey.has_heated_bed, "1" };
                var      profile  = GetProfile(settings);
                Assert.IsTrue(SliceSettingsWidget.ParseShowString("has_heated_bed", profile, null));
                Assert.IsFalse(SliceSettingsWidget.ParseShowString("!has_heated_bed", profile, null));
            }

            {
                string[] settings = new string[] { SettingsKey.has_heated_bed, "0", SettingsKey.auto_connect, "0" };
                var      profile  = GetProfile(settings);
                Assert.IsTrue(!SliceSettingsWidget.ParseShowString("has_heated_bed&auto_connect", profile, null));
                Assert.IsTrue(!SliceSettingsWidget.ParseShowString("has_heated_bed&!auto_connect", profile, null));
                Assert.IsTrue(!SliceSettingsWidget.ParseShowString("!has_heated_bed&auto_connect", profile, null));
                Assert.IsTrue(SliceSettingsWidget.ParseShowString("!has_heated_bed&!auto_connect", profile, null));
            }
            {
                string[] settings = new string[] { SettingsKey.has_heated_bed, "0", SettingsKey.auto_connect, "1" };
                var      profile  = GetProfile(settings);
                Assert.IsTrue(!SliceSettingsWidget.ParseShowString("has_heated_bed&auto_connect", profile, null));
                Assert.IsTrue(!SliceSettingsWidget.ParseShowString("has_heated_bed&!auto_connect", profile, null));
                Assert.IsTrue(SliceSettingsWidget.ParseShowString("!has_heated_bed&auto_connect", profile, null));
                Assert.IsTrue(!SliceSettingsWidget.ParseShowString("!has_heated_bed&!auto_connect", profile, null));
            }
            {
                string[] settings = new string[] { SettingsKey.has_heated_bed, "1", SettingsKey.auto_connect, "0" };
                var      profile  = GetProfile(settings);
                Assert.IsTrue(!SliceSettingsWidget.ParseShowString("has_heated_bed&auto_connect", profile, null));
                Assert.IsTrue(SliceSettingsWidget.ParseShowString("has_heated_bed&!auto_connect", profile, null));
                Assert.IsTrue(!SliceSettingsWidget.ParseShowString("!has_heated_bed&auto_connect", profile, null));
                Assert.IsTrue(!SliceSettingsWidget.ParseShowString("!has_heated_bed&!auto_connect", profile, null));
            }
            {
                string[] settings = new string[] { SettingsKey.has_heated_bed, "1", SettingsKey.auto_connect, "1" };
                var      profile  = GetProfile(settings);
                Assert.IsTrue(SliceSettingsWidget.ParseShowString("has_heated_bed&auto_connect", profile, null));
                Assert.IsTrue(!SliceSettingsWidget.ParseShowString("has_heated_bed&!auto_connect", profile, null));
                Assert.IsTrue(!SliceSettingsWidget.ParseShowString("!has_heated_bed&auto_connect", profile, null));
                Assert.IsTrue(!SliceSettingsWidget.ParseShowString("!has_heated_bed&!auto_connect", profile, null));
            }

            {
                string[] settings = new string[] { SettingsKey.has_heated_bed, "1", SettingsKey.auto_connect, "1", SettingsKey.has_fan, "1" };
                var      profile  = GetProfile(settings);
                Assert.IsTrue(SliceSettingsWidget.ParseShowString("has_heated_bed&auto_connect&has_fan", profile, null));
                Assert.IsTrue(!SliceSettingsWidget.ParseShowString("has_heated_bed&auto_connect&!has_fan", profile, null));
                Assert.IsTrue(!SliceSettingsWidget.ParseShowString("has_heated_bed&!auto_connect&has_fan", profile, null));
                Assert.IsTrue(!SliceSettingsWidget.ParseShowString("!has_heated_bed&auto_connect&has_fan", profile, null));
            }
        }