def on_start_up(self, component1, component2): self.input_combo.SetItems(self.get_exchange_item_from_engine(self.input_component, "INPUT")) self.output_combo.SetItems(self.get_exchange_item_from_engine(self.output_component, "OUTPUT")) links = [] x = engine.getLinksBtwnModels(component1['id'], component2['id']) y = engine.getLinksBtwnModels(component2['id'], component1['id']) if x: for l in x: links.append(l) if y: for l in y: links.append(l) if links: for l in links: link = LinkInfo(l['source_item'], l['target_item'], l['source_id'], l['target_id'], l['id'], l['spatial_interpolation'], l['temporal_interpolation']) self.__links[l['id']] = link # select the first value self.refresh_link_name_box() self.link_name_list_box.SetSelection(0) self.__selected_link = self.__links.keys()[0] self.on_change(None) else: # if no links are found, need to deactivate controls self.activate_controls(False)
def does_link_exist_between_models(self, R1, R2): # Return true if a link exist between the models, else return false link = engine.getLinksBtwnModels(R1.ID, R2.ID) if len(link) == 0: return False return True
def remove_link(self, link_obj): dlg = wx.MessageDialog( None, 'You are about to remove all data mappings that are associated with this link. Are you sure you want to perform this action?', 'Question', wx.YES_NO | wx.YES_DEFAULT | wx.ICON_WARNING) if dlg.ShowModal() != wx.ID_NO: # remove the link entry in self.links link = self.links.pop(link_obj) # remove the link from the cmd from_id = link[0].ID to_id = link[1].ID # get the link id links = engine.getLinksBtwnModels(from_id, to_id) # remove all links for link in links: success = engine.removeLinkById(link['id']) if not success: elog.error('ERROR|Could not remove link: %s' % link['id']) sPrint('ERROR|Could not remove link: %s' % link['id'], MessageType.ERROR) links = engine.getLinksBtwnModels(to_id, from_id) # Doing this a second time to remove bidirectional links for link in links: success = engine.removeLinkById(link['id']) if not success: elog.error('ERROR|Could not remove link: %s' % link['id']) sPrint('ERROR|Could not remove link: %s' % link['id'], MessageType.ERROR) self.remove_link_image(link_object=link_obj) self.remove_link_object_by_id(from_id, to_id)
def remove_link(self, link_obj): dlg = wx.MessageDialog(None, 'You are about to remove all data mappings that are associated with this link. Are you sure you want to perform this action?', 'Question', wx.YES_NO | wx.YES_DEFAULT | wx.ICON_WARNING) if dlg.ShowModal() != wx.ID_NO: # remove the link entry in self.links link = self.links.pop(link_obj) # remove the link from the cmd from_id = link[0].ID to_id = link[1].ID # get the link id links = engine.getLinksBtwnModels(from_id, to_id) # remove all links for link in links: success = engine.removeLinkById(link['id']) if not success: elog.error('ERROR|Could not remove link: %s' % link['id']) sPrint('ERROR|Could not remove link: %s' % link['id'], MessageType.ERROR) links = engine.getLinksBtwnModels(to_id, from_id) # Doing this a second time to remove bidirectional links for link in links: success = engine.removeLinkById(link['id']) if not success: elog.error('ERROR|Could not remove link: %s' % link['id']) sPrint('ERROR|Could not remove link: %s' % link['id'], MessageType.ERROR) self.remove_link_image(link_object=link_obj) self.remove_link_object_by_id(from_id, to_id)
def on_start_up(self, component1, component2): self.input_combo.SetItems(self.get_exchange_item_from_engine(self.input_component, "INPUT")) self.output_combo.SetItems(self.get_exchange_item_from_engine(self.output_component, "OUTPUT")) links = [] x = engine.getLinksBtwnModels(component1["id"], component2["id"]) y = engine.getLinksBtwnModels(component2["id"], component1["id"]) if x: for l in x: links.append(l) if y: for l in y: links.append(l) if links: for l in links: link = LinkInfo( l["source_item"], l["target_item"], l["source_id"], l["target_id"], l["id"], l["spatial_interpolation"], l["temporal_interpolation"], ) self.__links[l["id"]] = link # select the first value self.refresh_link_name_box() self.link_name_list_box.SetSelection(0) self.__selected_link = self.__links.keys()[0] self.on_change(None) else: # if no links are found, need to deactivate controls self.activate_controls(False)