11# A part of NonVisual Desktop Access (NVDA)
22# Copyright (C) 2009-2023 NV Access Limited, Aleksey Sadovoy, James Teh, Joseph Lee, Tuukka Ojala,
3- # Bram Duvigneau
3+ # Bram Duvigneau, Cyrille Bougot
44# This file is covered by the GNU General Public License.
55# See the file COPYING for more details.
66
1919from logHandler import log
2020import ui
2121from utils .localisation import TimeOutputFormat
22+ from scriptHandler import script
2223
2324if TYPE_CHECKING :
2425 from inputCore import InputGesture # noqa: F401
@@ -146,6 +147,13 @@ def getElapsedAndTotalIfPlaying(self) -> _StatusBarTimes:
146147 ui .message (_ ("No track playing" ))
147148 return elapsedAndTotalTime
148149
150+ @script (
151+ # Translators: The description of an NVDA command for reading the remaining time of the currently playing
152+ # track in Foobar 2000.
153+ description = _ ("Reports the remaining time of the currently playing track, if any" ),
154+ gesture = "kb:control+shift+r" ,
155+ speakOnDemand = True ,
156+ )
149157 def script_reportRemainingTime (self , gesture : "InputGesture" ):
150158 elapsedTime , totalTime = self .getElapsedAndTotalIfPlaying ()
151159 parsedElapsedTime = None
@@ -163,9 +171,13 @@ def script_reportRemainingTime(self, gesture: "InputGesture"):
163171 # Translators: Reported if the remaining time can not be calculated in Foobar2000
164172 ui .message (_ ("Remaining time not available" ))
165173
166- # Translators: The description of an NVDA command for reading the remaining time of the currently playing track in Foobar 2000.
167- script_reportRemainingTime .__doc__ = _ ("Reports the remaining time of the currently playing track, if any" )
168-
174+ @script (
175+ # Translators: The description of an NVDA command for reading the elapsed time of the currently playing
176+ # track in Foobar 2000.
177+ description = _ ("Reports the elapsed time of the currently playing track, if any" ),
178+ gesture = "kb:control+shift+e" ,
179+ speakOnDemand = True ,
180+ )
169181 def script_reportElapsedTime (self , gesture : "InputGesture" ):
170182 elapsedTime = self .getElapsedAndTotalIfPlaying ().elapsed
171183 if elapsedTime :
@@ -177,9 +189,13 @@ def script_reportElapsedTime(self, gesture: "InputGesture"):
177189 # Translators: Reported if the elapsed time is not available in Foobar2000
178190 ui .message (_ ("Elapsed time not available" ))
179191
180- # Translators: The description of an NVDA command for reading the elapsed time of the currently playing track in Foobar 2000.
181- script_reportElapsedTime .__doc__ = _ ("Reports the elapsed time of the currently playing track, if any" )
182-
192+ @script (
193+ # Translators: The description of an NVDA command for reading the length of the currently playing track in
194+ # Foobar 2000.
195+ description = _ ("Reports the length of the currently playing track, if any" ),
196+ gesture = "kb:control+shift+t" ,
197+ speakOnDemand = True ,
198+ )
183199 def script_reportTotalTime (self , gesture : "InputGesture" ):
184200 totalTime = self .getElapsedAndTotalIfPlaying ().total
185201 if totalTime :
@@ -190,12 +206,3 @@ def script_reportTotalTime(self, gesture: "InputGesture"):
190206 else :
191207 # Translators: Reported if the total time is not available in Foobar2000
192208 ui .message (_ ("Total time not available" ))
193-
194- # Translators: The description of an NVDA command for reading the length of the currently playing track in Foobar 2000.
195- script_reportTotalTime .__doc__ = _ ("Reports the length of the currently playing track, if any" )
196-
197- __gestures = {
198- "kb:control+shift+r" : "reportRemainingTime" ,
199- "kb:control+shift+e" : "reportElapsedTime" ,
200- "kb:control+shift+t" : "reportTotalTime" ,
201- }
0 commit comments