def on_remove(self, widget, data=None):
        """ Removes an entry of semantic data of a state.

        :param widget:
        :return:
        """
        treeiter, path = self.get_selected_object()
        if not treeiter:
            return

        # check if an element is selected
        dict_path_as_list = self.tree_store[path][self.ID_STORAGE_ID]
        logger.debug("Deleting semantic data entry with name {}!".format(dict_path_as_list[-1]))
        self.model.state.remove_semantic_data(dict_path_as_list)
        self.reload_tree_store_data()

        # hold cursor position where the last element was removed
        try:
            self.select_entry(self.tree_store[path][self.ID_STORAGE_ID])
        except IndexError:
            if len(self.tree_store):
                if len(path) > 1:
                    possible_before_path = tuple(list(path[:-1]) + [path[-1] - 1])
                    if possible_before_path[-1] > -1:
                        self.select_entry(self.tree_store[possible_before_path][self.ID_STORAGE_ID])
                    else:
                        self.select_entry(self.tree_store[path[:-1]][self.ID_STORAGE_ID])
                else:
                    self.select_entry(self.tree_store[path[0] - 1][self.ID_STORAGE_ID])
        return True
def on_remove ( self , widget , data = None ) : treeiter , path = self . get_selected_object ( ) if not treeiter : return dict_path_as_list = self . tree_store [ path ] [ self . ID_STORAGE_ID ] logger . debug ( "Deleting semantic data entry with name {}!" . format ( dict_path_as_list [ - 1 ] ) ) self . model . state . remove_semantic_data ( dict_path_as_list ) self . reload_tree_store_data ( ) try : self . select_entry ( self . tree_store [ path ] [ self . ID_STORAGE_ID ] ) except IndexError : if len ( self . tree_store ) : if len ( path ) > 1 : possible_before_path = tuple ( list ( path [ : - 1 ] ) + [ path [ - 1 ] - 1 ] ) if possible_before_path [ - 1 ] > - 1 : self . select_entry ( self . tree_store [ possible_before_path ] [ self . ID_STORAGE_ID ] ) else : self . select_entry ( self . tree_store [ path [ : - 1 ] ] [ self . ID_STORAGE_ID ] ) else : self . select_entry ( self . tree_store [ path [ 0 ] - 1 ] [ self . ID_STORAGE_ID ] ) return True
Removes an entry of semantic data of a state.

        :param widget:
        :return: