예제 #1
0
파일: user_input.py 프로젝트: aruns807/shim
    def user_key_ex(self, key):
        """
        Handle keys in ex mode
        TODO: expand this section to handle multi command
        arguments
        i.e finds should work in visual mode
        Dependent upon a proper command parser however

        This mode is kind of limited for now since we don't
        have a proper command parser yet
        """
        if key == 'Return':
            cmd = self._ex_parser.parse_string(self._command_buffer)
            interaction_manager.input_command(
                cmd, self._graphics,
                self.get_curr_instance(), self
            )
            self._curr_state = 'Default'
            self._command_buffer = ''
        else:
            self._command_buffer = (
                self._command_buffer + key,
                self._command_buffer[:-1]
            )[key == 'BackSpace']

            interaction_manager.render_page(
                self._graphics,
                self.get_curr_instance(), self
            )
예제 #2
0
 def set_GUI_reference(self, canvas):
     """
     Set graphics reference for particular instance and render page
     This should really only be done once per instace
     """
     self._graphics = canvas
     self._instances[self._curr_instance].set_line_height(
         self._graphics.get_line_height())
     interaction_manager.render_page(self._graphics,
                                     self.get_curr_instance(), self)
예제 #3
0
파일: user_input.py 프로젝트: aruns807/shim
 def set_GUI_reference(self, canvas):
     """
     Set graphics reference for particular instance and render page
     This should really only be done once per instace
     """
     self._graphics = canvas
     self._instances[self._curr_instance].set_line_height(
         self._graphics.get_line_height())
     interaction_manager.render_page(
         self._graphics,
         self.get_curr_instance(), self)
예제 #4
0
    def user_key_ex(self, key):
        """
        Handle keys in ex mode
        TODO: expand this section to handle multi command
        arguments
        i.e finds should work in visual mode
        Dependent upon a proper command parser however

        This mode is kind of limited for now since we don't
        have a proper command parser yet
        """
        if key == 'Return':
            cmd = self._ex_parser.parse_string(self._command_buffer)
            interaction_manager.input_command(cmd, self._graphics,
                                              self.get_curr_instance(), self)
            self._curr_state = 'Default'
            self._command_buffer = ''
        else:
            self._command_buffer = (
                self._command_buffer + key,
                self._command_buffer[:-1])[key == 'BackSpace']

            interaction_manager.render_page(self._graphics,
                                            self.get_curr_instance(), self)
예제 #5
0
파일: user_input.py 프로젝트: aruns807/shim
 def escape(self, event):
     self._curr_state = 'Default'
     self._command_buffer = ''
     interaction_manager.render_page(
         self._graphics, self._instances[self._curr_instance], self)
예제 #6
0
 def escape(self, event):
     self._curr_state = 'Default'
     self._command_buffer = ''
     interaction_manager.render_page(self._graphics,
                                     self._instances[self._curr_instance],
                                     self)