Skip to content

Commit

Permalink
Merge pull request #456 from TheJoeFin/settings-save-tess-change
Browse files Browse the repository at this point in the history
Settings save tess change
  • Loading branch information
TheJoeFin authored Apr 23, 2024
2 parents 961322c + 27feaf6 commit 6f95355
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 21 deletions.
4 changes: 2 additions & 2 deletions Tests/Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0-preview-24080-01" />
<PackageReference Include="xunit" Version="2.7.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
<PackageReference Include="xunit" Version="2.7.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.8">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion Text-Grab-Package/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<Identity
Name="40087JoeFinApps.TextGrab"
Publisher="CN=153F3B0F-BA3D-4964-8098-71AC78A1DF6A"
Version="4.4.1.0" />
Version="4.4.2.0" />

<Properties>
<DisplayName>Text Grab</DisplayName>
Expand Down
8 changes: 4 additions & 4 deletions Text-Grab/Controls/BottomBarSettings.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
VerticalAlignment="Top"
Background="{ui:ThemeResource CardBackgroundFillColorSecondaryBrush}"
CornerRadius="8">
<ListView
<ui:ListView
x:Name="LeftListBox"
d:ItemsSource="{d:SampleData ItemCount=5}"
ItemContainerStyle="{StaticResource GridViewListItem}"
Expand Down Expand Up @@ -105,7 +105,7 @@
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
</ui:ListView>
</Border>
<StackPanel
Grid.Row="1"
Expand Down Expand Up @@ -156,7 +156,7 @@
VerticalAlignment="Top"
Background="{ui:ThemeResource CardBackgroundFillColorSecondaryBrush}"
CornerRadius="8">
<ListView
<ui:ListView
x:Name="RightListBox"
d:ItemsSource="{d:SampleData ItemCount=1}"
ItemContainerStyle="{StaticResource GridViewListItem}"
Expand Down Expand Up @@ -203,7 +203,7 @@
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
</ui:ListView>
</Border>

<StackPanel
Expand Down
9 changes: 4 additions & 5 deletions Text-Grab/Controls/FindAndReplaceWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
VerticalAlignment="Center"
VerticalContentAlignment="Center">
<TextBlock Style="{StaticResource TextBodyNormal}">
Search With Regex
Use Regex
</TextBlock>
</ui:ToggleSwitch>

Expand Down Expand Up @@ -215,15 +215,14 @@
Text="Matches" />

<Border Grid.Row="3" Background="{ui:ThemeResource SolidBackgroundFillColorBaseAltBrush}">
<ListView
<ui:ListView
x:Name="ResultsListView"
Grid.Row="2"
Background="Transparent"
Foreground="{ui:ThemeResource TextFillColorPrimaryBrush}"
ScrollViewer.CanContentScroll="True"
ScrollViewer.VerticalScrollBarVisibility="Auto"
SelectionChanged="ResultsListView_SelectionChanged"
Style="{DynamicResource ListViewDarkStyle}">
SelectionChanged="ResultsListView_SelectionChanged">
<ListView.ItemTemplate>
<DataTemplate>
<Grid>
Expand Down Expand Up @@ -265,7 +264,7 @@
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</ui:ListView>
</Border>
</Grid>
</ui:FluentWindow>
2 changes: 1 addition & 1 deletion Text-Grab/Pages/GeneralSettings.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
x:Name="VersionTextblock"
VerticalAlignment="Center"
Style="{StaticResource TextBodyNormal}"
Text="Version 4.4.1" />
Text="Version 4.4.2" />

<ui:HyperlinkButton
x:Name="OpenExeFolderButton"
Expand Down
8 changes: 4 additions & 4 deletions Text-Grab/Pages/LanguageSettings.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
Content="How to install OCR languages with PowerShell"
NavigateUri="https://learn.microsoft.com/en-us/windows/powertoys/text-extractor#how-to-query-for-ocr-language-packs" />
<!-- Show the commands to execute to add other languages -->
<ListView
<ui:ListView
x:Name="WindowsLanguagesListView"
MaxWidth="600"
HorizontalAlignment="Left">
Expand All @@ -37,7 +37,7 @@
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</ui:ListView>
</StackPanel>
<StackPanel
x:Name="TesseractLanguagesStackPanel"
Expand All @@ -61,7 +61,7 @@
<TextBlock Text="Open Tesseract Language Data Folder" />
</StackPanel>
</ui:HyperlinkButton>
<ListView
<ui:ListView
x:Name="TesseractLanguagesListView"
MaxWidth="600"
HorizontalAlignment="Left">
Expand All @@ -72,7 +72,7 @@
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</ui:ListView>

<TextBlock Margin="0,20,0,0" Style="{StaticResource TextBodyNormal}">
Download and install languages from Tesseract GitHub<LineBreak />
Expand Down
8 changes: 5 additions & 3 deletions Text-Grab/Pages/LanguageSettings.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,27 @@ namespace Text_Grab.Pages;
/// </summary>
public partial class LanguageSettings : Page
{
private bool usingTesseract;
private readonly Settings DefaultSettings = AppUtilities.TextGrabSettings;


public LanguageSettings()
{
InitializeComponent();
usingTesseract = DefaultSettings.UseTesseract && TesseractHelper.CanLocateTesseractExe();
}

private async void Page_Loaded(object sender, RoutedEventArgs e)
{
LoadWindowsLanguages();

if (usingTesseract)
if (DefaultSettings.UseTesseract)
{
TesseractLanguagesStackPanel.Visibility = Visibility.Visible;
await LoadTesseractContent();
}
else
{
TesseractLanguagesStackPanel.Visibility = Visibility.Collapsed;
}
}

private void LoadWindowsLanguages()
Expand Down
3 changes: 3 additions & 0 deletions Text-Grab/Pages/TesseractSettings.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ private void TesseractPathTextBox_TextChanged(object sender, TextChangedEventArg
UseTesseractCheckBox.IsEnabled = false;

DefaultSettings.TesseractPath = pathText;
DefaultSettings.Save();
}

private void OpenPathButton_Click(object sender, RoutedEventArgs args)
Expand Down Expand Up @@ -76,6 +77,7 @@ private void UseTesseractCheckBox_Checked(object sender, RoutedEventArgs e)
return;

DefaultSettings.UseTesseract = useTesseractSwitch.IsChecked is true;
DefaultSettings.Save();
}

private void Page_Loaded(object sender, RoutedEventArgs e)
Expand All @@ -84,6 +86,7 @@ private void Page_Loaded(object sender, RoutedEventArgs e)
{
UseTesseractCheckBox.IsChecked = DefaultSettings.UseTesseract;
TesseractPathTextBox.Text = DefaultSettings.TesseractPath;
settingsSet = true;
return;
}

Expand Down
2 changes: 1 addition & 1 deletion Text-Grab/Text-Grab.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<PackageReference Include="Humanizer.Core" Version="2.14.1" />
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.3" />
<PackageReference Include="System.Drawing.Common" Version="9.0.0-preview.1.24081.2" />
<PackageReference Include="WPF-UI" Version="3.0.0" />
<PackageReference Include="WPF-UI" Version="3.0.4" />
<PackageReference Include="WpfScreenHelper" Version="2.1.0" />
<PackageReference Include="ZXing.Net" Version="0.16.9" />
<PackageReference Include="ZXing.Net.Bindings.Windows.Compatibility" Version="0.16.12" />
Expand Down

0 comments on commit 6f95355

Please sign in to comment.