Skip to content

Commit

Permalink
Deprecate condition element category
Browse files Browse the repository at this point in the history
  • Loading branch information
glopesdev committed Sep 28, 2022
1 parent aaad3bb commit 3bc166e
Show file tree
Hide file tree
Showing 11 changed files with 9 additions and 15 deletions.
5 changes: 4 additions & 1 deletion Bonsai.Core/ElementCategory.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace Bonsai
using System;

namespace Bonsai
{
/// <summary>
/// Specifies the category of a workflow element.
Expand All @@ -14,6 +16,7 @@ public enum ElementCategory
/// A combinator that propagates only the elements of an observable sequence
/// matching some specific condition.
/// </summary>
[Obsolete]
Condition,

/// <summary>
Expand Down
1 change: 0 additions & 1 deletion Bonsai.Core/Expressions/ConditionBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Bonsai.Expressions
/// </summary>
[Obsolete]
[ProxyType(typeof(Condition))]
[WorkflowElementCategory(ElementCategory.Condition)]
[XmlType("Condition", Namespace = Constants.XmlNamespace)]
[Description("Filters the elements of an observable sequence according to a condition specified by the encapsulated workflow.")]
public class ConditionBuilder : Condition
Expand Down
1 change: 0 additions & 1 deletion Bonsai.Core/Reactive/Condition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ namespace Bonsai.Reactive
/// Represents an expression builder which filters the elements of an observable
/// sequence according to a condition specified by the encapsulated workflow.
/// </summary>
[WorkflowElementCategory(ElementCategory.Condition)]
[XmlType(Namespace = Constants.ReactiveXmlNamespace)]
[Description("Filters the elements of an observable sequence according to a condition specified by the encapsulated workflow.")]
public class Condition : SingleArgumentWorkflowExpressionBuilder
Expand Down
2 changes: 0 additions & 2 deletions Bonsai.Design/ExpressionBuilderTypeConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo cul
{
case ElementCategory.Source:
return disabled ? HatchBrushes.DiagonalViolet : obsolete ? HatchBrushes.CrossViolet : Brushes.Violet;
case ElementCategory.Condition:
return disabled ? HatchBrushes.DiagonalLightGreen : obsolete ? HatchBrushes.CrossLightGreen : Brushes.LightGreen;
case ElementCategory.Transform:
return disabled ? HatchBrushes.DiagonalWhite : obsolete ? HatchBrushes.CrossWhite : Brushes.White;
case ElementCategory.Sink:
Expand Down
2 changes: 2 additions & 0 deletions Bonsai.Editor/EditorForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,9 @@ void InitializeToolboxCategory(string categoryName, IEnumerable<WorkflowElementD
}

if (typeCategory == ElementCategory.Workflow ||
#pragma warning disable CS0612 // Type or member is obsolete
typeCategory == ElementCategory.Condition ||
#pragma warning restore CS0612 // Type or member is obsolete
typeCategory == ElementCategory.Property)
{
typeCategory = ElementCategory.Combinator;
Expand Down
5 changes: 3 additions & 2 deletions Bonsai.Editor/GraphModel/ElementIcon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Bonsai.Editor.GraphModel
class ElementIcon
{
static readonly ElementIcon Source = new ElementIcon(ElementCategory.Source);
static readonly ElementIcon Condition = new ElementIcon(ElementCategory.Condition);
static readonly ElementIcon Transform = new ElementIcon(ElementCategory.Transform);
static readonly ElementIcon Sink = new ElementIcon(ElementCategory.Sink);
static readonly ElementIcon Nested = new ElementIcon(ElementCategory.Nested);
Expand Down Expand Up @@ -274,11 +273,13 @@ public static ElementIcon FromElementCategory(ElementCategory category)
switch (category)
{
case ElementCategory.Source: return Source;
case ElementCategory.Condition: return Condition;
case ElementCategory.Transform: return Transform;
case ElementCategory.Sink: return Sink;
case ElementCategory.Nested: return Nested;
case ElementCategory.Property: return Property;
#pragma warning disable CS0612 // Type or member is obsolete
case ElementCategory.Condition:
#pragma warning restore CS0612 // Type or member is obsolete
case ElementCategory.Combinator: return Combinator;
case ElementCategory.Workflow: return Workflow;
default: throw new ArgumentException("Invalid category.");
Expand Down
1 change: 0 additions & 1 deletion Bonsai.Editor/GraphModel/GraphNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ public Color FillColor
switch (Category)
{
case ElementCategory.Source: return CategoryColors.Source;
case ElementCategory.Condition: return CategoryColors.Combinator;
case ElementCategory.Transform: return CategoryColors.Transform;
case ElementCategory.Sink: return CategoryColors.Sink;
case ElementCategory.Nested:
Expand Down
4 changes: 0 additions & 4 deletions Bonsai.Editor/Resources/ElementCategory/Condition.svg

This file was deleted.

1 change: 0 additions & 1 deletion Bonsai.Scripting.Expressions/ExpressionCondition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ namespace Bonsai.Scripting.Expressions
/// of an observable sequence.
/// </summary>
[DefaultProperty(nameof(Expression))]
[WorkflowElementCategory(ElementCategory.Condition)]
[TypeDescriptionProvider(typeof(ExpressionConditionTypeDescriptionProvider))]
[Description("An expression script used to filter the elements of the sequence.")]
public class ExpressionCondition : SingleArgumentExpressionBuilder, IScriptingElement
Expand Down
1 change: 0 additions & 1 deletion Bonsai.Scripting/ExpressionCondition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ namespace Bonsai.Scripting
/// </summary>
[Obsolete]
[DefaultProperty(nameof(Expression))]
[WorkflowElementCategory(ElementCategory.Condition)]
[TypeDescriptionProvider(typeof(ExpressionConditionTypeDescriptionProvider))]
[Description("An expression script used to filter the elements of the sequence.")]
public class ExpressionCondition : SingleArgumentExpressionBuilder, IScriptingElement
Expand Down
1 change: 0 additions & 1 deletion Bonsai.Scripting/PythonCondition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Bonsai.Scripting
/// </summary>
[Obsolete]
[DefaultProperty(nameof(Script))]
[WorkflowElementCategory(ElementCategory.Condition)]
[Description("A Python script used to determine which elements of the input sequence are accepted.")]
public class PythonCondition : Combinator
{
Expand Down

0 comments on commit 3bc166e

Please sign in to comment.