Skip to content

Commit

Permalink
readme update
Browse files Browse the repository at this point in the history
  • Loading branch information
KaiErikNiermann committed Jan 4, 2024
1 parent 6ee03f3 commit 461db13
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"rust-analyzer.showUnlinkedFileNotification": false
}
13 changes: 4 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,17 @@
![Static Badge](https://img.shields.io/badge/OCR-tesseract-blue)
![Static Badge](https://img.shields.io/badge/GUI-gtk-blue)

> **DISCLAIMER** This project is still in very early development and **does not work** you can refer to the Features section in here to see the things currently implemented / will be implemented. I am committed to getting this in a functional state soon enough hopefully, but right now you can unfortunately not use this. Do feel free to contribute by opening a PR though. As I am a student things migth still take a while so I am accepting all the help I can get.
## Why

This is basically just a desktop implementation of googles version of live translation. To my knowledge the three main options for translating on screen content are
> **DISCLAIMER** This project is still in very early development and **does not work** you can refer to the Features section in here to see the things currently implemented / will be implemented. I am committed to getting this in a functional state soon enough hopefully, but right now you can unfortunately not use this. Do feel free to contribute by opening a PR though. As I am a student things might still take a while so I am accepting all the help I can get.
- Uploading a screenshot
- Google Translate app live translate
- Copy pasting text
## Why

This project aims to add a 4th option where you can specify a region of text on the screen to translate and then either translate just any text recognized in this specified segment or translate the text in real time as it changes.
The motivation behind wanting to make this was largey based a conversation with a friend about embedded subtitles in some older movies. The main issue being that nowdays alot of text is generally embedded in ways conventional approaches can't easily access. Joseph Finney's [Text-Grab](https://github.com/TheJoeFin/Text-Grab) approached this issue very nicely for the static case and I hope to extend that idea to the dynamic case of running live OCR to enable things like live captioning without any embedding in the application. With the addition of having the application be cross-platform.

### Future Applications

- Live translation of subtitles when preferred option does not exist
- Live translation of text content in games without a translation
- General translation of any text visible
- General translation of any dynamically changing text

## Features

Expand Down
Binary file added assets/subs_example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion cross_compile.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

docker run --rm --name cross -v "$(pwd):/mnt/" gtkrs-crosscomp
docker run --rm --name cross -v "$(pwd):/mnt/" gtk-crosscomp

zip -r gtkapp gtkapp

Expand Down
13 changes: 12 additions & 1 deletion libs/lib_gui/src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ pub fn build_ui(
let api_key_entry = Entry::new();
let api_key_label = gtk::Label::new(Some("Selected API key"));
let set_api_key_button = Button::with_label("Set API key");
let decorated_toggle = Button::with_label("Toggle title bar");

let menu = MenuBar::new();
let source = MenuItem::with_label("Source");
Expand All @@ -199,6 +200,7 @@ pub fn build_ui(
&mainwindow,
&button,
&overlay_text,
&decorated_toggle
);

menu.append(&source);
Expand Down Expand Up @@ -232,6 +234,7 @@ pub fn build_ui(
vbox.pack_start(&menu, false, false, 10);
vbox.pack_start(&button_lang_box, false, false, 10);
vbox.pack_start(&label, true, true, 10);
vbox.pack_start(&decorated_toggle, true, true, 10);

vbox.set_margin(25);

Expand Down Expand Up @@ -284,9 +287,17 @@ fn add_actions(
mainwindow: &gtk::ApplicationWindow,
button: &Button,
overlay_text: &Label,
decorated_toggle: &Button
) {
decorated_toggle.connect_clicked(
glib::clone!(@strong mainwindow, => move |_| {
let toggle = mainwindow.is_decorated();
mainwindow.set_decorated(!toggle);
})
);

button.connect_clicked(
glib::clone!(@weak label, @weak tbox, @weak mainwindow, @weak source_lang_choice, @strong target_lang_choice, @strong api_key_label, @strong overlay_text => move |_| {
glib::clone!(@weak label, @weak tbox, @weak mainwindow, @weak source_lang_choice, @strong target_lang_choice, @strong api_key_label, @strong overlay_text, => move |_| {

let start = Instant::now();

Expand Down

0 comments on commit 461db13

Please sign in to comment.