def onAddDimension(self,evt): dimensions = self.dbProxy.getDimensionNames(self.theDimensionTable) from DimensionNameDialog import DimensionNameDialog dlg = DimensionNameDialog(self,self.theDimensionTable,dimensions,'Add') if (dlg.ShowModal() == DIMNAME_BUTTONACTION_ID): for additionalDimension in dlg.dimensionNames(): self.Append(additionalDimension)
def onAddDimension(self,evt): dimensions = self.dbProxy.getDimensionNames(self.theDimensionTable) from DimensionNameDialog import DimensionNameDialog dlg = DimensionNameDialog(self,self.theDimensionTable,dimensions,'Add') if (dlg.ShowModal() == armid.DIMNAME_BUTTONACTION_ID): for additionalDimension in dlg.dimensionNames(): self.Append(additionalDimension)
def onAddDimension(self,evt): currentDimensions = self.dimensions() dimensions = self.dbProxy.riskEnvironmentNames(self.theCurrentRisk) remainingDimensions = [x for x in dimensions if x not in currentDimensions] from DimensionNameDialog import DimensionNameDialog dlg = DimensionNameDialog(self,self.theDimensionTable,remainingDimensions,'Add') if (dlg.ShowModal() == DIMNAME_BUTTONACTION_ID): for additionalDimension in dlg.dimensionNames(): idx = self.GetItemCount() self.InsertStringItem(idx,additionalDimension)
def onAddDimension(self, evt): if self.theDimensionTable == "environment": dimensions = self.dbProxy.getEnvironmentNames() else: dimensions = self.dbProxy.getDimensionNames(self.theDimensionTable, self.theCurrentEnvironment) from DimensionNameDialog import DimensionNameDialog dlg = DimensionNameDialog(self, self.theDimensionTable, dimensions, "Add") if dlg.ShowModal() == armid.DIMNAME_BUTTONACTION_ID: for additionalDimension in dlg.dimensionNames(): idx = self.GetItemCount() self.InsertStringItem(idx, additionalDimension)
def onAddDimension(self, evt): dimensions = self.dbProxy.getDimensionNames(self.theDimensionTable, self.theCurrentEnvironment) from DimensionNameDialog import DimensionNameDialog dlg = DimensionNameDialog(self, self.theDimensionTable, dimensions, 'Add') if (dlg.ShowModal() == armid.DIMNAME_BUTTONACTION_ID): newRoles = dlg.dimensionNames() for additionalDimension in newRoles: idx = self.GetItemCount() self.InsertStringItem(idx, additionalDimension) tpDict = self.dbProxy.roleTasks(self.theCurrentEnvironment, newRoles) noOfPersonas = self.thePersonaList.GetItemCount() if (noOfPersonas > 0): currentKeys = set([]) for x in range(noOfPersonas): listedTask = self.thePersonaList.GetItem(x, 0) listedPersona = self.thePersonaList.GetItem(x, 1) listedTuple = (listedTask.GetText(), listedPersona.GetText()) currentKeys.add(listedTuple) for personaDetails in tpDict.iteritems(): key = personaDetails[0] value = personaDetails[1] if ((key[0], key[1]) not in currentKeys): self.thePersonaList.InsertStringItem(0, key[0]) self.thePersonaList.SetStringItem(0, 1, key[1]) self.thePersonaList.SetStringItem(0, 2, value[0]) self.thePersonaList.SetStringItem(0, 3, value[1]) self.thePersonaList.SetStringItem(0, 4, value[2]) self.thePersonaList.SetStringItem(0, 5, value[3]) else: for personaDetails in tpDict.iteritems(): key = personaDetails[0] value = personaDetails[1] self.thePersonaList.InsertStringItem(0, key[0]) self.thePersonaList.SetStringItem(0, 1, key[1]) self.thePersonaList.SetStringItem(0, 2, value[0]) self.thePersonaList.SetStringItem(0, 3, value[1]) self.thePersonaList.SetStringItem(0, 4, value[2]) self.thePersonaList.SetStringItem(0, 5, value[3])
def onSituate(self,evt): tAsset = self.theParentDialog.objts[self.theParentDialog.selectedLabel] taId = tAsset.id() taName = tAsset.name() try: b = Borg() dbProxy = b.dbProxy envs = dbProxy.getEnvironmentNames() cDlg = DimensionNameDialog(self,'environment',envs,'Select') if (cDlg.ShowModal() == DIMNAME_BUTTONACTION_ID): sitEnvs = cDlg.dimensionNames() assetId = dbProxy.addAsset(cairis.core.AssetParametersFactory.buildFromTemplate(taName,sitEnvs)) # NB: we don't add anything to asset_template_asset, as we only use this table when the derived asset is part of a situated pattern cDlg.Destroy() except ARMException,errorText: dlg = wx.MessageDialog(self,str(errorText),'Situate template asset',wx.OK | wx.ICON_ERROR) dlg.ShowModal() dlg.Destroy() return
def onAddDimension(self,evt): dimensions = self.dbProxy.getDimensionNames(self.theDimensionTable,self.theCurrentEnvironment) from DimensionNameDialog import DimensionNameDialog dlg = DimensionNameDialog(self,self.theDimensionTable,dimensions,'Add') if (dlg.ShowModal() == DIMNAME_BUTTONACTION_ID): newRoles = dlg.dimensionNames() for additionalDimension in newRoles: idx = self.GetItemCount() self.InsertStringItem(idx,additionalDimension) tpDict = self.dbProxy.roleTasks(self.theCurrentEnvironment,newRoles) noOfPersonas = self.thePersonaList.GetItemCount() if (noOfPersonas > 0): currentKeys = set([]) for x in range(noOfPersonas): listedTask = self.thePersonaList.GetItem(x,0) listedPersona = self.thePersonaList.GetItem(x,1) listedTuple = (listedTask.GetText(),listedPersona.GetText()) currentKeys.add(listedTuple) for personaDetails in tpDict.iteritems(): key = personaDetails[0] value = personaDetails[1] if ((key[0],key[1]) not in currentKeys): self.thePersonaList.InsertStringItem(0,key[0]) self.thePersonaList.SetStringItem(0,1,key[1]) self.thePersonaList.SetStringItem(0,2,value[0]) self.thePersonaList.SetStringItem(0,3,value[1]) self.thePersonaList.SetStringItem(0,4,value[2]) self.thePersonaList.SetStringItem(0,5,value[3]) else: for personaDetails in tpDict.iteritems(): key = personaDetails[0] value = personaDetails[1] self.thePersonaList.InsertStringItem(0,key[0]) self.thePersonaList.SetStringItem(0,1,key[1]) self.thePersonaList.SetStringItem(0,2,value[0]) self.thePersonaList.SetStringItem(0,3,value[1]) self.thePersonaList.SetStringItem(0,4,value[2]) self.thePersonaList.SetStringItem(0,5,value[3])
def onSituate(self, evt): tAsset = self.theParentDialog.objts[self.theParentDialog.selectedLabel] taId = tAsset.id() taName = tAsset.name() try: b = Borg() dbProxy = b.dbProxy envs = dbProxy.getEnvironmentNames() cDlg = DimensionNameDialog(self, 'environment', envs, 'Select') if (cDlg.ShowModal() == armid.DIMNAME_BUTTONACTION_ID): sitEnvs = cDlg.dimensionNames() assetId = dbProxy.addAsset( AssetParametersFactory.buildFromTemplate(taName, sitEnvs)) # NB: we don't add anything to asset_template_asset, as we only use this table when the derived asset is part of a situated pattern cDlg.Destroy() except ARMException, errorText: dlg = wx.MessageDialog(self, str(errorText), 'Situate template asset', wx.OK | wx.ICON_ERROR) dlg.ShowModal() dlg.Destroy() return