mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-12 13:28:33 +00:00
Merge branch 'development' into feature/releases
This commit is contained in:
commit
7030c7af2a
@ -7,6 +7,7 @@ public class LayoutSelection : CorePropertyChanged
|
||||
{
|
||||
private string? _type;
|
||||
private string? _parameter;
|
||||
private string? _errorState;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets what kind of layout reference this is.
|
||||
@ -25,4 +26,13 @@ public class LayoutSelection : CorePropertyChanged
|
||||
get => _parameter;
|
||||
set => SetAndNotify(ref _parameter, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the error state of the layout reference.
|
||||
/// </summary>
|
||||
public string? ErrorState
|
||||
{
|
||||
get => _errorState;
|
||||
set => SetAndNotify(ref _errorState, value);
|
||||
}
|
||||
}
|
||||
@ -184,13 +184,14 @@ internal class DeviceService : IDeviceService
|
||||
device.ApplyLayout(null, false, false);
|
||||
else
|
||||
provider?.ApplyLayout(device, layout);
|
||||
|
||||
UpdateLeds();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
device.LayoutSelection.ErrorState = e.Message;
|
||||
_logger.Error(e, "Failed to apply device layout");
|
||||
}
|
||||
|
||||
UpdateLeds();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@ -9,100 +9,111 @@
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="800"
|
||||
x:Class="Artemis.UI.Screens.Device.Layout.DeviceLayoutTabView"
|
||||
x:DataType="layout:DeviceLayoutTabViewModel">
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
|
||||
<Border Classes="card" Margin="5">
|
||||
<Grid RowDefinitions="*,Auto">
|
||||
<StackPanel Grid.Row="0">
|
||||
<Grid RowDefinitions="*,*" ColumnDefinitions="*,Auto">
|
||||
<StackPanel Grid.Row="0" Grid.Column="0">
|
||||
<TextBlock Text="Default layout file path" />
|
||||
<TextBlock Classes="subtitle" FontSize="12" TextWrapping="Wrap" Text="{CompiledBinding DefaultLayoutPath}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
||||
<Button
|
||||
Classes="icon-button"
|
||||
HorizontalAlignment="Right"
|
||||
IsEnabled="{CompiledBinding !!DefaultLayoutPath}"
|
||||
ToolTip.Tip="Copy layout file path to clipboard"
|
||||
Click="LayoutPathButton_OnClick">
|
||||
<avalonia:MaterialIcon Kind="ContentCopy" Width="18" Height="18" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Grid RowDefinitions="Auto,*">
|
||||
<controls:InfoBar Grid.Row="0"
|
||||
Title="Failed to apply layout"
|
||||
IsOpen="{CompiledBinding Device.LayoutSelection.ErrorState, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
|
||||
Message="{CompiledBinding Device.LayoutSelection.ErrorState}"
|
||||
Severity="Error"
|
||||
IsClosable="False"
|
||||
Margin="5 0"/>
|
||||
|
||||
<Border Classes="card-separator" />
|
||||
<Grid RowDefinitions="*,*" ColumnDefinitions="*,Auto">
|
||||
<StackPanel Grid.Row="1" Grid.Column="0">
|
||||
<TextBlock Text="Image file path" />
|
||||
<TextBlock Classes="subtitle" FontSize="12" TextWrapping="Wrap" Text="{CompiledBinding ImagePath, TargetNullValue=None}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" VerticalAlignment="Center">
|
||||
<Button
|
||||
Classes="icon-button"
|
||||
HorizontalAlignment="Right"
|
||||
IsEnabled="{CompiledBinding !!ImagePath}"
|
||||
ToolTip.Tip="Copy image file path to clipboard"
|
||||
Click="ImagePathButton_OnClick">
|
||||
<avalonia:MaterialIcon Kind="ContentCopy" Width="18" Height="18" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<ScrollViewer Grid.Row="1" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
|
||||
<Border Classes="card" Margin="5">
|
||||
<Grid RowDefinitions="*,Auto">
|
||||
<StackPanel Grid.Row="0">
|
||||
<Grid RowDefinitions="*,*" ColumnDefinitions="*,Auto">
|
||||
<StackPanel Grid.Row="0" Grid.Column="0">
|
||||
<TextBlock Text="Default layout file path" />
|
||||
<TextBlock Classes="subtitle" FontSize="12" TextWrapping="Wrap" Text="{CompiledBinding DefaultLayoutPath}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
||||
<Button
|
||||
Classes="icon-button"
|
||||
HorizontalAlignment="Right"
|
||||
IsEnabled="{CompiledBinding !!DefaultLayoutPath}"
|
||||
ToolTip.Tip="Copy layout file path to clipboard"
|
||||
Click="LayoutPathButton_OnClick">
|
||||
<avalonia:MaterialIcon Kind="ContentCopy" Width="18" Height="18" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<Border Classes="card-separator" />
|
||||
<Grid RowDefinitions="*,*,*" ColumnDefinitions="*,Auto">
|
||||
<StackPanel Grid.Row="1" Grid.Column="0">
|
||||
<TextBlock Text="Layout provider" />
|
||||
<TextBlock Classes="subtitle" FontSize="12" Text="Choose between different ways to load a layout for this device." />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" VerticalAlignment="Center">
|
||||
<StackPanel.Styles>
|
||||
<Style Selector="ComboBox.layoutProvider /template/ ContentControl#ContentPresenter">
|
||||
<Setter Property="ContentTemplate">
|
||||
<Setter.Value>
|
||||
<DataTemplate x:DataType="layoutProviders:ILayoutProviderViewModel">
|
||||
<Border Classes="card-separator" />
|
||||
<Grid RowDefinitions="*,*" ColumnDefinitions="*,Auto">
|
||||
<StackPanel Grid.Row="1" Grid.Column="0">
|
||||
<TextBlock Text="Image file path" />
|
||||
<TextBlock Classes="subtitle" FontSize="12" TextWrapping="Wrap" Text="{CompiledBinding ImagePath, TargetNullValue=None}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" VerticalAlignment="Center">
|
||||
<Button
|
||||
Classes="icon-button"
|
||||
HorizontalAlignment="Right"
|
||||
IsEnabled="{CompiledBinding !!ImagePath}"
|
||||
ToolTip.Tip="Copy image file path to clipboard"
|
||||
Click="ImagePathButton_OnClick">
|
||||
<avalonia:MaterialIcon Kind="ContentCopy" Width="18" Height="18" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<Border Classes="card-separator" />
|
||||
<Grid RowDefinitions="*,*,*" ColumnDefinitions="*,Auto">
|
||||
<StackPanel Grid.Row="1" Grid.Column="0">
|
||||
<TextBlock Text="Layout provider" />
|
||||
<TextBlock Classes="subtitle" FontSize="12" Text="Choose between different ways to load a layout for this device." />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" VerticalAlignment="Center">
|
||||
<StackPanel.Styles>
|
||||
<Style Selector="ComboBox.layoutProvider /template/ ContentControl#ContentPresenter">
|
||||
<Setter Property="ContentTemplate">
|
||||
<Setter.Value>
|
||||
<DataTemplate x:DataType="layoutProviders:ILayoutProviderViewModel">
|
||||
<TextBlock Text="{CompiledBinding Name}" TextWrapping="Wrap" MaxWidth="350" />
|
||||
</DataTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</StackPanel.Styles>
|
||||
<ComboBox Classes="layoutProvider"
|
||||
Width="150"
|
||||
SelectedItem="{CompiledBinding SelectedLayoutProvider}"
|
||||
ItemsSource="{CompiledBinding LayoutProviders}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate x:DataType="layoutProviders:ILayoutProviderViewModel">
|
||||
<StackPanel>
|
||||
<TextBlock Text="{CompiledBinding Name}" TextWrapping="Wrap" MaxWidth="350" />
|
||||
</DataTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</StackPanel.Styles>
|
||||
<ComboBox Classes="layoutProvider"
|
||||
Width="150"
|
||||
SelectedItem="{CompiledBinding SelectedLayoutProvider}"
|
||||
ItemsSource="{CompiledBinding LayoutProviders}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate x:DataType="layoutProviders:ILayoutProviderViewModel">
|
||||
<StackPanel>
|
||||
<TextBlock Text="{CompiledBinding Name}" TextWrapping="Wrap" MaxWidth="350" />
|
||||
<TextBlock Classes="subtitle" Text="{CompiledBinding Description}" TextWrapping="Wrap" MaxWidth="350" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<TextBlock Classes="subtitle" Text="{CompiledBinding Description}" TextWrapping="Wrap" MaxWidth="350" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<ContentControl Content="{CompiledBinding SelectedLayoutProvider}" ClipToBounds="False" />
|
||||
<ContentControl Content="{CompiledBinding SelectedLayoutProvider}" ClipToBounds="False" />
|
||||
|
||||
<Border Classes="card-separator" />
|
||||
<Grid RowDefinitions="*,*" ColumnDefinitions="*,Auto">
|
||||
<StackPanel Grid.Row="1" Grid.Column="0">
|
||||
<TextBlock Text="Export current layout" />
|
||||
<TextBlock Classes="subtitle" FontSize="12" Text="If there is a layout used, export that. Otherwise, export the LEDs present." />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Orientation="Horizontal">
|
||||
<Button HorizontalAlignment="Right" Content="Export" Command="{CompiledBinding ExportLayout}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<controls:HyperlinkButton
|
||||
Grid.Row="1"
|
||||
Content="Learn more about layouts on the wiki"
|
||||
NavigateUri="https://wiki.artemis-rgb.com/en/guides/developer/layouts?mtm_campaign=artemis&mtm_kwd=device-properties"
|
||||
Margin="0 20"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
|
||||
<Border Classes="card-separator" />
|
||||
<Grid RowDefinitions="*,*" ColumnDefinitions="*,Auto">
|
||||
<StackPanel Grid.Row="1" Grid.Column="0">
|
||||
<TextBlock Text="Export current layout" />
|
||||
<TextBlock Classes="subtitle" FontSize="12" Text="If there is a layout used, export that. Otherwise, export the LEDs present." />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Orientation="Horizontal">
|
||||
<Button HorizontalAlignment="Right" Content="Export" Command="{CompiledBinding ExportLayout}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<controls:HyperlinkButton
|
||||
Grid.Row="1"
|
||||
Content="Learn more about layouts on the wiki"
|
||||
NavigateUri="https://wiki.artemis-rgb.com/en/guides/developer/layouts?mtm_campaign=artemis&mtm_kwd=device-properties"
|
||||
Margin="0 20"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@ -34,7 +34,7 @@ public abstract partial class TreeItemViewModel : ActivatableViewModelBase
|
||||
private RenderProfileElement? _currentProfileElement;
|
||||
private ObservableAsPropertyHelper<bool>? _isFocused;
|
||||
private TimeSpan _time;
|
||||
|
||||
|
||||
[Notify] private bool _canPaste;
|
||||
[Notify] private bool _isExpanded;
|
||||
[Notify] private bool _isFlyoutOpen;
|
||||
@ -100,7 +100,7 @@ public abstract partial class TreeItemViewModel : ActivatableViewModelBase
|
||||
public ReactiveCommand<Unit, Unit> Paste { get; }
|
||||
public ReactiveCommand<Unit, Unit> Delete { get; }
|
||||
public abstract bool SupportsChildren { get; }
|
||||
|
||||
|
||||
public async Task ShowBrokenStateExceptions()
|
||||
{
|
||||
if (ProfileElement == null)
|
||||
@ -117,7 +117,7 @@ public abstract partial class TreeItemViewModel : ActivatableViewModelBase
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void InsertElement(TreeItemViewModel elementViewModel, int targetIndex)
|
||||
{
|
||||
if (elementViewModel.Parent == this && Children.IndexOf(elementViewModel) == targetIndex)
|
||||
@ -239,26 +239,22 @@ public abstract partial class TreeItemViewModel : ActivatableViewModelBase
|
||||
await _windowService.ShowDialogAsync<LayerHintsDialogViewModel, bool>(layer);
|
||||
await ProfileEditorService.SaveProfileAsync();
|
||||
}
|
||||
|
||||
|
||||
private void ExecuteApplyAdaptionHints()
|
||||
{
|
||||
if (ProfileElement is not Layer layer)
|
||||
return;
|
||||
|
||||
|
||||
ProfileEditorService.ExecuteCommand(new ApplyAdaptionHints(layer, _deviceService.EnabledDevices.ToList()));
|
||||
}
|
||||
|
||||
private async void UpdateCanPaste(bool isFlyoutOpen)
|
||||
{
|
||||
string[] formats = await Shared.UI.Clipboard.GetFormatsAsync();
|
||||
//diogotr7: This can be null on Linux sometimes. I'm not sure why.
|
||||
if (formats == null!)
|
||||
{
|
||||
CanPaste = false;
|
||||
return;
|
||||
}
|
||||
|
||||
CanPaste = formats.Contains(ProfileElementExtensions.ClipboardDataFormat);
|
||||
string[]? formats = await Shared.UI.Clipboard.GetFormatsAsync();
|
||||
|
||||
// Can be null on some platforms
|
||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract
|
||||
CanPaste = formats != null && formats.Contains(ProfileElementExtensions.ClipboardDataFormat);
|
||||
}
|
||||
|
||||
private bool GetIsFocused(ProfileEditorFocusMode focusMode, RenderProfileElement? currentProfileElement)
|
||||
|
||||
@ -174,8 +174,11 @@ public partial class TimelineKeyframeViewModel<T> : ActivatableViewModelBase, IT
|
||||
|
||||
private async void UpdateCanPaste(bool isFlyoutOpen)
|
||||
{
|
||||
string[] formats = await Shared.UI.Clipboard.GetFormatsAsync();
|
||||
CanPaste = formats.Contains("Artemis.Keyframes");
|
||||
string[]? formats = await Shared.UI.Clipboard.GetFormatsAsync();
|
||||
|
||||
// Can be null on some platforms
|
||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract
|
||||
CanPaste = formats != null && formats.Contains("Artemis.Keyframes");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
<Styles xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:avalonia="clr-namespace:Markdown.Avalonia;assembly=Markdown.Avalonia"
|
||||
xmlns:ctxt="clr-namespace:ColorTextBlock.Avalonia;assembly=ColorTextBlock.Avalonia">
|
||||
xmlns:ctxt="clr-namespace:ColorTextBlock.Avalonia;assembly=ColorTextBlock.Avalonia"
|
||||
xmlns:controls="clr-namespace:Markdown.Avalonia.Controls;assembly=Markdown.Avalonia">
|
||||
<Design.PreviewWith>
|
||||
<avalonia:MarkdownScrollViewer>
|
||||
Test
|
||||
<avalonia:MarkdownScrollViewer MarkdownStyleName="FluentAvalonia">
|
||||
Markdown.Xaml support ```inline code ``` and block code.
|
||||
</avalonia:MarkdownScrollViewer>
|
||||
</Design.PreviewWith>
|
||||
<Style Selector="ScrollViewer > StackPanel">
|
||||
@ -65,4 +66,21 @@
|
||||
<Setter Property="Margin" Value="0,10,0,5" />
|
||||
</Style.Setters>
|
||||
</Style>
|
||||
|
||||
<Style Selector="ctxt|CCode">
|
||||
<Style.Setters>
|
||||
<Setter Property="Foreground" Value="#CE9178" />
|
||||
<Setter Property="Background" Value="#333333" />
|
||||
<Setter Property="Padding" Value="4 3 4 -1"></Setter>
|
||||
<Setter Property="Margin" Value="0 2 0 0"></Setter>
|
||||
<Setter Property="CornerRadius" Value="5" />
|
||||
<Setter Property="TextVerticalAlignment" Value="Bottom"></Setter>
|
||||
</Style.Setters>
|
||||
</Style>
|
||||
|
||||
<Style Selector="controls|Rule">
|
||||
<Style.Setters>
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonBorderBrush}"/>
|
||||
</Style.Setters>
|
||||
</Style>
|
||||
</Styles>
|
||||
Loading…
x
Reference in New Issue
Block a user