mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Linux input provider - Style fixes
Nodes - Added display value node Nodes - Updated help link
This commit is contained in:
1 parent
f9b3bc9377
commit
7a7d0ab387
16 files changed
+780
-73
No files matched your search
@@ -0,0 +1,19 @@
|
||||
using Artemis.Core;
|
||||
using Artemis.VisualScripting.Nodes.Static.Screens;
|
||||
|
||||
namespace Artemis.VisualScripting.Nodes.Static;
|
||||
|
||||
[Node("Display Value", "Displays an input value for testing purposes.", "Static", InputType = typeof(object))]
|
||||
public class DisplayValueNode : Node<string, DisplayValueNodeCustomViewModel>
|
||||
{
|
||||
public DisplayValueNode() : base("Display Value", "Displays an input value for testing purposes.")
|
||||
{
|
||||
Input = CreateInputPin<object>();
|
||||
}
|
||||
|
||||
public InputPin<object> Input { get; }
|
||||
|
||||
public override void Evaluate()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:screens="clr-namespace:Artemis.VisualScripting.Nodes.Static.Screens"
|
||||
xmlns:skiaSharp="clr-namespace:SkiaSharp;assembly=SkiaSharp"
|
||||
xmlns:core="clr-namespace:Artemis.Core;assembly=Artemis.Core"
|
||||
xmlns:converters1="clr-namespace:Artemis.UI.Shared.Converters;assembly=Artemis.UI.Shared"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Artemis.VisualScripting.Nodes.Static.Screens.DisplayValueNodeCustomView"
|
||||
x:DataType="screens:DisplayValueNodeCustomViewModel">
|
||||
<UserControl.Resources>
|
||||
<converters1:SKColorToStringConverter x:Key="SKColorToStringConverter" />
|
||||
<converters1:SKColorToColorConverter x:Key="SKColorToColorConverter" />
|
||||
</UserControl.Resources>
|
||||
<ContentControl Content="{CompiledBinding CurrentValue}" VerticalContentAlignment="Center">
|
||||
<ContentControl.DataTemplates>
|
||||
<DataTemplate DataType="skiaSharp:SKColor">
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<TextBlock x:Name="HexDisplay"
|
||||
Text="{CompiledBinding Converter={StaticResource SKColorToStringConverter}}"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Stretch"
|
||||
FontFamily="Consolas"/>
|
||||
<Border Margin="5 0 0 0"
|
||||
VerticalAlignment="Bottom"
|
||||
HorizontalAlignment="Right"
|
||||
BorderThickness="1"
|
||||
MinWidth="18"
|
||||
MinHeight="18"
|
||||
Background="{DynamicResource CheckerboardBrush}"
|
||||
BorderBrush="{DynamicResource ColorPickerButtonOutline}"
|
||||
CornerRadius="4"
|
||||
ClipToBounds="True">
|
||||
<Border CornerRadius="4">
|
||||
<Border.Background>
|
||||
<SolidColorBrush Color="{Binding Converter={StaticResource SKColorToColorConverter}}" />
|
||||
</Border.Background>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="core:Numeric">
|
||||
<TextBlock Text="{Binding}" FontFamily="Consolas"/>
|
||||
</DataTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding}" FontFamily="Consolas"/>
|
||||
</DataTemplate>
|
||||
</ContentControl.DataTemplates>
|
||||
</ContentControl>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,19 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.VisualScripting.Nodes.Static.Screens;
|
||||
|
||||
public partial class DisplayValueNodeCustomView : ReactiveUserControl<DisplayValueNodeCustomViewModel>
|
||||
{
|
||||
public DisplayValueNodeCustomView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using System.Reactive.Disposables;
|
||||
using Artemis.Core;
|
||||
using Artemis.UI.Shared.VisualScripting;
|
||||
using Avalonia.Threading;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Artemis.VisualScripting.Nodes.Static.Screens;
|
||||
|
||||
public class DisplayValueNodeCustomViewModel : CustomNodeViewModel
|
||||
{
|
||||
private readonly DisplayValueNode _node;
|
||||
private object? _currentValue;
|
||||
|
||||
public DisplayValueNodeCustomViewModel(DisplayValueNode node, INodeScript script) : base(node, script)
|
||||
{
|
||||
_node = node;
|
||||
|
||||
// Because the DisplayValueNode has no output it never evaluates, manually do so here
|
||||
this.WhenActivated(d =>
|
||||
{
|
||||
DispatcherTimer updateTimer = new(TimeSpan.FromMilliseconds(25.0 / 1000), DispatcherPriority.Normal, Update);
|
||||
updateTimer.Start();
|
||||
Disposable.Create(() => updateTimer.Stop()).DisposeWith(d);
|
||||
});
|
||||
}
|
||||
|
||||
public object? CurrentValue
|
||||
{
|
||||
get => _currentValue;
|
||||
private set => this.RaiseAndSetIfChanged(ref _currentValue, value);
|
||||
}
|
||||
|
||||
private void Update(object? sender, EventArgs e)
|
||||
{
|
||||
CurrentValue = _node.Input.Value;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user