mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Get piper develop to work on windows
This commit is contained in:
parent
cd9d25c1bb
commit
1aa97dbcf6
@ -468,10 +468,10 @@ class Piper(TTSBackend):
|
||||
|
||||
|
||||
def develop(): # {{{
|
||||
import tty
|
||||
|
||||
from qt.core import QSocketNotifier
|
||||
|
||||
from calibre.constants import iswindows
|
||||
from calibre.gui2 import Application
|
||||
app = Application([])
|
||||
p = Piper()
|
||||
@ -517,6 +517,8 @@ def develop(): # {{{
|
||||
|
||||
p.state_changed.connect(state_changed)
|
||||
p.saying.connect(saying)
|
||||
if not iswindows:
|
||||
import tty
|
||||
attr = tty.setraw(sys.stdin.fileno())
|
||||
os.set_blocking(sys.stdin.fileno(), False)
|
||||
sn = QSocketNotifier(sys.stdin.fileno(), QSocketNotifier.Type.Read, p)
|
||||
@ -525,6 +527,7 @@ def develop(): # {{{
|
||||
p.say(text)
|
||||
app.exec()
|
||||
finally:
|
||||
if not iswindows:
|
||||
import termios
|
||||
termios.tcsetattr(sys.stdout.fileno(), termios.TCSANOW, attr)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user