当前位置: 首页>>代码示例>>Python>>正文


Python EnvironmentListCtrl.inheritedEnvironment方法代码示例

本文整理汇总了Python中EnvironmentListCtrl.EnvironmentListCtrl.inheritedEnvironment方法的典型用法代码示例。如果您正苦于以下问题:Python EnvironmentListCtrl.inheritedEnvironment方法的具体用法?Python EnvironmentListCtrl.inheritedEnvironment怎么用?Python EnvironmentListCtrl.inheritedEnvironment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EnvironmentListCtrl.EnvironmentListCtrl的用法示例。


在下文中一共展示了EnvironmentListCtrl.inheritedEnvironment方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ThreatEnvironmentPanel

# 需要导入模块: from EnvironmentListCtrl import EnvironmentListCtrl [as 别名]
# 或者: from EnvironmentListCtrl.EnvironmentListCtrl import inheritedEnvironment [as 别名]

#.........这里部分代码省略.........
    aaSizer.Add(assetSizer,1,wx.EXPAND)

    propertiesBox = wx.StaticBox(self)
    propertiesSizer = wx.StaticBoxSizer(propertiesBox,wx.HORIZONTAL)
    environmentDimSizer.Add(propertiesSizer,1,wx.EXPAND)
    values = self.dbProxy.getDimensionNames('threat_value')
    valueLookup = ValueDictionary(values)
    self.propertiesList = PropertiesListCtrl(self,THREATENVIRONMENT_LISTPROPERTIES_ID,valueLookup)
    propertiesSizer.Add(self.propertiesList,1,wx.EXPAND)
    self.SetSizer(mainSizer)
    self.environmentList.Bind(wx.EVT_LIST_INSERT_ITEM,self.OnAddEnvironment)
    self.environmentList.Bind(wx.EVT_LIST_DELETE_ITEM,self.OnDeleteEnvironment)


  def loadControls(self,threat):
    self.environmentList.Unbind(wx.EVT_LIST_ITEM_SELECTED)
    self.environmentList.Unbind(wx.EVT_LIST_ITEM_DESELECTED)
    self.theThreatId = threat.id()
# We load the environment name control before anything else.  Weird stuff happens if we don't do this.  Don't ask me why!!!
    environmentNames = []
    if (len(threat.environmentProperties()) > 0):
      for cp in threat.environmentProperties():
        environmentNames.append(cp.name())
      self.environmentList.load(environmentNames)
      for cp in threat.environmentProperties():
        environmentName = cp.name()
        self.theEnvironmentDictionary[environmentName] = cp
      environmentName = environmentNames[0]
      p = self.theEnvironmentDictionary[environmentName]
      self.lhoodCtrl.SetStringSelection(p.likelihood())
      self.attackerList.setEnvironment(environmentName)
      self.attackerList.load(p.attackers()) 
      self.assetList.setEnvironment(environmentName)
      self.assetList.load(p.assets()) 
      self.propertiesList.setEnvironment(environmentName)
      self.propertiesList.load(p.properties(),p.rationale())
      self.environmentList.Select(0)

    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.lhoodCtrl.SetStringSelection(p.likelihood())
    self.attackerList.setEnvironment(environmentName)
    self.attackerList.load(p.attackers()) 
    self.assetList.setEnvironment(environmentName)
    self.assetList.load(p.assets()) 
    self.propertiesList.setEnvironment(environmentName)
    self.propertiesList.load(p.properties(),p.rationale())

  def OnEnvironmentDeselected(self,evt):
    self.theSelectedIdx = evt.GetIndex()
    environmentName = self.environmentList.GetItemText(self.theSelectedIdx)
    syProperties,pRationale = self.propertiesList.properties()
    self.theEnvironmentDictionary[environmentName] = ThreatEnvironmentProperties(environmentName,self.lhoodCtrl.GetValue(),self.assetList.dimensions(),self.attackerList.dimensions(),syProperties,pRationale)
    self.lhoodCtrl.SetValue('')
    self.attackerList.setEnvironment('')
    self.attackerList.DeleteAllItems() 
    self.assetList.setEnvironment('')
    self.assetList.DeleteAllItems() 
    self.propertiesList.setEnvironment('')
    self.propertiesList.DeleteAllItems()
    self.theSelectedIdx = -1

  def OnAddEnvironment(self,evt):
    self.theSelectedIdx = evt.GetIndex()
    environmentName = self.environmentList.GetItemText(self.theSelectedIdx)
    self.theEnvironmentDictionary[environmentName] = ThreatEnvironmentProperties(environmentName,'',[],[],[0,0,0,0,0,0,0,0],['None','None','None','None','None','None','None','None'])
    self.environmentList.Select(self.theSelectedIdx)
    self.attackerList.setEnvironment(environmentName)
    self.assetList.setEnvironment(environmentName)
    self.propertiesList.setEnvironment(environmentName)
    inheritedEnv = self.environmentList.inheritedEnvironment()
    if (inheritedEnv != '' and self.theThreatId != None):
      p = self.dbProxy.inheritedThreatProperties(self.theThreatId,inheritedEnv)
      self.theEnvironmentDictionary[environmentName] = p
      self.lhoodCtrl.SetStringSelection(p.likelihood())
      self.attackerList.setEnvironment(environmentName)
      self.attackerList.load(p.attackers()) 
      self.assetList.setEnvironment(environmentName)
      self.assetList.load(p.assets()) 
      self.propertiesList.setEnvironment(environmentName)
      self.propertiesList.load(p.properties(),p.rationale())

  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)
      syProperties,pRationale = self.propertiesList.properties() 
      self.theEnvironmentDictionary[environmentName] = ThreatEnvironmentProperties(environmentName,self.lhoodCtrl.GetValue(),self.assetList.dimensions(),self.attackerList.dimensions(),syProperties,pRationale)
    return self.theEnvironmentDictionary.values() 
开发者ID:InvalidToken,项目名称:CAIRIS,代码行数:104,代码来源:ThreatEnvironmentPanel.py

示例2: ReqToGoalEnvironmentPanel

# 需要导入模块: from EnvironmentListCtrl import EnvironmentListCtrl [as 别名]
# 或者: from EnvironmentListCtrl.EnvironmentListCtrl import inheritedEnvironment [as 别名]
class ReqToGoalEnvironmentPanel(wx.Panel):
  def __init__(self,parent,goalDef,goalCat,goalPri,goalFc,goalIssue,goalAssets,defaultEnv):
    wx.Panel.__init__(self,parent,armid.GOAL_PANELENVIRONMENT_ID)
    b = Borg()
    self.dbProxy = b.dbProxy
    self.theGoalId = None
    self.theEnvironmentDictionary = {}
    self.theSelectedIdx = -1
    self.theGoalDefinition = goalDef
    self.theGoalCategory = goalCat
    self.theGoalPriority = goalPri
    self.theGoalFitCriterion = goalFc
    self.theGoalIssue = goalIssue
    self.theGoalAssets = goalAssets

    mainSizer = wx.BoxSizer(wx.HORIZONTAL)
    environmentBox = wx.StaticBox(self)
    environmentListSizer = wx.StaticBoxSizer(environmentBox,wx.HORIZONTAL)
    mainSizer.Add(environmentListSizer,0,wx.EXPAND)
    self.environmentList = EnvironmentListCtrl(self,armid.GOAL_LISTENVIRONMENTS_ID,self.dbProxy)
    environmentListSizer.Add(self.environmentList,1,wx.EXPAND)
    environmentDimSizer = wx.BoxSizer(wx.VERTICAL)
    mainSizer.Add(environmentDimSizer,1,wx.EXPAND)

    nbBox = wx.StaticBox(self,-1)
    nbSizer = wx.StaticBoxSizer(nbBox,wx.VERTICAL)
    environmentDimSizer.Add(nbSizer,1,wx.EXPAND)
    self.notebook = ReqToGoalNotebook(self,self.dbProxy)
    nbSizer.Add(self.notebook,1,wx.EXPAND)

    self.SetSizer(mainSizer)

    self.goalAssociationCtrl = self.notebook.FindWindowById(armid.GOAL_LISTGOALREFINEMENTS_ID)
    self.subGoalAssociationCtrl = self.notebook.FindWindowById(armid.GOAL_LISTSUBGOALREFINEMENTS_ID)

    self.environmentList.Bind(wx.EVT_LIST_INSERT_ITEM,self.OnAddEnvironment)
    self.environmentList.Bind(wx.EVT_LIST_DELETE_ITEM,self.OnDeleteEnvironment)

    self.goalAssociationCtrl.Disable()
    self.subGoalAssociationCtrl.Disable()

    self.theEnvironmentDictionary[defaultEnv] = GoalEnvironmentProperties(defaultEnv)
    self.environmentList.Select(0)
    self.goalAssociationCtrl.setEnvironment(defaultEnv)
    self.goalAssociationCtrl.DeleteAllItems()
    self.subGoalAssociationCtrl.setEnvironment(defaultEnv)
    self.subGoalAssociationCtrl.DeleteAllItems()
    self.goalAssociationCtrl.Enable()
    self.subGoalAssociationCtrl.Enable()

  def OnEnvironmentSelected(self,evt):
    self.theSelectedIdx = evt.GetIndex()
    environmentName = self.environmentList.GetItemText(self.theSelectedIdx)
    p = self.theEnvironmentDictionary[environmentName]

    self.goalAssociationCtrl.setEnvironment(environmentName)
    self.goalAssociationCtrl.load(p.goalRefinements())
    self.subGoalAssociationCtrl.setEnvironment(environmentName)
    self.subGoalAssociationCtrl.load(p.subGoalRefinements())
    self.goalAssociationCtrl.Enable()
    self.subGoalAssociationCtrl.Enable()

  def OnEnvironmentDeselected(self,evt):
    self.theSelectedIdx = evt.GetIndex()
    environmentName = self.environmentList.GetItemText(self.theSelectedIdx)
    self.theEnvironmentDictionary[environmentName] = GoalEnvironmentProperties(environmentName,'',self.theGoalDefinition,self.theGoalCategory,self.theGoalPriority,self.theGoalFitCriterion,self.theGoalIssue,self.goalAssociationCtrl.dimensions(),self.subGoalAssociationCtrl.dimensions(),self.theGoalAssets,[])
    self.goalAssociationCtrl.DeleteAllItems()
    self.goalAssociationCtrl.setEnvironment('')
    self.subGoalAssociationCtrl.DeleteAllItems()
    self.subGoalAssociationCtrl.setEnvironment('')
    self.theSelectedIdx = -1
    self.goalAssociationCtrl.Disable()
    self.subGoalAssociationCtrl.Disable()

  def OnAddEnvironment(self,evt):
    self.theSelectedIdx = evt.GetIndex()
    environmentName = self.environmentList.GetItemText(self.theSelectedIdx)
    self.theEnvironmentDictionary[environmentName] = GoalEnvironmentProperties(environmentName)
    self.environmentList.Select(self.theSelectedIdx)
    self.goalAssociationCtrl.setEnvironment(environmentName)
    self.goalAssociationCtrl.DeleteAllItems()
    self.subGoalAssociationCtrl.setEnvironment(environmentName)
    self.subGoalAssociationCtrl.DeleteAllItems()
    self.goalAssociationCtrl.Enable()
    self.subGoalAssociationCtrl.Enable()
    inheritedEnv = self.environmentList.inheritedEnvironment()
    if (inheritedEnv != '' and self.theGoalId != None):
      p = self.dbProxy.inheritedGoalProperties(self.theGoalId,inheritedEnv)
      self.theEnvironmentDictionary[environmentName] = p
      self.goalAssociationCtrl.setEnvironment(environmentName)
      self.goalAssociationCtrl.load(p.goalRefinements())
      self.subGoalAssociationCtrl.setEnvironment(environmentName)
      self.subGoalAssociationCtrl.load(p.subGoalRefinements())

  def OnDeleteEnvironment(self,evt):
    selectedIdx = evt.GetIndex()
    environmentName = self.environmentList.GetItemText(selectedIdx)
    del self.theEnvironmentDictionary[environmentName]
    self.theSelectedIdx = -1
    self.goalAssociationCtrl.DeleteAllItems()
#.........这里部分代码省略.........
开发者ID:RachelLar,项目名称:CAIRIS-web,代码行数:103,代码来源:ReqToGoalEnvironmentPanel.py

示例3: ObstacleEnvironmentPanel

# 需要导入模块: from EnvironmentListCtrl import EnvironmentListCtrl [as 别名]
# 或者: from EnvironmentListCtrl.EnvironmentListCtrl import inheritedEnvironment [as 别名]

#.........这里部分代码省略.........
    self.labelCtrl.SetValue(p.label())
    self.probCtrl.SetValue(str(p.probability()))
    self.categoryCtrl.SetValue(p.category())
    self.definitionCtrl.SetValue(p.definition())
    self.goalAssociationCtrl.setEnvironment(environmentName)
    self.goalAssociationCtrl.load(p.goalRefinements())
    self.subGoalAssociationCtrl.setEnvironment(environmentName)
    self.concernsCtrl.setEnvironment(environmentName)
    self.subGoalAssociationCtrl.load(p.subGoalRefinements())
    self.concernsCtrl.load(p.concerns())

    self.categoryCtrl.Enable()
    self.definitionCtrl.Enable()
    self.goalAssociationCtrl.Enable()
    self.subGoalAssociationCtrl.Enable()
    self.concernsCtrl.Enable()

  def OnEnvironmentDeselected(self,evt):
    self.theSelectedIdx = evt.GetIndex()
    environmentName = self.environmentList.GetItemText(self.theSelectedIdx)
    self.theEnvironmentDictionary[environmentName] = ObstacleEnvironmentProperties(environmentName,self.labelCtrl.GetValue(),self.definitionCtrl.GetValue(),self.categoryCtrl.GetValue(),self.goalAssociationCtrl.dimensions(),self.subGoalAssociationCtrl.dimensions(),self.concernsCtrl.dimensions())
    self.labelCtrl.SetValue('')
    self.probCtrl.SetValue('')
    self.categoryCtrl.SetValue('')
    self.definitionCtrl.SetValue('')
    self.goalAssociationCtrl.DeleteAllItems()
    self.goalAssociationCtrl.setEnvironment('')
    self.subGoalAssociationCtrl.DeleteAllItems()
    self.concernsCtrl.DeleteAllItems()
    self.subGoalAssociationCtrl.setEnvironment('')
    self.concernsCtrl.setEnvironment('')
    self.theSelectedIdx = -1
    self.categoryCtrl.Disable()
    self.definitionCtrl.Disable()
    self.goalAssociationCtrl.Disable()
    self.subGoalAssociationCtrl.Disable()
    self.concernsCtrl.Disable()

  def OnAddEnvironment(self,evt):
    self.theSelectedIdx = evt.GetIndex()
    environmentName = self.environmentList.GetItemText(self.theSelectedIdx)
    self.theEnvironmentDictionary[environmentName] = ObstacleEnvironmentProperties(environmentName)
    self.environmentList.Select(self.theSelectedIdx)
    self.labelCtrl.SetValue('')
    self.probCtrl.SetValue('')
    self.categoryCtrl.SetValue('')
    self.definitionCtrl.SetValue('None')
    self.goalAssociationCtrl.setEnvironment(environmentName)
    self.goalAssociationCtrl.DeleteAllItems()
    self.subGoalAssociationCtrl.setEnvironment(environmentName)
    self.concernsCtrl.setEnvironment(environmentName)
    self.subGoalAssociationCtrl.DeleteAllItems()
    self.concernsCtrl.DeleteAllItems()
    self.categoryCtrl.Enable()
    self.definitionCtrl.Enable()
    self.goalAssociationCtrl.Enable()
    self.subGoalAssociationCtrl.Enable()
    self.concernsCtrl.Enable()
    inheritedEnv = self.environmentList.inheritedEnvironment()
    if (inheritedEnv != '' and self.theObstacleId != None):
      p = self.dbProxy.inheritedObstacleProperties(self.theObstacleId,inheritedEnv)
      self.theEnvironmentDictionary[environmentName] = p
      self.labelCtrl.SetValue(p.label())
      self.labelCtrl.SetValue(str(p.probability()))
      self.categoryCtrl.SetValue(p.category())
      self.definitionCtrl.SetValue(p.definition())
      self.goalAssociationCtrl.setEnvironment(environmentName)
      self.goalAssociationCtrl.load(p.goalRefinements())
      self.subGoalAssociationCtrl.setEnvironment(environmentName)
      self.concernsCtrl.setEnvironment(environmentName)
      self.subGoalAssociationCtrl.load(p.subGoalRefinements())
      self.concernsCtrl.load(p.concerns())

  def OnDeleteEnvironment(self,evt):
    selectedIdx = evt.GetIndex()
    environmentName = self.environmentList.GetItemText(selectedIdx)
    del self.theEnvironmentDictionary[environmentName]
    self.theSelectedIdx = -1
    self.labelCtrl.SetValue('')
    self.probCtrl.SetValue('')
    self.categoryCtrl.SetValue('')
    self.definitionCtrl.SetValue('')
    self.goalAssociationCtrl.DeleteAllItems()
    self.goalAssociationCtrl.setEnvironment('')
    self.subGoalAssociationCtrl.DeleteAllItems()
    self.subGoalAssociationCtrl.setEnvironment('')
    self.concernsCtrl.DeleteAllItems()
    self.concernsCtrl.setEnvironment('')
    self.categoryCtrl.Disable()
    self.definitionCtrl.Disable()
    self.goalAssociationCtrl.Disable()
    self.subGoalAssociationCtrl.Disable()
    self.concernsCtrl.Disable()


  def environmentProperties(self):
    if (self.theSelectedIdx != -1):
      environmentName = self.environmentList.GetItemText(self.theSelectedIdx)
      self.theEnvironmentDictionary[environmentName] = ObstacleEnvironmentProperties(environmentName,self.labelCtrl.GetValue(),self.definitionCtrl.GetValue(),self.categoryCtrl.GetValue(),self.goalAssociationCtrl.dimensions(),self.subGoalAssociationCtrl.dimensions(),self.concernsCtrl.dimensions())
    return self.theEnvironmentDictionary.values() 
开发者ID:AntonP1337,项目名称:cairis,代码行数:104,代码来源:ObstacleEnvironmentPanel.py

示例4: VulnerabilityEnvironmentPanel

# 需要导入模块: from EnvironmentListCtrl import EnvironmentListCtrl [as 别名]
# 或者: from EnvironmentListCtrl.EnvironmentListCtrl import inheritedEnvironment [as 别名]
class VulnerabilityEnvironmentPanel(wx.Panel):
  def __init__(self,parent,dp):
    wx.Panel.__init__(self,parent,armid.VULNERABILITY_PANELENVIRONMENT_ID)
    self.dbProxy = dp
    self.theVulId = None
    self.theEnvironmentDictionary = {}
    self.theSelectedIdx = -1

    mainSizer = wx.BoxSizer(wx.HORIZONTAL)
    environmentBox = wx.StaticBox(self)
    environmentListSizer = wx.StaticBoxSizer(environmentBox,wx.HORIZONTAL)
    mainSizer.Add(environmentListSizer,0,wx.EXPAND)
    self.environmentList = EnvironmentListCtrl(self,armid.VULNERABILITYENVIRONMENT_LISTENVIRONMENTS_ID,self.dbProxy)
    environmentListSizer.Add(self.environmentList,1,wx.EXPAND)

    environmentDimSizer = wx.BoxSizer(wx.VERTICAL)
    mainSizer.Add(environmentDimSizer,1,wx.EXPAND)

    sevBox = wx.StaticBox(self)
    sevSizer = wx.StaticBoxSizer(sevBox,wx.HORIZONTAL)
    environmentDimSizer.Add(sevSizer,0,wx.EXPAND)
    sevSizer.Add(wx.StaticText(self,-1,'Severity'))
    sevList = ['Negligible','Marginal','Critical','Catastrophic']
    self.sevCtrl = wx.ComboBox(self,armid.VULNERABILITYENVIRONMENT_COMBOSEVERITY_ID,choices=sevList,size=wx.DefaultSize,style=wx.CB_READONLY)
    sevSizer.Add(self.sevCtrl,1,wx.EXPAND) 

    aSizer = wx.BoxSizer(wx.HORIZONTAL)
    environmentDimSizer.Add(aSizer,1,wx.EXPAND)
    self.assetList = DimensionListCtrl(self,armid.VULNERABILITYENVIRONMENT_LISTASSETS_ID,wx.DefaultSize,'Asset','asset',self.dbProxy)
    assetBox = wx.StaticBox(self)
    assetSizer = wx.StaticBoxSizer(assetBox,wx.HORIZONTAL)
    assetSizer.Add(self.assetList,1,wx.EXPAND)
    aSizer.Add(assetSizer,1,wx.EXPAND)

    self.SetSizer(mainSizer)
    self.environmentList.Bind(wx.EVT_LIST_INSERT_ITEM,self.OnAddEnvironment)
    self.environmentList.Bind(wx.EVT_LIST_DELETE_ITEM,self.OnDeleteEnvironment)


  def loadControls(self,vulnerability):
    self.environmentList.Unbind(wx.EVT_LIST_ITEM_SELECTED)
    self.environmentList.Unbind(wx.EVT_LIST_ITEM_DESELECTED)
    self.theVulId = vulnerability.id()
# We load the environment name control before anything else.  Weird stuff happens if we don't do this.  Don't ask me why!!!
    environmentNames = []
    if (len(vulnerability.environmentProperties()) > 0):
      for cp in vulnerability.environmentProperties():
        environmentNames.append(cp.name())
      self.environmentList.load(environmentNames)
      for cp in vulnerability.environmentProperties():
        environmentName = cp.name()
        self.theEnvironmentDictionary[environmentName] = cp
      environmentName = environmentNames[0]
      p = self.theEnvironmentDictionary[environmentName]
      self.sevCtrl.SetStringSelection(p.severity())
      self.assetList.setEnvironment(environmentName)
      self.assetList.load(p.assets()) 
      self.environmentList.Select(0)

    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.sevCtrl.SetStringSelection(p.severity())
    self.assetList.setEnvironment(environmentName)
    self.assetList.load(p.assets()) 
      
  

  def OnEnvironmentDeselected(self,evt):
    self.theSelectedIdx = evt.GetIndex()
    environmentName = self.environmentList.GetItemText(self.theSelectedIdx)
    self.theEnvironmentDictionary[environmentName] = VulnerabilityEnvironmentProperties(environmentName,self.sevCtrl.GetValue(),self.assetList.dimensions())
    self.sevCtrl.SetValue('')
    self.assetList.setEnvironment('')
    self.assetList.DeleteAllItems() 
    self.theSelectedIdx = -1

  def OnAddEnvironment(self,evt):
    self.theSelectedIdx = evt.GetIndex()
    environmentName = self.environmentList.GetItemText(self.theSelectedIdx)
    self.theEnvironmentDictionary[environmentName] = VulnerabilityEnvironmentProperties(environmentName,'',[])
    self.environmentList.Select(self.theSelectedIdx)
    self.assetList.setEnvironment(environmentName)
    inheritedEnv = self.environmentList.inheritedEnvironment()
    if (inheritedEnv != '' and self.theVulId != None):
      p = self.dbProxy.inheritedVulnerabilityProperties(self.theVulId,inheritedEnv)
      self.theEnvironmentDictionary[environmentName] = p
      self.sevCtrl.SetStringSelection(p.severity())
      self.assetList.setEnvironment(environmentName)
      self.assetList.load(p.assets()) 

  def OnDeleteEnvironment(self,evt):
    selectedIdx = evt.GetIndex()
    environmentName = self.environmentList.GetItemText(selectedIdx)
    del self.theEnvironmentDictionary[environmentName]
#.........这里部分代码省略.........
开发者ID:RachelLar,项目名称:CAIRIS-web,代码行数:103,代码来源:VulnerabilityEnvironmentPanel.py

示例5: AssetEnvironmentPanel

# 需要导入模块: from EnvironmentListCtrl import EnvironmentListCtrl [as 别名]
# 或者: from EnvironmentListCtrl.EnvironmentListCtrl import inheritedEnvironment [as 别名]

#.........这里部分代码省略.........
    self.environmentList.Bind(wx.EVT_LIST_ITEM_DESELECTED,self.OnEnvironmentDeselected)

    self.propertiesList.Disable()
    self.associationCtrl.Disable()

  def loadControls(self,asset):
    self.theAssetId = asset.id()
    self.environmentList.Unbind(wx.EVT_LIST_ITEM_SELECTED)
    self.environmentList.Unbind(wx.EVT_LIST_ITEM_DESELECTED)
    noOfProperties = len(asset.environmentProperties())
    if (noOfProperties > 0):
      environmentNames = []
      for cp in asset.environmentProperties():
        environmentNames.append(cp.name())
      self.environmentList.load(environmentNames)

      for cp in asset.environmentProperties():
        environmentName = cp.name()
        self.theEnvironmentDictionary[environmentName] = cp
        environmentNames.append(environmentName) 
      environmentName = environmentNames[0]
      p = self.theEnvironmentDictionary[environmentName]
      self.propertiesList.setEnvironment(environmentName)
      self.propertiesList.load(p.properties(),p.rationale()) 
      self.associationCtrl.setEnvironment(environmentName)
      self.associationCtrl.load(p.associations()) 
      self.environmentList.Select(0)

    self.environmentList.Bind(wx.EVT_LIST_ITEM_SELECTED,self.OnEnvironmentSelected)
    self.environmentList.Bind(wx.EVT_LIST_ITEM_DESELECTED,self.OnEnvironmentDeselected)

    self.propertiesList.Enable()
    self.associationCtrl.Enable()
    if (noOfProperties > 0):
      self.theSelectedIdx = 0

  def OnEnvironmentSelected(self,evt):
    self.theSelectedIdx = evt.GetIndex()
    environmentName = self.environmentList.GetItemText(self.theSelectedIdx)
    p = self.theEnvironmentDictionary[environmentName]
    self.propertiesList.setEnvironment(environmentName)
    self.propertiesList.load(p.properties(),p.rationale())
    self.associationCtrl.setEnvironment(environmentName)
    self.associationCtrl.load(p.associations()) 
    self.propertiesList.Enable()
    self.associationCtrl.Enable()

  def OnEnvironmentDeselected(self,evt):
    self.theSelectedIdx = evt.GetIndex()
    environmentName = self.environmentList.GetItemText(self.theSelectedIdx)
    syProperties,pRationale = self.propertiesList.properties()
    self.theEnvironmentDictionary[environmentName] = AssetEnvironmentProperties(environmentName,syProperties,pRationale,self.associationCtrl.dimensions())
    self.propertiesList.setEnvironment('')
    self.propertiesList.DeleteAllItems() 
    self.associationCtrl.setEnvironment('')
    self.associationCtrl.DeleteAllItems() 
    self.propertiesList.Disable()
    self.associationCtrl.Disable()

    self.theSelectedIdx = -1

  def OnAddEnvironment(self,evt):
    self.theSelectedIdx = evt.GetIndex()
    environmentName = self.environmentList.GetItemText(self.theSelectedIdx)
    self.theEnvironmentDictionary[environmentName] = AssetEnvironmentProperties(environmentName,[0,0,0,0,0,0,0,0],['None','None','None','None','None','None','None','None'])
    self.environmentList.Select(self.theSelectedIdx)
    self.propertiesList.setEnvironment(environmentName)
    self.propertiesList.DeleteAllItems()
    self.associationCtrl.setEnvironment(environmentName)
    self.associationCtrl.DeleteAllItems()
    self.propertiesList.Enable()
    self.associationCtrl.Enable()
    inheritedEnv = self.environmentList.inheritedEnvironment()
    if (inheritedEnv != '' and self.theAssetId != None):
      p = self.dbProxy.inheritedAssetProperties(self.theAssetId,inheritedEnv)
      self.theEnvironmentDictionary[environmentName] = p
      self.propertiesList.setEnvironment(environmentName)
      self.propertiesList.load(p.properties(),p.rationale()) 
      self.associationCtrl.setEnvironment(environmentName)
      self.associationCtrl.load(p.associations())


  def OnDeleteEnvironment(self,evt):
    selectedIdx = evt.GetIndex()
    environmentName = self.environmentList.GetItemText(selectedIdx)
    del self.theEnvironmentDictionary[environmentName]
    self.theSelectedIdx = -1
    self.propertiesList.setEnvironment('')
    self.propertiesList.DeleteAllItems()
    self.associationCtrl.setEnvironment('')
    self.associationCtrl.DeleteAllItems()
    self.propertiesList.Disable()
    self.associationCtrl.Disable()

  def environmentProperties(self):
    if (self.theSelectedIdx != -1):
      environmentName = self.environmentList.GetItemText(self.theSelectedIdx)
      syProperties,pRationale = self.propertiesList.properties()
      self.theEnvironmentDictionary[environmentName] = AssetEnvironmentProperties(environmentName,syProperties,pRationale,self.associationCtrl.dimensions())
    return self.theEnvironmentDictionary.values() 
开发者ID:AntonP1337,项目名称:cairis,代码行数:104,代码来源:AssetEnvironmentPanel.py

示例6: TaskEnvironmentPanel

# 需要导入模块: from EnvironmentListCtrl import EnvironmentListCtrl [as 别名]
# 或者: from EnvironmentListCtrl.EnvironmentListCtrl import inheritedEnvironment [as 别名]

#.........这里部分代码省略.........
    self.benefitsCtrl.SetValue('')
    self.narrativeCtrl.setCodes({})
    self.consequencesCtrl.setCodes({})
    self.benefitsCtrl.setCodes({})
    self.theSelectedIdx = -1
    self.dependenciesCtrl.Disable()
    self.personaList.Disable() 
    self.assetList.Disable() 
    self.caList.Disable() 
    self.narrativeCtrl.Disable()
    self.consequencesCtrl.Disable()
    self.benefitsCtrl.Disable()

  def OnAddEnvironment(self,evt):
    self.theSelectedIdx = evt.GetIndex()
    environmentName = self.environmentList.GetItemText(self.theSelectedIdx)
    self.theEnvironmentDictionary[environmentName] = TaskEnvironmentProperties(environmentName)
    self.environmentList.Select(self.theSelectedIdx)
    self.personaList.setEnvironment(environmentName)
    self.assetList.setEnvironment(environmentName)
    self.caList.setEnvironment(environmentName)
    self.narrativeCtrl.setEnvironment(environmentName)
    self.personaList.DeleteAllItems() 
    self.assetList.DeleteAllItems() 
    self.caList.DeleteAllItems() 
    self.dependenciesCtrl.SetValue('')
    self.narrativeCtrl.SetValue('')
    self.consequencesCtrl.SetValue('')
    self.benefitsCtrl.SetValue('')
    self.narrativeCtrl.setCodes({})
    self.consequencesCtrl.setCodes({})
    self.benefitsCtrl.setCodes({})
    self.dependenciesCtrl.Enable()
    self.personaList.Enable() 
    self.assetList.Enable() 
    self.caList.Enable() 
    self.narrativeCtrl.Enable()
    self.consequencesCtrl.Enable()
    self.benefitsCtrl.Enable()
    inheritedEnv = self.environmentList.inheritedEnvironment()
    if (inheritedEnv != '' and self.theTaskId != None):
      p = self.dbProxy.inheritedTaskProperties(self.theTaskId,inheritedEnv)
      self.theEnvironmentDictionary[environmentName] = p
      self.dependenciesCtrl.SetValue(p.dependencies())
      self.personaList.setEnvironment(environmentName)
      self.assetList.setEnvironment(environmentName)
      self.caList.setEnvironment(environmentName)
      self.narrativeCtrl.setEnvironment(environmentName)
      self.personaList.load(p.personas()) 
      self.assetList.load(p.assets()) 
      self.caList.load(p.concernAssociations()) 
      self.narrativeCtrl.SetValue(p.narrative())
      self.consequencesCtrl.SetValue(p.consequences())
      self.benefitsCtrl.SetValue(p.benefits())
      self.narrativeCtrl.setCodes(p.codes('narrative'))
      self.consequencesCtrl.setCodes(p.codes('consequences'))
      self.benefitsCtrl.setCodes(p.codes('benefits'))

      self.dependenciesCtrl.Enable()
      self.personaList.Enable() 
      self.assetList.Enable() 
      self.caList.Enable() 
      self.narrativeCtrl.Enable()
      self.consequencesCtrl.Enable()
      self.benefitsCtrl.Enable()

  def OnDeleteEnvironment(self,evt):
    selectedIdx = evt.GetIndex()
    environmentName = self.environmentList.GetItemText(selectedIdx)
    del self.theEnvironmentDictionary[environmentName]
    self.theSelectedIdx = -1
    self.dependenciesCtrl.SetValue('')
    self.personaList.setEnvironment('')
    self.assetList.setEnvironment('')
    self.caList.setEnvironment('')
    self.narrativeCtrl.setEnvironment('')
    self.personaList.DeleteAllItems() 
    self.assetList.DeleteAllItems() 
    self.caList.DeleteAllItems() 
    self.narrativeCtrl.SetValue('')
    self.consequencesCtrl.SetValue('')
    self.benefitsCtrl.SetValue('')
    self.narrativeCtrl.setCodes({})
    self.consequencesCtrl.setCodes({})
    self.benefitsCtrl.setCodes({})
    self.dependenciesCtrl.Disable()
    self.personaList.Disable() 
    self.assetList.Disable() 
    self.caList.Disable() 
    self.narrativeCtrl.Disable()
    self.consequencesCtrl.Disable()
    self.benefitsCtrl.Disable()


  def environmentProperties(self):
    if (self.theSelectedIdx != -1):
      environmentName = self.environmentList.GetItemText(self.theSelectedIdx)
      envCodebook = {'narrative':self.narrativeCtrl.codes(),'consequences':self.consequencesCtrl.codes(),'benefits':self.benefitsCtrl.codes()}
      self.theEnvironmentDictionary[environmentName] = TaskEnvironmentProperties(environmentName,self.dependenciesCtrl.GetValue(),self.personaList.dimensions(),self.assetList.dimensions(),self.caList.dimensions(),self.narrativeCtrl.GetValue(),self.consequencesCtrl.GetValue(),self.benefitsCtrl.GetValue(),envCodebook)
    return self.theEnvironmentDictionary.values() 
开发者ID:InvalidToken,项目名称:CAIRIS,代码行数:104,代码来源:TaskEnvironmentPanel.py

示例7: UseCaseEnvironmentPanel

# 需要导入模块: from EnvironmentListCtrl import EnvironmentListCtrl [as 别名]
# 或者: from EnvironmentListCtrl.EnvironmentListCtrl import inheritedEnvironment [as 别名]

#.........这里部分代码省略.........
        self.postCondCtrl.setEnvironment(environmentName)
        self.postCondCtrl.setUseCase(self.theUseCaseName)

        self.environmentList.Select(0)
        self.environmentList.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnEnvironmentSelected)
        self.environmentList.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.OnEnvironmentDeselected)
        self.preCondCtrl.Enable()
        self.stepsCtrl.Enable()
        self.postCondCtrl.Enable()
        self.theSelectedIdx = 0

    def OnEnvironmentSelected(self, evt):
        self.theSelectedIdx = evt.GetIndex()
        environmentName = self.environmentList.GetItemText(self.theSelectedIdx)
        p = self.theEnvironmentDictionary[environmentName]

        self.preCondCtrl.SetValue(p.preconditions())
        self.stepsCtrl.reloadSteps(p.steps())
        self.postCondCtrl.SetValue(p.postconditions())
        self.stepsCtrl.setEnvironment(environmentName)
        self.preCondCtrl.setEnvironment(environmentName)
        self.preCondCtrl.setUseCase(self.theUseCaseName)
        self.postCondCtrl.setEnvironment(environmentName)
        self.postCondCtrl.setUseCase(self.theUseCaseName)
        self.preCondCtrl.Enable()
        self.stepsCtrl.Enable()
        self.postCondCtrl.Enable()

    def OnEnvironmentDeselected(self, evt):
        self.theSelectedIdx = evt.GetIndex()
        environmentName = self.environmentList.GetItemText(self.theSelectedIdx)
        self.theEnvironmentDictionary[environmentName] = UseCaseEnvironmentProperties(
            environmentName, self.preCondCtrl.GetValue(), self.stepsCtrl.steps(), self.postCondCtrl.GetValue()
        )
        self.preCondCtrl.SetValue("")
        self.stepsCtrl.clear()
        self.stepsCtrl.setEnvironment("")
        self.postCondCtrl.SetValue("")
        self.preCondCtrl.setEnvironment("")
        self.preCondCtrl.setUseCase("")
        self.postCondCtrl.setEnvironment("")
        self.postCondCtrl.setUseCase("")
        self.theSelectedIdx = -1
        self.preCondCtrl.Disable()
        self.stepsCtrl.Disable()
        self.postCondCtrl.Disable()

    def OnAddEnvironment(self, evt):
        self.theSelectedIdx = evt.GetIndex()
        environmentName = self.environmentList.GetItemText(self.theSelectedIdx)
        self.theEnvironmentDictionary[environmentName] = UseCaseEnvironmentProperties(environmentName)
        self.environmentList.Select(self.theSelectedIdx)
        self.preCondCtrl.SetValue("")
        self.stepsCtrl.setEnvironment(environmentName)
        self.stepsCtrl.clear()
        self.postCondCtrl.SetValue("")
        self.preCondCtrl.setEnvironment(environmentName)
        self.preCondCtrl.setUseCase(self.theUseCaseName)
        self.postCondCtrl.setEnvironment(environmentName)
        self.postCondCtrl.setUseCase(self.theUseCaseName)
        inheritedEnv = self.environmentList.inheritedEnvironment()
        if inheritedEnv != "" and self.theUseCaseId != None:
            p = self.dbProxy.inheritedUseCaseProperties(self.theUseCaseId, inheritedEnv)
            self.theEnvironmentDictionary[environmentName] = p
            self.preCondCtrl.SetValue(p.preconditions())
            self.stepsCtrl.reloadSteps(p.steps())
            self.stepsCtrl.setEnvironment(environmentName)
            self.postCondCtrl.SetValue(p.preconditions())
            self.preCondCtrl.setEnvironment(environmentName)
            self.preCondCtrl.setUseCase(self.theUseCaseName)
            self.postCondCtrl.setEnvironment(environmentName)
            self.postCondCtrl.setUseCase(self.theUseCaseName)
        self.preCondCtrl.Enable()
        self.stepsCtrl.Enable()
        self.postCondCtrl.Enable()

    def OnDeleteEnvironment(self, evt):
        selectedIdx = evt.GetIndex()
        environmentName = self.environmentList.GetItemText(selectedIdx)
        del self.theEnvironmentDictionary[environmentName]
        self.theSelectedIdx = -1
        self.preCondCtrl.SetValue("")
        self.stepsCtrl.clear()
        self.stepsCtrl.setEnvironment("")
        self.postCondCtrl.SetValue("")
        self.preCondCtrl.setEnvironment("")
        self.preCondCtrl.setUseCase("")
        self.postCondCtrl.setEnvironment("")
        self.postCondCtrl.setUseCase("")
        self.preCondCtrl.Disable()
        self.stepsCtrl.Disable()
        self.postCondCtrl.Disable()

    def environmentProperties(self):
        if self.theSelectedIdx != -1:
            environmentName = self.environmentList.GetItemText(self.theSelectedIdx)
            self.theEnvironmentDictionary[environmentName] = UseCaseEnvironmentProperties(
                environmentName, self.preCondCtrl.GetValue(), self.stepsCtrl.steps(), self.postCondCtrl.GetValue()
            )
        return self.theEnvironmentDictionary.values()
开发者ID:RachelLar,项目名称:cairis_update,代码行数:104,代码来源:UseCaseEnvironmentPanel.py

示例8: AttackerEnvironmentPanel

# 需要导入模块: from EnvironmentListCtrl import EnvironmentListCtrl [as 别名]
# 或者: from EnvironmentListCtrl.EnvironmentListCtrl import inheritedEnvironment [as 别名]
class AttackerEnvironmentPanel(wx.Panel):
  def __init__(self,parent,dp):
    wx.Panel.__init__(self,parent,armid.ATTACKER_PANELENVIRONMENT_ID)
    self.dbProxy = dp
    self.theAttackerId = None
    self.theEnvironmentDictionary = {}
    self.theSelectedIdx = -1

    mainSizer = wx.BoxSizer(wx.HORIZONTAL)
    environmentBox = wx.StaticBox(self)
    environmentListSizer = wx.StaticBoxSizer(environmentBox,wx.HORIZONTAL)
    mainSizer.Add(environmentListSizer,0,wx.EXPAND)
    self.environmentList = EnvironmentListCtrl(self,armid.ATTACKERENVIRONMENT_LISTENVIRONMENTS_ID,self.dbProxy)
    environmentListSizer.Add(self.environmentList,1,wx.EXPAND)
    environmentDimSizer = wx.BoxSizer(wx.VERTICAL)
    mainSizer.Add(environmentDimSizer,1,wx.EXPAND)
    rmSizer = wx.BoxSizer(wx.HORIZONTAL)
    environmentDimSizer.Add(rmSizer,1,wx.EXPAND)
    self.roleList = DimensionListCtrl(self,armid.ATTACKERENVIRONMENT_LISTROLES_ID,wx.DefaultSize,'Role','role',self.dbProxy)
    roleBox = wx.StaticBox(self)
    roleSizer = wx.StaticBoxSizer(roleBox,wx.HORIZONTAL)
    roleSizer.Add(self.roleList,1,wx.EXPAND)
    rmSizer.Add(roleSizer,1,wx.EXPAND)

    self.motiveList = DimensionListCtrl(self,armid.ATTACKERENVIRONMENT_LISTMOTIVES_ID,wx.DefaultSize,'Motive','motivation',self.dbProxy)
    motiveBox = wx.StaticBox(self)
    motiveSizer = wx.StaticBoxSizer(motiveBox,wx.HORIZONTAL)
    motiveSizer.Add(self.motiveList,1,wx.EXPAND)
    rmSizer.Add(motiveSizer,1,wx.EXPAND)
    capBox = wx.StaticBox(self)
    capSizer = wx.StaticBoxSizer(capBox,wx.HORIZONTAL)
    environmentDimSizer.Add(capSizer,1,wx.EXPAND)
    self.capabilitiesList = CapabilitiesListCtrl(self,armid.ATTACKERENVIRONMENT_LISTCAPABILITIES_ID,self.dbProxy)
    capSizer.Add(self.capabilitiesList,1,wx.EXPAND)
    self.SetSizer(mainSizer)
    self.environmentList.Bind(wx.EVT_LIST_INSERT_ITEM,self.OnAddEnvironment)
    self.environmentList.Bind(wx.EVT_LIST_DELETE_ITEM,self.OnDeleteEnvironment)


  def loadControls(self,attacker):
    self.environmentList.Unbind(wx.EVT_LIST_ITEM_SELECTED)
    self.environmentList.Unbind(wx.EVT_LIST_ITEM_DESELECTED)
    self.theAttackerId = attacker.id()
    environmentNames = []
    for cp in attacker.environmentProperties():
      environmentNames.append(cp.name())
    self.environmentList.load(environmentNames)

    for cp in attacker.environmentProperties():
      environmentName = cp.name()
      self.theEnvironmentDictionary[environmentName] = cp
      environmentNames.append(environmentName) 
    environmentName = environmentNames[0]
    p = self.theEnvironmentDictionary[environmentName]
    self.roleList.setEnvironment(environmentName)
    self.roleList.load(p.roles()) 
    self.motiveList.setEnvironment(environmentName)
    self.motiveList.load(p.motives()) 
    self.capabilitiesList.setEnvironment(environmentName)
    self.capabilitiesList.load(p.capabilities())
    self.environmentList.Select(0)
    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.roleList.setEnvironment(environmentName)
    self.roleList.load(p.roles()) 
    self.motiveList.setEnvironment(environmentName)
    self.motiveList.load(p.motives()) 
    self.capabilitiesList.setEnvironment(environmentName)
    self.capabilitiesList.load(p.capabilities())

  def OnEnvironmentDeselected(self,evt):
    self.theSelectedIdx = evt.GetIndex()
    environmentName = self.environmentList.GetItemText(self.theSelectedIdx)
    self.theEnvironmentDictionary[environmentName] = AttackerEnvironmentProperties(environmentName,self.roleList.dimensions(),self.motiveList.dimensions(),self.capabilitiesList.capabilities())

    self.roleList.setEnvironment('')
    self.roleList.DeleteAllItems() 
    self.motiveList.setEnvironment('')
    self.motiveList.DeleteAllItems() 
    self.capabilitiesList.setEnvironment('')
    self.capabilitiesList.DeleteAllItems()
    self.theSelectedIdx = -1

  def OnAddEnvironment(self,evt):
    self.theSelectedIdx = evt.GetIndex()
    environmentName = self.environmentList.GetItemText(self.theSelectedIdx)
    self.theEnvironmentDictionary[environmentName] = AttackerEnvironmentProperties(environmentName,[],[],[])
    self.environmentList.Select(self.theSelectedIdx)
    self.capabilitiesList.setEnvironment(environmentName)
    inheritedEnv = self.environmentList.inheritedEnvironment()
    if (inheritedEnv != '' and self.theAttackerId != None):
      p = self.dbProxy.inheritedAttackerProperties(self.theAttackerId,inheritedEnv)
      self.theEnvironmentDictionary[environmentName] = p
      self.roleList.setEnvironment(environmentName)
#.........这里部分代码省略.........
开发者ID:RachelLar,项目名称:CAIRIS-web,代码行数:103,代码来源:AttackerEnvironmentPanel.py


注:本文中的EnvironmentListCtrl.EnvironmentListCtrl.inheritedEnvironment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。