1414import config
1515import ui
1616import textInfos
17+ import speech
1718import versionInfo
1819if versionInfo .version_year < 2019 :
1920 import win32clipboard
2021from time import sleep
2122from threading import Thread
23+ from scriptHandler import script
2224from . import fen
2325from ._gui import *
2426
@@ -35,6 +37,8 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
3537
3638 scriptCategory = "FEN reader"
3739
40+ speechOnDemand = {"speakOnDemand" : True } if hasattr (speech .speech .SpeechMode , "onDemand" ) else {}
41+
3842 def __init__ (self , * args , ** kwargs ):
3943 super (GlobalPlugin , self ).__init__ (* args , ** kwargs )
4044 if hasattr (settingsDialogs , 'SettingsPanel' ):
@@ -86,7 +90,7 @@ def describeBoard(self):
8690 timeForSearching = Thread (target = sleep , args = (0.3 ,))
8791 timeForSearching .start ()
8892 while not description and c < l - 16 :
89- if not timeForSearching .isAlive ():
93+ if not timeForSearching .is_alive ():
9094 ui .message (_ ("Too much text has been selected" ))
9195 return
9296 # First use english notation by default
@@ -120,7 +124,8 @@ def describeBoard(self):
120124 ui .message (_ ("Selected text doesn't contains a valid FEN code" ))
121125 else :
122126 ui .message (_ ("There is not selected text" ))
123-
127+
128+ @script (** speechOnDemand )
124129 def script_describeBoard (self , gesture ):
125130 self .describeBoard ()
126131 # Translators: Message presented in input help mode.
0 commit comments