mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Plugin Features - Removed icons
Data model event node - Fix numeric values
This commit is contained in:
parent
654863e0de
commit
212f8855de
@ -22,6 +22,7 @@ public class PluginFeatureAttribute : Attribute
|
|||||||
/// The plugins display icon that's shown in the settings see <see href="https://materialdesignicons.com" /> for
|
/// The plugins display icon that's shown in the settings see <see href="https://materialdesignicons.com" /> for
|
||||||
/// available icons
|
/// available icons
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Obsolete("Feature icons are no longer shown in the UI.")]
|
||||||
public string? Icon { get; set; }
|
public string? Icon { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -31,20 +31,7 @@ public class PluginFeatureInfo : CorePropertyChanged, IPrerequisitesSubject
|
|||||||
|
|
||||||
Name = attribute?.Name ?? featureType.Name.Humanize(LetterCasing.Title);
|
Name = attribute?.Name ?? featureType.Name.Humanize(LetterCasing.Title);
|
||||||
Description = attribute?.Description;
|
Description = attribute?.Description;
|
||||||
Icon = attribute?.Icon;
|
|
||||||
AlwaysEnabled = attribute?.AlwaysEnabled ?? false;
|
AlwaysEnabled = attribute?.AlwaysEnabled ?? false;
|
||||||
|
|
||||||
if (Icon != null) return;
|
|
||||||
if (typeof(DeviceProvider).IsAssignableFrom(featureType))
|
|
||||||
Icon = "Devices";
|
|
||||||
else if (typeof(Module).IsAssignableFrom(featureType))
|
|
||||||
Icon = "VectorRectangle";
|
|
||||||
else if (typeof(LayerBrushProvider).IsAssignableFrom(featureType))
|
|
||||||
Icon = "Brush";
|
|
||||||
else if (typeof(LayerEffectProvider).IsAssignableFrom(featureType))
|
|
||||||
Icon = "AutoAwesome";
|
|
||||||
else
|
|
||||||
Icon = "Plugin";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal PluginFeatureInfo(Plugin plugin, PluginFeatureAttribute? attribute, PluginFeature instance)
|
internal PluginFeatureInfo(Plugin plugin, PluginFeatureAttribute? attribute, PluginFeature instance)
|
||||||
@ -56,19 +43,8 @@ public class PluginFeatureInfo : CorePropertyChanged, IPrerequisitesSubject
|
|||||||
|
|
||||||
Name = attribute?.Name ?? instance.GetType().Name.Humanize(LetterCasing.Title);
|
Name = attribute?.Name ?? instance.GetType().Name.Humanize(LetterCasing.Title);
|
||||||
Description = attribute?.Description;
|
Description = attribute?.Description;
|
||||||
Icon = attribute?.Icon;
|
|
||||||
AlwaysEnabled = attribute?.AlwaysEnabled ?? false;
|
AlwaysEnabled = attribute?.AlwaysEnabled ?? false;
|
||||||
Instance = instance;
|
Instance = instance;
|
||||||
|
|
||||||
if (Icon != null) return;
|
|
||||||
Icon = Instance switch
|
|
||||||
{
|
|
||||||
DeviceProvider => "Devices",
|
|
||||||
Module => "VectorRectangle",
|
|
||||||
LayerBrushProvider => "Brush",
|
|
||||||
LayerEffectProvider => "AutoAwesome",
|
|
||||||
_ => "Plugin"
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -110,17 +86,6 @@ public class PluginFeatureInfo : CorePropertyChanged, IPrerequisitesSubject
|
|||||||
set => SetAndNotify(ref _description, value);
|
set => SetAndNotify(ref _description, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The plugins display icon that's shown in the settings see <see href="https://materialdesignicons.com" /> for
|
|
||||||
/// available icons
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty]
|
|
||||||
public string? Icon
|
|
||||||
{
|
|
||||||
get => _icon;
|
|
||||||
set => SetAndNotify(ref _icon, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Marks the feature to always be enabled as long as the plugin is enabled and cannot be disabled.
|
/// Marks the feature to always be enabled as long as the plugin is enabled and cannot be disabled.
|
||||||
/// <para>Note: always <see langword="true" /> if this is the plugin's only feature</para>
|
/// <para>Note: always <see langword="true" /> if this is the plugin's only feature</para>
|
||||||
@ -142,20 +107,7 @@ public class PluginFeatureInfo : CorePropertyChanged, IPrerequisitesSubject
|
|||||||
get => _instance;
|
get => _instance;
|
||||||
internal set => SetAndNotify(ref _instance, value);
|
internal set => SetAndNotify(ref _instance, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a string representing either a full path pointing to an svg or the markdown icon
|
|
||||||
/// </summary>
|
|
||||||
public string? ResolvedIcon
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (Icon == null)
|
|
||||||
return null;
|
|
||||||
return Icon.Contains('.') ? Plugin.ResolveRelativePath(Icon) : Icon;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal PluginFeatureEntity Entity { get; }
|
internal PluginFeatureEntity Entity { get; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
@ -129,7 +129,7 @@ public class ArtemisIcon : UserControl
|
|||||||
/// theme
|
/// theme
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly StyledProperty<bool> FillProperty =
|
public static readonly StyledProperty<bool> FillProperty =
|
||||||
AvaloniaProperty.Register<ArtemisIcon, bool>(nameof(Icon), true, notifying: IconChanging);
|
AvaloniaProperty.Register<ArtemisIcon, bool>(nameof(Icon), false, notifying: IconChanging);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a boolean indicating whether or not the icon should be filled in with the primary text color of the
|
/// Gets or sets a boolean indicating whether or not the icon should be filled in with the primary text color of the
|
||||||
|
|||||||
@ -25,12 +25,12 @@
|
|||||||
</Grid.ContextFlyout>
|
</Grid.ContextFlyout>
|
||||||
|
|
||||||
<!-- Icon column -->
|
<!-- Icon column -->
|
||||||
<shared:ArtemisIcon Grid.Column="0"
|
<avalonia:MaterialIcon Grid.Column="0"
|
||||||
Icon="{CompiledBinding FeatureInfo.ResolvedIcon}"
|
ToolTip.Tip="{CompiledBinding FeatureType}"
|
||||||
Fill="False"
|
Kind="{CompiledBinding FeatureIcon}"
|
||||||
Width="20"
|
Width="20"
|
||||||
Height="20"
|
Height="20"
|
||||||
IsVisible="{CompiledBinding LoadException, Converter={x:Static ObjectConverters.IsNull}}" />
|
IsVisible="{CompiledBinding LoadException, Converter={x:Static ObjectConverters.IsNull}}" />
|
||||||
|
|
||||||
<Button Grid.Column="0"
|
<Button Grid.Column="0"
|
||||||
Classes="AppBarButton icon-button"
|
Classes="AppBarButton icon-button"
|
||||||
|
|||||||
@ -5,11 +5,17 @@ using System.Reactive;
|
|||||||
using System.Reactive.Disposables;
|
using System.Reactive.Disposables;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Artemis.Core;
|
using Artemis.Core;
|
||||||
|
using Artemis.Core.DeviceProviders;
|
||||||
|
using Artemis.Core.LayerBrushes;
|
||||||
|
using Artemis.Core.LayerEffects;
|
||||||
|
using Artemis.Core.Modules;
|
||||||
|
using Artemis.Core.ScriptingProviders;
|
||||||
using Artemis.Core.Services;
|
using Artemis.Core.Services;
|
||||||
using Artemis.UI.Shared;
|
using Artemis.UI.Shared;
|
||||||
using Artemis.UI.Shared.Services;
|
using Artemis.UI.Shared.Services;
|
||||||
using Artemis.UI.Shared.Services.Builders;
|
using Artemis.UI.Shared.Services.Builders;
|
||||||
using Avalonia.Threading;
|
using Avalonia.Threading;
|
||||||
|
using Material.Icons;
|
||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
|
|
||||||
namespace Artemis.UI.Screens.Plugins;
|
namespace Artemis.UI.Screens.Plugins;
|
||||||
@ -90,6 +96,42 @@ public class PluginFeatureViewModel : ActivatableViewModelBase
|
|||||||
public bool CanRemovePrerequisites => FeatureInfo.PlatformPrerequisites.Any(p => p.UninstallActions.Any());
|
public bool CanRemovePrerequisites => FeatureInfo.PlatformPrerequisites.Any(p => p.UninstallActions.Any());
|
||||||
public bool IsPopupEnabled => CanInstallPrerequisites || CanRemovePrerequisites;
|
public bool IsPopupEnabled => CanInstallPrerequisites || CanRemovePrerequisites;
|
||||||
|
|
||||||
|
public MaterialIconKind FeatureIcon
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (FeatureInfo.FeatureType.IsAssignableTo(typeof(DeviceProvider)))
|
||||||
|
return MaterialIconKind.Devices;
|
||||||
|
if (FeatureInfo.FeatureType.IsAssignableTo(typeof(Module)))
|
||||||
|
return MaterialIconKind.VectorRectangle;
|
||||||
|
if (FeatureInfo.FeatureType.IsAssignableTo(typeof(LayerBrushProvider)))
|
||||||
|
return MaterialIconKind.Brush;
|
||||||
|
if (FeatureInfo.FeatureType.IsAssignableTo(typeof(LayerEffectProvider)))
|
||||||
|
return MaterialIconKind.AutoAwesome;
|
||||||
|
if (FeatureInfo.FeatureType.IsAssignableTo(typeof(ScriptingProvider)))
|
||||||
|
return MaterialIconKind.Code;
|
||||||
|
return MaterialIconKind.Extension;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string FeatureType
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (FeatureInfo.FeatureType.IsAssignableTo(typeof(DeviceProvider)))
|
||||||
|
return "Device Provider";
|
||||||
|
if (FeatureInfo.FeatureType.IsAssignableTo(typeof(Module)))
|
||||||
|
return "Module";
|
||||||
|
if (FeatureInfo.FeatureType.IsAssignableTo(typeof(LayerBrushProvider)))
|
||||||
|
return "Layer Brush";
|
||||||
|
if (FeatureInfo.FeatureType.IsAssignableTo(typeof(LayerEffectProvider)))
|
||||||
|
return "Layer Effect";
|
||||||
|
if (FeatureInfo.FeatureType.IsAssignableTo(typeof(ScriptingProvider)))
|
||||||
|
return "Scripting Provider";
|
||||||
|
return "Miscellaneous feature";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void ExecuteShowLogsFolder()
|
private void ExecuteShowLogsFolder()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
<ComboBox.ItemTemplate>
|
<ComboBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<shared:ArtemisIcon Icon="{CompiledBinding Info.ResolvedIcon}" Width="16" Height="16" Margin="0 0 5 0" />
|
<shared:ArtemisIcon Icon="{CompiledBinding Plugin.Info.ResolvedIcon}" Width="16" Height="16" Margin="0 0 5 0" />
|
||||||
<TextBlock Text="{CompiledBinding LanguageName}" />
|
<TextBlock Text="{CompiledBinding LanguageName}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
<shared:ArtemisIcon Grid.Row="0"
|
<shared:ArtemisIcon Grid.Row="0"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Grid.RowSpan="2"
|
Grid.RowSpan="2"
|
||||||
Icon="{CompiledBinding ScriptConfiguration.Script.ScriptingProvider.Info.ResolvedIcon, FallbackValue=QuestionMark}"
|
Icon="{CompiledBinding ScriptConfiguration.Script.ScriptingProvider.Plugin.Info.ResolvedIcon, FallbackValue=QuestionMark}"
|
||||||
Width="32 "
|
Width="32 "
|
||||||
Height="32"
|
Height="32"
|
||||||
Margin="0 0 10 0"
|
Margin="0 0 10 0"
|
||||||
|
|||||||
@ -10,7 +10,7 @@ public class ProfileModuleViewModel : ViewModelBase
|
|||||||
{
|
{
|
||||||
Module = module;
|
Module = module;
|
||||||
Name = module.Info.Name;
|
Name = module.Info.Name;
|
||||||
Icon = module.Info.ResolvedIcon ?? MaterialIconKind.QuestionMark.ToString();
|
Icon = module.Plugin.Info.ResolvedIcon ?? MaterialIconKind.QuestionMark.ToString();
|
||||||
Description = module.Info.Description;
|
Description = module.Info.Description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -56,6 +56,9 @@ public class DataModelEventNode : Node<DataModelPathEntity, DataModelEventNodeCu
|
|||||||
// If the path is a regular value, evaluate the current value
|
// If the path is a regular value, evaluate the current value
|
||||||
else if (_oldValuePin != null && _newValuePin != null)
|
else if (_oldValuePin != null && _newValuePin != null)
|
||||||
{
|
{
|
||||||
|
if (_newValuePin.IsNumeric)
|
||||||
|
pathValue = new Numeric(pathValue);
|
||||||
|
|
||||||
if (Equals(_lastValue, pathValue))
|
if (Equals(_lastValue, pathValue))
|
||||||
{
|
{
|
||||||
TimeSinceLastTrigger.Value = (DateTime.Now - _lastTrigger).TotalMilliseconds;
|
TimeSinceLastTrigger.Value = (DateTime.Now - _lastTrigger).TotalMilliseconds;
|
||||||
@ -119,6 +122,9 @@ public class DataModelEventNode : Node<DataModelPathEntity, DataModelEventNodeCu
|
|||||||
if (propertyType == null)
|
if (propertyType == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (Numeric.IsTypeCompatible(propertyType))
|
||||||
|
propertyType = typeof(Numeric);
|
||||||
|
|
||||||
_oldValuePin = CreateOrAddOutputPin(propertyType, "Old value");
|
_oldValuePin = CreateOrAddOutputPin(propertyType, "Old value");
|
||||||
_newValuePin = CreateOrAddOutputPin(propertyType, "New value");
|
_newValuePin = CreateOrAddOutputPin(propertyType, "New value");
|
||||||
_lastValue = null;
|
_lastValue = null;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user