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 = command_parser.ex_parse(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 )
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.line_height) interaction_manager.render_page( [], [], self._graphics, self.get_curr_instance(), self)
def escape(self, event): self.curr_state = 'Default' self.command_buffer = '' interaction_manager.render_page( [], [], self._graphics, self.instances[self.curr_instance], self)