Skip to content

Commit

Permalink
talking is now an optional thing
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewdeanmartin committed Dec 11, 2023
1 parent 83fa344 commit 84cd503
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
4 changes: 0 additions & 4 deletions bar.txt

This file was deleted.

16 changes: 14 additions & 2 deletions dedlin/outputters/talking_outputter.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
"""Make text editor hypothetically usable while blind."""
from typing import Optional
import logging

import pyttsx3
try:
import pyttsx3
except ImportError:
pyttsx3 = None

logger = logging.getLogger(__name__)


class TalkingPrinter:
""" "Make the output of the program more readable."""

def __init__(self) -> None:
"""Set up initial state"""
self.engine = pyttsx3.init()
if pyttsx3 is not None:
self.engine = pyttsx3.init()
else:
self.engine = None

def print(self, text: str, end: Optional[str]) -> None:
"""Speak"""
if self.engine is None:
logger.warning("No pyttsx3 installed, cannot speak")
return
self.engine.say(text)
self.engine.runAndWait()

Expand Down
9 changes: 6 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ requests = ">=2.31.0"
# ascii art/fonts
art = ">=6.1"

# Accessibilty
pyttsx3 = ">=2.90"

# printer support
mistune = ">=3.0.2"
markdown-it-py = ">=3.0.0"
Expand All @@ -77,6 +74,12 @@ markdown-it-py = ">=3.0.0"
#fastapi = { version = "*", optional = true }
#uvicorn = { version = "*", optional = true }

# Accessibilty
[tool.poetry.extras]
# doesn't build on gitlab actions today (dec 2023)
# pyttsx3 = ">=2.90"
speaking = ["pyttsx3"]

#[tool.poetry.extras]
#webapi = ["fastapi","uvicorn"]

Expand Down

0 comments on commit 84cd503

Please sign in to comment.