コード例 #1
0
    def show_correction_box(self, editor_name, utterance, 
        can_reinterpret, should_adapt = 1):
        """display a correction box for correction of a complete, recent
        utterance, accept user corrections, allow the user to
        approve or cancel, and adapt the speech engine.

        **INPUTS**

        *STR editor_name* -- name of the editor instance

        *SpokenUtterance utterance* -- the utterance itself

        *BOOL can_reinterpret* -- flag indicating whether the utterance
        could be reinterpreted upon correction, allowing the correction
        box to give some visual feedback to the user to indictate this.
        Whether the utterance can actually be reinterpreted may change
        between the call to this method and its return, so there is no
        guarantee that reinterpretation will take place.

        *BOOL should_adapt* -- flag indicating whether correct_utterance
        should adapt the speech engine according to user corrections (if
        the user approves), or if the caller will handle that later.

        **OUTPUTS**

        *BOOL* -- true if the user made changes and approved them
        """
        debug.virtual('MediatorConsole.show_correction_box')
コード例 #2
0
    def store_current_state(self):
        """stores the current state of the buffer, including both the
        contents and the current selection, for subsequent restoration.
        Store_current_state returns a "cookie" which can be passed to
        restore_state or compare_with_current.  The type and attributes
        of the cookie will depend on the specific subclass of
        SB_ServiceState.  In the most straightforward implementation, it 
        may include a copy of the entire contents of the
        buffer and the selection.  In other cases, particularly when the
        editor or SB_ServiceState provides an internal undo stack, it may simply be a
        reference to a point in this stack.
        
        Important Notes:
        
        You should only pass the cookie to methods of
        the SAME SourceBuff object from which it came.  Generally,
        cookies can not be pickled and retrieved.

        The type of cookie will vary with the concrete subclass 
        of SB_ServiceState.  The corresponding class object is 
        returned by _state_cookie_class.  However, external callers
        should not depend on the type, attributes, or methods 
        of the cookie.

        **INPUTS**

        *none*

        **OUTPUTS**

        *SourceBuffCookie* -- state cookie (see above).  Note that
        SourceBuffCookie is a dummy class.  The
        actual return type will vary with SB_ServiceState subclass.
        """
        debug.virtual('SB_ServiceState.store_current_state')
コード例 #3
0
ファイル: Context.py プロジェクト: jboner/emacs-config
    def equivalence_key(self):
        """returns a key used to separate Context instances into
        equivalence classes.  Two contexts which are equivalent (i.e.
        share the same set of circumstances under which they apply)
        should have identical keys.  Two contexts which are not
        equivalent should have distinct keys.

        For example, two instances of ContPy should both return the same
        key, but an instance of ContPy and an instance of ContC should
        not.

        Generally, the equivalence key should be constructed from the
        name of the Context subclass (omitting any Context or Cont
        prefix), followed by ": " and any data required to distinguish 
        inequivalent contexts.  Contexts with multiple pieces of data
        should sort that data by keyname.  If there is no data, the ": " 
        should be omitted.  Subclasses which differ from their parent class 
        only in that they supply or enforce a value for an argument of the
        parent constructor should return the same equivalence key as
        their parent class would if given that value explicitly.  (So
        ContLanguage(language = 'python') and ContPy() should both
        return 'Language: python' (and not 'Py').

        **INPUTS**

        *none*

        **OUTPUTS**

        *STR* -- the key
        """
        # should never instantiate Context itself, and always overload this method
        virtual("Context.equivalence_key")
コード例 #4
0
    def compare_state_selections(self, first_cookie, second_cookie):
        """compares the selection and cursor positions at the times when
        two cookies were returned by store_current_state.
        If the state corresponding to either cookie has
        been lost, compare_states will return false.

        This method does not synchronize with the editor prior to
        comparing with "current".  To ensure that the "current" state 
        is really current, the caller must synchronize.
        (This avoids having duplicate synchronize calls 
        when comparing with the current state of more than one buffer).

        **INPUTS**

        *SourceBuffCookie* first_cookie, second_cookie -- see 
        store_current_state.  Note that SourceBuffCookie is a dummy 
        type, not an actual class.  The actual type will vary with 
        SourceBuff subclass.

        **OUTPUTS**

        *BOOL* -- true if position and selection are the same, false if 
        they are not, or it cannot be determined due to expiration of 
        either cookie
        """
        debug.virtual('SB_ServiceState.compare_state_selections')
コード例 #5
0
    def new_window(self, window, title, editors, instance_name = None):
        """factory which creates a new TargetWindow object.
        **Note:** the caller should first check single_display.  If it
        returns true, then the module cannot act as a window factory.
        Instead, the subwindow identification client will play that role.
        **Also note:** some subclasses will be unable to create a new
        window without an initial instance.

        **INPUTS**

        *INT* window -- the window handle (unique identifier) of the
        window

        *STR* title -- the current title of the window

        *AppMgr* editors -- the application manager
         
        *STR* instance -- the name of the initial instance belonging to
        the window, or None if there is none initially

        **OUTPUTS**

        *TargetWindow* -- a new TargetWindow object, or None
        if the module is unable to create one
        """
        debug.virtual('KnownTargetModule.new_window')
コード例 #6
0
 def make_view(self):
    """Factory method for creating a view layer for this dialog.
    
    **OUTPUTS**
    
    *ViewLayer* -- a new view layer for this dialog.
    """
    debug.virtual('DlgModelView.make_view', self)
コード例 #7
0
ファイル: GenEditWX.py プロジェクト: goneflyin/emacs-config
    def add_pane(self, ID):
        """create the actual WaxPanel for the frame

        **INPUTS**

        *wxWindowId ID* -- the ID of the panel
        """
        debug.virtual('WaxPane.add_pane')
コード例 #8
0
    def notify(self):
        """send the message, and return synchronously

        **INPUTS**

        *none*

        **OUTPUTS**

        *none*
        """
        debug.virtual('SocketHasDataEvent.notify')
コード例 #9
0
    def notify(self):
        """send the message, and return synchronously

        **INPUTS**

        *none*

        **OUTPUTS**

        *none*
        """
        debug.virtual('InterThreadEvent.notify')
コード例 #10
0
ファイル: TargetWindow.py プロジェクト: vine77/nrc-voicecode
    def add_instance(self, instance):
        """add a new instance to the window

        **INPUTS**

        *STR* instance -- name of the editor instance

        **OUTPUTS**

        *BOOL* -- true if the instance was added successfully
        """
        debug.virtual('TargetWindow.add_instance')
コード例 #11
0
    def _language_name_from_app(self):
        """Returns the name of the language a file is written in
        
        **INPUTS**        

        *none*

        **OUTPUTS**

        *STR* -- the name of the language
        """
        debug.virtual('SourceBuffCached._language_name_from_app')
コード例 #12
0
ファイル: GenEditWX.py プロジェクト: goneflyin/emacs-config
    def editor_window(self):
        """returns a reference to the editor window

        **INPUTS**

        *none*

        **OUTPUTS**

        *wxTextCtrl* -- the editor window
        """
        debug.virtual('SingleBufferWindow.editor_window')
コード例 #13
0
    def language_name(self):
        """Returns the name of the language a file is written in
        
        **INPUTS**        

        *none*

        **OUTPUTS**

        *STR* -- the name of the language
        """
        debug.virtual('SB_ServiceLang.language_name')
コード例 #14
0
    def initial_version(self):
        """the initial version from which DictConverter converts
        
        **INPUTS**

        *none*

        **OUTPUTS**

        *INT* -- the initial version from which DictConverter converts
        """
        debug.virtual('DictConverter.initial_version')
コード例 #15
0
ファイル: GenEditWX.py プロジェクト: goneflyin/emacs-config
    def current_font(self):
        """find the current font for the text buffers in this window

        **INPUTS**

        *none*

        **OUTPUTS**

        *wxFont* -- the current font
        """
        debug.virtual('WaxFrameBase.current_font')
コード例 #16
0
    def final_version(self):
        """the final version to which DictConverter converts
        
        **INPUTS**

        *none*

        **OUTPUTS**

        *INT* -- the final version to which DictConverter converts
        """
        debug.virtual('DictConverter.final_version')
コード例 #17
0
ファイル: GenEditWX.py プロジェクト: goneflyin/emacs-config
    def editor_buffer(self):
        """returns a reference to the TextBufferWX embedded in the GUI

        **INPUTS**

        *none*

        **OUTPUT**

        *TextBufferWX* -- the TextBufferWX
        """
        debug.virtual('SingleBufferWindow.editor_buffer')
コード例 #18
0
ファイル: GenEditWX.py プロジェクト: goneflyin/emacs-config
    def set_font(self, font):
        """sets the current font for the text buffers in this window

        **INPUTS**

        *wxFont font* -- the desired font

        **OUTPUTS**

        *none*
        """
        debug.virtual('WaxFrameBase.set_font')
コード例 #19
0
    def message_box(self, message):
        """displays an error or warning message in a message box

        **INPUTS**

        *STR message* -- the message

        **OUTPUTS**

        *none*
        """
        debug.virtual('MediatorConsole.message_box')
コード例 #20
0
    def dismiss(self):
        """send the message, and return synchronously

        **INPUTS**

        *none*

        **OUTPUTS**

        *none*
        """
        debug.virtual('DismissModalEvent.dismiss')
コード例 #21
0
    def spoken_forms(self):
        """returns list of spoken forms from the utterance

        **INPUTS**

        *none*

        **OUTPUTS**

        *[STR]* -- list of spoken forms from the utterance
        """
        debug.virtual('SpokenUtterance.spoken_forms')
コード例 #22
0
    def dict_class(self):
        """indicates the class corresponding to the dictionaries
        we are converting

        **INPUTS**

        *none*

        **OUTPUTS**

        *CLASS* -- the class corresponding to the dictionaries
        """
        debug.virtual('DictConverter.dict_class')
コード例 #23
0
    def known_versions(self):
        """returns a list of known initial versions from which the
        converter will convert

        **INPUTS**

        *none*

        **OUTPUTS**

        *[INT]* -- the initial versions which this DictConverter knows
        """
        debug.virtual('DictConverter.known_versions')
コード例 #24
0
    def rename_buffer_cbk(self, new_buff_name):
        """callback which notifies us that the application
        has renamed the buffer corresponding to this cookie

        **INPUTS**

        *STR* new_buff_name -- new name of the buffer 

        **OUTPUTS**

        *none*
        """
        debug.virtual('SourceBuffCookie.rename_buffer_cbk')
コード例 #25
0
ファイル: wxMediator.py プロジェクト: vine77/nrc-voicecode
    def main_frame(self):
        """returns a reference to the main frame of the wxMediator
        application

        **INPUTS**

        *none*

        **OUTPUTS**

        *wx.Frame* -- the main wx.Frame
        """
        debug.virtual('wxMediator.main_frame')
コード例 #26
0
    def buffer_closed(self, buffer):
        """clean up and destroy all grammars for a buffer which 
        has been closed.

        **INPUTS**

        *STR* buffer -- name of buffer

        **OUTPUTS**

        *none*
        """
        debug.virtual('GramMgr.buffer_closed')
コード例 #27
0
    def rename_buffer_cbk(self, new_buff_name):
        """callback which notifies us that the application
        has renamed the buffer corresponding to this cookie

        **INPUTS**

        *STR* new_buff_name -- new name of the buffer 

        **OUTPUTS**

        *none*
        """
        debug.virtual('SourceBuffCookie.rename_buffer_cbk')
コード例 #28
0
ファイル: CmdPrompt.py プロジェクト: allforabit/emacs-config
    def in_progress(self):
        """contents of command line currently being edited (not the one
        stored by save_edited)
        A concrete subclass of CmdPromptWithHistory must define this method.
        **INPUT**

        *none*

        **OUTPUTS**

        *STR* -- partial command currently being edited
        """
        debug.virtual('CmdPromptWithHistory.save_edited')
コード例 #29
0
    def main_frame(self):
        """returns a reference to the main frame of the wxMediator
        application

        **INPUTS**

        *none*

        **OUTPUTS**

        *wx.Frame* -- the main wx.Frame
        """
        debug.virtual('wxMediator.main_frame')
コード例 #30
0
    def raise_active_window(self):
        """makes the active window (within the current process) the
        foreground one (for the system)

        **INPUTS**

        *none*

        **OUTPUTS**

        *none*
        """
        debug.virtual('MediatorConsole.raise_active_window')
コード例 #31
0
    def create_main(self):
        """create the main frame window for the mediator, but do not
        show it
        
        **INPUTS**
        
        *none*
        
        **OUTPUTS**

        *none*
        """
        debug.virtual('wxMediator.create_main')
コード例 #32
0
    def dismiss_event(self):
        """returns a DismissModalEvent which can be used to dismiss the
        dialog

        **INPUTS**

        *none*

        **OUTPUTS**

        *DismissModalEvent* -- the event
        """
        debug.virtual('DlgModelView.dismiss_event', self)
コード例 #33
0
ファイル: wxMediator.py プロジェクト: vine77/nrc-voicecode
    def create_main(self):
        """create the main frame window for the mediator, but do not
        show it
        
        **INPUTS**
        
        *none*
        
        **OUTPUTS**

        *none*
        """
        debug.virtual('wxMediator.create_main')
コード例 #34
0
    def raise_main_frame(self):
        """bring the main frame of the application (and any modal dialog
        boxes on top of it to the foreground

        **INPUTS**

        *none*

        **OUTPUTS**

        *none*
        """
        debug.virtual('WinSystem.raise_main_frame')
コード例 #35
0
    def dismiss_event(self):
        """returns a DismissModalEvent which can be used to dismiss the
        dialog

        **INPUTS**

        *none*

        **OUTPUTS**

        *DismissModalEvent* -- the event
        """
        debug.virtual('DlgModelView.dismiss_event', self)
コード例 #36
0
ファイル: WinSystem.py プロジェクト: vine77/nrc-voicecode
    def raise_main_frame(self):
        """bring the main frame of the application (and any modal dialog
        boxes on top of it to the foreground

        **INPUTS**

        *none*

        **OUTPUTS**

        *none*
        """
        debug.virtual('WinSystem.raise_main_frame')
コード例 #37
0
 def suppress_abbreviation(self):
     """manually suppress abbreviation of the next word of the
     symbol
     
     **INPUTS**
     
     *none*
     
     **OUTPUTS**
     
     *none*
     """ 
     debug.virtual('SymBuilder.suppress_abbreviation')
コード例 #38
0
    def raise_active_window(self):
        """makes the active window (within the current process) the
        foreground one (for the system)

        **INPUTS**

        *none*

        **OUTPUTS**

        *none*
        """
        debug.virtual('MediatorConsole.raise_active_window')
コード例 #39
0
 def suppress_separator(self):
     """manually suppress separator before the next word of the
     symbol
     
     **INPUTS**
     
     *none*
     
     **OUTPUTS**
     
     *none*
     """ 
     debug.virtual('SymBuilder.suppress_separator')
コード例 #40
0
    def finish(self):
        """finish building the symbol (allows for SymBuilder subclasses
        with fixed suffixes

        **INPUTS**

        *none*

        **OUTPUTS**

        *STR* -- the final symbol
        """
        debug.virtual('SymBuilder.finish')
コード例 #41
0
    def words(self):
        """returns list of words (as (spoken, written) 2-tuples) 
        from the utterance.

        **INPUTS**

        *none*

        **OUTPUTS**

        *[(STR, STR)]* -- list of words (as (spoken, written) 2-tuples) 
        
        """
        debug.virtual('SpokenUtterance.words')
コード例 #42
0
    def cur_pos(self):
        """returns current position (either the start or end of
        the current selection, and usually the end)

        **INPUTS**

        *none*

        **OUTPUTS**

        *INT* -- the offset into the buffer of the current cursor
        position.
        """
        debug.virtual('TextBuffer.cur_pos')
コード例 #43
0
    def get_visible(self):
        """ get start and end offsets of the currently visible region of
        the buffer.  End is the offset of the first character not
        visible (matching Python's slice convention)

        **INPUTS**

        *none*

        **OUTPUTS**

        *INT* (start, end)
        """
        debug.virtual('VisibleBuffer.get_visible')
コード例 #44
0
    def modified(self):
        """has the buffer been modified since the last time it was
        saved?

        **INPUTS**

        *none*

        **OUTPUTS**

        *BOOL* -- true if the buffer has been modified since the last
        save (or load)
        """
        debug.virtual('StoreableTextBuffer.modified')
コード例 #45
0
    def line_nums_of_range(self, range = None):
        """find line numbers of a range of positions

        **INPUTS**

        *(INT, INT) range* -- range of character offsets into the buffer. 
         Defaults to the current selection.

        **OUTPUTS**

        *(INT, INT)* -- corresponding pair of line numbers (starting with 0)
        """

        debug.virtual('NumberedLines.line_nums_of_range')
コード例 #46
0
    def range_of_lines(self, first_line, last_line):
        """returns the character range corresponding to the specified range
        of lines (not including the final newline)

        **INPUTS**

        *INT first_line, second_line* -- line numbers (starting with 0)

        **OUTPUTS**

        *(INT, INT)* -- offsets into the buffer of the start and end of
        the range of lines.
        """
        debug.virtual('NumberedLines.range_of_lines')
コード例 #47
0
    def editor(self):
        """if dedicated, returns VoiceCode's name for the corresponding
        editor

        **INPUTS**

        *none*

        **OUTPUTS**

        *STR* -- VoiceCode's internal name for the editor corresponding
        to this module (or None if not dedicated)
        """
        debug.virtual('KnownTargetModule.editor')
コード例 #48
0
    def create_editor(self):
        """create the underlying editor
        
        **INPUTS**
        
        *none*
        
        **OUTPUTS**

        *GenEditFrames, WaxClientBase* -- the underlying WaxEdit 
        editor, which must be an instance of a concrete subclass 
        of WaxClientBase
        """
        debug.virtual('WaxClientApp.create_editor')
コード例 #49
0
    def line_length(self, line = None):
        """returns the length of the specified line

        **INPUTS**

        *INT line* -- line number (starting with 0).  Defaults to current line.
        If line is out of range, returns None.

        **OUTPUTS**

        *INT* -- length of start of that line.
        """

        debug.virtual('NumberedLines.line_length')
コード例 #50
0
ファイル: Context.py プロジェクト: allforabit/emacs-config
    def _applies(self, app, preceding_symbol = 0):        
        """Returns *true* iif the context applies given current state
        of an application.

        [AppState] *app* is the application in question.

        BOOL *preceding_symbol* indicates if a symbol would be inserted
        at the current cursor position before the action corresponding
        to this context was executed.  
        
        .. [AppState] file:///./AppState.AppState.html
        """
        # should never instantiate Context directly, always overload this method        
        virtual('Context._applies')
コード例 #51
0
    def _get_visible_from_app(self):
        
        """Gets start and end positions of visible region directly
        from external editor.

        **INPUTS**

        *none*

        **OUTPUTS**

        *INT* (start, end)
        """
        debug.virtual('SourceBuff._get_visible_from_app')        
コード例 #52
0
    def unpack_mess(self, mess):
        """Unpacks a message to a raw string..
        
        **INPUTS**
        
        *STR* mess -- The packed message
        

        **OUTPUTS**
        
        *STR un_packed_mess* -- The message unpacked to a raw string.
        """

        debug.virtual('unpack_mess')
コード例 #53
0
ファイル: messaging.py プロジェクト: vine77/nrc-voicecode
    def send_string(self, a_string):
        """Sends a string on the connection.
        
        **INPUTS**
        
        *STR* a_string -- String to send
        

        **OUTPUTS**
        
        *none* -- 
        """
        
        debug.virtual('send_string')
コード例 #54
0
ファイル: messaging.py プロジェクト: vine77/nrc-voicecode
    def receive_string(self, num_bytes):
        """Receives a string on the connection.
        
        **INPUTS**
        
        INT *num_bytes* -- Number of bytes to receive.
        

        **OUTPUTS**
        
        STR *a_string* -- The received string
        """
        
        debug.virtual('receive_string')        
コード例 #55
0
ファイル: messaging.py プロジェクト: vine77/nrc-voicecode
    def decode(self, str_mess):
        """Decodes a message to {arg:val} format.
      
        **INPUTS**
        
        *STR* str_mess -- The message in raw string format
        
        **OUTPUTS**
        
        *(STR, {STR: STR}) name_argvals_mess* -- First element is the
        message name, second element is message arguments in
        *(name, {arg:val})* format.  """

        debug.virtual('MessEncoder.decode')
コード例 #56
0
    def correction_available(self):
        """indicates whether correction features are available, so that
        tests which depend on these features can be run conditionally

        **INPUTS**

        *none*

        **OUTPUTS**
        
        *STR* -- 'basic' or 'advanced', or None if no correction is
        available
        """
        debug.virtual('PersistentConfig.correction_available')
コード例 #57
0
    def _state_cookie_class(self):
        """returns the class object for the type of cookie used by
        store_current_state.

        **INPUTS**

        *none*

        **OUTPUTS**

        *CLASS* -- class of state cookies corresponding to this
        SB_ServiceState

        """
        debug.virtual('SB_ServiceState._state_cookie_class')
コード例 #58
0
ファイル: messaging.py プロジェクト: vine77/nrc-voicecode
    def get_packed_mess(self, transporter):
        """Receive a packaged message over a transport channel.
        
        **INPUTS**
                
        [MessTransporter] *transporter* -- Transport channel to be used
        

        **OUTPUTS**

        STR *pkd_mess* -- The packed message

        .. [MessTransporter] file:///./messaging.MessTransporter.html"""
        
        debug.virtual('get_pkd_mess')        
コード例 #59
0
    def instance_name(self):
        """returns the instance name of the editor instance being used
        for regression testing, if we are using NewMediatorObject,
        otherwise None
            
        **INPUTS**

        *none*

        **OUTPUTS**

        *STR* -- the name of the editor instance, or None if we are
        using the old MediatorObject
        """
        debug.virtual('PersistentConfig.instance_name')
コード例 #60
0
    def empty(self):
        """is the symbol currently empty (i.e. invisible elements like
        change_capitalization, suppress_separator, or
        suppress_abbreviation have been processed so far, and there is
        no fixed prefix or suffix for the symbol)
        
        **INPUTS**

        *none*

        **OUTPUTS**

        *BOOL* -- true if the symbol is empty
        """
        debug.virtual('SymBuilder.empty')