def insertRow(self, row, parent_index, node, reinserting = False): ''' Override the default insertRow to catch updates to models. ''' # Catch the events where we alter the list of available models and # notify interested objects XmlModel.insertRow(self, row, parent_index, node, reinserting) if node.tag == 'model': update_models_to_run_lists()
def insertRow(self, row, parent_index, node, reinserting=False): ''' Override the default insertRow to catch updates to models. ''' # Catch the events where we alter the list of available models and # notify interested objects XmlModel.insertRow(self, row, parent_index, node, reinserting) if node.tag == 'model': update_models_to_run_lists()
def removeRow(self, row, parent_index): ''' Override the default removeRow to catch updates to models. ''' # Catch the events where we alter the list of available models and # notify interested objects node = self.index(row, 0, parent_index).internalPointer().node notify = False if node is not None and node.tag == 'model': notify = True XmlModel.removeRow(self, row, parent_index) if notify: update_models_to_run_lists()
def removeRow(self, row, parent_index): ''' Override the default removeRow to catch updates to models. ''' # Catch the events where we alter the list of available models and # notify interested objects node = self.index(row, 0, parent_index).internalPointer().node notify = False if node is not None and node.tag == 'model': notify = True XmlModel.removeRow(self, row, parent_index) if notify: update_models_to_run_lists()
def addModel(self, models_to_run_list_index, model_name): ''' Add a model to a models_to_run list. @param scenario_index (QModelIndex): index of the list to insert under @param models_name (String): name of model to add ''' unique_name = get_unique_name(model_name, get_model_names(self.project)) attribs = {'type': 'selectable', 'return_value': model_name, 'name': unique_name} model_node = Element('selectable', attribs) model_node.text = 'True' last_row_num = self.model.rowCount(models_to_run_list_index) self.model.insertRow(last_row_num, models_to_run_list_index, model_node) # Validate models to run update_models_to_run_lists()
def addModel(self, models_to_run_list_index, model_name): ''' Add a model to a models_to_run list. @param scenario_index (QModelIndex): index of the list to insert under @param models_name (String): name of model to add ''' unique_name = get_unique_name(model_name, get_model_names(self.project)) attribs = { 'type': 'selectable', 'return_value': model_name, 'name': unique_name } model_node = Element('selectable', attribs) model_node.text = 'True' last_row_num = self.model.rowCount(models_to_run_list_index) self.model.insertRow(last_row_num, models_to_run_list_index, model_node) # Validate models to run update_models_to_run_lists()
def create_model_from_template_callback(self, new_model_node): # do the actual inserting of the opus model into the project self.model.insertRow(0, self.selected_index(), new_model_node) update_models_to_run_lists()
def create_model_from_template_callback(self, new_model_node): # do the actual inserting of the opus model into the project self.model.insertRow(0, self.selected_index(), new_model_node) update_models_to_run_lists()