def script_text_changed(self, text_buffer, state_m):
        """ Update gui elements according text buffer changes

        Checks if the dirty flag needs to be set and the tab label to be updated.

        :param TextBuffer text_buffer: Text buffer of the edited script
        :param rafcon.gui.models.state.StateModel state_m: The state model related to the text buffer
        :return:
        """

        state_identifier = self.get_state_identifier(state_m)
        if state_identifier in self.tabs:
            tab_list = self.tabs
        elif state_identifier in self.closed_tabs:
            tab_list = self.closed_tabs
        else:
            logger.warning('It was tried to check a source script of a state with no state-editor')
            return
        if tab_list[state_identifier]['controller'].get_controller('source_ctrl') is None:
            logger.warning('It was tried to check a source script of a state with no source-editor')
            return
        current_text = tab_list[state_identifier]['controller'].get_controller('source_ctrl').view.get_text()
        old_is_dirty = tab_list[state_identifier]['source_code_view_is_dirty']
        source_script_state_m = state_m.state_copy if isinstance(state_m, LibraryStateModel) else state_m
        # remove next two lines and tab is also set dirty for source scripts inside of a LibraryState (maybe in future)
        if isinstance(state_m, LibraryStateModel) or state_m.state.get_next_upper_library_root_state() is not None:
            return
        if source_script_state_m.state.script_text == current_text:
            tab_list[state_identifier]['source_code_view_is_dirty'] = False
        else:
            tab_list[state_identifier]['source_code_view_is_dirty'] = True
        if old_is_dirty is not tab_list[state_identifier]['source_code_view_is_dirty']:
            self.update_tab_label(source_script_state_m)
def script_text_changed ( self , text_buffer , state_m ) : state_identifier = self . get_state_identifier ( state_m ) if state_identifier in self . tabs : tab_list = self . tabs elif state_identifier in self . closed_tabs : tab_list = self . closed_tabs else : logger . warning ( 'It was tried to check a source script of a state with no state-editor' ) return if tab_list [ state_identifier ] [ 'controller' ] . get_controller ( 'source_ctrl' ) is None : logger . warning ( 'It was tried to check a source script of a state with no source-editor' ) return current_text = tab_list [ state_identifier ] [ 'controller' ] . get_controller ( 'source_ctrl' ) . view . get_text ( ) old_is_dirty = tab_list [ state_identifier ] [ 'source_code_view_is_dirty' ] source_script_state_m = state_m . state_copy if isinstance ( state_m , LibraryStateModel ) else state_m if isinstance ( state_m , LibraryStateModel ) or state_m . state . get_next_upper_library_root_state ( ) is not None : return if source_script_state_m . state . script_text == current_text : tab_list [ state_identifier ] [ 'source_code_view_is_dirty' ] = False else : tab_list [ state_identifier ] [ 'source_code_view_is_dirty' ] = True if old_is_dirty is not tab_list [ state_identifier ] [ 'source_code_view_is_dirty' ] : self . update_tab_label ( source_script_state_m )
Update gui elements according text buffer changes

        Checks if the dirty flag needs to be set and the tab label to be updated.

        :param TextBuffer text_buffer: Text buffer of the edited script
        :param rafcon.gui.models.state.StateModel state_m: The state model related to the text buffer
        :return: