diff --git a/ControlElements/TextImageButtonFactory.cs b/ControlElements/TextImageButtonFactory.cs index 31898dd3b..68b1458b0 100644 --- a/ControlElements/TextImageButtonFactory.cs +++ b/ControlElements/TextImageButtonFactory.cs @@ -195,7 +195,7 @@ namespace MatterHackers.MatterControl { FlowLayoutWidget groupLableAndEditControl = new FlowLayoutWidget(); - editButton = new Button(0, 0, new ButtonViewThreeImage(LoadUpButtonImage("icon_edit_white.png"), LoadUpButtonImage("icon_edit_gray.png"), LoadUpButtonImage("icon_edit_Black.png"))); + editButton = new Button(0, 0, new ButtonViewThreeImage(LoadUpButtonImage("icon_edit_white.png"), LoadUpButtonImage("icon_edit_gray.png"), LoadUpButtonImage("icon_edit_black.png"))); editButton.Margin = new BorderDouble(2, -2, 2, 0); editButton.VAnchor = Agg.UI.VAnchor.ParentTop; TextWidget textLabel = new TextWidget(label, textColor: ActiveTheme.Instance.PrimaryTextColor); diff --git a/CustomWidgets/ExportPrintItemWindow.cs b/CustomWidgets/ExportPrintItemWindow.cs index 8b7b95171..53e76c0e7 100644 --- a/CustomWidgets/ExportPrintItemWindow.cs +++ b/CustomWidgets/ExportPrintItemWindow.cs @@ -117,17 +117,28 @@ namespace MatterHackers.MatterControl buttonRow.Padding = new BorderDouble (0); // TODO: make this work on the mac and then delete this if - if (MatterHackers.Agg.UI.WindowsFormsAbstract.GetOSType () == WindowsFormsAbstract.OSType.Windows) + if (MatterHackers.Agg.UI.WindowsFormsAbstract.GetOSType () == WindowsFormsAbstract.OSType.Windows) { showInFolderAfterSave = new CheckBox (LocalizedString.Get ("Show file in folder after save"), ActiveTheme.Instance.PrimaryTextColor, 10); showInFolderAfterSave.Margin = new BorderDouble (top: 10); exportSTLGCodeButtonsContainer.AddChild (showInFolderAfterSave); + + buttonRow.AddChild (new HorizontalSpacer ()); + buttonRow.AddChild (cancelButton); + topToBottom.AddChild (exportSTLGCodeButtonsContainer); + topToBottom.AddChild (buttonRow); } + if (MatterHackers.Agg.UI.WindowsFormsAbstract.GetOSType () == WindowsFormsAbstract.OSType.X11) + { + showInFolderAfterSave = new CheckBox (LocalizedString.Get ("Show file in folder after save"), ActiveTheme.Instance.PrimaryTextColor, 10); + showInFolderAfterSave.Margin = new BorderDouble (top: 10); + exportSTLGCodeButtonsContainer.AddChild (showInFolderAfterSave); - buttonRow.AddChild (new HorizontalSpacer()); - buttonRow.AddChild(cancelButton); - topToBottom.AddChild(exportSTLGCodeButtonsContainer); - topToBottom.AddChild (buttonRow); + buttonRow.AddChild (new HorizontalSpacer ()); + buttonRow.AddChild (cancelButton); + topToBottom.AddChild (exportSTLGCodeButtonsContainer); + topToBottom.AddChild (buttonRow); + } this.AddChild(topToBottom); } diff --git a/DataStorage/Datastore.cs b/DataStorage/Datastore.cs index fb20393c9..7a4bc2fb7 100644 --- a/DataStorage/Datastore.cs +++ b/DataStorage/Datastore.cs @@ -118,7 +118,16 @@ namespace MatterHackers.MatterControl.DataStorage { return Path.Combine("..", "..", "StaticData"); } - + case Agg.UI.WindowsFormsAbstract.OSType.X11: + if (Directory.Exists("StaticData")) + { + return "StaticData"; + } + else + { + return Path.Combine("..", "..", "StaticData"); + } + default: throw new NotImplementedException(); } @@ -197,7 +206,8 @@ namespace MatterHackers.MatterControl.DataStorage } } - switch (MatterHackers.Agg.UI.WindowsFormsAbstract.GetOSType()) + Agg.UI.WindowsFormsAbstract.OSType osType = MatterHackers.Agg.UI.WindowsFormsAbstract.GetOSType (); + switch (osType) { case Agg.UI.WindowsFormsAbstract.OSType.Windows: dbSQLite = new SQLiteWin32.SQLiteConnection(datastoreLocation); @@ -206,6 +216,9 @@ namespace MatterHackers.MatterControl.DataStorage case Agg.UI.WindowsFormsAbstract.OSType.Mac: dbSQLite = new SQLiteUnix.SQLiteConnection(datastoreLocation); break; + case Agg.UI.WindowsFormsAbstract.OSType.X11: + dbSQLite = new SQLiteUnix.SQLiteConnection(datastoreLocation); + break; default: throw new NotImplementedException(); diff --git a/PrinterCommunication/PrinterCommunication.cs b/PrinterCommunication/PrinterCommunication.cs index 03276abae..5be2aa34b 100644 --- a/PrinterCommunication/PrinterCommunication.cs +++ b/PrinterCommunication/PrinterCommunication.cs @@ -1240,10 +1240,14 @@ namespace MatterHackers.MatterControl //Function is not mac-friendly bool SerialPortAlreadyOpen(string portName) { - if (MatterHackers.Agg.UI.WindowsFormsAbstract.GetOSType() == WindowsFormsAbstract.OSType.Mac) - { - return false; - } + if (MatterHackers.Agg.UI.WindowsFormsAbstract.GetOSType () == WindowsFormsAbstract.OSType.Mac) + { + return false; + } + else if (MatterHackers.Agg.UI.WindowsFormsAbstract.GetOSType () == WindowsFormsAbstract.OSType.X11) + { + return false; + } else { int dwFlagsAndAttributes = 0x40000000; diff --git a/PrinterControls/PrinterConnections/SetupStepInstallDriver.cs b/PrinterControls/PrinterConnections/SetupStepInstallDriver.cs index ae4cbe228..e5298d73c 100644 --- a/PrinterControls/PrinterConnections/SetupStepInstallDriver.cs +++ b/PrinterControls/PrinterConnections/SetupStepInstallDriver.cs @@ -154,6 +154,44 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections case Agg.UI.WindowsFormsAbstract.OSType.Mac: break; + + case Agg.UI.WindowsFormsAbstract.OSType.X11: + if (File.Exists(fileName)) + { + if (Path.GetExtension(fileName).ToUpper() == ".INF") + { + var driverInstallerProcess = new Process(); + // Prepare the process to run + // Enter in the command line arguments, everything you would enter after the executable name itself + driverInstallerProcess.StartInfo.Arguments = Path.GetFullPath(fileName); + // Enter the executable to run, including the complete path + string printerDriverInstallerExePathAndFileName = Path.Combine(".", "InfInstaller.exe"); + + driverInstallerProcess.StartInfo.CreateNoWindow = true; + driverInstallerProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; + + driverInstallerProcess.StartInfo.FileName = Path.GetFullPath(printerDriverInstallerExePathAndFileName); + driverInstallerProcess.StartInfo.Verb = "runas"; + driverInstallerProcess.StartInfo.UseShellExecute = true; + + driverInstallerProcess.Start(); + + driverInstallerProcess.WaitForExit(); + + // Retrieve the app's exit code + var exitCode = driverInstallerProcess.ExitCode; + } + else + { + Process.Start(fileName); + } + } + else + { + throw new Exception(string.Format("Can't find dirver {0}.", fileName)); + } + break; + } } diff --git a/SlicerConfiguration/SlicingQueue.cs b/SlicerConfiguration/SlicingQueue.cs index 1a1175ec5..d57eae18c 100644 --- a/SlicerConfiguration/SlicingQueue.cs +++ b/SlicerConfiguration/SlicingQueue.cs @@ -164,6 +164,30 @@ namespace MatterHackers.MatterControl.SlicerConfiguration throw new NotImplementedException(); } + case Agg.UI.WindowsFormsAbstract.OSType.X11: + switch (ActivePrinterProfile.Instance.ActiveSliceEngineType) + { + case ActivePrinterProfile.SlicingEngineTypes.Slic3r: + { + //string parentLocation = Directory.GetParent (ApplicationDataStorage.Instance.ApplicationPath).ToString (); + string applicationPath = Path.Combine(ApplicationDataStorage.Instance.ApplicationPath, "Slic3r.app", "Contents", "MacOS", "slic3r"); + return applicationPath; + } + case ActivePrinterProfile.SlicingEngineTypes.CuraEngine: + { + string applicationPath = Path.Combine(ApplicationDataStorage.Instance.ApplicationPath, "CuraEngine"); + return applicationPath; + } + case ActivePrinterProfile.SlicingEngineTypes.MatterSlice: + { + string applicationPath = Path.Combine(ApplicationDataStorage.Instance.ApplicationPath, "MatterSlice"); + return applicationPath; + } + + default: + throw new NotImplementedException(); + } + default: throw new NotImplementedException(); }