Skip to content

Commit

Permalink
added unique box reading
Browse files Browse the repository at this point in the history
  • Loading branch information
arcb01 committed Jan 7, 2024
1 parent 897572b commit e1e4d17
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions gnarrator/reading_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ def read_screen(self, mode, window, screen_region=None):
self.window.set_to_regional(screen_region=self.screen_region)
self.window.reset_opacity()

# if only 1 detection was found, read it directly
# TODO: Apply reading stylesheet to the button
# NOTE: for snq mode can't be done here
if len(self.OCR.get_detections) == 1 and mode == "regional":
self.say_content_immediatly(det_text_content)

return self.window

def read_snq_screen(self):
Expand All @@ -133,9 +139,11 @@ def read_snq_screen(self):
# 4. Draw the button...
return screen_region

def say_content_immediatly(self):
def say_content_immediatly(self, content=None):
if not content:
content = self.det_text_content
# Call the TTS engine to read the content out loud
QTimer.singleShot(10, lambda: self.say_content(self.det_text_content))
QTimer.singleShot(10, lambda: self.say_content(content))
# When this the previous statement finishes then the window will be closed
QTimer.singleShot(12, lambda: self.window.close())

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

setuptools.setup(
name='gnarrator',
version='1.1.253',
version='1.1.263',
python_requires='>=3.9.0',
author='Arnau Castelalno',
author_email='[email protected]',
Expand Down

0 comments on commit e1e4d17

Please sign in to comment.