protected override void AddChildElements()
        {
            actionBarButtonFactory.invertImageLocation = false;
            string connectString = new LocalizedString("Connect").Translated;
            connectPrinterButton = actionBarButtonFactory.Generate(connectString, "icon_power_32x32.png");
            connectPrinterButton.Margin = new BorderDouble(3, 0);
            connectPrinterButton.VAnchor = VAnchor.ParentCenter;
            connectPrinterButton.Cursor = Cursors.Hand;

            string disconnectString = new LocalizedString("Disconnect").Translated;
            disconnectPrinterButton = actionBarButtonFactory.Generate(disconnectString, "icon_power_32x32.png");
            disconnectPrinterButton.Margin = new BorderDouble(3, 0);
            disconnectPrinterButton.VAnchor = VAnchor.ParentCenter;
            disconnectPrinterButton.Visible = false;
            disconnectPrinterButton.Cursor = Cursors.Hand;

            selectActivePrinterButton = new PrinterSelectButton();
            selectActivePrinterButton.HAnchor = HAnchor.ParentLeftRight;
            selectActivePrinterButton.Cursor = Cursors.Hand;

            actionBarButtonFactory.invertImageLocation = true;

            this.AddChild(connectPrinterButton);
            this.AddChild(disconnectPrinterButton);
            this.AddChild(selectActivePrinterButton);
            this.AddChild(CreateOptionsMenu());
        }
        private FlowLayoutWidget createPrinterNameContainer()
        {
            FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.TopToBottom);
            container.Margin = new BorderDouble(0, 5);
            BorderDouble elementMargin = new BorderDouble(top: 3);

			string printerNameLabelTxt = new LocalizedString("Printer Name").Translated;
			string printerNameLabelTxtFull = string.Format ("{0}:", printerNameLabelTxt);
			TextWidget printerNameLabel = new TextWidget(printerNameLabelTxtFull, 0, 0, 12);
            printerNameLabel.TextColor = this.defaultTextColor;
            printerNameLabel.HAnchor = HAnchor.ParentLeftRight;
            printerNameLabel.Margin = new BorderDouble(0, 0, 0, 1);

            printerNameInput = new MHTextEditWidget(this.ActivePrinter.Name);
            printerNameInput.HAnchor = HAnchor.ParentLeftRight;

			printerNameError = new TextWidget(new LocalizedString("Give your printer a name.").Translated, 0, 0, 10);
            printerNameError.TextColor = RGBA_Bytes.White;
            printerNameError.HAnchor = HAnchor.ParentLeftRight;
            printerNameError.Margin = elementMargin;

            container.AddChild(printerNameLabel);
            container.AddChild(printerNameInput);
            container.AddChild(printerNameError);
            container.HAnchor = HAnchor.ParentLeftRight;
            return container;
        }
        GuiWidget CreateOptionsMenu()
        {
            ImageBuffer gearImage = new ImageBuffer();
            string imagePathAndFile = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "gear_icon.png");
            ImageBMPIO.LoadImageData(imagePathAndFile, gearImage);

            FlowLayoutWidget leftToRight = new FlowLayoutWidget();
            leftToRight.Margin = new BorderDouble(5, 0);
            string optionsString = new LocalizedString("Options").Translated;
            TextWidget optionsText = new TextWidget(optionsString, textColor: RGBA_Bytes.White);
            optionsText.VAnchor = Agg.UI.VAnchor.ParentCenter;
            optionsText.Margin = new BorderDouble(0, 0, 3, 0);
            leftToRight.AddChild(optionsText);
            GuiWidget gearWidget = new ImageWidget(gearImage);
            gearWidget.VAnchor = Agg.UI.VAnchor.ParentCenter;
            leftToRight.AddChild(gearWidget);
            leftToRight.HAnchor = HAnchor.FitToChildren;
            leftToRight.VAnchor = VAnchor.FitToChildren;

            Menu optionMenu = new Menu(leftToRight);
            optionMenu.OpenOffset = new Vector2(-2, -10);
            optionMenu.VAnchor = Agg.UI.VAnchor.ParentCenter;
            optionMenu.MenuItems.Add(new MenuItem(new ThemeColorSelectorWidget()));

            return optionMenu;
        }
Example #4
0
        public PrinterChooser(string selectedMake = null)
        {
			string defaultManufacturerLbl = new LocalizedString ("Select Make").Translated;
			string defaultManufacturerLblFull = string.Format ("- {0} -", defaultManufacturerLbl);
			ManufacturerDropList = new StyledDropDownList(defaultManufacturerLblFull);            
            bool addOther = false;
            string pathToWhitelist = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "OEMSettings", "PrinterSettingsWhitelist.txt");
            string[] folderWhitelist = File.ReadAllLines(pathToWhitelist);
            string pathToManufacturers = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "PrinterSettings");
            if (Directory.Exists(pathToManufacturers))
            {
                int index = 0;
                int preselectIndex = -1;
                foreach (string manufacturerDirectory in Directory.EnumerateDirectories(pathToManufacturers))
                {
                    string folderName = new System.IO.DirectoryInfo(manufacturerDirectory).Name;
                    if (folderWhitelist.Contains(folderName))
                    {
                        string manufacturer = Path.GetFileName(manufacturerDirectory);
                        if (manufacturer == "Other")
                        {
                            addOther = true;
                        }
                        else
                        {
                            ManufacturerDropList.AddItem(manufacturer);
                            if (selectedMake != null)
                            {
                                if (manufacturer == selectedMake)
                                {
                                    preselectIndex = index;
                                }
                            }
                        
                            index++;

                        }
                    }
                }
                if (addOther)
                {
                    if (selectedMake != null && preselectIndex == -1)
                    {
                        preselectIndex = index;
                    }
					ManufacturerDropList.AddItem(new LocalizedString("Other").Translated);
                }
                if (preselectIndex != -1)
                {
                    ManufacturerDropList.SelectedIndex = preselectIndex;
                }

            }

            AddChild(ManufacturerDropList);

            HAnchor = HAnchor.FitToChildren;
            VAnchor = VAnchor.FitToChildren;
        }
Example #5
0
        public void QueuePartForSlicing(PrintItemWrapper itemToQueue)
        {
            itemToQueue.DoneSlicing = false;
			string preparingToSliceModelTxt = new LocalizedString("Preparing to slice model").Translated;
			string peparingToSliceModelFull = string.Format ("{0}...", preparingToSliceModelTxt);
			itemToQueue.OnSlicingOutputMessage(new StringEventArgs(peparingToSliceModelFull));
            using (TimedLock.Lock(listOfSlicingItems, "QueuePartForSlicing"))
            {
                //Add to thumbnail generation queue
                listOfSlicingItems.Add(itemToQueue);
            }
        }
        public SavePartsSheetFeedbackWindow(int totalParts, string firstPartName, RGBA_Bytes backgroundColor)
            : base(300, 500)
        {
            BackgroundColor = backgroundColor;
			string savePartSheetTitle = new LocalizedString("MatterControl").Translated;
			string savePartSheetTitleFull = new LocalizedString("Saving to Parts Sheet").Translated;
			Title = string.Format("{0} - {1}",savePartSheetTitle, savePartSheetTitleFull) ;
            this.totalParts = totalParts;

            feedback.Padding = new BorderDouble(5, 5);
            feedback.AnchorAll();
            AddChild(feedback);
        }
        //PartPreview3DGcode part3DGcodeView;

        public PartPreviewMainWindow(PrintItemWrapper printItem)
            : base(690, 340)
        {
			string partPreviewTitle = new LocalizedString ("MatterControl").Translated;
			Title = string.Format("{0}: ", partPreviewTitle) + Path.GetFileName(printItem.Name);

            BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

            TabControl tabControl = new TabControl();
            tabControl.TabBar.BorderColor = new RGBA_Bytes(0, 0, 0, 0);
            tabControl.TabBar.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

            double buildHeight = ActiveSliceSettings.Instance.BuildHeight;

			string part3DViewLblBeg = ("3D");
			string part3DViewLblEnd = new LocalizedString ("View").Translated;
			string part3DViewLblFull = string.Format("{0} {1} ", part3DViewLblBeg, part3DViewLblEnd);
            part3DView = new View3DTransformPart(printItem, new Vector3(ActiveSliceSettings.Instance.BedSize, buildHeight), ActiveSliceSettings.Instance.BedShape);
			TabPage partPreview3DView = new TabPage(part3DView, part3DViewLblFull);

            partGcodeView = new GcodeViewBasic(printItem, ActiveSliceSettings.Instance.GetBedSize, ActiveSliceSettings.Instance.GetBedCenter);
			TabPage layerView = new TabPage(partGcodeView, new LocalizedString("Layer View").Translated);

            //part3DGcodeView = new PartPreview3DGcode(printItem.FileLocation, bedXSize, bedYSize);

            tabControl.AddTab(new SimpleTextTabWidget(partPreview3DView , 16,
                        ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes()));

            tabControl.AddTab(new SimpleTextTabWidget(layerView, 16,
                        ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes()));       

            this.AddChild(tabControl);
            this.AnchorAll();

            AddHandlers();

            Width = 640;
            Height = 480;

            ShowAsSystemWindow();
            MinimumSize = new Vector2(400, 300);

            // We do this after showing the system window so that when we try and take fucus the parent window (the system window)
            // exists and can give the fucus to its child the gecode window.
            if (Path.GetExtension(printItem.FileLocation).ToUpper() == ".GCODE")
            {
                tabControl.TabBar.SwitchToPage(layerView);
                partGcodeView.Focus();
            }
        }
        private FlowLayoutWidget createComPortContainer()
        {
            FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.TopToBottom);
            container.Margin = new BorderDouble(0);
            container.VAnchor = VAnchor.ParentBottomTop;
            BorderDouble elementMargin = new BorderDouble(top: 3);

			string serialPortLabel = new LocalizedString("Serial Port").Translated;
			string serialPortLabelFull = string.Format("{0}:", serialPortLabel);

			TextWidget comPortLabel = new TextWidget(serialPortLabelFull, 0, 0, 12);
            comPortLabel.TextColor = this.defaultTextColor;
            comPortLabel.Margin = new BorderDouble(0, 0, 0, 10);
            comPortLabel.HAnchor = HAnchor.ParentLeftRight;

            FlowLayoutWidget comPortWidget = GetComPortWidget();
            comPortWidget.HAnchor = HAnchor.ParentLeftRight;

            FlowLayoutWidget comPortMessageContainer = new FlowLayoutWidget();
            comPortMessageContainer.Margin = elementMargin;
            comPortMessageContainer.HAnchor = HAnchor.ParentLeftRight;

			printerComPortError = new TextWidget(new LocalizedString("Currently available serial ports.").Translated, 0, 0, 10);
            printerComPortError.TextColor = RGBA_Bytes.White;
            printerComPortError.AutoExpandBoundsToText = true;            

			printerComPortHelpLink = linkButtonFactory.Generate(new LocalizedString("What's this?").Translated);
            printerComPortHelpLink.Margin = new BorderDouble(left: 5);
            printerComPortHelpLink.VAnchor = VAnchor.ParentBottom;
            printerComPortHelpLink.Click += new ButtonBase.ButtonEventHandler(printerComPortHelp_Click);

			printerComPortHelpMessage = new TextWidget(new LocalizedString("The 'Serial Port' identifies which connected device is\nyour printer. Changing which usb plug you use may\nchange the associated serial port.\n\nTip: If you are uncertain, plug-in in your printer and hit\nrefresh. The new port that appears should be your\nprinter.").Translated, 0, 0, 10);
            printerComPortHelpMessage.TextColor = RGBA_Bytes.White;
            printerComPortHelpMessage.Margin = new BorderDouble(top: 10);
            printerComPortHelpMessage.Visible = false;

            comPortMessageContainer.AddChild(printerComPortError);
            comPortMessageContainer.AddChild(printerComPortHelpLink);

            container.AddChild(comPortLabel);
            container.AddChild(comPortWidget);
            container.AddChild(comPortMessageContainer);
            container.AddChild(printerComPortHelpMessage);


            container.HAnchor = HAnchor.ParentLeftRight;
            return container;
        }
        private FlowLayoutWidget createPrinterBaudRateContainer()
        {
            FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.TopToBottom);
            container.Margin = new BorderDouble(0);
            container.VAnchor = VAnchor.ParentBottomTop;
            BorderDouble elementMargin = new BorderDouble(top: 3);

			string baudRateLabelText = new LocalizedString ("Baud Rate").Translated;
			string baudRateLabelTextFull = string.Format ("{0}:", baudRateLabelText);

			TextWidget baudRateLabel = new TextWidget(baudRateLabelTextFull, 0, 0, 12);
            baudRateLabel.TextColor = this.defaultTextColor;
            baudRateLabel.Margin = new BorderDouble(0, 0, 0, 10);
            baudRateLabel.HAnchor = HAnchor.ParentLeftRight;

            baudRateWidget = GetBaudRateWidget();
            baudRateWidget.HAnchor = HAnchor.ParentLeftRight;

            FlowLayoutWidget baudRateMessageContainer = new FlowLayoutWidget();
            baudRateMessageContainer.Margin = elementMargin;
            baudRateMessageContainer.HAnchor = HAnchor.ParentLeftRight;

			printerBaudRateError = new TextWidget(new LocalizedString("Select the baud rate.").Translated, 0, 0, 10);
            printerBaudRateError.TextColor = RGBA_Bytes.White;
            printerBaudRateError.AutoExpandBoundsToText = true;   

			printerBaudRateHelpLink = linkButtonFactory.Generate(new LocalizedString("What's this?").Translated);
            printerBaudRateHelpLink.Margin = new BorderDouble(left: 5);
            printerBaudRateHelpLink.VAnchor = VAnchor.ParentBottom;
            printerBaudRateHelpLink.Click += new ButtonBase.ButtonEventHandler(printerBaudRateHelp_Click);

			printerBaudRateHelpMessage = new TextWidget(new LocalizedString("The term 'Baud Rate' roughly means the speed at which\ndata is transmitted.  Baud rates may differ from printer to\nprinter. Refer to your printer manual for more info.\n\nTip: If you are uncertain - try 250000.").Translated, 0, 0, 10);
            printerBaudRateHelpMessage.TextColor = RGBA_Bytes.White;
            printerBaudRateHelpMessage.Margin = new BorderDouble(top: 10);
            printerBaudRateHelpMessage.Visible = false;

            baudRateMessageContainer.AddChild(printerBaudRateError);
            baudRateMessageContainer.AddChild(printerBaudRateHelpLink);

            container.AddChild(baudRateLabel);
            container.AddChild(baudRateWidget);
            container.AddChild(baudRateMessageContainer);
            container.AddChild(printerBaudRateHelpMessage);
            

            container.HAnchor = HAnchor.ParentLeftRight;
            return container;
        }
        public ExportToFolderFeedbackWindow(int totalParts, string firstPartName, RGBA_Bytes backgroundColor)
            : base(300, 500)
        {
            BackgroundColor = backgroundColor;
			string exportingToFolderTitle = new LocalizedString("MatterControl").Translated;
			string exportingToFolderTitleFull = new LocalizedString("Exporting to Folder").Translated;
			Title = string.Format("{0} - {1}", exportingToFolderTitle, exportingToFolderTitleFull);
            this.totalParts = totalParts;

            feedback.Padding = new BorderDouble(5, 5);
            feedback.AnchorAll();
            AddChild(feedback);

            nextLine = CreateNextLine("");
            feedback.AddChild(nextLine);
        }
        public FlowLayoutWidget createPrinterConnectionMessageContainer()
        {

            FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.TopToBottom);
            container.VAnchor = VAnchor.ParentBottomTop;
            container.Margin = new BorderDouble(5);            
            BorderDouble elementMargin = new BorderDouble(top: 5);

			TextWidget printerMessageOne = new TextWidget(new LocalizedString("MatterControl will now attempt to auto-detect printer.").Translated, 0, 0, 10);
            printerMessageOne.Margin = new BorderDouble(0, 10, 0,5);
            printerMessageOne.TextColor = RGBA_Bytes.White;
            printerMessageOne.HAnchor = HAnchor.ParentLeftRight;
            printerMessageOne.Margin = elementMargin;

			string printerMessageTwoTxt = new LocalizedString("Disconnect printer").Translated;
			string printerMessageTwoTxtEnd = new LocalizedString("if currently connected").Translated;
			string printerMessageTwoTxtFull = string.Format ("1.) {0} ({1}).", printerMessageTwoTxt, printerMessageTwoTxtEnd);
			TextWidget printerMessageTwo = new TextWidget(printerMessageTwoTxtFull, 0, 0, 12);
            printerMessageTwo.TextColor = RGBA_Bytes.White;
            printerMessageTwo.HAnchor = HAnchor.ParentLeftRight;
            printerMessageTwo.Margin = elementMargin;

			string printerMessageThreeTxt = new LocalizedString("Press").Translated;
			string printerMessageThreeTxtEnd = new LocalizedString ("Continue").Translated;
			string printerMessageThreeFull = string.Format ("2.) {0} '{1}'.", printerMessageThreeTxt, printerMessageThreeTxtEnd);
			TextWidget printerMessageThree = new TextWidget(printerMessageThreeFull, 0, 0, 12);
            printerMessageThree.TextColor = RGBA_Bytes.White;
            printerMessageThree.HAnchor = HAnchor.ParentLeftRight;
            printerMessageThree.Margin = elementMargin;

            GuiWidget vSpacer = new GuiWidget();
            vSpacer.VAnchor = VAnchor.ParentBottomTop;

			Button manualLink = linkButtonFactory.Generate(new LocalizedString("Manual Configuration").Translated);
            manualLink.Margin = new BorderDouble(0, 5);
            manualLink.Click += new ButtonBase.ButtonEventHandler(ManualLink_Click);

            container.AddChild(printerMessageOne);
            container.AddChild(printerMessageTwo);
            container.AddChild(printerMessageThree);
            container.AddChild(vSpacer);
            container.AddChild(manualLink);

            container.HAnchor = HAnchor.ParentLeftRight;
            return container;            
        }
        public PrinterListItemView(Printer printerRecord, ConnectionWindow windowController)
            :base(printerRecord, windowController)
        {            
            this.Margin = new BorderDouble(1);
            this.BackgroundColor = this.defaultBackgroundColor;
            this.Padding = new BorderDouble(5);            
            
            string[] comportNames = SerialPort.GetPortNames();
            bool portIsAvailable = comportNames.Contains(printerRecord.ComPort);

            printerName = new TextWidget(this.printerRecord.Name);
            printerName.TextColor = this.defaultTextColor;
            printerName.HAnchor = HAnchor.ParentLeftRight;

			string availableText = new LocalizedString("Unavailable").Translated;
            RGBA_Bytes availableColor = new RGBA_Bytes(158, 18, 0);
            if (portIsAvailable)
            {
                availableText = "";
            }

            if (ActivePrinterProfile.Instance.ActivePrinter != null)
            {
                int connectedPrinterHash = ActivePrinterProfile.Instance.ActivePrinter.GetHashCode();
                int printerOptionHash = printerRecord.GetHashCode();
                if (connectedPrinterHash == printerOptionHash)
                {
                    availableText = PrinterCommunication.Instance.PrinterConnectionStatusVerbose;                    
                    availableColor = new RGBA_Bytes(0,95,107);
                }
            }        

            TextWidget availableIndicator = new TextWidget(availableText, pointSize: 10);
            availableIndicator.TextColor = availableColor;
            availableIndicator.Padding = new BorderDouble(3, 0, 0, 3);
            availableIndicator.VAnchor = Agg.UI.VAnchor.ParentCenter;

            this.AddChild(printerName);
            this.AddChild(availableIndicator);
            this.HAnchor = HAnchor.ParentLeftRight;

            BindHandlers();
        }
        public ConnectionWindow()
            : base(350, 600)
        {                     
			string connectToPrinterTitle = new LocalizedString("MatterControl").Translated;
			string connectToPrinterTitleEnd = new LocalizedString ("Connect to Printer").Translated;
			Title = string.Format("{0} - {1}",connectToPrinterTitle,connectToPrinterTitleEnd);      
			      
            if (GetPrinterRecordCount() > 0)
            {
                ChangeToChoosePrinter();
            }
            else
            {
                ChangeToAddPrinter();
            }

            this.ShowAsSystemWindow();
            MinimumSize = new Vector2(350, 400);
            
        }
        public ExportLibraryItemWindow(PrintLibraryListItem printLibraryItem)
            : base(400, 250)
        {
            if (System.IO.Path.GetExtension(printLibraryItem.printItem.FileLocation).ToUpper() == ".GCODE")
            {
                partIsGCode = true;
            }

			string exportLibraryFileTitle = new LocalizedString("MatterControl").Translated;
			string exportLibraryFileTitleFull = new LocalizedString("Export File").Translated;
			this.Title = string.Format("{0}: {1}", exportLibraryFileTitle, exportLibraryFileTitleFull);
            this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

            // TODO: Complete member initialization
            this.printQueueItem = printLibraryItem;


            doLayout();
            ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent(reloadAfterPrinterProfileChanged, ref unregisterEvents);
        }
Example #15
0
        public ModelChooser(string manufacturer)
        {
			string defaultModelDropDownLbl = new LocalizedString("Select Model").Translated;
			string defaultModelDropDownLblFull = string.Format("- {0} -", defaultModelDropDownLbl);
			ModelDropList = new StyledDropDownList(defaultModelDropDownLblFull);
            string pathToModels = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "PrinterSettings", manufacturer);
            if (Directory.Exists(pathToModels))
            {
                foreach (string manufacturerDirectory in Directory.EnumerateDirectories(pathToModels))
                {
                    string model = Path.GetFileName(manufacturerDirectory);
                    ModelDropList.AddItem(model);
                }
            }
			ModelDropList.AddItem(new LocalizedString("Other").Translated);

            AddChild(ModelDropList);

            HAnchor = HAnchor.FitToChildren;
            VAnchor = VAnchor.FitToChildren;
        }
        private void AddEePromControls(FlowLayoutWidget controlsTopToBottomLayout)
        {
            GroupBox eePromControlsGroupBox = new GroupBox(new LocalizedString("EEProm Settings").Translated);

			eePromControlsGroupBox.Margin = new BorderDouble(0);
            eePromControlsGroupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            eePromControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
            eePromControlsGroupBox.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;
            eePromControlsGroupBox.VAnchor = Agg.UI.VAnchor.FitToChildren;
			eePromControlsGroupBox.Height = 68;

            {
				FlowLayoutWidget eePromControlsLayout = new FlowLayoutWidget();
				eePromControlsLayout.HAnchor |= HAnchor.ParentLeftRight;
				eePromControlsLayout.VAnchor |= Agg.UI.VAnchor.ParentCenter;
				eePromControlsLayout.Margin = new BorderDouble(3, 0, 3, 6);
				eePromControlsLayout.Padding = new BorderDouble(0);
                {
					Agg.Image.ImageBuffer eePromImage = new Agg.Image.ImageBuffer();
					ImageBMPIO.LoadImageData(Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath,"Icons", "PrintStatusControls", "leveling-24x24.png"), eePromImage);
					ImageWidget eePromIcon = new ImageWidget(eePromImage);
					eePromIcon.Margin = new BorderDouble (right: 6);

					Button openEePromWindow = textImageButtonFactory.Generate(new LocalizedString("CONFIGURE").Translated);
                    openEePromWindow.Click += (sender, e) =>
                    {
#if false // This is to force the creation of the repetier window for testing when we don't have repetier firmware.
                        new MatterHackers.MatterControl.EeProm.EePromRepetierWidget();
#else
						switch(PrinterCommunication.Instance.FirmwareType)
                        {
                            case PrinterCommunication.FirmwareTypes.Repetier:
                                new MatterHackers.MatterControl.EeProm.EePromRepetierWidget();
                            break;

                            case PrinterCommunication.FirmwareTypes.Marlin:
                                new MatterHackers.MatterControl.EeProm.EePromMarlinWidget();
                            break;

                            default:
                                UiThread.RunOnIdle((state) => 
                                {
									string message = new LocalizedString("Oops! There is no eeprom mapping for your printer's firmware.").Translated;
                                    StyledMessageBox.ShowMessageBox(message, "Warning no eeprom mapping", StyledMessageBox.MessageType.OK);
                                }
                                );
                            break;
                        }
#endif
                    };
					//eePromControlsLayout.AddChild(eePromIcon);
                    eePromControlsLayout.AddChild(openEePromWindow);
                }

                eePromControlsGroupBox.AddChild(eePromControlsLayout);
            }

            eePromControlsContainer = new DisableableWidget();
            eePromControlsContainer.AddChild(eePromControlsGroupBox);

            controlsTopToBottomLayout.AddChild(eePromControlsContainer);
        }
        void onConnectionSuccess()
        {
            printerErrorMessage.TextColor = RGBA_Bytes.White;
			string printerErrorMessageLblThree = new LocalizedString ("Connection succeeded").Translated;
			string printerErrorMessageLblThreeFull = string.Format ("{0}!", printerErrorMessageLblThree);
			printerErrorMessage.Text = printerErrorMessageLblThreeFull;
            nextButton.Visible = true;
            connectButton.Visible = false;
        }
        void ConnectButton_Click(object sender, MouseEventArgs mouseEvent)
        {
            string candidatePort = null;
            currentPortNames = SerialPort.GetPortNames();
            foreach (string portName in currentPortNames)
            {
                if (!startingPortNames.Any(portName.Contains))
                {
                    candidatePort = portName;
                }
            }

            if (candidatePort == null)
            {
                printerErrorMessage.TextColor = RGBA_Bytes.Red;
				string printerErrorMessageLblFull = new LocalizedString ("Oops! Printer could not be detected ").Translated;
				printerErrorMessage.Text = printerErrorMessageLblFull;                
            }
            else
            {
                ActivePrinter.ComPort = candidatePort;
                printerErrorMessage.TextColor = RGBA_Bytes.White;
				string printerErrorMessageLblTwo = new LocalizedString ("Attempting to connect").Translated;
				string printerErrorMessageLblTwoFull = string.Format("{0}...",printerErrorMessageLblTwo);
				printerErrorMessage.Text = printerErrorMessageLblTwoFull;
                this.ActivePrinter.Commit();
                ActivePrinterProfile.Instance.ActivePrinter = this.ActivePrinter;
                PrinterCommunication.Instance.ConnectToActivePrinter();
                connectButton.Visible = false;                
            }     
        }
        public PluginChooserWindow()
            : base(360, 300)
        {
			Title = new LocalizedString("Installed Plugins").Translated;

            FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
            topToBottom.AnchorAll();
            topToBottom.Padding = new BorderDouble(3, 0, 3, 5);

            FlowLayoutWidget headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight);
            headerRow.HAnchor = HAnchor.ParentLeftRight;
            headerRow.Margin = new BorderDouble(0, 3, 0, 0);
            headerRow.Padding = new BorderDouble(0, 3, 0, 3);

            {
				string elementHeaderLblBeg = new LocalizedString("Select a Design Tool").Translated;
				string elementHeaderLblFull = string.Format("{0}:", elementHeaderLblBeg);
				string elementHeaderLbl = elementHeaderLblFull;
				TextWidget elementHeader = new TextWidget(string.Format(elementHeaderLbl), pointSize: 14);
                elementHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                elementHeader.HAnchor = HAnchor.ParentLeftRight;
                elementHeader.VAnchor = Agg.UI.VAnchor.ParentBottom;

                headerRow.AddChild(elementHeader);
            }

            topToBottom.AddChild(headerRow);

            GuiWidget presetsFormContainer = new GuiWidget();
            //ListBox printerListContainer = new ListBox();
            {
                presetsFormContainer.HAnchor = HAnchor.ParentLeftRight;
                presetsFormContainer.VAnchor = VAnchor.ParentBottomTop;
                presetsFormContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
            }

            FlowLayoutWidget pluginRowContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
            pluginRowContainer.AnchorAll();
            presetsFormContainer.AddChild(pluginRowContainer);

            foreach(CreatorInformation creatorInfo in RegisteredCreators.Instance.Creators)
            {
                ClickWidget pluginRow = new ClickWidget();         
                pluginRow.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
                pluginRow.Height = 38;
			    pluginRow.BackgroundColor = RGBA_Bytes.White;
                pluginRow.Padding = new BorderDouble(3);
                pluginRow.Margin = new BorderDouble(6,0,6,6);                

                GuiWidget overlay = new GuiWidget();
                overlay.AnchorAll();
                overlay.Cursor = Cursors.Hand;
                
                FlowLayoutWidget macroRow = new FlowLayoutWidget();
                macroRow.AnchorAll();
                macroRow.BackgroundColor = RGBA_Bytes.White;

                if (creatorInfo.iconPath != "")
                {
                    ImageBuffer imageBuffer = LoadImage(creatorInfo.iconPath);
                    ImageWidget imageWidget = new ImageWidget(imageBuffer);
                    macroRow.AddChild(imageWidget);
                }

                TextWidget buttonLabel = new TextWidget(creatorInfo.description, pointSize: 14);

                buttonLabel.Margin = new BorderDouble(left: 10);
                buttonLabel.VAnchor = Agg.UI.VAnchor.ParentCenter;                
                macroRow.AddChild(buttonLabel);

                FlowLayoutWidget hSpacer = new FlowLayoutWidget();
                hSpacer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
                macroRow.AddChild(hSpacer);

                CreatorInformation callCorrectFunctionHold = creatorInfo;
                pluginRow.Click += (sender, e) =>
                {
                    if (RegisteredCreators.Instance.Creators.Count > 0)
                    {
                        callCorrectFunctionHold.functionToLaunchCreator(null, null);
                    }
                    UiThread.RunOnIdle(CloseOnIdle);
                };
                pluginRow.AddChild(macroRow);
                pluginRow.AddChild(overlay);
                pluginRowContainer.AddChild(pluginRow);
            }

            topToBottom.AddChild(presetsFormContainer);
            BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

            //ShowAsSystemWindow();

			Button cancelPresetsButton = textImageButtonFactory.Generate(new LocalizedString("Cancel").Translated);
            cancelPresetsButton.Click += (sender, e) => { Close(); };

            FlowLayoutWidget buttonRow = new FlowLayoutWidget();
            buttonRow.HAnchor = HAnchor.ParentLeftRight;
            buttonRow.Padding = new BorderDouble(0, 3);

            GuiWidget hButtonSpacer = new GuiWidget();
            hButtonSpacer.HAnchor = HAnchor.ParentLeftRight;
            
            buttonRow.AddChild(hButtonSpacer);
            buttonRow.AddChild(cancelPresetsButton);

            topToBottom.AddChild(buttonRow);

            AddChild(topToBottom);
        }
Example #20
0
        private ContactFormWindow(string subject = "", string bodyText = "")
            : base(500, 550)
        {
			Title = new LocalizedString("MatterControl: Submit an Issue").Translated;

            BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

            contactFormWidget = new ContactFormWidget(subject, bodyText);

            AddChild(contactFormWidget);
            AddHandlers();

            ShowAsSystemWindow();
            MinimumSize = new Vector2(500, 550);
        }
        void ConnectButton_Click(object sender, MouseEventArgs mouseEvent)
        {
            string serialPort;
            try
            {
                serialPort = GetSelectedSerialPort();
                this.ActivePrinter.ComPort = serialPort;
                this.ActivePrinter.Commit();
                printerComPortHelpLink.Visible = false;
                printerComPortError.TextColor = RGBA_Bytes.White;
				string printerComPortErrorLbl = new LocalizedString("Attempting to connect").Translated;
				string printerComPortErrorLblFull = string.Format("{0}...",printerComPortErrorLbl);
				printerComPortError.Text = printerComPortErrorLblFull;
                ActivePrinterProfile.Instance.ActivePrinter = this.ActivePrinter;
                PrinterCommunication.Instance.ConnectToActivePrinter();
                connectButton.Visible = false;
                refreshButton.Visible = false;
            }
            catch
            {
                printerComPortHelpLink.Visible = false;
                printerComPortError.TextColor = RGBA_Bytes.Red;
				printerComPortError.Text = new LocalizedString("Oops! Please select a serial port.").Translated;
            }
        }
Example #22
0
        private void AddModelInfo(FlowLayoutWidget buttonPanel)
        {
            textImageButtonFactory.FixedWidth = 44;

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

			string printTimeLbl = new LocalizedString ("Print Time").Translated;
			string printTimeLblFull = string.Format ("{0}:", printTimeLbl);
            // put in the print time
			modelInfoContainer.AddChild(new TextWidget(printTimeLblFull, textColor: RGBA_Bytes.White));
            {
                string timeRemainingText = "---";

                if (gcodeViewWidget != null && gcodeViewWidget.LoadedGCode != null)
                {
                    int secondsRemaining = (int)gcodeViewWidget.LoadedGCode.GCodeCommandQueue[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: RGBA_Bytes.White, pointSize: 10);
                estimatedPrintTime.HAnchor = Agg.UI.HAnchor.ParentLeft;
                estimatedPrintTime.Margin = new BorderDouble(3, 0, 0, 3);
                modelInfoContainer.AddChild(estimatedPrintTime);
            }

            //modelInfoContainer.AddChild(new TextWidget("Size:", textColor: RGBA_Bytes.White));
            
			string filamentLengthLbl = new LocalizedString ("Filament Length").Translated;
			string filamentLengthLblFull = string.Format ("{0}:", filamentLengthLbl);
            // show the filament used
			modelInfoContainer.AddChild(new TextWidget(filamentLengthLblFull, textColor: RGBA_Bytes.White));
            {
                double filamentUsed = gcodeViewWidget.LoadedGCode.GetFilamentUsedMm(ActiveSliceSettings.Instance.NozzleDiameter);

                GuiWidget estimatedPrintTime = new TextWidget(string.Format("{0:0.0} mm", filamentUsed), textColor: RGBA_Bytes.White, pointSize: 10);
                estimatedPrintTime.HAnchor = Agg.UI.HAnchor.ParentLeft;
                estimatedPrintTime.Margin = new BorderDouble(3, 0, 0, 3);
                modelInfoContainer.AddChild(estimatedPrintTime);
            }

			string filamentVolumeLbl = new LocalizedString ("Filament Volume").Translated;
			string filamentVolumeLblFull = string.Format("{0}:", filamentVolumeLbl);
			modelInfoContainer.AddChild(new TextWidget(filamentVolumeLblFull, textColor: RGBA_Bytes.White));
            {
                var density = 1.0;
                string filamentType = "PLA";
                if(filamentType == "ABS")
                {
                    density = 1.04;
                }
                else if(filamentType == "PLA") 
                {
                    density = 1.24;
                }
                
                double filamentMm3 = gcodeViewWidget.LoadedGCode.GetFilamentCubicMm(ActiveSliceSettings.Instance.FillamentDiameter);

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

			string weightLbl = new LocalizedString("Weight").Translated;
			string weightLblFull = string.Format("{0}:", weightLbl);
			modelInfoContainer.AddChild(new TextWidget(weightLblFull, textColor: RGBA_Bytes.White));
            {
                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.FillamentDiameter, density);

                GuiWidget estimatedPrintTime = new TextWidget(string.Format("{0:0.00} g", filamentWeightGrams), textColor: RGBA_Bytes.White, pointSize: 10);
                estimatedPrintTime.HAnchor = Agg.UI.HAnchor.ParentLeft;
                estimatedPrintTime.Margin = new BorderDouble(3, 0, 0, 3);
                modelInfoContainer.AddChild(estimatedPrintTime);
            }

            //modelInfoContainer.AddChild(new TextWidget("Layer Count:", textColor: RGBA_Bytes.White));

            buttonPanel.AddChild(modelInfoContainer);

            textImageButtonFactory.FixedWidth = 0;
        }
        void AddChildElements()
        {
            FlowLayoutWidget settingsStatusLabelContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
            settingsStatusLabelContainer.VAnchor |= VAnchor.ParentTop;
            settingsStatusLabelContainer.Margin = new BorderDouble(0);
            {
				string activeSettingsLabelText = new LocalizedString ("Active Settings").Translated;
				string activeSettingsLabelTextFull = string.Format ("{0}:", activeSettingsLabelText);


				TextWidget settingsStatusLabel = new TextWidget(string.Format(activeSettingsLabelTextFull), pointSize: 10);
                settingsStatusLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;

                settingsStatusDescription = new TextWidget("", pointSize: 14);
                settingsStatusDescription.Margin = new BorderDouble(top: 4);
                settingsStatusDescription.AutoExpandBoundsToText = true;
                settingsStatusDescription.TextColor = ActiveTheme.Instance.PrimaryTextColor;

				string unsavedChangesTxtBeg = new  LocalizedString("unsaved changes").Translated;
				string unsavedChangesTxtFull = string.Format ("({0})", unsavedChangesTxtBeg);
				unsavedChangesIndicator = new TextWidget(unsavedChangesTxtFull, pointSize: 10);
                unsavedChangesIndicator.AutoExpandBoundsToText = true;
                unsavedChangesIndicator.Visible = false;
                unsavedChangesIndicator.Margin = new BorderDouble(left: 4);
                unsavedChangesIndicator.TextColor = ActiveTheme.Instance.PrimaryTextColor;

                settingsStatusLabelContainer.AddChild(settingsStatusLabel);
                settingsStatusLabelContainer.AddChild(settingsStatusDescription);
                settingsStatusLabelContainer.AddChild(unsavedChangesIndicator);
            }

			saveButton = textImageButtonFactory.Generate(new LocalizedString("Save").Translated);
            saveButton.VAnchor = VAnchor.ParentTop;
            saveButton.Visible = false;
            saveButton.Margin = new BorderDouble(0, 0, 0, 10);
            saveButton.Click += new ButtonBase.ButtonEventHandler(saveButton_Click);

			revertbutton = textImageButtonFactory.Generate(new LocalizedString("Revert").Translated);
            revertbutton.VAnchor = VAnchor.ParentTop;
            revertbutton.Visible = false;
            revertbutton.Margin = new BorderDouble(0,0,0,10);
            revertbutton.Click += new ButtonBase.ButtonEventHandler(revertbutton_Click);

			SliceOptionsMenuDropList = new DropDownMenu(new LocalizedString("Options   ").Translated);
            SliceOptionsMenuDropList.Margin = new BorderDouble(top: 11);
            SliceOptionsMenuDropList.VAnchor |= VAnchor.ParentTop;
            SliceOptionsMenuDropList.HoverColor = new RGBA_Bytes(0, 0, 0, 50);
            SliceOptionsMenuDropList.NormalColor = new RGBA_Bytes(0, 0, 0, 0);
            SliceOptionsMenuDropList.BorderColor = new RGBA_Bytes(0, 0, 0, 0);
            SliceOptionsMenuDropList.BackgroundColor = new RGBA_Bytes(0, 0, 0, 0);
            this.SliceOptionsMenuDropList.SelectionChanged += new EventHandler(MenuDropList_SelectionChanged);

            SetMenuItems();

            FlowLayoutWidget sliceEngineContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
            sliceEngineContainer.Margin = new BorderDouble(0,0,10,0);
            sliceEngineContainer.VAnchor |= VAnchor.ParentTop;
            {
				string sliceEngineLabelText = new LocalizedString ("Slice Engine").Translated;
				string sliceEngineLabelTextFull = string.Format ("{0}:", sliceEngineLabelText);
				TextWidget sliceEngineLabel = new TextWidget(string.Format(sliceEngineLabelTextFull), pointSize: 10);
                sliceEngineLabel.Margin = new BorderDouble(0);
                sliceEngineLabel.HAnchor = HAnchor.ParentLeft;
                sliceEngineLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
                
                EngineMenuDropList = CreateSliceEngineDropdown();                

                sliceEngineContainer.AddChild(sliceEngineLabel);
                sliceEngineContainer.AddChild(EngineMenuDropList);
            }

            this.AddChild(sliceEngineContainer);
            this.AddChild(settingsStatusLabelContainer);

            GuiWidget spacer = new GuiWidget(HAnchor.ParentLeftRight);
            this.AddChild(spacer);

            this.AddChild(saveButton);
            this.AddChild(revertbutton);
            this.AddChild(SliceOptionsMenuDropList);

            SetStatusDisplay();
        }
        void SetMenuItems()
        {
			string importTxt = new LocalizedString ("Import").Translated;
			string importTxtFull = string.Format ("{0}", importTxt);
			string exportTxt = new LocalizedString("Export").Translated;
			string exportTxtFull = string.Format ("{0}", exportTxt);
            //Set the name and callback function of the menu items
            slicerOptionsMenuItems = new TupleList<string, Func<bool>> 
            {
				{importTxtFull, ImportQueueMenu_Click},
				{exportTxtFull, ExportQueueMenu_Click},
            };

            //Add the menu items to the menu itself
            foreach (Tuple<string, Func<bool>> item in slicerOptionsMenuItems)
            {
                SliceOptionsMenuDropList.AddItem(item.Item1);
            }
        }
Example #25
0
        private FlowLayoutWidget getActivePrinterInfo()
        {
            FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.TopToBottom);
            container.Margin = new BorderDouble(6, 0,6,3);
            container.HAnchor = HAnchor.ParentLeftRight;
            container.VAnchor |= VAnchor.ParentTop;

            FlowLayoutWidget topRow = new FlowLayoutWidget();
            topRow.Name = "PrintStatusRow.ActivePrinterInfo.TopRow";
            topRow.HAnchor = HAnchor.ParentLeftRight;

			string nextPrintLbl = new LocalizedString("Next Print").Translated;
			string nextPrintLblFull = string.Format("{0}:", nextPrintLbl);       
			activePrintLabel = getPrintStatusLabel(nextPrintLblFull, pointSize: 11);
            activePrintLabel.VAnchor = VAnchor.ParentTop;

            topRow.AddChild(activePrintLabel);

			activePrintName = getPrintStatusLabel("this is the biggest name we will allow", pointSize: 14);
            activePrintName.AutoExpandBoundsToText = false;
			activePrintStatus = getPrintStatusLabel("this is the biggest label we will allow - bigger", pointSize: 11);
            activePrintStatus.AutoExpandBoundsToText = false;
            activePrintStatus.Text = "";
            activePrintStatus.Margin = new BorderDouble(top: 3);

            activePrintInfo = getPrintStatusLabel("", pointSize: 11);
            activePrintInfo.AutoExpandBoundsToText = true;

            PrintActionRow printActionRow = new PrintActionRow();

            container.AddChild(topRow);
            container.AddChild(activePrintName);
            container.AddChild(activePrintStatus);
            //container.AddChild(activePrintInfo);
            container.AddChild(printActionRow);
            container.AddChild(new MessageActionRow());

            return container;
        }
Example #26
0
        public static void ShowCantFindFileMessage(PrintItemWrapper printItem)
        {
            UiThread.RunOnIdle((state) =>
            {
                string maxLengthName = printItem.FileLocation;
                int maxLength = 43;
                if (maxLengthName.Length > maxLength)
                {
                    string start = maxLengthName.Substring(0, 15) + "...";
                    int amountRemaining = (maxLength - start.Length);
                    string end = maxLengthName.Substring(maxLengthName.Length - amountRemaining, amountRemaining);
                    maxLengthName = start + end;
                }
				string notFoundMessage = new LocalizedString("Oops! Could not find this file").Translated;
				string notFoundMessageEnd = new LocalizedString("Would you like to remove it from the queue").Translated;
				string message = String.Format("{0}:\n'{1}'\n\n{2}?",notFoundMessage, maxLengthName,notFoundMessageEnd);
				string titleLbl = new LocalizedString("Item not Found").Translated;
					if (StyledMessageBox.ShowMessageBox(message, titleLbl, StyledMessageBox.MessageType.YES_NO))
                {
                    PrintQueueControl.Instance.RemoveIndex(PrintQueueControl.Instance.GetIndex(printItem));
                }
            });
        }
Example #27
0
        private void UpdatePrintStatus()
        {
            if (PrinterCommunication.Instance.ActivePrintItem != null)
            {
                int totalSecondsInPrint = PrinterCommunication.Instance.TotalSecondsInPrint;

                int totalHoursInPrint = (int)(totalSecondsInPrint / (60 * 60));
                int totalMinutesInPrint = (int)(totalSecondsInPrint / 60 - totalHoursInPrint * 60);
                totalSecondsInPrint = totalSecondsInPrint % 60;

                string totalTimeLabel = new LocalizedString("Est. Print Time").Translated;
                string calculatingLabel = new LocalizedString("Calculating...").Translated;
                string totalPrintTimeText;

                if (totalSecondsInPrint > 0)
                {
                    
                    if (totalHoursInPrint > 0)
                    {
						
						totalPrintTimeText = string.Format("{3} {0}h {1:00}m {2:00}s",
                            totalHoursInPrint,
                            totalMinutesInPrint,
							totalSecondsInPrint,
							totalTimeLabel);
                    }
                    else
                    {
						totalPrintTimeText = string.Format("{2} {0}m {1:00}s",
                            totalMinutesInPrint,
							totalSecondsInPrint,
							totalTimeLabel);
                    }
                }
                else
                {
                    totalPrintTimeText = string.Format("{0}: {1}", totalTimeLabel, calculatingLabel);
                }

                //GC.WaitForFullGCComplete();

                string printPercentRemainingText;
				string printPercentCompleteTxt = new LocalizedString("complete").Translated;
				printPercentRemainingText = string.Format("{0:0.0}% {1}", PrinterCommunication.Instance.PercentComplete,printPercentCompleteTxt);

                switch (PrinterCommunication.Instance.CommunicationState)
                {
				case PrinterCommunication.CommunicationStates.PreparingToPrint:
						string preparingPrintLbl = new LocalizedString("Preparing To Print").Translated;
						string preparingPrintLblFull = string.Format("{0}:", preparingPrintLbl);
						activePrintLabel.Text = preparingPrintLblFull;
                        //ActivePrintStatusText = ""; // set by slicer
                        activePrintInfo.Text = "";
                        break;

                    case PrinterCommunication.CommunicationStates.Printing:
                        {
                            activePrintLabel.Text = PrinterCommunication.Instance.PrintingStateString;
                            ActivePrintStatusText = totalPrintTimeText;
                        }
                        break;

                    case PrinterCommunication.CommunicationStates.Paused:
                        {
							string activePrintLblTxt = new LocalizedString ("Printing Paused").Translated;
							string activePrintLblTxtFull = string.Format("{0}:", activePrintLblTxt);
							activePrintLabel.Text = activePrintLblTxtFull;
                            ActivePrintStatusText = totalPrintTimeText;
                        }
                        break;

				case PrinterCommunication.CommunicationStates.FinishedPrint:
					string donePrintingTxt = new LocalizedString ("Done Printing").Translated;
					string donePrintingTxtFull = string.Format ("{0}:", donePrintingTxt);
					activePrintLabel.Text = donePrintingTxtFull;
                    ActivePrintStatusText = totalPrintTimeText;
                        break;

				default:
						string nextPrintLblActive = new LocalizedString ("Next Print").Translated;
						string nextPrintLblActiveFull = string.Format("{0}: ", nextPrintLblActive);

						activePrintLabel.Text = nextPrintLblActiveFull;
                        ActivePrintStatusText = "";
                        activePrintInfo.Text = "";
                        break;
                }
            }
            else
            {
				string nextPrintLabel = new LocalizedString ("Next Print").Translated;
				string nextPrintLabelFull = string.Format ("{0}:", nextPrintLabel);

				activePrintLabel.Text = nextPrintLabelFull;
				ActivePrintStatusText = string.Format(new LocalizedString("Press 'Add' to choose an item to print").Translated);
                activePrintInfo.Text = "";
            }
        }
Example #28
0
        public void ConstructPrintQueueItem()
        {
            linkButtonFactory.fontSize = 10;
            linkButtonFactory.textColor = RGBA_Bytes.Black;

            WidgetTextColor = RGBA_Bytes.Black;
            WidgetBackgroundColor = RGBA_Bytes.White;

            TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;

            SetDisplayAttributes();

            FlowLayoutWidget topToBottomLayout = new FlowLayoutWidget(FlowDirection.TopToBottom);
            topToBottomLayout.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;

            FlowLayoutWidget topContentsFlowLayout = new FlowLayoutWidget(FlowDirection.LeftToRight);
            topContentsFlowLayout.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;
            {
                FlowLayoutWidget leftColumn = new FlowLayoutWidget(FlowDirection.TopToBottom);
                leftColumn.VAnchor = VAnchor.ParentTop | Agg.UI.VAnchor.FitToChildren;
                {
                    PartThumbnailWidget thumbnailWidget = new PartThumbnailWidget(PrintItemWrapper, "part_icon_transparent_40x40.png", "building_thumbnail_40x40.png", new Vector2(50, 50));
                    leftColumn.AddChild(thumbnailWidget);
                }

                FlowLayoutWidget middleColumn = new FlowLayoutWidget(FlowDirection.TopToBottom);
                middleColumn.VAnchor = VAnchor.ParentTop | Agg.UI.VAnchor.FitToChildren;
                middleColumn.HAnchor = HAnchor.ParentLeftRight;// | Agg.UI.HAnchor.FitToChildren;
                middleColumn.Padding = new BorderDouble(8);
                middleColumn.Margin = new BorderDouble(10,0);
                {
                    string labelName = textInfo.ToTitleCase(PrintItemWrapper.Name);
                    labelName = labelName.Replace('_', ' ');
                    partLabel = new TextWidget(labelName, pointSize: 14);
                    partLabel.TextColor = WidgetTextColor;
                    partLabel.MinimumSize = new Vector2(1, 16);

					string partStatusLblTxt = new LocalizedString ("Status").Translated;     
					string partStatusLblTxtTest = new LocalizedString ("Queued to Print").Translated;
					string partStatusLblTxtFull = string.Format("{0}: {1}", partStatusLblTxt,partStatusLblTxtTest);

					partStatus = new TextWidget(partStatusLblTxtFull, pointSize: 10);
                    partStatus.AutoExpandBoundsToText = true;
                    partStatus.TextColor = WidgetTextColor;
                    partStatus.MinimumSize = new Vector2(50, 12);

					middleColumn.AddChild(partLabel);
                    middleColumn.AddChild(partStatus);
                }

                CreateEditControls();

                topContentsFlowLayout.AddChild(leftColumn);
                topContentsFlowLayout.AddChild(middleColumn);
                topContentsFlowLayout.AddChild(editControls);

                editControls.Visible = false;
            }

            topToBottomLayout.AddChild(topContentsFlowLayout);
            this.AddChild(topToBottomLayout);

            AddHandlers();
        }
Example #29
0
        private string getHelpMessageFromStatus()
        {
            if (ActivePrinterProfile.Instance.ActivePrinter == null)
            {
				return new LocalizedString("No printer selected.  Press 'Connect' to choose a printer.").Translated;
            }
            else
            {

                switch (PrinterCommunication.Instance.CommunicationState)
                {
                    case PrinterCommunication.CommunicationStates.Disconnected:
						return new LocalizedString("Not connected. Press 'Connect' to enable printing.").Translated;
					case PrinterCommunication.CommunicationStates.AttemptingToConnect:
						string attemptToConnect = new LocalizedString ("Attempting to Connect").Translated;
						string attemptToConnectFull = string.Format ("{0}...", attemptToConnect);
						return  attemptToConnectFull;               
                    case PrinterCommunication.CommunicationStates.ConnectionLost:
                    case PrinterCommunication.CommunicationStates.FailedToConnect:
						return new LocalizedString("Unable to communicate with printer.").Translated;
                    case PrinterCommunication.CommunicationStates.Connected:
                        if (PrinterCommunication.Instance.ActivePrintItem != null)
                        {
							return new LocalizedString("Item selected. Press 'Start' to begin your print.").Translated;
                        }
                        else
                        {
							return new LocalizedString("No items to select. Press 'Add' to select a file to print.").Translated;
                        }
                    default:
                        return "";
                }
            }
        }
Example #30
0
        void CreateAndAddChildren(object state)
        {
            RemoveAllChildren();

            FlowLayoutWidget mainContainerTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
            mainContainerTopToBottom.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth;
            mainContainerTopToBottom.VAnchor = Agg.UI.VAnchor.Max_FitToChildren_ParentHeight;

            buttonBottomPanel = new FlowLayoutWidget(FlowDirection.LeftToRight);
            buttonBottomPanel.HAnchor = HAnchor.ParentLeftRight;
            buttonBottomPanel.Padding = new BorderDouble(3, 3);
            buttonBottomPanel.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

			generateGCodeButton = textImageButtonFactory.Generate(new LocalizedString("Generate").Translated);
            generateGCodeButton.Click += new ButtonBase.ButtonEventHandler(generateButton_Click);
            buttonBottomPanel.AddChild(generateGCodeButton);

            layerSelectionButtonsPannel = new FlowLayoutWidget(FlowDirection.RightToLeft);
            layerSelectionButtonsPannel.HAnchor = HAnchor.ParentLeftRight;
            layerSelectionButtonsPannel.Padding = new BorderDouble(0);

			closeButton = textImageButtonFactory.Generate(new LocalizedString("Close").Translated);

            layerSelectionButtonsPannel.AddChild(closeButton);

            FlowLayoutWidget centerPartPreviewAndControls = new FlowLayoutWidget(FlowDirection.LeftToRight);
            centerPartPreviewAndControls.AnchorAll();

            gcodeDispalyWidget = new GuiWidget(HAnchor.ParentLeftRight, Agg.UI.VAnchor.ParentBottomTop);

			string startingMessage = new LocalizedString("Loading GCode...").Translated;
            if (Path.GetExtension(printItem.FileLocation).ToUpper() == ".GCODE")
            {
                gcodeDispalyWidget.AddChild(CreateGCodeViewWidget(printItem.FileLocation));
            }
            else
            {
                string gcodePathAndFileName = printItem.GCodePathAndFileName;
                bool gcodeFileIsComplete = printItem.IsGCodeFileComplete(gcodePathAndFileName);

                if (gcodeProcessingStateInfoText != null && gcodeProcessingStateInfoText.Text == "Slicing Error")
                {
                    startingMessage = "Slicing Error. Please review your slice settings.";
                }
                else
                {
					startingMessage = new LocalizedString("Press 'generate' to view layers").Translated;
                }

                if (File.Exists(gcodePathAndFileName) && gcodeFileIsComplete)
                {
                    gcodeDispalyWidget.AddChild(CreateGCodeViewWidget(gcodePathAndFileName));
                }

                // we only hook these up to make sure we can regenerate the gcode when we want
                printItem.SlicingOutputMessage += sliceItem_SlicingOutputMessage;
                printItem.Done += sliceItem_Done;
            }

            centerPartPreviewAndControls.AddChild(gcodeDispalyWidget);

            buttonRightPanel = CreateRightButtonPannel();
            centerPartPreviewAndControls.AddChild(buttonRightPanel);

            // add in a spacer
            layerSelectionButtonsPannel.AddChild(new GuiWidget(HAnchor.ParentLeftRight));
            buttonBottomPanel.AddChild(layerSelectionButtonsPannel);

            mainContainerTopToBottom.AddChild(centerPartPreviewAndControls);
            mainContainerTopToBottom.AddChild(buttonBottomPanel);
            this.AddChild(mainContainerTopToBottom);

            AddProcessingMessage(startingMessage);

            AddViewControls();

            AddHandlers();
        }