Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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
71 changes: 69 additions & 2 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,35 @@ on: [push, pull_request]
jobs:
build:
runs-on: ${{ matrix.os }}
timeout-minutes: 15
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os: [windows-2022, ubuntu-24.04, macos-15]
steps:
- name: Install OS dependencies
if: matrix.os == 'ubuntu-24.04'
run: sudo apt-get install -y fonts-liberation2 fonts-noto-core fonts-noto-cjk
run: sudo apt-get update && sudo apt-get install -y fonts-liberation2 fonts-noto-core fonts-noto-cjk patchelf
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Python dependencies for signature fields
run: pip install -r scripts/requirements-signature-fields.txt
- name: Install Python build dependencies for signature helper
run: pip install nuitka ordered-set
- name: Build signature helper (macOS/Linux)
if: matrix.os != 'windows-2022'
run: python scripts/build_embedder_helper.py --platform auto
- name: Build signature helper (Windows)
if: matrix.os == 'windows-2022'
shell: cmd
run: |
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do set VSINSTALL=%%i
call "%VSINSTALL%\Common7\Tools\VsDevCmd.bat" && python scripts\build_embedder_helper.py --platform windows
- name: Setup .NET 9
uses: actions/setup-dotnet@v4
with:
Expand All @@ -24,6 +43,36 @@ jobs:
run: dotnet workload install macos
- name: Build
run: dotnet run --project NAPS2.Tools -- build debug -v
- name: Copy signature helper into debug output (Windows)
if: matrix.os == 'windows-2022'
shell: pwsh
run: |
Get-ChildItem -Path "NAPS2.App.WinForms/bin" -Recurse -Directory -Filter "net9-windows" |
ForEach-Object {
$toolsDir = Join-Path $_.FullName "tools"
New-Item -ItemType Directory -Force -Path $toolsDir | Out-Null
Copy-Item -Force "build/windows/naps2-signature-helper.exe" (Join-Path $toolsDir "naps2-signature-helper.exe")
}
- name: Copy signature helper into debug output (Linux)
if: matrix.os == 'ubuntu-24.04'
shell: bash
run: |
set -euo pipefail
while IFS= read -r -d '' dir; do
mkdir -p "$dir/tools"
cp build/linux/naps2-signature-helper "$dir/tools/naps2-signature-helper"
chmod +x "$dir/tools/naps2-signature-helper"
done < <(find NAPS2.App.Gtk/bin -type d -name net9 -path '*/Debug*/*' -print0)
- name: Copy signature helper into debug output (macOS)
if: matrix.os == 'macos-15'
shell: bash
run: |
set -euo pipefail
while IFS= read -r -d '' app; do
mkdir -p "$app/Contents/tools"
cp build/macos/naps2-signature-helper "$app/Contents/tools/naps2-signature-helper"
chmod +x "$app/Contents/tools/naps2-signature-helper"
done < <(find NAPS2.App.Mac/bin -type d -name "NAPS2.app" -path '*/Debug*/*' -print0)
- name: Test
if: matrix.os != 'macos-15'
run: dotnet run --project NAPS2.Tools -- test -v --nogui
Expand All @@ -36,3 +85,21 @@ jobs:
- name: Test (ImageSharp images)
if: matrix.os == 'ubuntu-24.04'
run: dotnet run --project NAPS2.Tools -- test -v --nogui --images is --scope sdk
- name: Upload Windows binary
if: matrix.os == 'windows-2022'
uses: actions/upload-artifact@v4
with:
name: naps2-windows-debug
path: NAPS2.App.WinForms/bin/Debug*/net9-windows/
- name: Upload Linux binary
if: matrix.os == 'ubuntu-24.04'
uses: actions/upload-artifact@v4
with:
name: naps2-linux-debug
path: NAPS2.App.Gtk/bin/Debug*/net9/
- name: Upload macOS binary
if: matrix.os == 'macos-15'
uses: actions/upload-artifact@v4
with:
name: naps2-macos-debug
path: NAPS2.App.Mac/bin/Debug*/net9-macos/
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ packages/
*.suo
.vs/
.idea/
.nuget/
.nuget/
build_output.log
build/*
naps2.egg-info/*
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "third_party/pyHanko"]
path = third_party/pyHanko
url = https://github.com/MatthiasValvekens/pyHanko.git
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.11
1 change: 1 addition & 0 deletions NAPS2.App.Mac/NAPS2.App.Mac.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<ApplicationIcon>../NAPS2.Lib/Icons/favicon.ico</ApplicationIcon>

<SupportedOSPlatformVersion>12.0</SupportedOSPlatformVersion>
<TargetPlatformVersion>15.0</TargetPlatformVersion>
<RuntimeIdentifiers Condition="$([MSBuild]::IsOSPlatform('OSX'))">osx-x64;osx-arm64</RuntimeIdentifiers>
<TrimMode>partial</TrimMode>

Expand Down
10 changes: 5 additions & 5 deletions NAPS2.Images.Mac/NAPS2.Images.Mac.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6;net8;net8-macos</TargetFrameworks>
<TargetFrameworks>net6;net8;net9-macos</TargetFrameworks>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CheckEolTargetFramework>false</CheckEolTargetFramework>
Expand All @@ -17,22 +17,22 @@

<ItemGroup>
<ProjectReference Include="..\NAPS2.Images\NAPS2.Images.csproj" />
<PackageReference Include="Eto.Platform.Mac64" Version="2.8.3" Condition="'$(TargetFramework)' != 'net8-macos'" />
<PackageReference Include="Eto.Platform.Mac64" Version="2.8.3" Condition="'$(TargetFramework)' != 'net9-macos'" />
</ItemGroup>

<PropertyGroup Condition="'$(TargetFramework)' != 'net8-macos'">
<PropertyGroup Condition="'$(TargetFramework)' != 'net9-macos'">
<DefineConstants>MONOMAC</DefineConstants>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' != 'net8-macos'">
<ItemGroup Condition="'$(TargetFramework)' != 'net9-macos'">
<Using Include="MonoMac.AppKit" />
<Using Include="MonoMac.CoreGraphics" />
<Using Include="MonoMac.Foundation" />
<Using Include="MonoMac.ImageIO" />
<Using Include="MonoMac.MobileCoreServices" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8-macos'">
<ItemGroup Condition="'$(TargetFramework)' == 'net9-macos'">
<Using Include="AppKit" />
<Using Include="CoreGraphics" />
<Using Include="Foundation" />
Expand Down
1 change: 1 addition & 0 deletions NAPS2.Lib.Mac/EtoForms/Ui/MacDesktopForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ protected override void CreateToolbarsAndMenus()
.Append(Commands.ZoomOut)
.Separator()
.Append(Commands.Crop)
.Append(Commands.SignatureField)
.Append(Commands.BrightCont)
.Append(Commands.HueSat)
.Append(Commands.BlackWhite)
Expand Down
1 change: 1 addition & 0 deletions NAPS2.Lib/EtoForms/Desktop/DesktopSubFormController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public IDesktopSubFormController WithSelection(Func<ListSelection<UiImage>> sele
public void ShowSharpenForm() => ShowImageForm<SharpenForm>();
public void ShowSplitForm() => ShowImageForm<SplitForm>();
public void ShowRotateForm() => ShowImageForm<RotateForm>();
public void ShowSignatureFieldForm() => ShowImageForm<SignatureFieldForm>();

public void ShowCombineForm()
{
Expand Down
1 change: 1 addition & 0 deletions NAPS2.Lib/EtoForms/Desktop/IDesktopSubFormController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public interface IDesktopSubFormController
void ShowSplitForm();
void ShowCombineForm();
void ShowRotateForm();
void ShowSignatureFieldForm();
void ShowProfilesForm();
void ShowOcrForm();
void ShowBatchScanForm();
Expand Down
4 changes: 2 additions & 2 deletions NAPS2.Lib/EtoForms/Ui/AboutForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected override void BuildLayout()
C.NoWrap(AssemblyHelper.Product),
L.Row(
L.Column(
C.NoWrap(string.Format(MiscResources.Version, AssemblyHelper.Version)),
C.NoWrap(string.Format(MiscResources.Version, AssemblyHelper.DisplayVersion)),
C.UrlLink(NAPS2_HOMEPAGE)
),
Config.Get(c => c.HiddenButtons).HasFlag(ToolbarButtons.Donate)
Expand Down Expand Up @@ -95,4 +95,4 @@ private LayoutElement GetUpdateWidget()
return new UpdateCheckWidget(_updateChecker, Config);
#endif
}
}
}
6 changes: 6 additions & 0 deletions NAPS2.Lib/EtoForms/Ui/DesktopCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ public DesktopCommands(DesktopController desktopController, DesktopScanControlle
Text = UiStrings.Crop,
IconName = "transform_crop_small"
};
SignatureField = new ActionCommand(desktopSubFormController.ShowSignatureFieldForm)
{
Text = "Place Signature Field",
IconName = "document_sign_small"
};
BrightCont = new ActionCommand(desktopSubFormController.ShowBrightnessContrastForm)
{
Text = UiStrings.BrightnessContrast,
Expand Down Expand Up @@ -381,6 +386,7 @@ public DesktopCommands WithSelection(Func<ListSelection<UiImage>> selectionFunc)
public ActionCommand ImageMenu { get; set; }
public ActionCommand ViewImage { get; set; }
public ActionCommand Crop { get; set; }
public ActionCommand SignatureField { get; set; }
public ActionCommand BrightCont { get; set; }
public ActionCommand HueSat { get; set; }
public ActionCommand BlackWhite { get; set; }
Expand Down
1 change: 1 addition & 0 deletions NAPS2.Lib/EtoForms/Ui/DesktopForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ protected virtual void CreateToolbarsAndMenus()
.Append(Commands.ViewImage)
.Separator()
.Append(Commands.Crop)
.Append(Commands.SignatureField)
.Append(Commands.BrightCont)
.Append(Commands.HueSat)
.Append(Commands.BlackWhite)
Expand Down
Loading