def register(controller=None): # The BrailleInput event has a 'cursor' parameter, which is the # cursor position, available through the request/cursor TALES # expression controller.register_event('BrailleInput', _("Input from the braille table.")) method=controller.message_log if brlapi is None: controller.log(_("BrlTTY not installed. There will be no braille support.")) else: engine=BrlEngine(controller) try: engine.init_brlapi() if engine.brlconnection is not None: gobject.io_add_watch(engine.brlconnection.fileDescriptor, gobject.IO_IN, engine.input_handler) method=engine.action_brldisplay engine.brldisplay("Advene connected") except: controller.log(_("Could not initialize BrlTTY. No braille support.")) # Register the Braille action even if the API is not available. controller.register_action(RegisteredAction( name="Braille", method=method, description=_("Display a message in Braille"), parameters={'message': _("Message to display.")}, defaults={'message': 'annotation/content/data'}, predefined={'message': ( ( 'annotation/content/data', _("The annotation content") ), )}, category='external', ))
def register(controller=None): engine_name = config.data.preferences.get('tts-engine', 'auto') selected = None if engine_name == 'auto': # Automatic configuration. Order is important. for name in ('customarg', 'custom', 'espeak', 'macosx', 'festival', 'sapi', 'generic'): c = ENGINES[name] if c.can_run(): controller.log("TTS: Automatically using " + c.__doc__.splitlines()[0]) selected = c break else: c = ENGINES.get(engine_name) if c is None: controller.log( "TTS: %s was specified but it does not exist. Using generic fallback. Please check your configuration." % c.__doc__.splitlines()[0]) selected = ENGINES['generic'] elif c.can_run(): controller.log("TTS: Using %s as specified." % c.__doc__.splitlines()[0]) selected = c else: controller.log( "TTS: Using %s as specified, but it apparently cannot run. Please check your configuration." % c.__doc__.splitlines()[0]) selected = c engine = selected(controller) controller.register_action( RegisteredAction( name="Pronounce", method=engine.action_pronounce, description=_("Pronounce a text"), parameters={'message': _("String to pronounce.")}, defaults={'message': 'annotation/content/data'}, predefined={ 'message': (('annotation/content/data', _("The annotation content")), ) }, category='sound', ))
def register(controller=None): #print "Registering default GUI actions" ac = DefaultGUIActions(controller) controller.register_action( RegisteredAction( name="Message", method=ac.action_message_log, description=_("Display a message"), parameters={'message': _("String to display.")}, defaults={'message': 'annotation/content/data'}, predefined={ 'message': (('annotation/content/data', _("The annotation content")), ) }, category='popup', )) controller.register_action( RegisteredAction( name="Popup", method=ac.action_popup, description=_("Display a popup"), parameters={ 'message': _("String to display."), 'duration': _("Display duration in ms. Ignored if empty.") }, defaults={ 'message': 'annotation/content/data', 'duration': 'annotation/fragment/duration' }, predefined={ 'message': (('annotation/content/data', _("The annotation content")), ), 'duration': (('string:1000', _("1 second")), ('annotation/fragment/duration', _("The annotation duration"))) }, category='popup', )) controller.register_action( RegisteredAction( name="Entry", method=ac.action_entry, description=_("Popup an entry box"), parameters={ 'message': _("String to display."), 'destination': _("Object where to store the answer (should have a content)"), 'duration': _("Display duration in ms. Ignored if empty.") }, defaults={ 'message': 'annotation/content/data', 'destination': 'annotation/related/first', 'duration': 'annotation/fragment/duration' }, predefined=ac.action_entry_predefined, category='popup', )) controller.register_action( RegisteredAction( name="PopupGoto", method=ac.action_popup_goto, description=_("Display a popup to go to another position"), parameters={ 'description': _("General description"), 'message': _("String to display."), 'position': _("New position"), 'duration': _("Display duration in ms. Ignored if empty.") }, defaults={ 'description': 'annotation/content/data', 'message': 'string:' + _('Go to related annotation'), 'position': 'annotation/related/first/fragment/begin', 'duration': 'annotation/fragment/duration' }, predefined=ac.action_popup_goto_predefined, category='popup', )) controller.register_action( RegisteredAction( name="PopupURL", method=ac.action_popup_url, description=_("Display a popup linking to an URL"), parameters={ 'description': _("General description"), 'message': _("String to display."), 'url': _("URL"), 'duration': _("Display duration in ms. Ignored if empty.") }, defaults={ 'description': 'annotation/content/data', 'message': _('string:Display annotation in web browser'), 'url': 'annotation/absolute_url', 'duration': 'annotation/fragment/duration' }, predefined={ 'description': (('annotation/content/data', _("The annotation content")), ), 'message': ( ('string:' + _('See the Advene website'), _('See the Advene website')), ('string:' + _('See the annotation'), _('See the annotation')), ), 'url': ( ('string:http://advene.org/', _("The Advene website")), ('annotation/absolute_url', _("The annotation URL")), ), 'duration': (('string:1000', _("1 second")), ('annotation/fragment/duration', _("The annotation duration"))) }, category='gui', )) controller.register_action( RegisteredAction( name="OpenInterface", method=ac.action_open_interface, description=_("Open an interface view"), parameters={ 'guiview': _("View name (timeline, tree, transcription, browser, webbrowser, transcribe)" ), 'destination': _("Destination: popup, south, east"), }, defaults={ 'guiview': 'string:timeline', 'destination': 'string:south', }, predefined=ac.action_open_interface_predefined, category='gui', )) controller.register_action( RegisteredAction( name="OpenView", method=ac.action_open_view, description=_("Open a saved view"), parameters={ 'id': _("Identifier of the saved view"), }, predefined=ac.action_open_view_predefined, category='gui', )) controller.register_action( RegisteredAction( name="PopupGoto2", method=ac.generate_action_popup_goton(2), description=_("Display a popup with 2 options"), parameters={ 'description': _("General description"), 'message1': _("First option description"), 'position1': _("First position"), 'message2': _("Second option description"), 'position2': _("Second position"), 'duration': _("Display duration in ms. Ignored if empty.") }, defaults={ 'description': 'annotation/content/data', 'message1': 'string:' + _('Go to the beginning'), 'position1': 'annotation/fragment/begin', 'message2': 'string:' + _('Go to the end'), 'position2': 'annotation/fragment/end', 'duration': 'annotation/fragment/duration', }, predefined=ac.action_popup_goto_predefined, category='popup', )) controller.register_action( RegisteredAction( name="PopupGoto3", method=ac.generate_action_popup_goton(3), description=_("Display a popup with 3 options"), parameters={ 'description': _("General description"), 'message1': _("First option description"), 'position1': _("First position"), 'message2': _("Second option description"), 'position2': _("Second position"), 'message3': _("Third option description"), 'position3': _("Third position"), 'duration': _("Display duration in ms. Ignored if empty.") }, defaults={ 'description': 'annotation/content/data', 'message1': 'string:' + _('Go to the beginning'), 'position1': 'annotation/fragment/begin', 'message2': 'string:' + _('Go to the end'), 'position2': 'annotation/fragment/end', 'message3': 'string:' + _('Go to related annotation'), 'position3': 'annotation/related/fragment/begin', 'duration': 'annotation/fragment/duration', }, predefined=ac.action_popup_goto_predefined, category='popup', )) controller.register_action( RegisteredAction( name="PopupGotoOutgoingRelated", method=ac.action_popup_goto_outgoing_related, description=_( "Display a popup to navigate to related annotations"), parameters={ 'message': _("String to display."), }, defaults={ 'message': 'string:' + _("Choose the related annotation you want to visualise."), }, category='popup', )) controller.register_action( RegisteredAction( name="CreateBookmark", method=ac.action_create_bookmark, description=_("Create a bookmark"), parameters={ 'position': _("Bookmark position (in ms)"), 'message': _("Bookmark content."), }, defaults={ 'message': 'string:' + _("Bookmark"), 'position': 'options/controller/player/current_position_value' }, category='gui', ))
def register(controller=None): ac=DefaultActionsRepository(controller) controller.register_action(RegisteredAction( name="Message", method=ac.Message, description=_("Display a message"), parameters={'message': _("Message to display")}, defaults={'message': 'annotation/content/data'}, predefined={'message': ( ( 'annotation/content/data', _("The annotation content") ), )}, category='gui', ) ) controller.register_action(RegisteredAction( name="PlayerStart", method=ac.PlayerStart, description=_("Start the player"), parameters={'position': _("Start position (in ms)")}, defaults={'position': 'string:0'}, predefined={'position': ( ( 'string:0', _("The movie start") ), ( 'annotation/fragment/begin', _("The annotation begin") ), ( 'annotation/fragment/end', _("The annotation end") ), )}, category='player', ) ) controller.register_action(RegisteredAction( name="PlayerGoto", method=ac.PlayerGoto, description=_("Go to the given position"), parameters={'position': _("Goto position (in ms)")}, defaults={'position': 'annotation/fragment/begin'}, predefined=ac.PlayerGoto_predefined, category='player', ) ) controller.register_action(RegisteredAction( name="PlayerStop", method=ac.PlayerStop, description=_("Stop the player"), category='player', ) ) controller.register_action(RegisteredAction( name="PlayerPause", method=ac.PlayerPause, description=_("Pause the player"), category='player', ) ) controller.register_action(RegisteredAction( name="PlayerResume", method=ac.PlayerResume, description=_("Resume the player"), category='player', ) ) controller.register_action(RegisteredAction( name="Snapshot", method=ac.Snapshot, description=_("Take a snapshot"), category='expert', ) ) controller.register_action(RegisteredAction( name="Caption", method=ac.Caption, description=_("Display a caption"), parameters={'message': _("Message to display"), 'duration': _("Duration of the caption")}, defaults={'message': 'annotation/content/data', 'duration': 'annotation/fragment/duration'}, predefined={'message': ( ( 'annotation/content/data', _("The annotation content") ), ), 'duration': ( ( 'string:1000', _("1 second") ), ( 'annotation/fragment/duration',_("The annotation duration") ) )}, category='image', ) ) controller.register_action(RegisteredAction( name="AnnotationCaption", method=ac.AnnotationCaption, description=_("Caption the annotation"), parameters={'message': _("Message to display")}, defaults={'message': 'annotation/content/data'}, predefined={'message': ( ( 'annotation/content/data', _("The annotation content") ), )}, category='image', ) ) controller.register_action(RegisteredAction( name="DisplayMarker", method=ac.DisplayMarker, description=_("Display a graphical shape"), parameters={'shape': _("Shape (square, circle, triangle)"), 'color': _("Color"), 'x': _("x-position (percentage of screen)"), 'y': _("y-position (percentage of screen)"), 'size': _("Size (arbitrary units)"), 'duration': _("Duration of the display in ms")}, defaults={'shape': 'string:circle', 'color': 'string:red', 'x': 'string:10', 'y': 'string:10', 'size': 'string:5', 'duration': 'annotation/fragment/duration'}, predefined={'shape': ( ( 'string:square', _("A square") ), ( 'string:circle', _("A circle") ), ( 'string:triangle', _("A triangle") ), ), 'color': ( ( 'string:white', _('White') ), ( 'string:black', _('Black') ), ( 'string:red', _('Red') ), ( 'string:green', _('Green') ), ( 'string:blue', _('Blue') ), ( 'string:yellow', _('Yellow') ), ), 'x': ( ( 'string:5', _('At the top of the screen') ), ( 'string:50', _('In the middle of the screen' ) ), ( 'string:95', _('At the bottom of the screen') ), ), 'y': ( ( 'string:5', _('At the left of the screen') ), ( 'string:50', _('In the middle of the screen') ), ), 'size': ( ( 'string:2', _("Small") ), ( 'string:4', _("Normal") ), ( 'string:10', _("Large") ), ), 'duration': ( ( 'string:1000', _("1 second") ), ( 'annotation/fragment/duration', _("The annotation duration") ) )}, category='image', ) ) controller.register_action(RegisteredAction( name="AnnotationMute", method=ac.AnnotationMute, description=_("Zero the volume during the annotation"), category='player', ) ) controller.register_action(RegisteredAction( name="SoundOff", method=ac.SoundOff, description=_("Zero the volume"), category='player', ) ) controller.register_action(RegisteredAction( name="SoundOn", method=ac.SoundOn, description=_("Restore the volume"), category='player', ) ) controller.register_action(RegisteredAction( name="ActivateSTBV", method=ac.ActivateSTBV, description=_("Activate a STBV"), parameters={'viewid': _("STBV id")}, defaults={'viewid': 'string:stbv_id'}, predefined=ac.ActivateSTBV_predefined, category='gui', ) ) controller.register_action(RegisteredAction( name="SendUserEvent", method=ac.SendUserEvent, description=_("Send a user event"), parameters={'identifier': _("Identifier"), 'delay': _("Delay in ms before sending the event.")}, defaults={'identifier': 'string:name', 'delay': 'string:2000'}, category='expert', ) ) controller.register_action(RegisteredAction( name="OpenURL", method=ac.OpenURL, description=_("Open a URL in the web browser"), parameters={'url': _("URL")}, defaults={'url': 'string:http://advene.org/'}, category='external', ) ) controller.register_action(RegisteredAction( name="OpenStaticView", method=ac.OpenStaticView, description=_("Open a static view"), parameters={'viewid': _("View")}, defaults={'viewid': 'string:Specify a view here'}, predefined=ac.OpenStaticView_predefined, category='gui', ) ) controller.register_action(RegisteredAction( name="SetVolume", method=ac.SetVolume, description=_("Set the audio volume"), parameters={'volume': _("Volume level (from 0 to 100)")}, defaults={'volume': 'string:50'}, category='player', ) ) controller.register_action(RegisteredAction( name="SetRate", method=ac.SetRate, description=_("Set the playing rate"), parameters={'rate': _("Rate (100: normal rate, 200: twice slower)")}, defaults={'rate': 'string:100'}, category='player', ) ) controller.register_action(RegisteredAction( name="PlaySoundClip", method=ac.PlaySoundClip, description=_("Play a sound resource"), parameters={'clip': _("Clip id"), 'volume': _("Volume (0..100)"), 'balance': _("Left-right balance: -1 -> full left, 0 -> center, 1 -> full right") }, defaults={'clip': 'string:Please select a sound by clicking on the arrow. The soundclips are located in the soundclips/ resource folder.', 'volume': 'string:100', 'balance': 'string:0' }, predefined=ac.PlaySoundClip_predefined, category='sound', ) ) controller.register_action(RegisteredAction( name="PlaySound", method=ac.PlaySound, description=_("Play a sound file"), parameters={'filename': _("Sound filename"), 'volume': _("Volume (0..100)"), 'balance': _("Left-right balance: -1 -> full left, 0 -> center, 1 -> full right") }, defaults={'filename': 'string:test.wav', 'volume': 'string:100', 'balance': 'string:0' }, category='sound', ) ) controller.register_action(RegisteredAction( name="SetState", method=ac.SetState, description=_("Set a state variable"), parameters={'name': _("State variable name"), 'value': _("State value") }, defaults={'name': 'string:foo', 'value': 'string:0' }, category='state', ) ) controller.register_action(RegisteredAction( name="IncrState", method=ac.IncrState, description=_("Increment a state variable"), parameters={'name': _("State variable name")}, defaults={'name': 'string:foo'}, category='state', ) ) controller.register_action(RegisteredAction( name="ClearState", method=ac.ClearState, description=_("Clear all state variables"), category='state', ) )