Пример #1
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
            )
Пример #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
 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
 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)