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(): # {{{
|
def develop(): # {{{
|
||||||
import tty
|
|
||||||
|
|
||||||
from qt.core import QSocketNotifier
|
from qt.core import QSocketNotifier
|
||||||
|
|
||||||
|
from calibre.constants import iswindows
|
||||||
from calibre.gui2 import Application
|
from calibre.gui2 import Application
|
||||||
app = Application([])
|
app = Application([])
|
||||||
p = Piper()
|
p = Piper()
|
||||||
@ -517,16 +517,19 @@ def develop(): # {{{
|
|||||||
|
|
||||||
p.state_changed.connect(state_changed)
|
p.state_changed.connect(state_changed)
|
||||||
p.saying.connect(saying)
|
p.saying.connect(saying)
|
||||||
attr = tty.setraw(sys.stdin.fileno())
|
if not iswindows:
|
||||||
os.set_blocking(sys.stdin.fileno(), False)
|
import tty
|
||||||
|
attr = tty.setraw(sys.stdin.fileno())
|
||||||
|
os.set_blocking(sys.stdin.fileno(), False)
|
||||||
sn = QSocketNotifier(sys.stdin.fileno(), QSocketNotifier.Type.Read, p)
|
sn = QSocketNotifier(sys.stdin.fileno(), QSocketNotifier.Type.Read, p)
|
||||||
sn.activated.connect(input_ready)
|
sn.activated.connect(input_ready)
|
||||||
try:
|
try:
|
||||||
p.say(text)
|
p.say(text)
|
||||||
app.exec()
|
app.exec()
|
||||||
finally:
|
finally:
|
||||||
import termios
|
if not iswindows:
|
||||||
termios.tcsetattr(sys.stdout.fileno(), termios.TCSANOW, attr)
|
import termios
|
||||||
|
termios.tcsetattr(sys.stdout.fileno(), termios.TCSANOW, attr)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user