Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify qualified name for workflow element icons #1433

Merged
merged 3 commits into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Bonsai.Core/Expressions/AsyncSubjectBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.ComponentModel;
using System.Reactive.Subjects;
using System.Xml.Serialization;
Expand All @@ -10,8 +10,8 @@ namespace Bonsai.Expressions
/// </summary>
[Obsolete]
[ProxyType(typeof(Reactive.AsyncSubject))]
[WorkflowElementIcon(nameof(AsyncSubjectBuilder))]
[XmlType("AsyncSubject", Namespace = Constants.XmlNamespace)]
[WorkflowElementIcon(typeof(AsyncSubjectBuilder), nameof(AsyncSubjectBuilder))]
[Description("Broadcasts the last value of an observable sequence to all subscribed and future observers using a shared subject.")]
public class AsyncSubjectBuilder : Reactive.AsyncSubject
{
Expand All @@ -27,8 +27,8 @@ AsyncSubject<TSource> CreateSubject<TSource>()
/// <typeparam name="T">The type of the result stored by the subject.</typeparam>
[Obsolete]
[ProxyType(typeof(Reactive.AsyncSubject<>))]
[WorkflowElementIcon(nameof(AsyncSubjectBuilder))]
[XmlType("AsyncSubject", Namespace = Constants.XmlNamespace)]
[WorkflowElementIcon(typeof(AsyncSubjectBuilder), nameof(AsyncSubjectBuilder))]
[Description("Broadcasts the result of the first observable sequence to complete to all subscribed and future observers.")]
public class AsyncSubjectBuilder<T> : SubjectBuilder<T>
{
Expand Down
4 changes: 2 additions & 2 deletions Bonsai.Core/Expressions/BehaviorSubjectBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ namespace Bonsai.Expressions
/// </summary>
[Obsolete]
[ProxyType(typeof(Reactive.BehaviorSubject))]
[WorkflowElementIcon(nameof(BehaviorSubjectBuilder))]
[XmlType("BehaviorSubject", Namespace = Constants.XmlNamespace)]
[WorkflowElementIcon(typeof(BehaviorSubjectBuilder), nameof(BehaviorSubjectBuilder))]
[Description("Broadcasts the latest value of an observable sequence to all subscribed and future observers using a shared subject.")]
public class BehaviorSubjectBuilder : Reactive.BehaviorSubject
{
Expand All @@ -27,8 +27,8 @@ Reactive.BehaviorSubject<TSource>.Subject CreateSubject<TSource>()
/// <typeparam name="T">The type of the elements processed by the subject.</typeparam>
[Obsolete]
[ProxyType(typeof(Reactive.BehaviorSubject<>))]
[WorkflowElementIcon(nameof(BehaviorSubjectBuilder))]
[XmlType("BehaviorSubject", Namespace = Constants.XmlNamespace)]
[WorkflowElementIcon(typeof(BehaviorSubjectBuilder), nameof(BehaviorSubjectBuilder))]
[Description("Broadcasts the latest value from other observable sequences to all subscribed and future observers.")]
public class BehaviorSubjectBuilder<T> : SubjectBuilder<T>
{
Expand Down
4 changes: 2 additions & 2 deletions Bonsai.Core/Expressions/PublishSubjectBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ namespace Bonsai.Expressions
/// </summary>
[Obsolete]
[ProxyType(typeof(Reactive.PublishSubject))]
[WorkflowElementIcon(nameof(PublishSubjectBuilder))]
[XmlType("PublishSubject", Namespace = Constants.XmlNamespace)]
[WorkflowElementIcon(typeof(PublishSubjectBuilder), nameof(PublishSubjectBuilder))]
[Description("Broadcasts the values of an observable sequence to multiple subscribers using a shared subject.")]
public class PublishSubjectBuilder : Reactive.PublishSubject
{
Expand All @@ -23,8 +23,8 @@ public class PublishSubjectBuilder : Reactive.PublishSubject
/// <typeparam name="T">The type of the elements processed by the subject.</typeparam>
[Obsolete]
[ProxyType(typeof(Reactive.PublishSubject<>))]
[WorkflowElementIcon(nameof(PublishSubjectBuilder))]
[XmlType("PublishSubject", Namespace = Constants.XmlNamespace)]
[WorkflowElementIcon(typeof(PublishSubjectBuilder), nameof(PublishSubjectBuilder))]
[Description("Broadcasts the values from other observable sequences to multiple subscribers.")]
public class PublishSubjectBuilder<T> : SubjectBuilder<T>
{
Expand Down
4 changes: 2 additions & 2 deletions Bonsai.Core/Expressions/ReplaySubjectBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ namespace Bonsai.Expressions
/// </summary>
[Obsolete]
[ProxyType(typeof(Reactive.ReplaySubject))]
[WorkflowElementIcon(nameof(ReplaySubjectBuilder))]
[XmlType("ReplaySubject", Namespace = Constants.XmlNamespace)]
[WorkflowElementIcon(typeof(ReplaySubjectBuilder), nameof(ReplaySubjectBuilder))]
[Description("Replays the values of an observable sequence to all subscribed and future observers using a shared subject.")]
public class ReplaySubjectBuilder : SubjectBuilder
{
Expand Down Expand Up @@ -90,8 +90,8 @@ ReplaySubject<TSource> CreateSubject<TSource>()
/// <typeparam name="T">The type of the elements processed by the subject.</typeparam>
[Obsolete]
[ProxyType(typeof(Reactive.ReplaySubject<>))]
[WorkflowElementIcon(nameof(ReplaySubjectBuilder))]
[XmlType("ReplaySubject", Namespace = Constants.XmlNamespace)]
[WorkflowElementIcon(typeof(ReplaySubjectBuilder), nameof(ReplaySubjectBuilder))]
[Description("Replays the values of other observable sequences to all subscribed and future observers.")]
public class ReplaySubjectBuilder<T> : SubjectBuilder<T>
{
Expand Down
4 changes: 2 additions & 2 deletions Bonsai.Core/Expressions/ResourceSubjectBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ namespace Bonsai.Expressions
/// </summary>
[Obsolete]
[ProxyType(typeof(Reactive.ResourceSubject))]
[WorkflowElementIcon(nameof(ResourceSubjectBuilder))]
[XmlType("ResourceSubject", Namespace = Constants.XmlNamespace)]
[WorkflowElementIcon(typeof(ResourceSubjectBuilder), nameof(ResourceSubjectBuilder))]
[Description("Stores a disposable resource and shares it with all subscribed and future observers.")]
public class ResourceSubjectBuilder : Reactive.ResourceSubject
{
Expand All @@ -27,8 +27,8 @@ Reactive.ResourceSubject<TSource>.Subject CreateSubject<TSource>() where TSource
/// <typeparam name="T">The type of the disposable resource stored by the subject.</typeparam>
[Obsolete]
[ProxyType(typeof(Reactive.ResourceSubject<>))]
[WorkflowElementIcon(nameof(ResourceSubjectBuilder))]
[XmlType("ResourceSubject", Namespace = Constants.XmlNamespace)]
[WorkflowElementIcon(typeof(ResourceSubjectBuilder), nameof(ResourceSubjectBuilder))]
[Description("Stores a disposable resource and shares it with all subscribed and future observers.")]
public class ResourceSubjectBuilder<T> : SubjectBuilder<T> where T : class, IDisposable
{
Expand Down
2 changes: 1 addition & 1 deletion Bonsai.Core/Expressions/SubjectExpressionBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Bonsai.Expressions
/// Provides a base class for expression builders that declare shared subjects. This is an abstract class.
/// </summary>
[DefaultProperty(nameof(Name))]
[WorkflowElementIcon(typeof(SubjectExpressionBuilder), nameof(SubjectExpressionBuilder))]
[WorkflowElementIcon(nameof(SubjectExpressionBuilder))]
public abstract class SubjectExpressionBuilder : VariableArgumentExpressionBuilder, INamedElement
{
/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion Bonsai.Core/Expressions/SubscribeSubject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static IObservable<TSource> Process<TSource>(ISubject<TSource> subject)
/// </summary>
/// <typeparam name="T">The type of the elements processed by the subject.</typeparam>
[XmlType(Namespace = Constants.XmlNamespace)]
[WorkflowElementIcon(typeof(SubscribeSubject), nameof(SubscribeSubject))]
[WorkflowElementIcon(nameof(SubscribeSubject))]
public class SubscribeSubject<T> : SubscribeSubject
{
/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion Bonsai.Core/Expressions/VisualizerMappingBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ namespace Bonsai.Expressions
/// in a mashup visualizer.
/// </summary>
[WorkflowElementCategory(ElementCategory.Property)]
[WorkflowElementIcon("Bonsai:ElementIcon.Visualizer")]
[XmlType("VisualizerMapping", Namespace = Constants.XmlNamespace)]
[WorkflowElementIcon(typeof(ElementCategory), "ElementIcon.Visualizer")]
[Description("Specifies an observable sequence to be combined in a mashup visualizer.")]
public sealed class VisualizerMappingBuilder : SingleArgumentExpressionBuilder, INamedElement, IArgumentBuilder, ISerializableElement
{
Expand Down
2 changes: 1 addition & 1 deletion Bonsai.Core/Expressions/WorkflowInputBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ public override Expression Build(IEnumerable<Expression> arguments)
/// <typeparam name="TSource">
/// The type of the elements in the generated observable sequence.
/// </typeparam>
[WorkflowElementIcon(nameof(WorkflowInputBuilder))]
[XmlType("WorkflowInput", Namespace = Constants.XmlNamespace)]
[WorkflowElementIcon(typeof(WorkflowInputBuilder), nameof(WorkflowInputBuilder))]
public class WorkflowInputBuilder<TSource> : WorkflowInputBuilder
{
/// <inheritdoc/>
Expand Down
4 changes: 2 additions & 2 deletions Bonsai.Core/Reactive/Subjects/AsyncSubject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ namespace Bonsai.Reactive
/// Represents an expression builder that broadcasts the last value of an observable
/// sequence to all subscribed and future observers using a shared subject.
/// </summary>
[WorkflowElementIcon(nameof(AsyncSubject))]
[XmlType(Namespace = Constants.ReactiveXmlNamespace)]
[WorkflowElementIcon(typeof(AsyncSubject), nameof(AsyncSubject))]
[Description("Broadcasts the last value of an observable sequence to all subscribed and future observers using a shared subject.")]
public class AsyncSubject : SubjectBuilder
{
Expand All @@ -35,8 +35,8 @@ Rx.AsyncSubject<TSource> CreateSubject<TSource>()
/// sequence to complete to all subscribed and future observers.
/// </summary>
/// <typeparam name="T">The type of the result stored by the subject.</typeparam>
[WorkflowElementIcon(nameof(AsyncSubject))]
[XmlType(Namespace = Constants.ReactiveXmlNamespace)]
[WorkflowElementIcon(typeof(AsyncSubject), nameof(AsyncSubject))]
[Description("Broadcasts the result of the first observable sequence to complete to all subscribed and future observers.")]
public class AsyncSubject<T> : SubjectBuilder<T>
{
Expand Down
4 changes: 2 additions & 2 deletions Bonsai.Core/Reactive/Subjects/BehaviorSubject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ namespace Bonsai.Reactive
/// Represents an expression builder that broadcasts the latest value of an observable
/// sequence to all subscribed and future observers using a shared subject.
/// </summary>
[WorkflowElementIcon(nameof(BehaviorSubject))]
[XmlType(Namespace = Constants.ReactiveXmlNamespace)]
[WorkflowElementIcon(typeof(BehaviorSubject), nameof(BehaviorSubject))]
[Description("Broadcasts the latest value of an observable sequence to all subscribed and future observers using a shared subject.")]
public class BehaviorSubject : SubjectBuilder
{
Expand All @@ -36,8 +36,8 @@ BehaviorSubject<TSource>.Subject CreateSubject<TSource>()
/// sequences to all subscribed and future observers.
/// </summary>
/// <typeparam name="T">The type of the elements processed by the subject.</typeparam>
[WorkflowElementIcon(nameof(BehaviorSubject))]
[XmlType(Namespace = Constants.ReactiveXmlNamespace)]
[WorkflowElementIcon(typeof(BehaviorSubject), nameof(BehaviorSubject))]
[Description("Broadcasts the latest value from other observable sequences to all subscribed and future observers.")]
public class BehaviorSubject<T> : SubjectBuilder<T>
{
Expand Down
4 changes: 2 additions & 2 deletions Bonsai.Core/Reactive/Subjects/PublishSubject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ namespace Bonsai.Reactive
/// Represents an expression builder that broadcasts the values of an observable
/// sequence to multiple subscribers using a shared subject.
/// </summary>
[WorkflowElementIcon(nameof(PublishSubject))]
[XmlType(Namespace = Constants.ReactiveXmlNamespace)]
[WorkflowElementIcon(typeof(PublishSubject), nameof(PublishSubject))]
[Description("Broadcasts the values of an observable sequence to multiple subscribers using a shared subject.")]
public class PublishSubject : SubjectBuilder
{
Expand All @@ -28,8 +28,8 @@ protected override Expression BuildSubject(Expression expression)
/// sequences to multiple subscribers.
/// </summary>
/// <typeparam name="T">The type of the elements processed by the subject.</typeparam>
[WorkflowElementIcon(nameof(PublishSubject))]
[XmlType(Namespace = Constants.ReactiveXmlNamespace)]
[WorkflowElementIcon(typeof(PublishSubject), nameof(PublishSubject))]
[Description("Broadcasts the values from other observable sequences to multiple subscribers.")]
public class PublishSubject<T> : SubjectBuilder<T>
{
Expand Down
4 changes: 2 additions & 2 deletions Bonsai.Core/Reactive/Subjects/ReplaySubject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ namespace Bonsai.Reactive
/// Represents an expression builder that replays the values of an observable
/// sequence to all subscribed and future observers using a shared subject.
/// </summary>
[WorkflowElementIcon(nameof(ReplaySubject))]
[XmlType(Namespace = Constants.ReactiveXmlNamespace)]
[WorkflowElementIcon(typeof(ReplaySubject), nameof(ReplaySubject))]
[Description("Replays the values of an observable sequence to all subscribed and future observers using a shared subject.")]
public class ReplaySubject : SubjectBuilder
{
Expand Down Expand Up @@ -81,8 +81,8 @@ Rx.ReplaySubject<TSource> CreateSubject<TSource>()
/// sequences to all subscribed and future observers.
/// </summary>
/// <typeparam name="T">The type of the elements processed by the subject.</typeparam>
[WorkflowElementIcon(nameof(ReplaySubject))]
[XmlType(Namespace = Constants.ReactiveXmlNamespace)]
[WorkflowElementIcon(typeof(ReplaySubject), nameof(ReplaySubject))]
[Description("Replays the values of other observable sequences to all subscribed and future observers.")]
public class ReplaySubject<T> : SubjectBuilder<T>
{
Expand Down
4 changes: 2 additions & 2 deletions Bonsai.Core/Reactive/Subjects/ResourceSubject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ namespace Bonsai.Reactive
/// value of an observable sequence to all subscribed and future observers. The value
/// is disposed when the containing context is closed.
/// </summary>
[WorkflowElementIcon(nameof(ResourceSubject))]
[XmlType(Namespace = Constants.ReactiveXmlNamespace)]
[WorkflowElementIcon(typeof(ResourceSubject), nameof(ResourceSubject))]
[Description("Stores a disposable resource and shares it with all subscribed and future observers.")]
public class ResourceSubject : SubjectBuilder
{
Expand All @@ -38,8 +38,8 @@ ResourceSubject<TSource>.Subject CreateSubject<TSource>() where TSource : class,
/// is disposed when the containing context is closed.
/// </summary>
/// <typeparam name="T">The type of the disposable resource stored by the subject.</typeparam>
[WorkflowElementIcon(nameof(ResourceSubject))]
[XmlType(Namespace = Constants.ReactiveXmlNamespace)]
[WorkflowElementIcon(typeof(ResourceSubject), nameof(ResourceSubject))]
[Description("Stores a disposable resource and shares it with all subscribed and future observers.")]
public class ResourceSubject<T> : SubjectBuilder<T> where T : class, IDisposable
{
Expand Down
10 changes: 9 additions & 1 deletion Bonsai.Editor/GraphModel/ElementIcon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,15 @@ private ElementIcon(Type workflowElementType)
{
var iconAttribute = workflowElementType.GetCustomAttribute<WorkflowElementIconAttribute>() ?? WorkflowElementIconAttribute.Default;
resourceQualifier = Type.GetType(iconAttribute.TypeName ?? string.Empty, false) ?? workflowElementType;
if (!string.IsNullOrEmpty(iconAttribute.Name)) defaultName = iconAttribute.Name;
if (!string.IsNullOrEmpty(iconAttribute.Name))
{
defaultName = iconAttribute.Name;
if (defaultName.IndexOf(AssemblySeparator) >= 0)
{
resourceQualifier = null;
return;
}
}
else defaultName = resourceQualifier.Name;
if (resourceQualifier.Namespace != null)
{
Expand Down
2 changes: 1 addition & 1 deletion Bonsai.Vision/Bonsai.Vision.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Description>Bonsai Vision Library containing reactive algorithms for computer vision and image processing.</Description>
<PackageTags>Bonsai Rx Image Processing Computer Vision</PackageTags>
<TargetFramework>net462</TargetFramework>
<VersionPrefix>2.7.0</VersionPrefix>
<VersionPrefix>2.8.0</VersionPrefix>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="OpenCV.Net" Version="3.4.1" />
Expand Down
2 changes: 1 addition & 1 deletion Bonsai.Vision/CameraCapture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Bonsai.Vision
/// the specified camera.
/// </summary>
[DefaultProperty(nameof(Index))]
[WorkflowElementIcon(typeof(ElementCategory), "ElementIcon.Video")]
[WorkflowElementIcon("Bonsai:ElementIcon.Video")]
[Description("Generates a sequence of images acquired from the specified camera.")]
public class CameraCapture : Source<IplImage>
{
Expand Down
2 changes: 1 addition & 1 deletion Bonsai.Vision/FileCapture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Bonsai.Vision
/// specified movie file.
/// </summary>
[DefaultProperty(nameof(FileName))]
[WorkflowElementIcon(typeof(ElementCategory), "ElementIcon.Video")]
[WorkflowElementIcon("Bonsai:ElementIcon.Video")]
[Description("Generates a sequence of images from the specified movie file.")]
public class FileCapture : Source<IplImage>
{
Expand Down
2 changes: 1 addition & 1 deletion Bonsai.Vision/VideoWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Bonsai.Vision
/// <summary>
/// Represents an operator that writes a sequence of images into a compressed AVI file.
/// </summary>
[WorkflowElementIcon(typeof(ElementCategory), "ElementIcon.Video")]
[WorkflowElementIcon("Bonsai:ElementIcon.Video")]
[Description("Writes a sequence of images into a compressed AVI file.")]
public class VideoWriter : FileSink<IplImage, VideoWriterDisposable>
{
Expand Down