Modified code so that MatterControl will open on Linux. Still Cannot connect to a printer or slice parts.

This commit is contained in:
gregory-diaz 2014-06-02 17:24:56 -07:00
parent 9205d5312b
commit 53a29071a6
6 changed files with 102 additions and 12 deletions

View file

@ -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);

View file

@ -122,12 +122,23 @@ namespace MatterHackers.MatterControl
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);
}
this.AddChild(topToBottom);
}

View file

@ -118,6 +118,15 @@ 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();

View file

@ -1244,6 +1244,10 @@ namespace MatterHackers.MatterControl
{
return false;
}
else if (MatterHackers.Agg.UI.WindowsFormsAbstract.GetOSType () == WindowsFormsAbstract.OSType.X11)
{
return false;
}
else
{
int dwFlagsAndAttributes = 0x40000000;

View file

@ -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;
}
}

View file

@ -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();
}