class CodeNetworkPanel(BasePanel): def __init__(self,parent,personaName,codeNet): BasePanel.__init__(self,parent,armid.CODENETWORK_ID) b = Borg() self.dbProxy = b.dbProxy self.theCodeNetwork = codeNet self.theViewMenu = wx.Menu() self.theViewMenu.Append(armid.CNV_MENU_ADD_ID,'Add') self.theViewMenu.Append(armid.CNV_MENU_EDIT_ID,'Edit') wx.EVT_MENU(self,armid.CNV_MENU_ADD_ID,self.onAddRelationship) wx.EVT_MENU(self,armid.CNV_MENU_EDIT_ID,self.onEditRelationship) mainSizer = wx.BoxSizer(wx.VERTICAL) personas = self.dbProxy.getDimensionNames('persona') mainSizer.Add(self.buildComboSizerList('Persona',(87,30),armid.CODENETWORK_COMBOPERSONA_ID,personas),0,wx.EXPAND) cnBox = wx.StaticBox(self,-1,'Code Network') cnSizer = wx.StaticBoxSizer(cnBox,wx.HORIZONTAL) mainSizer.Add(cnSizer,1,wx.EXPAND) self.codeNetView = CodeNetworkView(self,armid.CODENETWORK_IMAGENETWORK_ID) self.codeNetView.Bind(wx.EVT_RIGHT_DOWN,self.onRightDown) self.codeNetView.reloadImage() cnSizer.Add(self.codeNetView,1,wx.EXPAND) self.personaCtrl = self.FindWindowById(armid.CODENETWORK_COMBOPERSONA_ID) self.personaCtrl.SetValue(personaName) self.personaCtrl.Bind(wx.EVT_COMBOBOX,self.onPersonaChange) self.SetSizer(mainSizer) def onPersonaChange(self,evt): personaName = self.personaCtrl.GetValue() self.regenerateView(personaName) def regenerateView(self,personaName): self.theCodeNetwork = CodeNetworkModel(self.dbProxy.personaCodeNetwork(personaName),personaName) self.theCodeNetwork.graph() self.codeNetView.reloadImage() def onAddRelationship(self,evt): personaName = self.personaCtrl.GetValue() dlg = CodeRelationshipDialog(self) if (dlg.ShowModal() == armid.CODERELATIONSHIP_BUTTONADD_ID): fromName = dlg.fromName() toName = dlg.toName() rshipType = dlg.relationship() b = Borg() b.dbProxy.addCodeRelationship(personaName,fromName,toName,rshipType) self.regenerateView(personaName) dlg.Destroy() def onEditRelationship(self,evt): personaName = self.personaCtrl.GetValue() dlg = CodeRelationshipEditor(self,personaName) if (dlg.ShowModal() == armid.CODERELATIONSHIP_BUTTONCOMMIT_ID): self.codeNetView.reloadImage() def onRightDown(self,evt): self.PopupMenu(self.theViewMenu)
def regenerateView(self, personaName): self.theCodeNetwork = CodeNetworkModel( self.dbProxy.personaCodeNetwork(personaName), personaName) self.theCodeNetwork.graph() self.codeNetView.reloadImage()
class CodeNetworkPanel(BasePanel): def __init__(self, parent, personaName, codeNet): BasePanel.__init__(self, parent, CODENETWORK_ID) b = Borg() self.dbProxy = b.dbProxy self.theCodeNetwork = codeNet self.theViewMenu = wx.Menu() self.theViewMenu.Append(CNV_MENU_ADD_ID, 'Add') self.theViewMenu.Append(CNV_MENU_EDIT_ID, 'Edit') wx.EVT_MENU(self, CNV_MENU_ADD_ID, self.onAddRelationship) wx.EVT_MENU(self, CNV_MENU_EDIT_ID, self.onEditRelationship) mainSizer = wx.BoxSizer(wx.VERTICAL) personas = self.dbProxy.getDimensionNames('persona') mainSizer.Add( self.buildComboSizerList('Persona', (87, 30), CODENETWORK_COMBOPERSONA_ID, personas), 0, wx.EXPAND) cnBox = wx.StaticBox(self, -1, 'Code Network') cnSizer = wx.StaticBoxSizer(cnBox, wx.HORIZONTAL) mainSizer.Add(cnSizer, 1, wx.EXPAND) self.codeNetView = CodeNetworkView(self, CODENETWORK_IMAGENETWORK_ID) self.codeNetView.Bind(wx.EVT_RIGHT_DOWN, self.onRightDown) self.codeNetView.reloadImage() cnSizer.Add(self.codeNetView, 1, wx.EXPAND) self.personaCtrl = self.FindWindowById(CODENETWORK_COMBOPERSONA_ID) self.personaCtrl.SetValue(personaName) self.personaCtrl.Bind(wx.EVT_COMBOBOX, self.onPersonaChange) self.SetSizer(mainSizer) def onPersonaChange(self, evt): personaName = self.personaCtrl.GetValue() self.regenerateView(personaName) def regenerateView(self, personaName): self.theCodeNetwork = CodeNetworkModel( self.dbProxy.personaCodeNetwork(personaName), personaName) self.theCodeNetwork.graph() self.codeNetView.reloadImage() def onAddRelationship(self, evt): personaName = self.personaCtrl.GetValue() dlg = CodeRelationshipDialog(self) if (dlg.ShowModal() == CODERELATIONSHIP_BUTTONADD_ID): fromName = dlg.fromName() toName = dlg.toName() rshipType = dlg.relationship() b = Borg() b.dbProxy.addCodeRelationship(personaName, fromName, toName, rshipType) self.regenerateView(personaName) dlg.Destroy() def onEditRelationship(self, evt): personaName = self.personaCtrl.GetValue() dlg = CodeRelationshipEditor(self, personaName) if (dlg.ShowModal() == CODERELATIONSHIP_BUTTONCOMMIT_ID): self.codeNetView.reloadImage() def onRightDown(self, evt): self.PopupMenu(self.theViewMenu)
def regenerateView(self,personaName): self.theCodeNetwork = CodeNetworkModel(list(self.theSelectedSet),personaName,self.theGraphName) self.theCodeNetwork.graph() self.codeNetView.reloadImage()
class ImpliedProcessPanel(BasePanel): def __init__(self,parent,isCreate): BasePanel.__init__(self,parent,armid.IMPLIEDPROCESS_ID) b = Borg() self.dbProxy = b.dbProxy self.theSelectedSet = set([]) self.theGraphName = 'impliedProc' mainSizer = wx.BoxSizer(wx.VERTICAL) personas = self.dbProxy.getDimensionNames('persona') mainSizer.Add(self.buildComboSizerList('Persona',(87,30),armid.IMPLIEDPROCESS_COMBOPERSONA_ID,personas),0,wx.EXPAND) cnBox = wx.StaticBox(self,-1,'Code Network') cnSizer = wx.StaticBoxSizer(cnBox,wx.HORIZONTAL) mainSizer.Add(cnSizer,1,wx.EXPAND) self.codeNetView = CodeNetworkView(self,armid.IMPLIEDPROCESS_IMAGENETWORK_ID,self.theGraphName) cnSizer.Add(self.codeNetView,1,wx.EXPAND) idnSizer = wx.BoxSizer(wx.HORIZONTAL) mainSizer.Add(idnSizer,1,wx.EXPAND) idnSizer.Add(ImpliedProcessNotebook(self),1,wx.EXPAND) self.codeRelationships = self.FindWindowById(armid.IMPLIEDPROCESS_LISTRELATIONSHIPS_ID) self.codeRelationships.Bind(wx.EVT_LIST_ITEM_SELECTED,self.onRelationshipAdded) self.codeRelationships.Bind(wx.EVT_LIST_ITEM_DESELECTED,self.onRelationshipRemoved) self.personaCtrl = self.FindWindowById(armid.IMPLIEDPROCESS_COMBOPERSONA_ID) self.personaCtrl.Bind(wx.EVT_COMBOBOX,self.onPersonaChange) mainSizer.Add(self.buildCommitButtonSizer(armid.IMPLIEDPROCESS_BUTTONCOMMIT_ID,isCreate),0,wx.ALIGN_CENTER) self.SetSizer(mainSizer) def loadControls(self,implProc): nameCtrl = self.FindWindowById(armid.IMPLIEDPROCESS_TEXTNAME_ID) descCtrl = self.FindWindowById(armid.IMPLIEDPROCESS_TEXTDESCRIPTION_ID) specCtrl = self.FindWindowById(armid.IMPLIEDPROCESS_TEXTSPECIFICATION_ID) nameCtrl.SetValue(implProc.name()) descCtrl.SetValue(implProc.description()) personaName = implProc.persona() self.personaCtrl.SetValue(personaName) self.theSelectedSet = set(implProc.network()) relationshipPage = self.FindWindowById(armid.IMPLIEDPROCESS_PAGERELATIONSHIP_ID) relationshipPage.buildList(personaName) relationshipPage.highlightSet(self.theSelectedSet) self.regenerateView(personaName) specCtrl.SetValue(implProc.specification()) def onRelationshipAdded(self,evt): personaName = self.personaCtrl.GetValue() idx = evt.GetIndex() fromName = self.codeRelationships.GetItemText(idx) fromType = self.codeRelationships.GetItem(idx,1) rType = self.codeRelationships.GetItem(idx,2) toName = self.codeRelationships.GetItem(idx,3) toType = self.codeRelationships.GetItem(idx,4) sKey = (fromName,fromType.GetText(),toName.GetText(),toType.GetText(),rType.GetText()) self.theSelectedSet.add(sKey) self.regenerateView(personaName) def onRelationshipRemoved(self,evt): personaName = self.personaCtrl.GetValue() idx = evt.GetIndex() fromName = self.codeRelationships.GetItemText(idx) fromType = self.codeRelationships.GetItem(idx,1) rType = self.codeRelationships.GetItem(idx,2) toName = self.codeRelationships.GetItem(idx,3) toType = self.codeRelationships.GetItem(idx,4) sKey = (fromName,fromType.GetText(),toName.GetText(),toType.GetText(),rType.GetText()) self.theSelectedSet.remove(sKey) self.regenerateView(personaName) def onPersonaChange(self,evt): personaName = self.personaCtrl.GetValue() self.theSelectedSet = set([]) self.rshipPage = self.FindWindowById(armid.IMPLIEDPROCESS_PAGERELATIONSHIP_ID) self.rshipPage.buildList(personaName) self.regenerateView(personaName) def regenerateView(self,personaName): self.theCodeNetwork = CodeNetworkModel(list(self.theSelectedSet),personaName,self.theGraphName) self.theCodeNetwork.graph() self.codeNetView.reloadImage() def dimensions(self): return list(self.theSelectedSet)
def regenerateView(self, personaName): self.theCodeNetwork = CodeNetworkModel(list(self.theSelectedSet), personaName, self.theGraphName) self.theCodeNetwork.graph() self.codeNetView.reloadImage()
class ImpliedProcessPanel(BasePanel): def __init__(self, parent, isCreate): BasePanel.__init__(self, parent, IMPLIEDPROCESS_ID) b = Borg() self.dbProxy = b.dbProxy self.theSelectedSet = set([]) self.theGraphName = 'impliedProc' mainSizer = wx.BoxSizer(wx.VERTICAL) personas = self.dbProxy.getDimensionNames('persona') mainSizer.Add( self.buildComboSizerList('Persona', (87, 30), IMPLIEDPROCESS_COMBOPERSONA_ID, personas), 0, wx.EXPAND) cnBox = wx.StaticBox(self, -1, 'Code Network') cnSizer = wx.StaticBoxSizer(cnBox, wx.HORIZONTAL) mainSizer.Add(cnSizer, 1, wx.EXPAND) self.codeNetView = CodeNetworkView(self, IMPLIEDPROCESS_IMAGENETWORK_ID, self.theGraphName) cnSizer.Add(self.codeNetView, 1, wx.EXPAND) idnSizer = wx.BoxSizer(wx.HORIZONTAL) mainSizer.Add(idnSizer, 1, wx.EXPAND) idnSizer.Add(ImpliedProcessNotebook(self), 1, wx.EXPAND) self.codeRelationships = self.FindWindowById( IMPLIEDPROCESS_LISTRELATIONSHIPS_ID) self.codeRelationships.Bind(wx.EVT_LIST_ITEM_SELECTED, self.onRelationshipAdded) self.codeRelationships.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.onRelationshipRemoved) self.personaCtrl = self.FindWindowById(IMPLIEDPROCESS_COMBOPERSONA_ID) self.personaCtrl.Bind(wx.EVT_COMBOBOX, self.onPersonaChange) mainSizer.Add( self.buildCommitButtonSizer(IMPLIEDPROCESS_BUTTONCOMMIT_ID, isCreate), 0, wx.ALIGN_CENTER) self.SetSizer(mainSizer) def loadControls(self, implProc): nameCtrl = self.FindWindowById(IMPLIEDPROCESS_TEXTNAME_ID) descCtrl = self.FindWindowById(IMPLIEDPROCESS_TEXTDESCRIPTION_ID) specCtrl = self.FindWindowById(IMPLIEDPROCESS_TEXTSPECIFICATION_ID) channelCtrl = self.FindWindowById(IMPLIEDPROCESS_LISTCHANNELS_ID) nameCtrl.SetValue(implProc.name()) descCtrl.SetValue(implProc.description()) channelCtrl.load(implProc.channels()) personaName = implProc.persona() self.personaCtrl.SetValue(personaName) self.theSelectedSet = set(implProc.network()) relationshipPage = self.FindWindowById( IMPLIEDPROCESS_PAGERELATIONSHIP_ID) relationshipPage.buildList(personaName) relationshipPage.highlightSet(self.theSelectedSet) self.regenerateView(personaName) specCtrl.SetValue(implProc.specification()) def onRelationshipAdded(self, evt): personaName = self.personaCtrl.GetValue() idx = evt.GetIndex() fromName = self.codeRelationships.GetItemText(idx) fromType = self.codeRelationships.GetItem(idx, 1) rType = self.codeRelationships.GetItem(idx, 2) toName = self.codeRelationships.GetItem(idx, 3) toType = self.codeRelationships.GetItem(idx, 4) sKey = (fromName, fromType.GetText(), toName.GetText(), toType.GetText(), rType.GetText()) self.theSelectedSet.add(sKey) self.regenerateView(personaName) def onRelationshipRemoved(self, evt): personaName = self.personaCtrl.GetValue() idx = evt.GetIndex() fromName = self.codeRelationships.GetItemText(idx) fromType = self.codeRelationships.GetItem(idx, 1) rType = self.codeRelationships.GetItem(idx, 2) toName = self.codeRelationships.GetItem(idx, 3) toType = self.codeRelationships.GetItem(idx, 4) sKey = (fromName, fromType.GetText(), toName.GetText(), toType.GetText(), rType.GetText()) self.theSelectedSet.remove(sKey) self.regenerateView(personaName) def onPersonaChange(self, evt): personaName = self.personaCtrl.GetValue() self.theSelectedSet = set([]) self.rshipPage = self.FindWindowById( IMPLIEDPROCESS_PAGERELATIONSHIP_ID) self.rshipPage.buildList(personaName) self.regenerateView(personaName) def regenerateView(self, personaName): self.theCodeNetwork = CodeNetworkModel(list(self.theSelectedSet), personaName, self.theGraphName) self.theCodeNetwork.graph() self.codeNetView.reloadImage() def dimensions(self): return list(self.theSelectedSet)
def onCommit(self,evt): relationships = self.crListCtrl.dimensions() self.dbProxy.updateCodeNetwork(self.thePersonaName,relationships) model = CodeNetworkModel(relationships,self.thePersonaName) model.graph() self.EndModal(armid.CODERELATIONSHIP_BUTTONCOMMIT_ID)
def regenerateView(self,personaName): self.theCodeNetwork = CodeNetworkModel(self.dbProxy.personaCodeNetwork(personaName),personaName) self.theCodeNetwork.graph() self.codeNetView.reloadImage()
class ImpliedCharacteristicPanel(BasePanel): def __init__(self, parent, pName, fromCode, toCode, rtName): BasePanel.__init__(self, parent, IMPLIEDCHARACTERISTIC_ID) b = Borg() self.dbProxy = b.dbProxy charName = '' qualName = 'Unknown' varName = 'Intrinsic' try: charName, qualName, varName = self.dbProxy.impliedCharacteristic( pName, fromCode, toCode, rtName) except NoImpliedCharacteristic, e: self.dbProxy.initialiseImpliedCharacteristic( pName, fromCode, toCode, rtName) mainSizer = wx.BoxSizer(wx.VERTICAL) self.codeNetView = CodeNetworkView( self, IMPLIEDCHARACTERISTIC_IMAGENETWORK_ID) mainSizer.Add(self.codeNetView, 1, wx.EXPAND) codeNet = CodeNetworkModel( self.dbProxy.personaCodeNetwork(pName, fromCode, toCode), pName) codeNet.graph() self.codeNetView.reloadImage() mainSizer.Add( self.buildTextSizer('Characteristic', (87, 30), IMPLIEDCHARACTERISTIC_TEXTCHARACTERISTIC_ID), 0, wx.EXPAND) mainSizer.Add( self.buildTextSizer('Qualifier', (87, 30), IMPLIEDCHARACTERISTIC_TEXTQUALIFIER_ID), 0, wx.EXPAND) intentionSizer = wx.BoxSizer(wx.HORIZONTAL) mainSizer.Add(intentionSizer, 0, wx.EXPAND) intentionSizer.Add( self.buildTextSizer('Intention', (87, 30), IMPLIEDCHARACTERISTIC_TEXTINTENTION_ID), 1, wx.EXPAND) intentionSizer.Add( self.buildComboSizerList( 'Type', (87, 30), IMPLIEDCHARACTERISTIC_COMBOINTENTIONTYPE_ID, ['goal', 'softgoal']), 1, wx.EXPAND) elSizer = wx.BoxSizer(wx.HORIZONTAL) mainSizer.Add(elSizer, 1, wx.EXPAND) lhsBox = wx.StaticBox(self, -1, fromCode) lhsSizer = wx.StaticBoxSizer(lhsBox, wx.VERTICAL) elSizer.Add(lhsSizer, 1, wx.EXPAND) lhsEls = self.dbProxy.impliedCharacteristicElements( pName, fromCode, toCode, rtName, 1) lhsSizer.Add( ImpliedCharacteristicElementsListCtrl( self, IMPLIEDCHARACTERISTIC_LISTLHS_ID, lhsEls), 1, wx.EXPAND) rhsBox = wx.StaticBox(self, -1, toCode) rhsSizer = wx.StaticBoxSizer(rhsBox, wx.VERTICAL) elSizer.Add(rhsSizer, 1, wx.EXPAND) rhsEls = self.dbProxy.impliedCharacteristicElements( pName, fromCode, toCode, rtName, 0) rhsSizer.Add( ImpliedCharacteristicElementsListCtrl( self, IMPLIEDCHARACTERISTIC_LISTRHS_ID, rhsEls), 1, wx.EXPAND) mainSizer.Add( self.buildComboSizerList('Characteristic Type', (87, 30), IMPLIEDCHARACTERISTIC_COMBOTYPE_ID, ['Intrinsic', 'Contextual']), 0, wx.EXPAND) mainSizer.Add( self.buildCommitButtonSizer(IMPLIEDCHARACTERISTIC_BUTTONCOMMIT_ID, False), 0, wx.CENTER) self.SetSizer(mainSizer) charCtrl = self.FindWindowById( IMPLIEDCHARACTERISTIC_TEXTCHARACTERISTIC_ID) charCtrl.SetValue(charName) qualCtrl = self.FindWindowById(IMPLIEDCHARACTERISTIC_TEXTQUALIFIER_ID) qualCtrl.SetValue(qualName) varCtrl = self.FindWindowById(IMPLIEDCHARACTERISTIC_COMBOTYPE_ID) varCtrl.SetValue(varName) itValues = self.dbProxy.impliedCharacteristicIntention( charName, pName, fromCode, toCode, rtName) intCtrl = self.FindWindowById(IMPLIEDCHARACTERISTIC_TEXTINTENTION_ID) intCtrl.SetValue(itValues[0]) itCtrl = self.FindWindowById( IMPLIEDCHARACTERISTIC_COMBOINTENTIONTYPE_ID) itCtrl.SetValue(itValues[1])