本文整理汇总了Python中DimensionNameDialog.DimensionNameDialog类的典型用法代码示例。如果您正苦于以下问题:Python DimensionNameDialog类的具体用法?Python DimensionNameDialog怎么用?Python DimensionNameDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DimensionNameDialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onRemovePattern
def onRemovePattern(self,evt):
countermeasure = self.theParentDialog.objts[self.theParentDialog.selectedLabel]
cmId = countermeasure.id()
try:
b = Borg()
dbProxy = b.dbProxy
patterns = dbProxy.countermeasurePatterns(cmId)
cDlg = DimensionNameDialog(self,'securitypattern',patterns,'Select')
if (cDlg.ShowModal() == DIMNAME_BUTTONACTION_ID):
patternName = cDlg.dimensionName()
patternId = dbProxy.getDimensionId(patternName,'securitypattern')
spDeps = dbProxy.reportDependencies('securitypattern',cmId)
if (len(spDeps) > 0):
dlg = DependentsDialog(self,spDeps,'securitypattern')
retValue = dlg.ShowModal()
dlg.Destroy()
if (retValue != DEPENDENTS_BUTTONCONFIRM_ID):
cDlg.Destroy()
return
else:
dbProxy.deleteDependencies(spDeps)
dbProxy.deleteSituatedPattern(cmId,patternName)
cDlg.Destroy()
except ARMException,errorText:
dlg = wx.MessageDialog(self,str(errorText),'Generate countermeasure asset',wx.OK | wx.ICON_ERROR)
dlg.ShowModal()
dlg.Destroy()
return
示例2: onAddDimension
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)
示例3: onAdd
def onAdd(self,evt):
try:
riskDict = self.dbProxy.getDimensionNames('risk')
if (len(riskDict) == 0):
dlg = wx.MessageDialog(self,'Cannot mitigate for non-existing risks','Add response',wx.OK)
dlg.ShowModal()
dlg.Destroy()
return
responseTypes = ['Accept','Transfer','Mitigate']
from DimensionNameDialog import DimensionNameDialog
rtDlg = DimensionNameDialog(self,'response',responseTypes,'Select',(300,200))
if (rtDlg.ShowModal() == DIMNAME_BUTTONACTION_ID):
responseType = rtDlg.dimensionName()
responsePanel = MitigateEnvironmentPanel
if (responseType == 'Accept'):
responsePanel = AcceptEnvironmentPanel
elif (responseType == 'Transfer'):
responsePanel = TransferEnvironmentPanel
addParameters = ResponseDialogParameters(RESPONSE_ID,'Add response',ResponseDialog,RESPONSE_BUTTONCOMMIT_ID,self.dbProxy.addResponse,True,responsePanel,responseType)
self.addObject(addParameters)
rtDlg.Destroy()
except ARMException,errorText:
dlg = wx.MessageDialog(self,str(errorText),'Add response',wx.OK | wx.ICON_ERROR)
dlg.ShowModal()
dlg.Destroy()
return
示例4: onAddDimension
def onAddDimension(self,evt):
targetList = self.dbProxy.targetNames(self.theRiskList.GetItems())
from DimensionNameDialog import DimensionNameDialog
dlg = DimensionNameDialog(self,'Target',targetList,'Add')
if (dlg.ShowModal() == armid.DIMNAME_BUTTONACTION_ID):
additionalDimension = dlg.dimensionName()
self.Append(additionalDimension)
self.theSelectedValue = additionalDimension
示例5: onListAlphabet
def onListAlphabet(self,evt):
b = Borg()
codes = b.dbProxy.getDimensionNames('code',False)
cDlg = DimensionNameDialog(self,'code',codes,'Select')
if (cDlg.ShowModal() == DIMNAME_BUTTONACTION_ID):
codeName = cDlg.dimensionName()
self.addCode(codeName)
cDlg.Destroy()
示例6: onAddDimension
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)
示例7: onInheritEnvironment
def onInheritEnvironment(self,evt):
from DimensionNameDialog import DimensionNameDialog
dimensions = self.dbProxy.getEnvironmentNames()
dlg = DimensionNameDialog(self,'environment',dimensions,'Inherit from ')
if (dlg.ShowModal() == DIMNAME_BUTTONACTION_ID):
self.theInheritedEnvironment = dlg.dimensionName()
adddlg = DimensionNameDialog(self,'environment',dimensions,'Add')
if (adddlg.ShowModal() == DIMNAME_BUTTONACTION_ID):
idx = self.GetItemCount()
self.InsertStringItem(idx,adddlg.dimensionName())
示例8: onAddDimension
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)
示例9: onReassociate
def onReassociate(self,evt):
b = Borg()
p = b.dbProxy
dimensions = p.getDimensionNames('asset')
dlg = DimensionNameDialog(self,'asset',dimensions,'Select')
if (dlg.ShowModal() == DIMNAME_BUTTONACTION_ID):
selectedAsset = dlg.dimensionName()
reqTable = self.GetTable()
selectedReq = reqTable.om.reqs[self.GetGridCursorRow()]
p.reassociateAsset(selectedAsset,self.envCombo.GetValue(),selectedReq.id())
self.modCombo.SetStringSelection(selectedAsset)
dlg.Destroy()
self.envCombo.SetValue('')
self.setTable(self.modCombo,self.envCombo)
self.thePanel.refresh()
示例10: onAssociateSituated
def onAssociateSituated(self,evt):
countermeasure = self.theParentDialog.objts[self.theParentDialog.selectedLabel]
cmId = countermeasure.id()
try:
b = Borg()
dbProxy = b.dbProxy
patterns = dbProxy.candidateCountermeasurePatterns(cmId)
cDlg = DimensionNameDialog(self,'securitypattern',patterns,'Select')
if (cDlg.ShowModal() == DIMNAME_BUTTONACTION_ID):
patternName = cDlg.dimensionName()
dbProxy.associateCountermeasureToPattern(cmId,patternName)
cDlg.Destroy()
except ARMException,errorText:
dlg = wx.MessageDialog(self,str(errorText),'Generate countermeasure asset',wx.OK | wx.ICON_ERROR)
dlg.ShowModal()
dlg.Destroy()
return
示例11: onSelectGenerateFromTemplate
def onSelectGenerateFromTemplate(self,evt):
countermeasure = self.theParentDialog.objts[self.theParentDialog.selectedLabel]
cmId = countermeasure.id()
try:
b = Borg()
dbProxy = b.dbProxy
templateAssets = dbProxy.getDimensionNames('template_asset')
cDlg = DimensionNameDialog(self,'template_asset',templateAssets,'Select')
if (cDlg.ShowModal() == DIMNAME_BUTTONACTION_ID):
templateAssetName = cDlg.dimensionName()
assetId = dbProxy.addAsset(cairis.core.AssetParametersFactory.buildFromTemplate(templateAssetName,countermeasure.environments()))
dbProxy.addTrace('countermeasure_asset',cmId,assetId)
cDlg.Destroy()
except ARMException,errorText:
dlg = wx.MessageDialog(self,str(errorText),'Generate countermeasure asset',wx.OK | wx.ICON_ERROR)
dlg.ShowModal()
dlg.Destroy()
return
示例12: onSituate
def onSituate(self,evt):
cvObjt = self.theParentDialog.objts[self.theParentDialog.selectedLabel]
cvName = cvObjt.name()
try:
environments = self.dbProxy.getDimensionNames('environment',False)
cDlg = DimensionNameDialog(self,'environment',environments,'Select')
if (cDlg.ShowModal() == armid.DIMNAME_BUTTONACTION_ID):
envName = cDlg.dimensionName()
dlg = WeaknessAnalysisDialog(self,cvName,envName)
if (dlg.ShowModal() == armid.WEAKNESSANALYSIS_BUTTONCOMMIT_ID):
self.situateComponentView(cvName,envName,dlg.targets(),dlg.goalObstacles())
dlg.Destroy()
cDlg.Destroy()
except ARMException,errorText:
dlg = wx.MessageDialog(self,str(errorText),'Situate component view',wx.OK | wx.ICON_ERROR)
dlg.ShowModal()
dlg.Destroy()
return
示例13: onSituate
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
示例14: onUseCaseContribution
def onUseCaseContribution(self, evt):
ucName = self.GetItemText(self.theSelectedIdx)
ucs = self.dbProxy.getUseCaseContributions(ucName)
ucKeys = ucs.keys()
ucKeys.append("[New Contribution]")
rsDlg = DimensionNameDialog(self, "usecase_contribution", ucKeys, "Select")
if rsDlg.ShowModal() == DIMNAME_BUTTONACTION_ID:
synName = rsDlg.dimensionName()
rType = "reference"
if synName != "[New Contribution]":
rc, rType = ucs[synName]
else:
rc = ReferenceContribution(ucName, "", "", "")
dlg = UseCaseContributionDialog(self, rc, rType)
if dlg.ShowModal() == REFERENCECONTRIBUTION_BUTTONCOMMIT_ID:
if rc.meansEnd() == "":
self.dbProxy.addUseCaseContribution(dlg.parameters())
else:
self.dbProxy.updateUseCaseContribution(dlg.parameters())
示例15: onUseCaseContribution
def onUseCaseContribution(self,evt):
ucName = self.GetItemText(self.theSelectedIdx)
ucs = self.dbProxy.getUseCaseContributions(ucName)
ucKeys = ucs.keys()
ucKeys.append('[New Contribution]')
rsDlg = DimensionNameDialog(self,'usecase_contribution',ucKeys,'Select')
if (rsDlg.ShowModal() == DIMNAME_BUTTONACTION_ID):
synName = rsDlg.dimensionName()
rType = 'reference'
if (synName != '[New Contribution]'):
rc,rType = ucs[synName]
else:
rc = ReferenceContribution(ucName,'','','')
dlg = UseCaseContributionDialog(self,rc,rType)
if (dlg.ShowModal() == REFERENCECONTRIBUTION_BUTTONCOMMIT_ID):
if (rc.meansEnd() == ''):
self.dbProxy.addUseCaseContribution(dlg.parameters())
else:
self.dbProxy.updateUseCaseContribution(dlg.parameters())