本文整理汇总了Python中EnvironmentListCtrl.EnvironmentListCtrl.dimensions方法的典型用法代码示例。如果您正苦于以下问题:Python EnvironmentListCtrl.dimensions方法的具体用法?Python EnvironmentListCtrl.dimensions怎么用?Python EnvironmentListCtrl.dimensions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EnvironmentListCtrl.EnvironmentListCtrl
的用法示例。
在下文中一共展示了EnvironmentListCtrl.dimensions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CountermeasureEnvironmentPanel
# 需要导入模块: from EnvironmentListCtrl import EnvironmentListCtrl [as 别名]
# 或者: from EnvironmentListCtrl.EnvironmentListCtrl import dimensions [as 别名]
#.........这里部分代码省略.........
self.propertiesList.Enable()
self.costCombo.Enable()
self.roleList.Enable()
self.environmentList.Bind(wx.EVT_LIST_ITEM_SELECTED,self.OnEnvironmentSelected)
self.environmentList.Bind(wx.EVT_LIST_ITEM_DESELECTED,self.OnEnvironmentDeselected)
self.theSelectedIdx = 0
def OnEnvironmentSelected(self,evt):
self.theSelectedIdx = evt.GetIndex()
environmentName = self.environmentList.GetItemText(self.theSelectedIdx)
p = self.theEnvironmentDictionary[environmentName]
self.reqList.setEnvironment(environmentName)
self.reqList.load(p.requirements())
self.targetList.setEnvironment(environmentName)
self.targetList.load(p.targets())
self.propertiesList.setEnvironment(environmentName)
self.propertiesList.load(p.properties(),p.rationale())
self.costCombo.SetStringSelection(p.cost())
self.roleList.setEnvironment(environmentName)
self.roleList.load(p.roles())
self.personaList.load(p.personas())
self.reqList.Enable()
self.targetList.Enable()
self.propertiesList.Enable()
self.costCombo.Enable()
self.roleList.Enable()
self.personaList.Enable()
def OnEnvironmentDeselected(self,evt):
self.theSelectedIdx = evt.GetIndex()
environmentName = self.environmentList.GetItemText(self.theSelectedIdx)
syProperties, pRationale = self.propertiesList.properties()
properties = CountermeasureEnvironmentProperties(environmentName,self.reqList.dimensions(),self.targetList.targets(),syProperties,pRationale,self.costCombo.GetValue(),self.roleList.dimensions(),self.personaList.dimensions())
self.theEnvironmentDictionary[environmentName] = properties
self.reqList.setEnvironment('')
self.reqList.DeleteAllItems()
self.targetList.setEnvironment('')
self.targetList.DeleteAllItems()
self.propertiesList.setEnvironment('')
self.propertiesList.DeleteAllItems()
self.costCombo.SetValue('')
self.roleList.setEnvironment('')
self.roleList.DeleteAllItems()
self.personaList.DeleteAllItems()
self.theSelectedIdx = -1
self.reqList.Disable()
self.targetList.Disable()
self.propertiesList.Disable()
self.costCombo.Disable()
self.roleList.Disable()
def OnAddEnvironment(self,evt):
if (self.theSelectedIdx != -1):
environmentName = self.environmentList.GetItemText(self.theSelectedIdx)
syProperties,pRationale = self.propertiesList.properties()
properties = CountermeasureEnvironmentProperties(environmentName,self.reqList.dimensions(),self.targetList.targets(),syProperties,pRationale,self.costCombo.GetValue(),self.roleList.dimensions(),self.personaList.dimensions())
self.theEnvironmentDictionary[environmentName] = properties
self.theSelectedIdx = evt.GetIndex()
environmentName = self.environmentList.GetItemText(self.theSelectedIdx)
self.theEnvironmentDictionary[environmentName] = CountermeasureEnvironmentProperties(environmentName)
self.reqList.setEnvironment(environmentName)
self.reqList.DeleteAllItems()
示例2: MitigateEnvironmentPanel
# 需要导入模块: from EnvironmentListCtrl import EnvironmentListCtrl [as 别名]
# 或者: from EnvironmentListCtrl.EnvironmentListCtrl import dimensions [as 别名]
#.........这里部分代码省略.........
if ((mitType == 'Deter') or (mitType == 'Prevent')):
self.pointCombo.SetValue('')
self.pointCombo.Disable()
self.dmList.DeleteAllItems()
self.dmList.Disable()
elif (mitType == 'Detect'):
self.pointCombo.Enable()
self.dmList.Disable()
elif (mitType == 'React'):
self.pointCombo.Disable()
self.dmList.Enable()
def loadControls(self,accept):
self.environmentList.Unbind(wx.EVT_LIST_ITEM_SELECTED)
self.environmentList.Unbind(wx.EVT_LIST_ITEM_DESELECTED)
environmentNames = []
for cp in accept.environmentProperties():
environmentNames.append(cp.name())
self.environmentList.load(environmentNames)
for cp in accept.environmentProperties():
environmentName = cp.name()
self.theEnvironmentDictionary[environmentName] = cp
environmentNames.append(environmentName)
environmentName = environmentNames[0]
p = self.theEnvironmentDictionary[environmentName]
self.typeCombo.SetStringSelection(p.type())
self.pointCombo.SetStringSelection(p.detectionPoint())
self.dmList.setEnvironment(environmentName)
self.dmList.load(p.detectionMechanisms())
self.environmentList.Select(0)
self.activateTypeCtrls()
self.environmentList.Bind(wx.EVT_LIST_ITEM_SELECTED,self.OnEnvironmentSelected)
self.environmentList.Bind(wx.EVT_LIST_ITEM_DESELECTED,self.OnEnvironmentDeselected)
self.theSelectedIdx = 0
def OnEnvironmentSelected(self,evt):
self.theSelectedIdx = evt.GetIndex()
environmentName = self.environmentList.GetItemText(self.theSelectedIdx)
p = self.theEnvironmentDictionary[environmentName]
self.typeCombo.SetStringSelection(p.type())
self.pointCombo.SetStringSelection(p.detectionPoint())
self.dmList.setEnvironment(environmentName)
self.dmList.load(p.detectionMechanisms())
self.typeCombo.Enable()
self.activateTypeCtrls()
def OnEnvironmentDeselected(self,evt):
self.theSelectedIdx = evt.GetIndex()
environmentName = self.environmentList.GetItemText(self.theSelectedIdx)
self.theEnvironmentDictionary[environmentName] = MitigateEnvironmentProperties(environmentName,self.typeCombo.GetValue(),self.pointCombo.GetValue(),self.dmList.dimensions())
self.typeCombo.SetValue('')
self.pointCombo.SetValue('')
self.dmList.setEnvironment('')
self.dmList.DeleteAllItems()
self.theSelectedIdx = -1
self.typeCombo.Disable()
self.pointCombo.Disable()
self.dmList.Disable()
def OnAddEnvironment(self,evt):
self.theSelectedIdx = evt.GetIndex()
environmentName = self.environmentList.GetItemText(self.theSelectedIdx)
self.theEnvironmentDictionary[environmentName] = MitigateEnvironmentProperties(environmentName)
self.typeCombo.SetValue('')
self.pointCombo.SetValue('')
self.dmList.setEnvironment(environmentName)
self.dmList.DeleteAllItems()
self.environmentList.Select(self.theSelectedIdx)
self.typeCombo.Enable()
def OnDeleteEnvironment(self,evt):
selectedIdx = evt.GetIndex()
environmentName = self.environmentList.GetItemText(selectedIdx)
del self.theEnvironmentDictionary[environmentName]
self.theSelectedIdx = -1
def environmentProperties(self):
if (self.theSelectedIdx != -1):
environmentName = self.environmentList.GetItemText(self.theSelectedIdx)
properties = MitigateEnvironmentProperties(environmentName,self.typeCombo.GetValue(),self.pointCombo.GetValue(),self.dmList.dimensions())
self.theEnvironmentDictionary[environmentName] = properties
for cname in self.environmentList.dimensions():
p = self.theEnvironmentDictionary[cname]
mitType = p.type()
if (len(mitType) == 0):
exceptionText = 'No mitigation type selected for environment ' + p.name()
raise ARM.EnvironmentValidationError(exceptionText)
if (mitType == 'Detect') and (len(p.detectionPoint()) == 0):
exceptionText = 'No detection point selected for environment ' + p.name()
raise ARM.EnvironmentValidationError(exceptionText)
if (mitType == 'React') and (len(p.detectionMechanisms()) == 0):
exceptionText = 'No detection mechanisms selected for environment ' + p.name()
raise ARM.EnvironmentValidationError(exceptionText)
return self.theEnvironmentDictionary.values()