Skip to content

Commit

Permalink
[TextExtractor]Rename PowerOCR to Text Extractor (#20178)
Browse files Browse the repository at this point in the history
* [Image To Text]Rename PowerOCR to Image To Text

* fix spellchecker

* Rename to Text Extractor

* Missing mention

* Another missing mention
  • Loading branch information
jaimecbernardo authored Aug 31, 2022
1 parent 96f34ee commit 086eb58
Show file tree
Hide file tree
Showing 24 changed files with 73 additions and 71 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ body:
- G-code Preview
- G-code Thumbnail
- PowerAccent
- PowerOCR
- TextExtractor
- PowerRename
- PowerToys Run
- Screen ruler
Expand Down
1 change: 1 addition & 0 deletions .github/actions/spell-check/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,7 @@ IMAGERESIZERCONTEXTMENU
IMAGERESIZEREXT
imageresizerinput
imageresizersettings
TEXTEXTRACTOR
imagingdevices
IMain
IMarkdown
Expand Down
2 changes: 1 addition & 1 deletion COMMUNITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Their fork of Wox was the base of PowerToys Run.
Initial base of jjw24's fork, which makes it the base of PowerToys Run.

### [Text-Grab](https://github.com/TheJoeFin/Text-Grab) - Joseph Finney
Joe helped develop and contribute to the Image to Text utility. It is directly based on his Text Grab application.
Joe helped develop and contribute to the Text Extractor utility. It is directly based on his Text Grab application.

## Microsoft community members

Expand Down
4 changes: 2 additions & 2 deletions src/common/logger/logger_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct LogSettings
inline const static std::wstring fancyZonesOldLogPath = L"FancyZonesLogs\\"; // needed to clean up old logs
inline const static std::string shortcutGuideLoggerName = "shortcut-guide";
inline const static std::wstring shortcutGuideLogPath = L"ShortcutGuideLogs\\shortcut-guide-log.txt";
inline const static std::wstring powerOcrLogPath = L"Logs\\power-ocr-log.txt";
inline const static std::wstring powerOcrLogPath = L"Logs\\text-extractor-log.txt";
inline const static std::string keyboardManagerLoggerName = "keyboard-manager";
inline const static std::wstring keyboardManagerLogPath = L"Logs\\keyboard-manager-log.txt";
inline const static std::string findMyMouseLoggerName = "find-my-mouse";
Expand All @@ -33,7 +33,7 @@ struct LogSettings
inline const static std::string imageResizerLoggerName = "imageresizer";
inline const static std::string powerRenameLoggerName = "powerrename";
inline const static std::string alwaysOnTopLoggerName = "always-on-top";
inline const static std::string powerOcrLoggerName = "power-ocr";
inline const static std::string powerOcrLoggerName = "TextExtractor";
inline const static std::wstring alwaysOnTopLogPath = L"always-on-top-log.txt";
inline const static int retention = 30;
std::wstring logLevel;
Expand Down
10 changes: 5 additions & 5 deletions src/modules/PowerOCR/PowerOCR/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ private void Application_Startup(object sender, StartupEventArgs e)
_instanceMutex = new Mutex(true, @"Local\PowerToys_PowerOCR_InstanceMutex", out bool createdNew);
if (!createdNew)
{
Logger.LogWarning("Another running PowerOCR instance was detected. Exiting PowerOCR");
Logger.LogWarning("Another running TextExtractor instance was detected. Exiting TextExtractor");
_instanceMutex = null;
Environment.Exit(0);
return;
Expand All @@ -46,24 +46,24 @@ private void Application_Startup(object sender, StartupEventArgs e)
try
{
_ = int.TryParse(e.Args[0], out _powerToysRunnerPid);
Logger.LogInfo($"PowerOCR started from the PowerToys Runner. Runner pid={_powerToysRunnerPid}");
Logger.LogInfo($"TextExtractor started from the PowerToys Runner. Runner pid={_powerToysRunnerPid}");

RunnerHelper.WaitForPowerToysRunner(_powerToysRunnerPid, () =>
{
Logger.LogInfo("PowerToys Runner exited. Exiting PowerOCR");
Logger.LogInfo("PowerToys Runner exited. Exiting TextExtractor");
Environment.Exit(0);
});
var userSettings = new UserSettings(new Helpers.ThrottledActionInvoker());
eventMonitor = new EventMonitor();
}
catch (Exception ex)
{
Logger.LogError($"PowerOCR got an exception on start: {ex}");
Logger.LogError($"TextExtractor got an exception on start: {ex}");
}
}
else
{
Logger.LogInfo($"PowerOCR started detached from PowerToys Runner.");
Logger.LogInfo($"TextExtractor started detached from PowerToys Runner.");
_powerToysRunnerPid = -1;
var userSettings = new UserSettings(new Helpers.ThrottledActionInvoker());
keyboardMonitor = new KeyboardMonitor(userSettings);
Expand Down
2 changes: 1 addition & 1 deletion src/modules/PowerOCR/PowerOCR/Helpers/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace PowerOCR.Helpers
public static class Logger
{
private static readonly IFileSystem _fileSystem = new FileSystem();
private static readonly string ApplicationLogPath = Path.Combine(Constants.AppDataPath(), "PowerOCR\\Logs");
private static readonly string ApplicationLogPath = Path.Combine(Constants.AppDataPath(), "TextExtractor\\Logs");

static Logger()
{
Expand Down
2 changes: 1 addition & 1 deletion src/modules/PowerOCR/PowerOCR/OCROverlay.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:PowerOCR"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="PowerOCR"
Title="TextExtractor"
Width="800"
Height="450"
ShowActivated="False"
Expand Down
4 changes: 2 additions & 2 deletions src/modules/PowerOCR/PowerOCR/Settings/UserSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace PowerOCR.Settings
public class UserSettings : IUserSettings
{
private readonly ISettingsUtils _settingsUtils;
private const string PowerOcrModuleName = "PowerOCR";
private const string PowerOcrModuleName = "TextExtractor";
private const string DefaultActivationShortcut = "Win + Shift + O";
private const int MaxNumberOfRetry = 5;
private const int SettingsReadOnChangeDelayInMs = 300;
Expand Down Expand Up @@ -56,7 +56,7 @@ private void LoadSettingsFromJson()

if (!_settingsUtils.SettingsExists(PowerOcrModuleName))
{
Logger.LogInfo("PowerOCR settings.json was missing, creating a new one");
Logger.LogInfo("TextExtractor settings.json was missing, creating a new one");
var defaultPowerOcrSettings = new PowerOcrSettings();
defaultPowerOcrSettings.Save(_settingsUtils);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
namespace PowerOcrConstants
{
// Name of the powertoy module.
inline const std::wstring ModuleKey = L"PowerOCR";
inline const std::wstring ModuleKey = L"TextExtractor";
}
6 changes: 3 additions & 3 deletions src/modules/PowerOCR/PowerOCRModuleInterface/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="PowerOCR_Name" xml:space="preserve">
<value>PowerOCR</value>
<data name="TextExtractor_Name" xml:space="preserve">
<value>Text Extractor</value>
</data>
<data name="PowerOCR_Settings_Desc" xml:space="preserve">
<data name="TextExtractor_Settings_Desc" xml:space="preserve">
<value>This feature requires Windows 10 version 1903 or higher</value>
</data>
</root>
29 changes: 15 additions & 14 deletions src/modules/PowerOCR/PowerOCRModuleInterface/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ BOOL APIENTRY DllMain(HMODULE hModule,
{
case DLL_PROCESS_ATTACH:
Trace::RegisterProvider();
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
Expand Down Expand Up @@ -83,17 +84,17 @@ class PowerOCR : public PowertoyModuleIface
}
catch (...)
{
Logger::error("Failed to initialize PowerOCR start shortcut");
Logger::error("Failed to initialize TextExtractor start shortcut");
}
}
else
{
Logger::info("PowerOCR settings are empty");
Logger::info("TextExtractor settings are empty");
}

if (!m_hotkey.key)
{
Logger::info("PowerOCR is going to use default shortcut");
Logger::info("TextExtractor is going to use default shortcut");
m_hotkey.win = true;
m_hotkey.alt = false;
m_hotkey.shift = true;
Expand All @@ -109,7 +110,7 @@ class PowerOCR : public PowertoyModuleIface

void launch_process()
{
Logger::trace(L"Starting PowerOCR process");
Logger::trace(L"Starting TextExtractor process");
unsigned long powertoys_pid = GetCurrentProcessId();

std::wstring executable_args = L"";
Expand All @@ -122,11 +123,11 @@ class PowerOCR : public PowertoyModuleIface
sei.lpParameters = executable_args.data();
if (ShellExecuteExW(&sei))
{
Logger::trace("Successfully started the PowerOCR process");
Logger::trace("Successfully started the TextExtractor process");
}
else
{
Logger::error( L"PowerOCR failed to start. {}", get_last_error_or_default(GetLastError()));
Logger::error( L"TextExtractor failed to start. {}", get_last_error_or_default(GetLastError()));
}

m_hProcess = sei.hProcess;
Expand All @@ -153,9 +154,9 @@ class PowerOCR : public PowertoyModuleIface
public:
PowerOCR()
{
app_name = GET_RESOURCE_STRING(IDS_POWEROCR_NAME);
app_name = GET_RESOURCE_STRING(IDS_TEXTEXTRACTOR_NAME);
app_key = PowerOcrConstants::ModuleKey;
LoggerHelpers::init_logger(app_key, L"ModuleInterface", "PowerOCR");
LoggerHelpers::init_logger(app_key, L"ModuleInterface", "TextExtractor");
m_hInvokeEvent = CreateDefaultEvent(CommonSharedConstants::SHOW_POWEROCR_SHARED_EVENT);
init_settings();
}
Expand All @@ -171,7 +172,7 @@ class PowerOCR : public PowertoyModuleIface
// Destroy the powertoy and free memory
virtual void destroy() override
{
Logger::trace("PowerOCR::destroy()");
Logger::trace("TextExtractor::destroy()");
delete this;
}

Expand All @@ -193,9 +194,9 @@ class PowerOCR : public PowertoyModuleIface

// Create a Settings object.
PowerToysSettings::Settings settings(hinstance, get_name());
settings.set_description(GET_RESOURCE_STRING(IDS_POWEROCR_SETTINGS_DESC));
settings.set_description(GET_RESOURCE_STRING(IDS_TEXTEXTRACTOR_SETTINGS_DESC));

settings.set_overview_link(L"https://aka.ms/PowerToysOverview_PowerOCR");
settings.set_overview_link(L"https://aka.ms/PowerToysOverview_TextExtractor");

return settings.serialize_to_buffer(buffer, buffer_size);
}
Expand Down Expand Up @@ -227,7 +228,7 @@ class PowerOCR : public PowertoyModuleIface

virtual void enable()
{
Logger::trace("PowerOCR::enable()");
Logger::trace("TextExtractor::enable()");
ResetEvent(m_hInvokeEvent);
launch_process();
m_enabled = true;
Expand All @@ -236,7 +237,7 @@ class PowerOCR : public PowertoyModuleIface

virtual void disable()
{
Logger::trace("PowerOCR::disable()");
Logger::trace("TextExtractor::disable()");
if (m_enabled)
{
ResetEvent(m_hInvokeEvent);
Expand All @@ -251,7 +252,7 @@ class PowerOCR : public PowertoyModuleIface
{
if (m_enabled)
{
Logger::trace(L"PowerOCR hotkey pressed");
Logger::trace(L"TextExtractor hotkey pressed");
if (!is_process_running())
{
launch_process();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//////////////////////////////
// Non-localizable

#define FILE_DESCRIPTION "PowerToys PowerOCR"
#define FILE_DESCRIPTION "PowerToys TextExtractor"
#define INTERNAL_NAME "PowerToys.PowerOCR"
#define ORIGINAL_FILENAME "PowerToys.PowerOCR.dll"

Expand Down
2 changes: 1 addition & 1 deletion src/settings-ui/Settings.UI.Library/EnabledModules.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public bool PowerAccent

private bool powerOCR = true;

[JsonPropertyName("PowerOCR")]
[JsonPropertyName("TextExtractor")]
public bool PowerOCR
{
get => powerOCR;
Expand Down
2 changes: 1 addition & 1 deletion src/settings-ui/Settings.UI.Library/PowerOcrSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
{
public class PowerOcrSettings : BasePTModuleSettings, ISettingsConfig
{
public const string ModuleName = "PowerOCR";
public const string ModuleName = "TextExtractor";

[JsonPropertyName("properties")]
public PowerOcrProperties Properties { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/settings-ui/Settings.UI.Library/SndPowerOcrSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
{
public class SndPowerOcrSettings
{
[JsonPropertyName("PowerOCR")]
[JsonPropertyName("TextExtractor")]
public PowerOcrSettings Settings { get; set; }

public SndPowerOcrSettings()
Expand Down
2 changes: 1 addition & 1 deletion src/settings-ui/Settings.UI/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs ar
case "KBM": StartupPage = typeof(Views.KeyboardManagerPage); break;
case "MouseUtils": StartupPage = typeof(Views.MouseUtilsPage); break;
case "PowerAccent": StartupPage = typeof(Views.PowerAccentPage); break;
case "PowerOCR": StartupPage = typeof(Views.PowerOcrPage); break;
case "TextExtractor": StartupPage = typeof(Views.PowerOcrPage); break;
case "PowerRename": StartupPage = typeof(Views.PowerRenamePage); break;
case "FileExplorer": StartupPage = typeof(Views.PowerPreviewPage); break;
case "ShortcutGuide": StartupPage = typeof(Views.ShortcutGuidePage); break;
Expand Down
2 changes: 1 addition & 1 deletion src/settings-ui/Settings.UI/OOBE/Enums/PowerToysModules.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public enum PowerToysModules
KBM,
MouseUtils,
PowerAccent,
PowerOCR,
TextExtractor,
PowerRename,
Run,
ShortcutGuide,
Expand Down
10 changes: 5 additions & 5 deletions src/settings-ui/Settings.UI/OOBE/Views/OobePowerOCR.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,27 @@
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:toolkitcontrols="using:CommunityToolkit.WinUI.UI.Controls">

<controls:OOBEPageControl x:Uid="Oobe_PowerOCR"
<controls:OOBEPageControl x:Uid="Oobe_TextExtractor"
HeroImage="ms-appx:///Assets/Modules/OOBE/PowerOCR.gif">

<controls:OOBEPageControl.PageContent>
<StackPanel Orientation="Vertical">
<TextBlock x:Uid="Oobe_HowToUse"
Style="{ThemeResource OobeSubtitleStyle}" />

<controls:ShortcutWithTextLabelControl x:Name="HotkeyControl" x:Uid="Oobe_PowerOCR_HowToUse" />
<controls:ShortcutWithTextLabelControl x:Name="HotkeyControl" x:Uid="Oobe_TextExtractor_HowToUse" />


<TextBlock x:Uid="Oobe_TipsAndTricks"
Style="{ThemeResource OobeSubtitleStyle}"/>

<toolkitcontrols:MarkdownTextBlock Background="Transparent" x:Uid="Oobe_PowerOCR_TipsAndTricks" />
<toolkitcontrols:MarkdownTextBlock Background="Transparent" x:Uid="Oobe_TextExtractor_TipsAndTricks" />

<StackPanel Orientation="Horizontal" Spacing="12" Margin="0,24,0,0">
<Button x:Uid="OOBE_Settings"
Click="SettingsLaunchButton_Click"/>
<HyperlinkButton NavigateUri="https://aka.ms/PowerToysOverview_PowerOCR" Style="{StaticResource TextButtonStyle}">
<TextBlock x:Uid="LearnMore_PowerOCR"
<HyperlinkButton NavigateUri="https://aka.ms/PowerToysOverview_TextExtractor" Style="{StaticResource TextButtonStyle}">
<TextBlock x:Uid="LearnMore_TextExtractor"
TextWrapping="Wrap" />
</HyperlinkButton>
</StackPanel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public sealed partial class OobePowerOCR : Page
public OobePowerOCR()
{
this.InitializeComponent();
ViewModel = new OobePowerToysModule(OobeShellPage.OobeShellHandler.Modules[(int)PowerToysModules.PowerOCR]);
ViewModel = new OobePowerToysModule(OobeShellPage.OobeShellHandler.Modules[(int)PowerToysModules.TextExtractor]);
DataContext = ViewModel;
}

Expand Down
2 changes: 1 addition & 1 deletion src/settings-ui/Settings.UI/OOBE/Views/OobeShellPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
ShowAsMonochrome="False" />
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
<muxc:NavigationViewItem x:Uid="Shell_PowerOCR" Tag="PowerOCR">
<muxc:NavigationViewItem x:Uid="Shell_TextExtractor" Tag="TextExtractor">
<muxc:NavigationViewItem.Icon>
<BitmapIcon
UriSource="ms-appx:///Assets/FluentIcons/FluentIconsPowerOCR.png"
Expand Down
6 changes: 3 additions & 3 deletions src/settings-ui/Settings.UI/OOBE/Views/OobeShellPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ public OobeShellPage()
IsNew = true,
});

Modules.Insert((int)PowerToysModules.PowerOCR, new OobePowerToysModule()
Modules.Insert((int)PowerToysModules.TextExtractor, new OobePowerToysModule()
{
ModuleName = "PowerOCR",
ModuleName = "TextExtractor",
IsNew = true,
});

Expand Down Expand Up @@ -191,7 +191,7 @@ private void NavigationView_SelectionChanged(Microsoft.UI.Xaml.Controls.Navigati
case "KBM": NavigationFrame.Navigate(typeof(OobeKBM)); break;
case "PowerAccent": NavigationFrame.Navigate(typeof(OobePowerAccent)); break;
case "PowerRename": NavigationFrame.Navigate(typeof(OobePowerRename)); break;
case "PowerOCR": NavigationFrame.Navigate(typeof(OobePowerOCR)); break;
case "TextExtractor": NavigationFrame.Navigate(typeof(OobePowerOCR)); break;
case "FileExplorer": NavigationFrame.Navigate(typeof(OobeFileExplorer)); break;
case "ShortcutGuide": NavigationFrame.Navigate(typeof(OobeShortcutGuide)); break;
case "VideoConference": NavigationFrame.Navigate(typeof(OobeVideoConference)); break;
Expand Down
Loading

0 comments on commit 086eb58

Please sign in to comment.