Put a white background behind the text in the gcode view.
Do a better job of resetting the windows when no widgets are in use.
This commit is contained in:
parent
1f1bc8335e
commit
4b6e44d714
2 changed files with 36 additions and 25 deletions
|
|
@ -119,11 +119,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
gcodeDispalyWidget = new GuiWidget(HAnchor.ParentLeftRight, Agg.UI.VAnchor.ParentBottomTop);
|
||||
|
||||
string startingMessage = "Press 'Add' to select an item.".Localize();
|
||||
SetProcessingMessage("Press 'Add' to select an item.".Localize());
|
||||
if (printItem != null)
|
||||
{
|
||||
startingMessage = LocalizedString.Get("No GCode Available...");
|
||||
startingMessage = LocalizedString.Get("Loading GCode...");
|
||||
SetProcessingMessage(LocalizedString.Get("Loading GCode..."));
|
||||
if (Path.GetExtension(printItem.FileLocation).ToUpper() == ".GCODE")
|
||||
{
|
||||
gcodeDispalyWidget.AddChild(CreateGCodeViewWidget(printItem.FileLocation));
|
||||
|
|
@ -135,13 +134,13 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
string gcodePathAndFileName = printItem.GCodePathAndFileName;
|
||||
bool gcodeFileIsComplete = printItem.IsGCodeFileComplete(gcodePathAndFileName);
|
||||
|
||||
if (gcodeProcessingStateInfoText != null && gcodeProcessingStateInfoText.Text == "Slicing Error")
|
||||
if (gcodeProcessingStateInfoText.Text == "Slicing Error")
|
||||
{
|
||||
startingMessage = LocalizedString.Get("Slicing Error. Please review your slice settings.");
|
||||
SetProcessingMessage(LocalizedString.Get("Slicing Error. Please review your slice settings."));
|
||||
}
|
||||
else
|
||||
{
|
||||
startingMessage = LocalizedString.Get("Press 'generate' to view layers");
|
||||
SetProcessingMessage(LocalizedString.Get("Press 'generate' to view layers"));
|
||||
}
|
||||
|
||||
if (File.Exists(gcodePathAndFileName) && gcodeFileIsComplete)
|
||||
|
|
@ -155,7 +154,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
}
|
||||
else
|
||||
{
|
||||
startingMessage = string.Format("{0}\n'{1}'", LocalizedString.Get("File not found on disk."), printItem.Name);
|
||||
SetProcessingMessage(string.Format("{0}\n'{1}'", LocalizedString.Get("File not found on disk."), printItem.Name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -177,8 +176,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
mainContainerTopToBottom.AddChild(buttonBottomPanel);
|
||||
this.AddChild(mainContainerTopToBottom);
|
||||
|
||||
AddProcessingMessage(startingMessage);
|
||||
|
||||
Add2DViewControls();
|
||||
translateButton.Click += (sender, e) =>
|
||||
{
|
||||
|
|
@ -458,29 +455,43 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
}
|
||||
}
|
||||
|
||||
private void AddProcessingMessage(string message)
|
||||
private void SetProcessingMessage(string message)
|
||||
{
|
||||
gcodeProcessingStateInfoText = new TextWidget(message);
|
||||
gcodeProcessingStateInfoText.HAnchor = HAnchor.ParentCenter;
|
||||
gcodeProcessingStateInfoText.VAnchor = VAnchor.ParentCenter;
|
||||
gcodeProcessingStateInfoText.AutoExpandBoundsToText = true;
|
||||
if (gcodeProcessingStateInfoText == null)
|
||||
{
|
||||
gcodeProcessingStateInfoText = new TextWidget(message);
|
||||
gcodeProcessingStateInfoText.HAnchor = HAnchor.ParentCenter;
|
||||
gcodeProcessingStateInfoText.VAnchor = VAnchor.ParentCenter;
|
||||
gcodeProcessingStateInfoText.AutoExpandBoundsToText = true;
|
||||
|
||||
GuiWidget labelContainer = new GuiWidget();
|
||||
labelContainer.AnchorAll();
|
||||
labelContainer.AddChild(gcodeProcessingStateInfoText);
|
||||
labelContainer.Selectable = false;
|
||||
GuiWidget labelContainer = new GuiWidget();
|
||||
labelContainer.AnchorAll();
|
||||
labelContainer.AddChild(gcodeProcessingStateInfoText);
|
||||
labelContainer.Selectable = false;
|
||||
|
||||
gcodeDispalyWidget.AddChild(labelContainer);
|
||||
gcodeDispalyWidget.AddChild(labelContainer);
|
||||
}
|
||||
|
||||
if (message == "")
|
||||
{
|
||||
gcodeProcessingStateInfoText.BackgroundColor = new RGBA_Bytes();
|
||||
}
|
||||
else
|
||||
{
|
||||
gcodeProcessingStateInfoText.BackgroundColor = RGBA_Bytes.White;
|
||||
}
|
||||
|
||||
gcodeProcessingStateInfoText.Text = message;
|
||||
}
|
||||
|
||||
void LoadingProgressChanged(object sender, ProgressChangedEventArgs e)
|
||||
{
|
||||
gcodeProcessingStateInfoText.Text = string.Format("Loading GCode {0}%...", e.ProgressPercentage);
|
||||
SetProcessingMessage(string.Format("Loading GCode {0}%...", e.ProgressPercentage));
|
||||
}
|
||||
|
||||
void DoneLoadingGCode(object sender, EventArgs e)
|
||||
{
|
||||
gcodeProcessingStateInfoText.Text = "";
|
||||
SetProcessingMessage("");
|
||||
if (gcodeViewWidget != null
|
||||
&& gcodeViewWidget.LoadedGCode != null
|
||||
&& gcodeViewWidget.LoadedGCode.GCodeCommandQueue.Count > 0
|
||||
|
|
@ -632,11 +643,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
StringEventArgs message = e as StringEventArgs;
|
||||
if (message != null && message.Data != null)
|
||||
{
|
||||
gcodeProcessingStateInfoText.Text = message.Data;
|
||||
SetProcessingMessage(message.Data);
|
||||
}
|
||||
else
|
||||
{
|
||||
gcodeProcessingStateInfoText.Text = "";
|
||||
SetProcessingMessage("");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue