Added OCR processor

This commit is contained in:
2024-03-15 23:34:58 -05:00
parent 4cbdf1432d
commit 1d671d8f23
7 changed files with 191 additions and 8 deletions

View File

@@ -40,6 +40,7 @@ class ButtonControls(Gtk.ButtonBox):
hflip_button = Gtk.Button()
rrotate_button = Gtk.Button()
zoomin_button = Gtk.Button()
ocr_button = Gtk.Button()
self._set_class(self.fit_button)
@@ -51,6 +52,7 @@ class ButtonControls(Gtk.ButtonBox):
hflip_button.set_tooltip_text("Flip Horizontal")
rrotate_button.set_tooltip_text("Rotate Right")
zoomin_button.set_tooltip_text("Zoom In")
ocr_button.set_tooltip_text("OCR")
zoomout_button.set_image( Gtk.Image.new_from_file(f"{icons_path}/zoom-out.png") )
lrotate_button.set_image( Gtk.Image.new_from_file(f"{icons_path}/rotate-left.png") )
@@ -60,6 +62,7 @@ class ButtonControls(Gtk.ButtonBox):
hflip_button.set_image( Gtk.Image.new_from_file(f"{icons_path}/flip-horizontal.png") )
rrotate_button.set_image( Gtk.Image.new_from_file(f"{icons_path}/rotate-right.png") )
zoomin_button.set_image( Gtk.Image.new_from_file(f"{icons_path}/zoom-in.png") )
ocr_button.set_image( Gtk.Image.new_from_file(f"{icons_path}/ocr.png") )
zoomout_button.set_always_show_image(True)
lrotate_button.set_always_show_image(True)
@@ -69,6 +72,7 @@ class ButtonControls(Gtk.ButtonBox):
hflip_button.set_always_show_image(True)
rrotate_button.set_always_show_image(True)
zoomin_button.set_always_show_image(True)
ocr_button.set_always_show_image(True)
zoomout_button.connect("clicked", self._zoom_out)
lrotate_button.connect("clicked", self._rotate_left)
@@ -78,6 +82,7 @@ class ButtonControls(Gtk.ButtonBox):
hflip_button.connect("clicked", self._horizontal_flip)
rrotate_button.connect("clicked", self._rotate_right)
zoomin_button.connect("clicked", self._zoom_in)
ocr_button.connect("clicked", self._show_ocr)
center_widget.add(zoomout_button)
center_widget.add(lrotate_button)
@@ -87,6 +92,7 @@ class ButtonControls(Gtk.ButtonBox):
center_widget.add(hflip_button)
center_widget.add(rrotate_button)
center_widget.add(zoomin_button)
center_widget.add(ocr_button)
self.set_center_widget(center_widget)
@@ -125,3 +131,6 @@ class ButtonControls(Gtk.ButtonBox):
def _unset_class(self, target):
ctx = target.get_style_context()
ctx.remove_class("button-highlighted")
def _show_ocr(self, widget):
event_system.emit("show_ocr")