Merge pull request #4998 from larsbrubaker/master

main
This commit is contained in:
Lars Brubaker 2021-03-03 08:30:18 -08:00 committed by GitHub
commit db1828fa0e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 108 additions and 43 deletions

View file

@ -2273,7 +2273,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
{
SlicerConfigName = SettingsKey.sla_printable_area_inset,
PresentationName = "Printable Area Inset".Localize(),
HelpText = "The inset amount from the edges of the bed. Defines the printable area of the bed. Leave as 0s if the entire bed can be printed to.".Localize(),
HelpText = "The inset amount from the edges of the bed. Defines the printable area of the bed. Leave as 0s if the entire bed can be printed to (Left, Front, Right, Back).".Localize(),
DataEditType = DataEditTypes.BOUNDS,
RequiredDisplayDetail = DisplayDetailRequired.Advanced,
DefaultValue = ""
@ -2282,7 +2282,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
{
SlicerConfigName = SettingsKey.t0_inset,
PresentationName = "Nozzle 1 Inset".Localize(),
HelpText = "The inset amount for nozzle 1 from the bed".Localize(),
HelpText = "The inset amount for nozzle 1 from the bed (Left, Front, Right, Back).".Localize(),
DataEditType = DataEditTypes.BOUNDS,
RequiredDisplayDetail = DisplayDetailRequired.Advanced,
ShowIfSet = "extruder_count>1",
@ -2292,7 +2292,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
{
SlicerConfigName = SettingsKey.t1_inset,
PresentationName = "Nozzle 2 Inset".Localize(),
HelpText = "The inset amount for nozzle 2 from the bed".Localize(),
HelpText = "The inset amount for nozzle 2 from the bed (Left, Front, Right, Back).".Localize(),
DataEditType = DataEditTypes.BOUNDS,
RequiredDisplayDetail = DisplayDetailRequired.Advanced,
ShowIfSet = "extruder_count>1",

View file

@ -0,0 +1,41 @@
/*
Copyright (c) 2018, Lars Brubaker, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
using System;
namespace MatterHackers.MatterControl.DesignTools
{
[AttributeUsage(AttributeTargets.Class)]
public class RequiresPermissionsAttribute : Attribute
{
public RequiresPermissionsAttribute()
{
}
}
}

View file

@ -0,0 +1,40 @@
/*
Copyright (c) 2018, Lars Brubaker, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
using System;
namespace MatterHackers.MatterControl.DesignTools
{
public class SupressRebuildAttribute : Attribute
{
public SupressRebuildAttribute()
{
}
}
}

View file

@ -59,7 +59,7 @@ namespace MatterHackers.MatterControl.DesignTools
{
typeof(double), typeof(int), typeof(char), typeof(string), typeof(bool),
typeof(Color),
typeof(Vector2), typeof(Vector3), typeof(Vector4),
typeof(Vector2), typeof(Vector3),
typeof(DirectionVector), typeof(DirectionAxis),
typeof(SelectedChildren),
typeof(ImageBuffer),
@ -421,29 +421,6 @@ namespace MatterHackers.MatterControl.DesignTools
rowContainer = CreateSettingsColumn(property, field);
}
else if (propertyValue is Vector4 vector4)
{
var field = new Vector4Field(theme);
if (property.PropertyInfo.GetCustomAttributes(true).OfType<VectorFieldLabelsAttribute>().FirstOrDefault() is VectorFieldLabelsAttribute vectorFieldLabels)
{
field.Labels = vectorFieldLabels.Labels;
}
field.Initialize(0);
field.Vector4 = vector4;
field.ClearUndoHistory();
RegisterValueChanged(
field,
(valueString) => Vector4.Parse(valueString),
(value) =>
{
var s = ((Vector4)value).ToString();
return s.Substring(1, s.Length - 2);
});
rowContainer = CreateSettingsColumn(property, field);
}
else if (propertyValue is DirectionVector directionVector)
{
var field = new DirectionVectorField(theme);
@ -523,7 +500,8 @@ namespace MatterHackers.MatterControl.DesignTools
}
else if (propertyValue is SelectedChildren childSelector)
{
if (property.PropertyInfo.GetCustomAttributes(true).OfType<ShowAsListAttribute>().FirstOrDefault() is ShowAsListAttribute showAsList)
var showAsList = property.PropertyInfo.GetCustomAttributes(true).OfType<ShowAsListAttribute>().FirstOrDefault() != null;
if (showAsList)
{
UIField field = new ChildrenSelectorListField(property, theme);
@ -966,7 +944,14 @@ namespace MatterHackers.MatterControl.DesignTools
public static void AddUnlockLinkIfRequired(IObject3D item, GuiWidget editControlsContainer, ThemeConfig theme)
{
if (!item.Persistable)
(string url, GuiWidget markdownWidget)? unlockdata = null;
if (item.GetType().GetCustomAttributes(typeof(RequiresPermissionsAttribute), true).FirstOrDefault() is RequiresPermissionsAttribute unlockLink
&& !ApplicationController.Instance.UserHasPermission(item))
{
unlockdata = ApplicationController.Instance.GetUnlockData?.Invoke(item, theme);
}
else if (!item.Persistable)
{
// find the first self or child that is not authorized
var permission = item.DescendantsAndSelf()
@ -975,21 +960,20 @@ namespace MatterHackers.MatterControl.DesignTools
if (permission.Any())
{
var unlockItem = permission.First();
var unlockdata = ApplicationController.Instance.GetUnlockData?.Invoke(unlockItem, theme);
if (unlockdata != null
&& !string.IsNullOrEmpty(unlockdata.Value.url))
{
if (unlockdata.Value.markdownWidget != null)
{
unlockdata.Value.markdownWidget.VAnchor = VAnchor.Fit;
editControlsContainer.AddChild(unlockdata.Value.markdownWidget);
}
editControlsContainer.AddChild(GetUnlockRow(theme, unlockdata.Value.url));
}
unlockdata = ApplicationController.Instance.GetUnlockData?.Invoke(unlockItem, theme);
}
}
if (unlockdata != null && !string.IsNullOrEmpty(unlockdata.Value.url))
{
if (unlockdata.Value.markdownWidget != null)
{
unlockdata.Value.markdownWidget.VAnchor = VAnchor.Fit;
editControlsContainer.AddChild(unlockdata.Value.markdownWidget);
}
editControlsContainer.AddChild(GetUnlockRow(theme, unlockdata.Value.url));
}
}
public static GuiWidget GetUnlockRow(ThemeConfig theme, string url)

View file

@ -34,7 +34,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
public BoundsField(ThemeConfig theme)
: base (theme)
{
Labels = new[] { 'L', 'B', 'R', 'T' };
Labels = new[] { 'L', 'F', 'R', 'B' };
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB