From 212f8855de50735ba4915c22562e585d3df34277 Mon Sep 17 00:00:00 2001 From: Robert Date: Sat, 17 Sep 2022 19:12:14 +0200 Subject: [PATCH 1/4] Plugin Features - Removed icons Data model event node - Fix numeric values --- .../Plugins/PluginFeatureAttribute.cs | 1 + src/Artemis.Core/Plugins/PluginFeatureInfo.cs | 50 +------------------ .../Controls/ArtemisIcon.axaml.cs | 2 +- .../Screens/Plugins/PluginFeatureView.axaml | 12 ++--- .../Screens/Plugins/PluginFeatureViewModel.cs | 42 ++++++++++++++++ .../ScriptConfigurationCreateView.axaml | 2 +- .../Screens/Scripting/ScriptsDialogView.axaml | 2 +- .../Sidebar/Dialogs/ProfileModuleViewModel.cs | 2 +- .../Nodes/DataModel/DataModelEventNode.cs | 6 +++ 9 files changed, 60 insertions(+), 59 deletions(-) diff --git a/src/Artemis.Core/Plugins/PluginFeatureAttribute.cs b/src/Artemis.Core/Plugins/PluginFeatureAttribute.cs index 19acfa645..cf36770e1 100644 --- a/src/Artemis.Core/Plugins/PluginFeatureAttribute.cs +++ b/src/Artemis.Core/Plugins/PluginFeatureAttribute.cs @@ -22,6 +22,7 @@ public class PluginFeatureAttribute : Attribute /// The plugins display icon that's shown in the settings see for /// available icons /// + [Obsolete("Feature icons are no longer shown in the UI.")] public string? Icon { get; set; } /// diff --git a/src/Artemis.Core/Plugins/PluginFeatureInfo.cs b/src/Artemis.Core/Plugins/PluginFeatureInfo.cs index 35798a064..32d5775ec 100644 --- a/src/Artemis.Core/Plugins/PluginFeatureInfo.cs +++ b/src/Artemis.Core/Plugins/PluginFeatureInfo.cs @@ -31,20 +31,7 @@ public class PluginFeatureInfo : CorePropertyChanged, IPrerequisitesSubject Name = attribute?.Name ?? featureType.Name.Humanize(LetterCasing.Title); Description = attribute?.Description; - Icon = attribute?.Icon; 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) @@ -56,19 +43,8 @@ public class PluginFeatureInfo : CorePropertyChanged, IPrerequisitesSubject Name = attribute?.Name ?? instance.GetType().Name.Humanize(LetterCasing.Title); Description = attribute?.Description; - Icon = attribute?.Icon; AlwaysEnabled = attribute?.AlwaysEnabled ?? false; Instance = instance; - - if (Icon != null) return; - Icon = Instance switch - { - DeviceProvider => "Devices", - Module => "VectorRectangle", - LayerBrushProvider => "Brush", - LayerEffectProvider => "AutoAwesome", - _ => "Plugin" - }; } /// @@ -110,17 +86,6 @@ public class PluginFeatureInfo : CorePropertyChanged, IPrerequisitesSubject set => SetAndNotify(ref _description, value); } - /// - /// The plugins display icon that's shown in the settings see for - /// available icons - /// - [JsonProperty] - public string? Icon - { - get => _icon; - set => SetAndNotify(ref _icon, value); - } - /// /// Marks the feature to always be enabled as long as the plugin is enabled and cannot be disabled. /// Note: always if this is the plugin's only feature @@ -142,20 +107,7 @@ public class PluginFeatureInfo : CorePropertyChanged, IPrerequisitesSubject get => _instance; internal set => SetAndNotify(ref _instance, value); } - - /// - /// Gets a string representing either a full path pointing to an svg or the markdown icon - /// - public string? ResolvedIcon - { - get - { - if (Icon == null) - return null; - return Icon.Contains('.') ? Plugin.ResolveRelativePath(Icon) : Icon; - } - } - + internal PluginFeatureEntity Entity { get; } /// diff --git a/src/Artemis.UI.Shared/Controls/ArtemisIcon.axaml.cs b/src/Artemis.UI.Shared/Controls/ArtemisIcon.axaml.cs index e60e2e73b..1e3e47a1d 100644 --- a/src/Artemis.UI.Shared/Controls/ArtemisIcon.axaml.cs +++ b/src/Artemis.UI.Shared/Controls/ArtemisIcon.axaml.cs @@ -129,7 +129,7 @@ public class ArtemisIcon : UserControl /// theme /// public static readonly StyledProperty FillProperty = - AvaloniaProperty.Register(nameof(Icon), true, notifying: IconChanging); + AvaloniaProperty.Register(nameof(Icon), false, notifying: IconChanging); /// /// Gets or sets a boolean indicating whether or not the icon should be filled in with the primary text color of the diff --git a/src/Artemis.UI/Screens/Plugins/PluginFeatureView.axaml b/src/Artemis.UI/Screens/Plugins/PluginFeatureView.axaml index d9c6efbcb..790c38f82 100644 --- a/src/Artemis.UI/Screens/Plugins/PluginFeatureView.axaml +++ b/src/Artemis.UI/Screens/Plugins/PluginFeatureView.axaml @@ -25,12 +25,12 @@ - + - + Date: Sun, 25 Sep 2022 20:48:49 +0200 Subject: [PATCH 4/4] Migrations - Fix possible DB issue with migrator --- src/Artemis.Storage/Migrations/M0021GradientNodes.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Artemis.Storage/Migrations/M0021GradientNodes.cs b/src/Artemis.Storage/Migrations/M0021GradientNodes.cs index 11f062bd7..4d701ef24 100644 --- a/src/Artemis.Storage/Migrations/M0021GradientNodes.cs +++ b/src/Artemis.Storage/Migrations/M0021GradientNodes.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Linq; using Artemis.Storage.Entities.Profile; using Artemis.Storage.Entities.Profile.Nodes; @@ -63,13 +64,13 @@ public class M0021GradientNodes : IStorageMigration public void Apply(LiteRepository repository) { // Find all color gradient data bindings, there's no really good way to do this so infer it from the value - ILiteCollection collection = repository.Database.GetCollection(); - foreach (ProfileEntity profileEntity in collection.FindAll()) + List profiles = repository.Query().ToList(); + foreach (ProfileEntity profileEntity in profiles) { foreach (LayerEntity layer in profileEntity.Layers) MigrateDataBinding(layer.LayerBrush.PropertyGroup); - collection.Update(profileEntity); + repository.Update(profileEntity); } }