Skip to content

Commit

Permalink
Merge branch 'main' into tomlm/issue189speed
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlm authored Dec 8, 2024
2 parents 292771e + a256342 commit cddcf7e
Show file tree
Hide file tree
Showing 136 changed files with 691 additions and 267 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/PublishIncrementalNuget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Publish Incremental Nuget Release

on:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x

- name: Bump build version
id: bump
uses: vers-one/[email protected]
with:
files: |
"**/Consolonia.csproj"
version: bump-build

- name: Restore dependencies
run: dotnet restore src/Consolonia.sln

- name: Build
run: dotnet build src/Consolonia.sln -c Release --no-restore

- name: dotnet pack
run: |
dotnet pack src/Consolonia.sln -c Release -o packages --include-symbols --property WarningLevel=0
- name: Publish NuGet and symbols
id: nuget-push
uses: edumserrano/nuget-push@v1
with:
api-key: '${{ secrets.NUGET_KEY }}'
working-directory: 'packages'
fail-if-exists: false

- name: Commit new version changes
run: |
git config --global user.name "Github Action"
git config --global user.email "[email protected]"
git commit -a -m "Bumped version for published nuget artifacts"
git push
35 changes: 35 additions & 0 deletions .github/workflows/PublishNuget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Publish Nuget Release

on:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x

- name: Restore dependencies
run: dotnet restore src/Consolonia.sln

- name: Build
run: dotnet build src/Consolonia.sln -c Release --no-restore

- name: dotnet pack
run: |
dotnet pack src/Consolonia.sln -c Release -o packages --include-symbols --property WarningLevel=0
- name: Publish NuGet and symbols
id: nuget-push
uses: edumserrano/nuget-push@v1
with:
api-key: '${{ secrets.NUGET_KEY }}'
working-directory: 'packages'
fail-if-exists: false

7 changes: 6 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@
<Nullable>disable</Nullable>
</PropertyGroup>
<PropertyGroup>
<VersionPrefix>11.0.9</VersionPrefix>
<VersionPrefix>11.2.1</VersionPrefix>
<Authors>https://github.com/jinek/Consolonia/graphs/contributors</Authors>
<Description>Text User Interface implementation of Avalonia UI (GUI Framework)</Description>
<Copyright>Copyright © Evgeny Gorbovoy 2021 - 2022</Copyright>
<PackageIcon>Icon.png</PackageIcon>
<NoWarn>AVA3001</NoWarn>
</PropertyGroup>
<PropertyGroup>
<AvaloniaVersion>11.2.1</AvaloniaVersion>
</PropertyGroup>
<ItemGroup Condition="'$(IsPackable)' != 'false'">
<None Include="$(SolutionDir)/../Icon.png" Pack="True" PackagePath="\" />
<None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup>
</Project>
14 changes: 14 additions & 0 deletions src/Consolonia.Blazor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Consolonia UI

TUI (Text User Interface) (GUI Framework) implementation for [Avalonia UI](https://github.com/AvaloniaUI)

Supports XAML, data bindings, animation, styling and the rest from Avalonia.

> Project is in proof of concept state and is looking for collaboration.
## Showcase (click picture to see video)
[![datagridpic](https://user-images.githubusercontent.com/10516222/141980173-4eb4057a-6996-45bf-83f6-931316c98d88.png)](https://youtu.be/ttgZmbruk3Y)

Example of usage: https://github.com/jinek/ToolUI

Solution contains one more readme file with coding information.
4 changes: 2 additions & 2 deletions src/Consolonia.Core/ApplicationStartup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
using Consolonia.Core.Infrastructure;

// ReSharper disable UnusedMember.Global //todo: how to disable it for public methods?

// ReSharper disable CheckNamespace
// ReSharper disable MemberCanBePrivate.Global

namespace Consolonia.Core
namespace Consolonia
{
public static class ApplicationStartup
{
Expand Down
18 changes: 18 additions & 0 deletions src/Consolonia.Core/Infrastructure/ConsoloniaApplication.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Controls.Primitives;
using Avalonia.Input;
using Avalonia.Media;
Expand Down Expand Up @@ -59,4 +61,20 @@ public override void OnFrameworkInitializationCompleted()
}
}
}

public class ConsoloniaApplication<TMainWindow> : ConsoloniaApplication
where TMainWindow : Window, new()
{
public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
var window = Activator.CreateInstance<TMainWindow>();
ArgumentNullException.ThrowIfNull(window, typeof(TMainWindow).Name);
desktop.MainWindow = window;
}

base.OnFrameworkInitializationCompleted();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

namespace Consolonia.Core.Infrastructure
{
[Serializable]
public class ConsoloniaNotSupportedException : Exception
{
internal ConsoloniaNotSupportedException(NotSupportedRequest request)
Expand Down
12 changes: 1 addition & 11 deletions src/Consolonia.Core/Infrastructure/ExceptionSink.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
using System;
using System.Globalization;
using Avalonia;
using Avalonia.Logging;

namespace Consolonia.Core.Infrastructure
// ReSharper disable once ArrangeNamespaceBody
// ReSharper disable once ArrangeNamespaceBody
{
public class ExceptionSink : ILogSink
{
Expand Down Expand Up @@ -55,14 +54,5 @@ public void Log(LogEventLevel level, string area, object source, string messageT
throw consoloniaException;
}
}

public static class ExceptionSinkExtensions
{
public static AppBuilder LogToException(this AppBuilder builder)
{
Logger.Sink = new ExceptionSink();
return builder;
}
}
// ReSharper restore UnusedMember.Global
}
18 changes: 18 additions & 0 deletions src/Consolonia.Core/Infrastructure/ExceptionSinkExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Avalonia;
using Avalonia.Logging;
using Consolonia.Core.Infrastructure;

// ReSharper disable CheckNamespace
namespace Consolonia
// ReSharper disable once ArrangeNamespaceBody
{
public static class ExceptionSinkExtensions
{
public static AppBuilder LogToException(this AppBuilder builder)
{
Logger.Sink = new ExceptionSink();
return builder;
}
}
// ReSharper restore UnusedMember.Global
}
11 changes: 11 additions & 0 deletions src/Consolonia.Core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Consolonia.PlatformSupport
This package is the core Consolonia library.

## Background
Consolonia is a TUI (Text User Interface) (GUI Framework) implementation for [Avalonia UI](https://github.com/AvaloniaUI)

Supports XAML, data bindings, animation, styling and the rest from Avalonia.

## Showcase (click picture to see video)
[![datagridpic](https://user-images.githubusercontent.com/10516222/141980173-4eb4057a-6996-45bf-83f6-931316c98d88.png)](https://youtu.be/ttgZmbruk3Y)

18 changes: 0 additions & 18 deletions src/Consolonia.Designer/Consolonia.Designer.csproj

This file was deleted.

14 changes: 2 additions & 12 deletions src/Consolonia.Gallery/App.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
using System.Globalization;
using System.Threading;
using Avalonia.Controls.ApplicationLifetimes;
using Consolonia.Core.Infrastructure;
using Consolonia.Gallery.View;
using Consolonia.Themes.TurboVision.Themes.Fluent;
using Consolonia.Themes;

namespace Consolonia.Gallery
{
internal class App : ConsoloniaApplication
internal class App : ConsoloniaApplication<ControlsListView>
{
static App()
{
Expand All @@ -23,14 +22,5 @@ public App()
Styles.Add(new FluentTheme());
/*Styles.Add(new MaterialTheme());*/
}

public override void OnFrameworkInitializationCompleted()
{
var lifetime = ApplicationLifetime as IClassicDesktopStyleApplicationLifetime;
if (lifetime != null)
lifetime.MainWindow = new ControlsListView();

base.OnFrameworkInitializationCompleted();
}
}
}
5 changes: 1 addition & 4 deletions src/Consolonia.Gallery/Consolonia.Gallery.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Consolonia.Core\Consolonia.Core.csproj" />
<ProjectReference Include="..\Consolonia.PlatformSupport\Consolonia.PlatformSupport.csproj" />
<ProjectReference Include="..\Consolonia.Themes.TurboVision\Consolonia.Themes.TurboVision.csproj" />
<ProjectReference Include="..\Consolonia.Designer\Consolonia.Designer.csproj" />
<ProjectReference Include="..\Consolonia\Consolonia.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
</Style>
</StackPanel.Styles>
<Button>Standard _XAML Button</Button>
<Button Foreground="DarkGoldenrod">Foreground</Button>
<Button Background="Yellow">Background</Button>
<Button Background="DarkBlue" Foreground="Yellow">Custom Colors</Button>
<Button IsEnabled="False">Disabled</Button>
<RepeatButton Name="RepeatButton">
<TextBlock Name="RepeatButtonTextBlock"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:collections="clr-namespace:System.Collections;assembly=System.Runtime"
xmlns:system="clr-namespace:System;assembly=System.Runtime"
xmlns:drawing="clr-namespace:Consolonia.Core.Drawing;assembly=Consolonia.Core"
xmlns:helpers="clr-namespace:Consolonia.Themes.TurboVision.Templates.Controls.Helpers;assembly=Consolonia.Themes.TurboVision"
xmlns:helpers="clr-namespace:Consolonia.Themes.Templates.Controls.Helpers;assembly=Consolonia.Themes"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:helpers="clr-namespace:Consolonia.Themes.TurboVision.Templates.Controls.Helpers;assembly=Consolonia.Themes.TurboVision"
xmlns:helpers="clr-namespace:Consolonia.Themes.Templates.Controls.Helpers;assembly=Consolonia.Themes"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Expand Down Expand Up @@ -37,6 +37,9 @@
<helpers:SymbolsControl Text="&#9818;" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="ToggleType Checked" IsChecked="True" ToggleType="CheckBox"/>
<MenuItem Header="ToggleType Radio" IsChecked="True" ToggleType="Radio"/>
<MenuItem Header="ToggleType None" IsChecked="True" ToggleType="None"/>
<MenuItem Header="Menu Item with _Checkbox">
<MenuItem.Icon>
<CheckBox BorderThickness="0"
Expand Down
8 changes: 0 additions & 8 deletions src/Consolonia.Gallery/Program.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
using System;
using Avalonia;
using Consolonia.Core;
using Consolonia.Core.Infrastructure;
using Consolonia.Designer;
using Consolonia.PlatformSupport;

namespace Consolonia.Gallery
{
Expand All @@ -19,11 +15,7 @@ private static void Main(string[] args)

public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
#if DEBUG
.UseConsoloniaDesigner()
#else
.UseConsolonia()
#endif
.UseAutoDetectedConsole()
.LogToException();
}
Expand Down
17 changes: 14 additions & 3 deletions src/Consolonia.Gallery/View/ControlsListView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,34 @@
xmlns:gallery="clr-namespace:Consolonia.Gallery.Gallery"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
mc:Ignorable="d"
x:Class="Consolonia.Gallery.View.ControlsListView"
Title="ControlsListView" >
<Window.Resources>
<gallery:GalleryItemConverter x:Key="GalleryItemConverter" />
</Window.Resources>
<DockPanel>
<Grid RowDefinitions="* Auto" DockPanel.Dock="Left">
<DataGrid x:Name="Grid"
<DataGrid x:Name="Grid" Grid.Row="0"
SelectedIndex="0"
SelectionMode="Single">
<DataGrid.Columns>
<DataGridTextColumn Header="Name"
Binding="{Binding Name}" />
</DataGrid.Columns>
</DataGrid>
<Button Grid.Row="1" Content="Exit" Click="Exit_Click" KeyboardNavigation.IsTabStop="False"/>
<Grid Grid.Row="1" RowDefinitions="Auto Auto" ColumnDefinitions="Auto *">
<Label Content="Theme" />
<ComboBox Grid.Column="1" x:Name="ThemeCombo" SelectionChanged="ComboBox_SelectionChanged" IsTabStop="false" HorizontalContentAlignment="Stretch">
<ComboBoxItem Content="Material" IsSelected="True" />
<ComboBoxItem Content="Fluent"/>
<ComboBoxItem Content="TurboVision"/>
<ComboBoxItem Content="TurboVisionDark"/>
<ComboBoxItem Content="TurboVisionBlack"/>
</ComboBox>
<Button Grid.Row="1" Grid.ColumnSpan="2" Click="Exit_Click" IsTabStop="False">Exit</Button>
</Grid>

</Grid>
<Border Child="{Binding ElementName=Grid,Path=SelectedItem, Converter={StaticResource GalleryItemConverter}}"
BorderThickness="1"
Expand Down
Loading

0 comments on commit cddcf7e

Please sign in to comment.