Merge pull request #345 from gregory-diaz/master

Fixed Bug: Previously you could not add zip files to the queue using …
This commit is contained in:
johnlewin 2015-08-03 11:09:33 -07:00
commit 356bdad2d2
7 changed files with 58 additions and 10 deletions

View file

@ -175,7 +175,7 @@ namespace MatterHackers.MatterControl
}
}
private static string updateAvailableMessage = "There is a recommended update avalible for MatterControl. Would you like to download it now?".Localize();
private static string updateAvailableMessage = "There is a recommended update available for MatterControl. Would you like to download it now?".Localize();
private static string updateAvailableTitle = "Recommended Update Available".Localize();
private static string downloadNow = "Download Now".Localize();
private static string remindMeLater = "Remind Me Later".Localize();

View file

@ -5,6 +5,7 @@ using MatterHackers.MatterControl.DataStorage;
using MatterHackers.MatterControl.PrinterCommunication;
using MatterHackers.MatterControl.PrinterControls.PrinterConnections;
using MatterHackers.MatterControl.PrintQueue;
using System.Collections.Generic;
using MatterHackers.VectorMath;
using System;
using System.IO;
@ -51,7 +52,22 @@ namespace MatterHackers.MatterControl
{
foreach (string loadedFileName in openParams.FileNames)
{
QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(Path.GetFileNameWithoutExtension(loadedFileName), Path.GetFullPath(loadedFileName))));
if (Path.GetExtension(loadedFileName).ToUpper() == ".ZIP")
{
ProjectFileHandler project = new ProjectFileHandler(null);
List<PrintItem> partFiles = project.ImportFromProjectArchive(loadedFileName);
if (partFiles != null)
{
foreach (PrintItem part in partFiles)
{
QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(part.Name, part.FileLocation)));
}
}
}
else
{
QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(Path.GetFileNameWithoutExtension(loadedFileName), Path.GetFullPath(loadedFileName))));
}
}
}
});

View file

@ -33,6 +33,7 @@ using MatterHackers.Localizations;
using MatterHackers.MatterControl.CustomWidgets;
using MatterHackers.MatterControl.PrintHistory;
using MatterHackers.MatterControl.SlicerConfiguration;
using MatterHackers.MatterControl.PrinterCommunication;
using System;
using System.Collections.Generic;
@ -43,12 +44,19 @@ namespace MatterHackers.MatterControl.ConfigurationPage
private Button languageRestartButton;
private Button configureUpdateFeedButton;
public StyledDropDownList releaseOptionsDropList;
private string cannotRestartWhilePrintIsActiveMessage;
private string cannotRestartWhileActive;
public ApplicationSettingsWidget()
: base("Application Settings".Localize())
{
cannotRestartWhilePrintIsActiveMessage = "Oops! You cannot restart while a print is active.".Localize();
cannotRestartWhileActive = "Unable to restart".Localize();
mainContainer.AddChild(new HorizontalLine(separatorLineColor));
mainContainer.AddChild(GetLanguageControl());
mainContainer.AddChild(new HorizontalLine(separatorLineColor));
@ -189,7 +197,15 @@ namespace MatterHackers.MatterControl.ConfigurationPage
displayControlRestartButton.Margin = new BorderDouble(right: 6);
displayControlRestartButton.Click += (sender, e) =>
{
RestartApplication();
if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
{
StyledMessageBox.ShowMessageBox(null, cannotRestartWhilePrintIsActiveMessage, cannotRestartWhileActive);
}
else
{
RestartApplication();
}
};
FlowLayoutWidget optionsContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
@ -291,9 +307,18 @@ namespace MatterHackers.MatterControl.ConfigurationPage
languageRestartButton.VAnchor = Agg.UI.VAnchor.ParentCenter;
languageRestartButton.Visible = false;
languageRestartButton.Margin = new BorderDouble(right: 6);
languageRestartButton.Click += (sender, e) =>
{
RestartApplication();
if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
{
StyledMessageBox.ShowMessageBox(null, cannotRestartWhilePrintIsActiveMessage, cannotRestartWhileActive);
}
else
{
RestartApplication();
}
};
buttonRow.AddChild(settingsLabel);

View file

@ -318,7 +318,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
private static string setZHeightCoarseInstruction1 = LocalizedString.Get("Using the [Z] controls on this screen, we will now take a coarse measurement of the extruder height at this position.");
private static string setZHeightCourseInstructTextOne = "Place the paper under the extruder".Localize();
private static string setZHeightCourseInstructTextTwo = "Using the above contols".Localize();
private static string setZHeightCourseInstructTextTwo = "Using the above controls".Localize();
private static string setZHeightCourseInstructTextThree = LocalizedString.Get("Press [Z-] until there is resistance to moving the paper");
private static string setZHeightCourseInstructTextFour = LocalizedString.Get("Press [Z+] once to release the paper");
private static string setZHeightCourseInstructTextFive = LocalizedString.Get("Finally click 'Next' to continue.");

View file

@ -166,7 +166,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
private double gcodeRequestedExtrusionPosition = 0;
private string gcodeWarningMessage = "The file you are attempting to print is a GCode file.\n\nIt is recommendended that you only print Gcode files known to match your printer's configuration.\n\nAre you sure you want to print this GCode file?".Localize();
private string gcodeWarningMessage = "The file you are attempting to print is a GCode file.\n\nIt is recommended that you only print Gcode files known to match your printer's configuration.\n\nAre you sure you want to print this GCode file?".Localize();
private string itemNotFoundMessage = "Item not found".Localize();

View file

@ -69,6 +69,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
this.AnchorAll();
this.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
this.Padding = new BorderDouble(0); //To be re-enabled once native borders are turned off
GuiWidget mainContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
mainContainer.AnchorAll();
@ -117,9 +118,10 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
//ListBox printerListContainer = new ListBox();
{
printerListContainer.HAnchor = HAnchor.ParentLeftRight;
printerListContainer.VAnchor = VAnchor.ParentBottomTop;
printerListContainer.VAnchor = VAnchor.FitToChildren;
printerListContainer.Padding = new BorderDouble(3);
printerListContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
//Get a list of printer records and add them to radio button list
foreach (Printer printer in GetAllPrinters())
@ -165,9 +167,14 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
buttonContainer.AddChild(closeButton);
}
ScrollableWidget printerListScrollArea = new ScrollableWidget(true);
printerListScrollArea.ScrollArea.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;
printerListScrollArea.AnchorAll();
printerListScrollArea.AddChild(printerListContainer);
mainContainer.AddChild(headerRow);
mainContainer.AddChild(editButtonRow);
mainContainer.AddChild(printerListContainer);
mainContainer.AddChild(printerListScrollArea);
mainContainer.AddChild(buttonContainer);
this.AddChild(mainContainer);

View file

@ -834,7 +834,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
{
string error = "First Layer Extrusion Width' must be less than or equal to the 'Nozzle Diameter' * 4.".Localize();
string details = string.Format("First Layer Extrusion Width = {0}\nNozzle Diameter = {1}".Localize(), GetActiveValue("first_layer_extrusion_width"), NozzleDiameter);
string location = "Location: 'Settings & Controls' -> 'Settings' -> 'Filament' -> 'Extrusion' -> 'Frist Layer'".Localize();
string location = "Location: 'Settings & Controls' -> 'Settings' -> 'Filament' -> 'Extrusion' -> 'First Layer'".Localize();
StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
return false;
}
@ -843,7 +843,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
{
string error = "First Layer Extrusion Width' must be greater than 0.".Localize();
string details = string.Format("First Layer Extrusion Width = {0}".Localize(), GetActiveValue("first_layer_extrusion_width"));
string location = "Location: 'Settings & Controls' -> 'Settings' -> 'Filament' -> 'Extrusion' -> 'Frist Layer'".Localize();
string location = "Location: 'Settings & Controls' -> 'Settings' -> 'Filament' -> 'Extrusion' -> 'First Layer'".Localize();
StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
return false;
}