Merge pull request #3849 from larsbrubaker/master
Getting more tests to pass
This commit is contained in:
commit
5ca295385e
4 changed files with 90 additions and 37 deletions
|
|
@ -1315,16 +1315,48 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
}
|
||||
else // Allow right click on bed in all modes
|
||||
{
|
||||
// Workspace/plate context menu
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
var popupMenu = new PopupMenu(ApplicationController.Instance.MenuTheme);
|
||||
PopupBedActionsMenu(mouseEvent.Position);
|
||||
}
|
||||
}
|
||||
|
||||
var actions = new[] {
|
||||
new ActionSeparator(),
|
||||
base.OnMouseUp(mouseEvent);
|
||||
|
||||
if (deferEditorTillMouseUp)
|
||||
{
|
||||
this.deferEditorTillMouseUp = false;
|
||||
Scene_SelectionChanged(null, null);
|
||||
}
|
||||
}
|
||||
|
||||
public void PopupBedActionsMenu(Vector2 position)
|
||||
{
|
||||
// Workspace/plate context menu
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
var popupMenu = new PopupMenu(ApplicationController.Instance.MenuTheme);
|
||||
|
||||
var actions = new[] {
|
||||
WorkspaceActions["Insert"],
|
||||
new ActionSeparator(),
|
||||
new NamedAction()
|
||||
{
|
||||
Title = "Cut".Localize(),
|
||||
Action = () =>
|
||||
{
|
||||
Scene.Cut();
|
||||
},
|
||||
IsEnabled = () => Scene.SelectedItem != null
|
||||
},
|
||||
new NamedAction()
|
||||
{
|
||||
Title = "Copy".Localize(),
|
||||
Action = () =>
|
||||
{
|
||||
Scene.Copy();
|
||||
},
|
||||
IsEnabled = () => Scene.SelectedItem != null
|
||||
},
|
||||
new NamedAction()
|
||||
{
|
||||
Title = "Paste".Localize(),
|
||||
Action = () =>
|
||||
|
|
@ -1341,34 +1373,24 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
WorkspaceActions["ClearBed"],
|
||||
};
|
||||
|
||||
theme.CreateMenuItems(popupMenu, actions, emptyMenu: false);
|
||||
theme.CreateMenuItems(popupMenu, actions, emptyMenu: false);
|
||||
|
||||
var popupBounds = new RectangleDouble(mouseEvent.X + 1, mouseEvent.Y + 1, mouseEvent.X + 1, mouseEvent.Y + 1);
|
||||
var popupBounds = new RectangleDouble(position.X + 1, position.Y + 1, position.X + 1, position.Y + 1);
|
||||
|
||||
var systemWindow = this.Parents<SystemWindow>().FirstOrDefault();
|
||||
systemWindow.ShowPopup(
|
||||
new MatePoint(this)
|
||||
{
|
||||
Mate = new MateOptions(MateEdge.Left, MateEdge.Bottom),
|
||||
AltMate = new MateOptions(MateEdge.Left, MateEdge.Top)
|
||||
},
|
||||
new MatePoint(popupMenu)
|
||||
{
|
||||
Mate = new MateOptions(MateEdge.Left, MateEdge.Top),
|
||||
AltMate = new MateOptions(MateEdge.Left, MateEdge.Top)
|
||||
},
|
||||
altBounds: popupBounds);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
base.OnMouseUp(mouseEvent);
|
||||
|
||||
if (deferEditorTillMouseUp)
|
||||
{
|
||||
this.deferEditorTillMouseUp = false;
|
||||
Scene_SelectionChanged(null, null);
|
||||
}
|
||||
var systemWindow = this.Parents<SystemWindow>().FirstOrDefault();
|
||||
systemWindow.ShowPopup(
|
||||
new MatePoint(this)
|
||||
{
|
||||
Mate = new MateOptions(MateEdge.Left, MateEdge.Bottom),
|
||||
AltMate = new MateOptions(MateEdge.Left, MateEdge.Top)
|
||||
},
|
||||
new MatePoint(popupMenu)
|
||||
{
|
||||
Mate = new MateOptions(MateEdge.Left, MateEdge.Top),
|
||||
AltMate = new MateOptions(MateEdge.Left, MateEdge.Top)
|
||||
},
|
||||
altBounds: popupBounds);
|
||||
});
|
||||
}
|
||||
|
||||
// TODO: Consider if we should always allow DragDrop or if we should prevent during printer or other scenarios
|
||||
|
|
|
|||
|
|
@ -171,6 +171,25 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
this.AddChild(new ToolbarSeparator(theme));
|
||||
|
||||
var optionsButton = new PopupMenuButton("File".Localize(), theme)
|
||||
{
|
||||
Name = "Bed Options Menu",
|
||||
//ToolTipText = "Options",
|
||||
Enabled = true,
|
||||
Margin = theme.ButtonSpacing,
|
||||
VAnchor = VAnchor.Center
|
||||
};
|
||||
optionsButton.DynamicPopupContent = () =>
|
||||
{
|
||||
var popupMenu = new PopupMenu(ApplicationController.Instance.MenuTheme);
|
||||
theme.CreateMenuItems(popupMenu, this.BedMenuActions(sceneContext, theme), emptyMenu: false);
|
||||
|
||||
return popupMenu;
|
||||
};
|
||||
this.AddChild(optionsButton);
|
||||
|
||||
this.AddChild(new ToolbarSeparator(theme));
|
||||
|
||||
var undoButton = new IconButton(AggContext.StaticData.LoadIcon("Undo_grey_16x.png", 16, 16, theme.InvertIcons), theme)
|
||||
{
|
||||
Name = "3D View Undo",
|
||||
|
|
@ -677,7 +696,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
sceneContext.Scene.Cut();
|
||||
},
|
||||
IsEnabled = () => sceneContext.EditableScene
|
||||
IsEnabled = () => sceneContext.Scene.SelectedItem != null
|
||||
},
|
||||
new NamedAction()
|
||||
{
|
||||
|
|
@ -688,7 +707,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
sceneContext.Scene.Copy();
|
||||
},
|
||||
IsEnabled = () => sceneContext.EditableScene
|
||||
IsEnabled = () => sceneContext.Scene.SelectedItem != null
|
||||
},
|
||||
new NamedAction()
|
||||
{
|
||||
|
|
@ -699,7 +718,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
sceneContext.Scene.Paste();
|
||||
},
|
||||
IsEnabled = () => sceneContext.EditableScene
|
||||
IsEnabled = () => Clipboard.Instance.ContainsImage || Clipboard.Instance.GetText() == "!--IObjectSelection--!"
|
||||
},
|
||||
new ActionSeparator(),
|
||||
new NamedAction()
|
||||
|
|
|
|||
|
|
@ -239,6 +239,11 @@ namespace MatterControl.Tests.MatterControl
|
|||
{
|
||||
}
|
||||
|
||||
[Test, Ignore("Not implemented")]
|
||||
public async Task PrimitivesContainerTest()
|
||||
{
|
||||
}
|
||||
|
||||
[Test, Ignore("Not implemented")]
|
||||
public async Task McxContainerTest()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -310,7 +310,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
// Click 'Add Printer' if not on screen
|
||||
if (!testRunner.NameExists("Select Make", 0.2))
|
||||
{
|
||||
if (!testRunner.NameExists("Create Printer", 0.1))
|
||||
if (!testRunner.NameExists("Create Printer", 0.2))
|
||||
{
|
||||
// go to the start page
|
||||
testRunner.ClickByName("Hardware Tab");
|
||||
|
|
@ -318,7 +318,14 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
}
|
||||
else
|
||||
{
|
||||
testRunner.ClickByName("Print Button");
|
||||
if (testRunner.NameExists("Print Button", .2))
|
||||
{
|
||||
testRunner.ClickByName("Print Button");
|
||||
}
|
||||
else
|
||||
{
|
||||
testRunner.ClickByName("Create Printer");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue