def __init__(self,parent,fromName = '',toName = '',rType = ''):
    wx.Dialog.__init__(self,parent,CODERELATIONSHIP_ID,'Add Code Relationship',style=wx.DEFAULT_DIALOG_STYLE|wx.MAXIMIZE_BOX|wx.THICK_FRAME|wx.RESIZE_BORDER,size=(400,200))

    self.rtLookup = {'==':'associated','=>':'implies','<>':'conflict','[]':'part-of'}
    self.lookupRt = {'':'','associated':'==','implies':'=>','conflict':'<>','part-of':'[]'}

    self.theFromName = fromName
    self.theToName = toName
    self.theRelationship = self.lookupRt[rType]
    self.commitLabel = 'Add'
    mainSizer = wx.BoxSizer(wx.VERTICAL)


    b = Borg()
    codeList = b.dbProxy.getDimensionNames('code')
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'From',(87,30),CODERELATIONSHIP_COMBOFROMCODE_ID,codeList),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'To',(87,30),CODERELATIONSHIP_COMBOTOCODE_ID,codeList),0,wx.EXPAND)
    rtList = ['==','=>','<>','[]']
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Relationship',(87,30),CODERELATIONSHIP_COMBORTTYPE_ID,rtList),0,wx.EXPAND)
    mainSizer.Add(wx.StaticText(self,-1,''),1,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildAddCancelButtonSizer(self,CODERELATIONSHIP_BUTTONADD_ID),0,wx.ALIGN_CENTER)
    self.SetSizer(mainSizer)
    wx.EVT_BUTTON(self,CODERELATIONSHIP_BUTTONADD_ID,self.onCommit)

    if self.theFromName != '':
      fromCtrl = self.FindWindowById(CODERELATIONSHIP_COMBOFROMCODE_ID)
      toCtrl = self.FindWindowById(CODERELATIONSHIP_COMBOTOCODE_ID)
      rtCtrl = self.FindWindowById(CODERELATIONSHIP_COMBORTTYPE_ID)
      fromCtrl.SetValue(self.theFromName)
      toCtrl.SetValue(self.theToName)
      rtCtrl.SetValue(self.theRelationship)
  def __init__(self,parent,taskName,personaName,duration,frequency,demands,goalSupport):
    wx.Dialog.__init__(self,parent,TASKPERSONA_ID,'Add Task Persona',style=wx.DEFAULT_DIALOG_STYLE|wx.MAXIMIZE_BOX|wx.THICK_FRAME|wx.RESIZE_BORDER,size=(400,400))
    self.theDuration = ''
    self.theFrequency = ''
    self.theDemands = ''
    self.theGoalSupport = ''
    mainSizer = wx.BoxSizer(wx.VERTICAL)

    suPropertyValues = ['High Help','Medium Help','Low Help','None','Low Hindrance','Medium Hindrance','High Hindrance']
    mainSizer.Add(WidgetFactory.buildTextSizer(self,'Task',(87,30),COUNTERMEASURETASKPERSONA_TEXTTASK_ID,isReadOnly = True),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildTextSizer(self,'Persona',(87,30),COUNTERMEASURETASKPERSONA_TEXTPERSONA_ID,isReadOnly = True),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Duration',(87,30),COUNTERMEASURETASKPERSONA_COMBODURATION_ID,suPropertyValues),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Frequency',(87,30),COUNTERMEASURETASKPERSONA_COMBOFREQUENCY_ID,suPropertyValues),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Demands',(87,30),COUNTERMEASURETASKPERSONA_COMBODEMANDS_ID,suPropertyValues),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Goal Conflict',(87,30),COUNTERMEASURETASKPERSONA_COMBOGOALSUPPORT_ID,suPropertyValues),0,wx.EXPAND)
    mainSizer.Add(wx.StaticText(self,-1),1,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildAddCancelButtonSizer(self,COUNTERMEASURETASKPERSONA_BUTTONADD_ID),0,wx.ALIGN_CENTER)
    self.SetSizer(mainSizer)

    wx.EVT_BUTTON(self,COUNTERMEASURETASKPERSONA_BUTTONADD_ID,self.onAdd)
   
    taskCtrl = self.FindWindowById(COUNTERMEASURETASKPERSONA_TEXTTASK_ID)
    taskCtrl.SetValue(taskName)
    personaCtrl = self.FindWindowById(COUNTERMEASURETASKPERSONA_TEXTPERSONA_ID)
    personaCtrl.SetValue(personaName)
    durCtrl = self.FindWindowById(COUNTERMEASURETASKPERSONA_COMBODURATION_ID)
    durCtrl.SetStringSelection(duration)
    freqCtrl = self.FindWindowById(COUNTERMEASURETASKPERSONA_COMBOFREQUENCY_ID)
    freqCtrl.SetStringSelection(frequency)
    demCtrl = self.FindWindowById(COUNTERMEASURETASKPERSONA_COMBODEMANDS_ID)
    demCtrl.SetStringSelection(demands)
    gsupCtrl = self.FindWindowById(COUNTERMEASURETASKPERSONA_COMBOGOALSUPPORT_ID)
    gsupCtrl.SetStringSelection(goalSupport)
  def __init__(self,parent,setPersonas,currentEnvironmentName,dp,pName='',pDur='',pFreq='',pDem='',pGsup=''):
    wx.Dialog.__init__(self,parent,TASKPERSONA_ID,'Add Task Persona',style=wx.DEFAULT_DIALOG_STYLE|wx.MAXIMIZE_BOX|wx.THICK_FRAME|wx.RESIZE_BORDER,size=(400,300))
    self.theName = pName
    self.theDuration = pDur
    self.theFrequency = pFreq
    self.theDemands = pDem
    self.theGoalSupport = pGsup
    mainSizer = wx.BoxSizer(wx.VERTICAL)
    personaList = dp.getDimensionNames('persona',currentEnvironmentName)

    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Name',(87,30),TASKPERSONA_COMBONAME_ID,personaList),0,wx.EXPAND)
    suList = ['None','Low','Medium','High']
    durationList = ['Seconds','Minutes','Hours or longer']
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Duration',(87,30),TASKPERSONA_COMBODURATION_ID,durationList),0,wx.EXPAND)
    freqList = ['Hourly or more','Daily - Weekly','Monthly or less']
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Frequency',(87,30),TASKPERSONA_COMBOFREQUENCY_ID,freqList),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Demands',(87,30),TASKPERSONA_COMBODEMANDS_ID,suList),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Goal Conflict',(87,30),TASKPERSONA_COMBOGOALSUPPORT_ID,suList),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildAddCancelButtonSizer(self,TASKPERSONA_BUTTONADD_ID),0,wx.ALIGN_CENTER)
    if (self.theName != ''):
      self.SetLabel('Edit Task Persona')
      nameCtrl = self.FindWindowById(TASKPERSONA_COMBONAME_ID)
      nameCtrl.SetValue(self.theName)
      durCtrl = self.FindWindowById(TASKPERSONA_COMBODURATION_ID)
      durCtrl.SetStringSelection(self.theDuration)
      freqCtrl = self.FindWindowById(TASKPERSONA_COMBOFREQUENCY_ID)
      freqCtrl.SetStringSelection(self.theFrequency)
      demCtrl = self.FindWindowById(TASKPERSONA_COMBODEMANDS_ID)
      demCtrl.SetStringSelection(self.theDemands)
      gsupCtrl = self.FindWindowById(TASKPERSONA_COMBOGOALSUPPORT_ID)
      gsupCtrl.SetStringSelection(self.theGoalSupport)
    self.SetSizer(mainSizer)

    wx.EVT_BUTTON(self,TASKPERSONA_BUTTONADD_ID,self.onAdd)
Exemple #4
0
 def __init__(self, parent):
     wx.Panel.__init__(self, parent, armid.STEPSYNOPSIS_ID)
     b = Borg()
     self.dbProxy = b.dbProxy
     mainSizer = wx.BoxSizer(wx.VERTICAL)
     mainSizer.Add(
         WidgetFactory.buildTextSizer(self, "Synopsis", (87, 30), armid.STEPSYNOPSIS_TEXTSYNOPSIS_ID), 0, wx.EXPAND
     )
     actorSizer = wx.BoxSizer(wx.HORIZONTAL)
     mainSizer.Add(actorSizer, 0, wx.EXPAND)
     actorSizer.Add(
         WidgetFactory.buildComboSizerList(
             self, "Actor Type", (87, 30), armid.STEPSYNOPSIS_COMBOACTORTYPE_ID, ["asset", "role"]
         ),
         1,
         wx.EXPAND,
     )
     actorSizer.Add(
         WidgetFactory.buildComboSizerList(self, "Actor", (87, 30), armid.STEPSYNOPSIS_COMBOACTORNAME_ID, [""]),
         1,
         wx.EXPAND,
     )
     mainSizer.Add(wx.StaticText(self, -1, ""), 1, wx.EXPAND)
     mainSizer.Add(
         WidgetFactory.buildCommitButtonSizer(self, armid.STEPSYNOPSIS_BUTTONCOMMIT_ID, True), 0, wx.ALIGN_CENTER
     )
     self.SetSizer(mainSizer)
     wx.EVT_COMBOBOX(self, armid.STEPSYNOPSIS_COMBOACTORTYPE_ID, self.onActorType)
  def buildControls(self,parameters):
    mainSizer = wx.BoxSizer(wx.VERTICAL)
    associationSizer = wx.BoxSizer(wx.VERTICAL)
    mainSizer.Add(associationSizer,0,wx.EXPAND)
    environments = self.dbProxy.getDimensionNames('environment')
    assets = []
    navs = ['0','1','-1']

    associationTypes = []
    associationTypes = ['Inheritance','Association','Aggregation','Composition','Dependency']
    multiplicityTypes = ['1','*','1..*']

    associationSizer.Add(WidgetFactory.buildComboSizerList(self,'Environment',(87,30),CLASSASSOCIATION_COMBOENVIRONMENT_ID,environments),0,wx.EXPAND)
    associationSizer.Add(WidgetFactory.buildComboSizerList(self,'Head',(87,30),CLASSASSOCIATION_COMBOHEADASSET_ID,assets),0,wx.EXPAND)
    associationSizer.Add(WidgetFactory.buildComboSizerList(self,'Navigation',(87,30),CLASSASSOCIATION_COMBOHEADNAV_ID,navs),0,wx.EXPAND)
    associationSizer.Add(WidgetFactory.buildComboSizerList(self,'Adornment',(87,30),CLASSASSOCIATION_COMBOHEADTYPE_ID,associationTypes),0,wx.EXPAND)
    associationSizer.Add(WidgetFactory.buildComboSizerList(self,'nry',(87,30),CLASSASSOCIATION_COMBOHEADMULTIPLICITY_ID,multiplicityTypes),0,wx.EXPAND)
    associationSizer.Add(WidgetFactory.buildTextSizer(self,'Role',(87,30),CLASSASSOCIATION_TEXTHEADROLE_ID),0,wx.EXPAND)
    associationSizer.Add(WidgetFactory.buildTextSizer(self,'Role',(87,30),CLASSASSOCIATION_TEXTTAILROLE_ID),0,wx.EXPAND)
    associationSizer.Add(WidgetFactory.buildComboSizerList(self,'nry',(87,30),CLASSASSOCIATION_COMBOTAILMULTIPLICITY_ID,multiplicityTypes),0,wx.EXPAND)
    associationSizer.Add(WidgetFactory.buildComboSizerList(self,'Adornment',(87,30),CLASSASSOCIATION_COMBOTAILTYPE_ID,associationTypes),0,wx.EXPAND)
    associationSizer.Add(WidgetFactory.buildComboSizerList(self,'Navigation',(87,30),CLASSASSOCIATION_COMBOTAILNAV_ID,navs),0,wx.EXPAND)
    associationSizer.Add(WidgetFactory.buildComboSizerList(self,'Tail',(87,30),CLASSASSOCIATION_COMBOTAILASSET_ID,assets),0,wx.EXPAND)
    mainSizer.Add(wx.StaticText(self,-1),1,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildAddCancelButtonSizer(self,CLASSASSOCIATION_BUTTONCOMMIT_ID),0,wx.ALIGN_CENTER)
    self.SetSizer(mainSizer)

    wx.EVT_BUTTON(self,CLASSASSOCIATION_BUTTONCOMMIT_ID,self.onCommit)
    wx.EVT_COMBOBOX(self,CLASSASSOCIATION_COMBOENVIRONMENT_ID,self.onEnvironmentChange)
  def __init__(self,parent,setCapabilities,dp):
    wx.Dialog.__init__(self,parent,armid.CAPABILITY_ID,'Add Capability',style=wx.DEFAULT_DIALOG_STYLE|wx.MAXIMIZE_BOX|wx.THICK_FRAME|wx.RESIZE_BORDER,size=(400,150))
    self.theCapabilityName = ''
    self.theCapabilityValue = ''
    mainSizer = wx.BoxSizer(wx.VERTICAL)
    defaultCapabilities = set(dp.getDimensionNames('capability'))
    capabilityList = list(defaultCapabilities.difference(setCapabilities))
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Capability',(87,30),armid.CAPABILITY_COMBOCAPABILITY_ID,capabilityList),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Value',(87,30),armid.CAPABILITY_COMBOVALUE_ID,['Low','Medium','High']),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildAddCancelButtonSizer(self,armid.CAPABILITY_BUTTONADD_ID),0,wx.ALIGN_CENTER)
    self.SetSizer(mainSizer)

    wx.EVT_BUTTON(self,armid.CAPABILITY_BUTTONADD_ID,self.onAdd)
  def __init__(self,parent):
    wx.Dialog.__init__(self,parent,RESPONSECOST_ID,'Add Response Cost',style=wx.DEFAULT_DIALOG_STYLE|wx.MAXIMIZE_BOX|wx.THICK_FRAME|wx.RESIZE_BORDER,size=(400,100))
    b = Borg()
    self.dbProxy = b.dbProxy
    self.theResponseName = ''
    self.theResponseCost = ''
    mainSizer = wx.BoxSizer(wx.VERTICAL)
    responseList = self.dbProxy.getDimensionNames('response')
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Response',(87,30),RESPONSECOST_COMBORESPONSE_ID,responseList),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Cost',(87,30),RESPONSECOST_COMBOCOST_ID,['Low','Medium','High']),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildAddCancelButtonSizer(self,RESPONSECOST_BUTTONADD_ID),0,wx.ALIGN_CENTER)
    self.SetSizer(mainSizer)

    wx.EVT_BUTTON(self,RESPONSECOST_BUTTONADD_ID,self.onAdd)
  def __init__(self,parent,dp,envName,subGoal='',subGoalDim='',refinement='',alternate='',rationale='',isGoal=False):
    wx.Dialog.__init__(self,parent,GOALREFINEMENT_ID,'Add Goal Refinement',style=wx.DEFAULT_DIALOG_STYLE|wx.MAXIMIZE_BOX|wx.THICK_FRAME|wx.RESIZE_BORDER,size=(400,400))
    self.dbProxy = dp
    self.theCurrentEnvironment = envName
    self.theGoal = subGoal
    self.theGoalDimension = subGoalDim
    self.theRefinement = refinement
    self.theAlternateFlag = alternate
    self.theRationale = rationale
    mainSizer = wx.BoxSizer(wx.VERTICAL)
    goals = self.dbProxy.environmentGoals(self.theCurrentEnvironment)
    goals += self.dbProxy.environmentObstacles(self.theCurrentEnvironment)
    goals += self.dbProxy.environmentDomainProperties(self.theCurrentEnvironment)
    reqList = self.dbProxy.getOrderedRequirements()
    for req in reqList:
      goals += [req.label()]
    refNames = ['and','or','conflict','responsible','obstruct','resolve']
    altNames = ['Yes','No']
    goalDims = ['goal','task','usecase','requirement','obstacle','domainproperty','threat','vulnerability','role','misusecase']
    goalTitle = 'Sub-Goal'
    if isGoal == True:
      goalTitle = 'Goal'
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Type',(87,30),GOALREFINEMENT_COMBOGOALDIMENSION_ID,goalDims),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,goalTitle,(87,30),GOALREFINEMENT_COMBOGOAL_ID,goals),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Refinement',(87,30),GOALREFINEMENT_COMBOREFINEMENT_ID,refNames),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Alternate',(87,30),GOALREFINEMENT_COMBOALTERNATE_ID,altNames),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildMLTextSizer(self,'Rationale',(87,60),GOALREFINEMENT_TEXTRATIONALE_ID),1,wx.EXPAND,1,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildAddCancelButtonSizer(self,GOALREFINEMENT_BUTTONCOMMIT_ID),0,wx.ALIGN_CENTER)
    self.SetSizer(mainSizer)

    wx.EVT_COMBOBOX(self,GOALREFINEMENT_COMBOGOALDIMENSION_ID,self.onDimChange)
    wx.EVT_BUTTON(self,GOALREFINEMENT_BUTTONCOMMIT_ID,self.onCommit)
    self.commitLabel = 'Add'
    if (len(self.theGoal) > 0):
      self.commitLabel = 'Edit'
      self.SetLabel('Edit Goal Refinement')
      subGoalCtrl = self.FindWindowById(GOALREFINEMENT_COMBOGOAL_ID)
      subGoalCtrl.SetStringSelection(self.theGoal)
      dimCtrl = self.FindWindowById(GOALREFINEMENT_COMBOGOALDIMENSION_ID)
      dimCtrl.SetStringSelection(self.theGoalDimension)
      refCtrl = self.FindWindowById(GOALREFINEMENT_COMBOREFINEMENT_ID)
      refCtrl.SetStringSelection(self.theRefinement)
      altCtrl = self.FindWindowById(GOALREFINEMENT_COMBOALTERNATE_ID)
      altCtrl.SetStringSelection(self.theAlternateFlag)
      ratCtrl = self.FindWindowById(GOALREFINEMENT_TEXTRATIONALE_ID)
      ratCtrl.SetValue(self.theRationale)
      buttonCtrl = self.FindWindowById(GOALREFINEMENT_BUTTONCOMMIT_ID)
      buttonCtrl.SetLabel('Edit')
  def __init__(self,parent,firstName = '',surname='',affiliation='',role=''):
    wx.Dialog.__init__(self,parent,CONTRIBUTORENTRY_ID,'Add Contributor',style=wx.DEFAULT_DIALOG_STYLE|wx.MAXIMIZE_BOX|wx.THICK_FRAME|wx.RESIZE_BORDER,size=(500,300))
    self.theFirstName = firstName
    self.theSurname = surname
    self.theAffiliation = affiliation
    self.theRole = role
    mainSizer = wx.BoxSizer(wx.VERTICAL)

    mainSizer.Add(WidgetFactory.buildTextSizer(self,'Firstname',(87,30),CONTRIBUTORENTRY_TEXTFIRSTNAME_ID),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildTextSizer(self,'Surname',(87,30),CONTRIBUTORENTRY_TEXTSURNAME_ID),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildTextSizer(self,'Affiliation',(87,30),CONTRIBUTORENTRY_TEXTAFFILIATION_ID),0,wx.EXPAND)
    participantRoles = ['Participant','Facilitator','Scribe']
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Role',(87,30),CONTRIBUTORENTRY_COMBOROLE_ID,participantRoles),0,wx.EXPAND)
    mainSizer.Add(wx.StaticText(self,-1),1,wx.EXPAND)

    mainSizer.Add(WidgetFactory.buildAddCancelButtonSizer(self,CONTRIBUTORENTRY_BUTTONCOMMIT_ID),0,wx.ALIGN_CENTER)
    self.SetSizer(mainSizer)

    wx.EVT_BUTTON(self,CONTRIBUTORENTRY_BUTTONCOMMIT_ID,self.onCommit)
    self.commitLabel = 'Add'
    if (len(self.theFirstName) > 0):
      self.commitLabel = 'Edit'
      self.SetLabel('Edit Contributor')
      firstNameCtrl = self.FindWindowById(CONTRIBUTORENTRY_TEXTFIRSTNAME_ID)
      firstNameCtrl.SetValue(self.theFirstName)
      surnameCtrl = self.FindWindowById(CONTRIBUTORENTRY_TEXTSURNAME_ID)
      surnameCtrl.SetValue(self.theSurname)
      affiliationCtrl = self.FindWindowById(CONTRIBUTORENTRY_TEXTAFFILIATION_ID)
      affiliationCtrl.SetValue(self.theAffiliation)
      roleCtrl = self.FindWindowById(CONTRIBUTORENTRY_COMBOROLE_ID)
      roleCtrl.SetStringSelection(self.theRole)
      buttonCtrl = self.FindWindowById(CONTRIBUTORENTRY_BUTTONCOMMIT_ID)
      buttonCtrl.SetLabel('Edit')
Exemple #10
0
  def __init__(self,parent,envName):
    wx.Panel.__init__(self,parent,EXCEPTION_ID)
    b = Borg()
    self.dbProxy = b.dbProxy
    self.theEnvironmentName = envName
    mainSizer = wx.BoxSizer(wx.VERTICAL)
    mainSizer.Add(WidgetFactory.buildTextSizer(self,'Name',(87,30),EXCEPTION_TEXTNAME_ID),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildRadioButtonSizer(self,'Type',(87,30),[(EXCEPTION_RADIOGOAL_ID,'Goal'),(EXCEPTION_RADIOREQUIREMENT_ID,'Requirement')]))
    goalList = self.dbProxy.environmentGoals(self.theEnvironmentName)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Values',(87,30),EXCEPTION_COMBOGOALS_ID,goalList),0,wx.EXPAND)
    catList = ['Confidentiality Threat','Integrity Threat','Availability Threat','Accountability Threat','Anonymity Threat','Pseudonymity Threat','Unlinkability Threat','Unobservability Threat','Vulnerability','Duration','Frequency','Demands','Goal Support']
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Category',(87,30),EXCEPTION_COMBOCATEGORY_ID,catList),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildMLTextSizer(self,'Definition',(87,30),EXCEPTION_TEXTDEFINITION_ID),1,wx.EXPAND)
    self.SetSizer(mainSizer)

    wx.EVT_RADIOBUTTON(self,EXCEPTION_RADIOGOAL_ID,self.onGoalSelected)
    wx.EVT_RADIOBUTTON(self,EXCEPTION_RADIOREQUIREMENT_ID,self.onRequirementSelected)
  def __init__(self,parent,ciName,elName,currentValue):
    wx.Dialog.__init__(self,parent,armid.CHARACTERISTICREFERENCETYPE_ID,'Edit Characteristic Reference Type',style=wx.DEFAULT_DIALOG_STYLE|wx.MAXIMIZE_BOX|wx.THICK_FRAME|wx.RESIZE_BORDER,size=(300,400))

    self.theElementName = elName
    self.theValue = currentValue
    mainSizer = wx.BoxSizer(wx.VERTICAL)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Characteristic Reference Type',(87,30),armid.CHARACTERISTICREFERENCETYPE_COMBOVALUE_ID,['grounds','warrant','rebuttal']),0,wx.EXPAND)
    
    mainSizer.Add(WidgetFactory.buildTextSizer(self,'Characteristic Intention',(87,30),armid.CHARACTERISTICREFERENCETYPE_TEXTCHARINTENT_ID),0,wx.EXPAND)
    ciCtrl = self.FindWindowById(armid.CHARACTERISTICREFERENCETYPE_TEXTCHARINTENT_ID)
    ciCtrl.Disable()

    mainSizer.Add(WidgetFactory.buildTextSizer(self,'Intention',(87,30),armid.CHARACTERISTICREFERENCETYPE_TEXTINTENTION_ID),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Intention Type',(87,30),armid.CHARACTERISTICREFERENCETYPE_COMBOINTTYPE_ID,['goal','softgoal']),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Means/End',(87,30),armid.CHARACTERISTICREFERENCETYPE_COMBOMEANSEND_ID,['means','end']),0,wx.EXPAND)
    contType = ['Make','SomePositive','Help','Hurt','SomeNegative','Break']
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Contribution',(87,30),armid.CHARACTERISTICREFERENCETYPE_COMBOCONTRIBUTION_ID,contType),0,wx.EXPAND)
  
    mainSizer.Add(wx.StaticText(self,-1,''),1,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildCommitButtonSizer(self,armid.CHARACTERISTICREFERENCETYPE_BUTTONCOMMIT_ID,False),0,wx.ALIGN_CENTER)
    self.SetSizer(mainSizer)
    wx.EVT_BUTTON(self,armid.CHARACTERISTICREFERENCETYPE_BUTTONCOMMIT_ID,self.onCommit)
    self.valueCtrl = self.FindWindowById(armid.CHARACTERISTICREFERENCETYPE_COMBOVALUE_ID)
    self.valueCtrl.SetValue(currentValue)

    self.ciCtrl = self.FindWindowById(armid.CHARACTERISTICREFERENCETYPE_TEXTCHARINTENT_ID)
    self.ciCtrl.SetValue(ciName)

    self.intCtrl = self.FindWindowById(armid.CHARACTERISTICREFERENCETYPE_TEXTINTENTION_ID)
    self.intTypeCtrl = self.FindWindowById(armid.CHARACTERISTICREFERENCETYPE_COMBOINTTYPE_ID)
    self.meCtrl = self.FindWindowById(armid.CHARACTERISTICREFERENCETYPE_COMBOMEANSEND_ID)
    self.contCtrl = self.FindWindowById(armid.CHARACTERISTICREFERENCETYPE_COMBOCONTRIBUTION_ID)

    b = Borg()
    intDetails = b.dbProxy.impliedCharacteristicElementIntention(ciName,elName)
    intName = intDetails[0]
    intDim = intDetails[1] 
    meName = intDetails[2]
    contName = intDetails[3]

    if intName != '':
      self.intCtrl.SetValue(intName)
      self.intTypeCtrl.SetValue(intDim)
      self.meCtrl.SetValue(meName)
      self.contCtrl.SetValue(contName) 
  def __init__(self,parent,setProperties,values):
    wx.Dialog.__init__(self,parent,armid.PROPERTY_ID,'Add Security Property',style=wx.DEFAULT_DIALOG_STYLE|wx.MAXIMIZE_BOX|wx.THICK_FRAME|wx.RESIZE_BORDER,size=(400,300))

    weights = {"Confidentiality":0,"Integrity":1,"Availability":2,"Accountability":3,"Anonymity":4,"Pseudonymity":5,"Unlinkability":6,"Unobservability":7}
    self.thePropertyName = ''
    self.thePropertyValue = ''
    self.thePropertyRationale = 'None'
    self.commitLabel = 'Add'
    mainSizer = wx.BoxSizer(wx.VERTICAL)
#    defaultProperties = set(['Confidentiality','Integrity','Availability','Accountability','Anonymity','Pseudonymity','Unlinkability','Unobservability'])
    defaultProperties = set(weights.keys())
    propertyList = sorted(list(defaultProperties.difference(setProperties)), key=lambda x:weights[x])
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Property',(87,30),armid.PROPERTY_COMBOPROPERTY_ID,propertyList),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Value',(87,30),armid.PROPERTY_COMBOVALUE_ID,values),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildMLTextSizer(self,'Rationale',(87,60),armid.PROPERTY_TEXTRATIONALE_ID),1,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildAddCancelButtonSizer(self,armid.PROPERTY_BUTTONADD_ID),0,wx.ALIGN_CENTER)
    self.SetSizer(mainSizer)
    wx.EVT_BUTTON(self,armid.PROPERTY_BUTTONADD_ID,self.onCommit)
Exemple #13
0
 def __init__(self,parent,reqList,setTargets,envName):
   wx.Dialog.__init__(self,parent,PROPERTY_ID,'Add Target',style=wx.DEFAULT_DIALOG_STYLE|wx.MAXIMIZE_BOX|wx.THICK_FRAME|wx.RESIZE_BORDER,size=(400,250))
   b = Borg()
   self.dbProxy = b.dbProxy
   self.theTarget = ''
   self.theEffectiveness = ''
   self.theRationale = ''
   self.commitLabel = 'Add'
   mainSizer = wx.BoxSizer(wx.VERTICAL)
   self.theTargetDictionary = self.dbProxy.targetNames(reqList,envName)
   defaultTargets = set(self.theTargetDictionary.keys())
   targetList = list(defaultTargets.difference(setTargets))
   mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Target',(87,30),TARGET_COMBOTARGET_ID,targetList),0,wx.EXPAND)
   mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Effectiveness',(87,30),TARGET_COMBOEFFECTIVENESS_ID,['None','Low','Medium','High']),0,wx.EXPAND)
   mainSizer.Add(WidgetFactory.buildMLTextSizer(self,'Rationale',(87,60),TARGET_TEXTRATIONALE_ID),1,wx.EXPAND)
   mainSizer.Add(WidgetFactory.buildAddCancelButtonSizer(self,TARGET_BUTTONCOMMIT_ID),0,wx.ALIGN_CENTER)
   self.SetSizer(mainSizer)
   wx.EVT_BUTTON(self,TARGET_BUTTONCOMMIT_ID,self.onCommit)
  def __init__(self,parent,dp,envName,assetProperties,headNav = 0,headAdornment = '',headNry = '',headRole='',tailRole='',tailNry='',tailAdornment='',tailNav = 0,tailName = ''):
    wx.Dialog.__init__(self,parent,ASSETASSOCIATION_ID,'Add Asset Association',style=wx.DEFAULT_DIALOG_STYLE|wx.MAXIMIZE_BOX|wx.THICK_FRAME|wx.RESIZE_BORDER,size=(400,500))
    self.dbProxy = dp
    self.theAssetProperties = assetProperties
    self.theCurrentEnvironment = envName
    self.theHeadNav = int(headNav)
    self.theHeadAdornment = headAdornment
    self.theHeadNry = headNry
    self.theHeadRole = headRole
    self.theTailRole = tailRole
    self.theTailNry = tailNry
    self.theTailAdornment = tailAdornment
    self.theTailNav = int(tailNav)
    self.theTailName = tailName
    mainSizer = wx.BoxSizer(wx.VERTICAL)
    assets = self.dbProxy.environmentAssets(self.theCurrentEnvironment)
    associationTypes = ['Inheritance','Association','Aggregation','Composition','Dependency']
    multiplicityTypes = ['1','*','1..*']
    navs = ['0','1','-1']

    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Navigation',(87,30),ASSETASSOCIATION_COMBOHEADNAV_ID,navs),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Adornment',(87,30),ASSETASSOCIATION_COMBOHEADTYPE_ID,associationTypes),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'nry',(87,30),ASSETASSOCIATION_COMBOHEADMULTIPLICITY_ID,multiplicityTypes),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildTextSizer(self,'Role',(87,30),ASSETASSOCIATION_TEXTHEADROLE_ID),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildTextSizer(self,'Role',(87,30),ASSETASSOCIATION_TEXTTAILROLE_ID),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'nry',(87,30),ASSETASSOCIATION_COMBOTAILMULTIPLICITY_ID,multiplicityTypes),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Adornment',(87,30),ASSETASSOCIATION_COMBOTAILTYPE_ID,associationTypes),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Navigation',(87,30),ASSETASSOCIATION_COMBOTAILNAV_ID,navs),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Tail',(87,30),ASSETASSOCIATION_COMBOTAILASSET_ID,assets),0,wx.EXPAND)

    mainSizer.Add(WidgetFactory.buildAddCancelButtonSizer(self,ASSETASSOCIATION_BUTTONCOMMIT_ID),0,wx.ALIGN_CENTER)
    self.SetSizer(mainSizer)

    wx.EVT_BUTTON(self,ASSETASSOCIATION_BUTTONCOMMIT_ID,self.onCommit)
    self.commitLabel = 'Add'
    if (len(self.theTailName) > 0):
      self.commitLabel = 'Edit'
      self.SetLabel('Edit Asset Association')
      headNavCtrl = self.FindWindowById(ASSETASSOCIATION_COMBOHEADNAV_ID)
      headNavCtrl.SetValue(str(self.theHeadNav))
      headTypeCtrl = self.FindWindowById(ASSETASSOCIATION_COMBOHEADTYPE_ID)
      headTypeCtrl.SetValue(self.theHeadAdornment)
      headNryCtrl = self.FindWindowById(ASSETASSOCIATION_COMBOHEADMULTIPLICITY_ID)
      headNryCtrl.SetValue(self.theHeadNry)
      headRoleCtrl = self.FindWindowById(ASSETASSOCIATION_TEXTHEADROLE_ID)
      headRoleCtrl.SetValue(self.theHeadRole)
      tailRoleCtrl = self.FindWindowById(ASSETASSOCIATION_TEXTTAILROLE_ID)
      tailRoleCtrl.SetValue(self.theTailRole)
      tailNryCtrl = self.FindWindowById(ASSETASSOCIATION_COMBOTAILMULTIPLICITY_ID)
      tailNryCtrl.SetValue(self.theTailNry)
      tailTypeCtrl = self.FindWindowById(ASSETASSOCIATION_COMBOTAILTYPE_ID)
      tailTypeCtrl.SetValue(self.theTailAdornment)
      tailNavCtrl = self.FindWindowById(ASSETASSOCIATION_COMBOTAILNAV_ID)
      tailNavCtrl.SetValue(str(self.theTailNav))
      tailCtrl = self.FindWindowById(ASSETASSOCIATION_COMBOTAILASSET_ID)
      tailCtrl.SetValue(self.theTailName)
      buttonCtrl = self.FindWindowById(ASSETASSOCIATION_BUTTONCOMMIT_ID)
      buttonCtrl.SetLabel('Edit')
Exemple #15
0
 def buildControls(self,isCreate):
   mainSizer = wx.BoxSizer(wx.VERTICAL)
   mainSizer.Add(WidgetFactory.buildTextSizer(self,'Name',(87,30),armid.ROLE_TEXTNAME_ID),0,wx.EXPAND)
   mainSizer.Add(WidgetFactory.buildTextSizer(self,'Short Code',(87,30),armid.ROLE_TEXTSHORTCODE_ID),0,wx.EXPAND)
   roleTypes = self.dbProxy.getDimensionNames('role_type')
   mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Type',(87,30),armid.ROLE_COMBOTYPE_ID,roleTypes),0,wx.EXPAND)
   mainSizer.Add(WidgetFactory.buildMLTextSizer(self,'Description',(87,80),armid.ROLE_TEXTDESCRIPTION_ID),0,wx.EXPAND)
   mainSizer.Add(RoleEnvironmentPanel(self,self.dbProxy),1,wx.EXPAND)
   mainSizer.Add(WidgetFactory.buildCommitButtonSizer(self,armid.ROLE_BUTTONCOMMIT_ID,isCreate),0,wx.ALIGN_CENTER)
   self.SetSizer(mainSizer)
  def __init__(self,parent):
    wx.Dialog.__init__(self,parent,DOMAINENTRY_ID,'Add domain interface',style=wx.DEFAULT_DIALOG_STYLE|wx.MAXIMIZE_BOX|wx.THICK_FRAME|wx.RESIZE_BORDER,size=(300,300))
    b = Borg()
    self.dbProxy = b.dbProxy
    self.theDomain = ''
    self.theConnectionDomain = ''
    self.thePhenomena = ''
    mainSizer = wx.BoxSizer(wx.VERTICAL)

    domList = self.dbProxy.getDimensionNames('domain')
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Domain',(87,30),DOMAINENTRY_COMBODOMAIN_ID,domList),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildTextSizer(self,'Phenomena',(87,30),DOMAINENTRY_TEXTPHENOMENA_ID),0,wx.EXPAND)
    cdList = [''] + domList
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Connection Domain',(87,30),DOMAINENTRY_COMBOCONNECTIONDOMAIN_ID,cdList),0,wx.EXPAND)
    mainSizer.Add(wx.StaticText(self,-1),1,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildAddCancelButtonSizer(self,DOMAINENTRY_BUTTONCOMMIT_ID),0,wx.ALIGN_CENTER)
    self.SetSizer(mainSizer)

    wx.EVT_BUTTON(self,DOMAINENTRY_BUTTONCOMMIT_ID,self.onCommit)
    self.commitLabel = 'Add'
Exemple #17
0
  def buildControls(self,parameters):
    mainSizer = wx.BoxSizer(wx.VERTICAL)
    associationSizer = wx.BoxSizer(wx.HORIZONTAL)
    mainSizer.Add(associationSizer,0,wx.EXPAND)
    environments = self.dbProxy.getDimensionNames('environment')
    roles = self.dbProxy.getDimensionNames('role')
    self.dependencyTypes = ['goal','task','asset']
    self.dependencies = []
    associationSizer.Add(WidgetFactory.buildComboSizerList(self,'Environment',(150,30),DEPENDENCY_COMBOENVIRONMENT_ID,environments),0,wx.EXPAND)
    associationSizer.Add(WidgetFactory.buildComboSizerList(self,'Depender',(200,30),DEPENDENCY_COMBODEPENDER_ID,roles),0,wx.EXPAND)
    associationSizer.Add(WidgetFactory.buildComboSizerList(self,'Dependee',(200,30),DEPENDENCY_COMBODEPENDEE_ID,roles),0,wx.EXPAND)
    associationSizer.Add(WidgetFactory.buildComboSizerList(self,'Type',(87,30),DEPENDENCY_COMBODTYPE_ID,self.dependencyTypes),0,wx.EXPAND)
    associationSizer.Add(WidgetFactory.buildComboSizerList(self,'Dependency',(200,30),DEPENDENCY_COMBODEPENDENCY_ID,self.dependencies),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildMLTextSizer(self,'Rationale',(87,60),DEPENDENCY_TEXTRATIONALE_ID),1,wx.EXPAND,1,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildAddCancelButtonSizer(self,DEPENDENCY_BUTTONCOMMIT_ID),0,wx.ALIGN_CENTER)
    self.SetSizer(mainSizer)

    wx.EVT_BUTTON(self,DEPENDENCY_BUTTONCOMMIT_ID,self.onCommit)
    wx.EVT_COMBOBOX(self,DEPENDENCY_COMBOENVIRONMENT_ID,self.onEnvironmentChange)
    wx.EVT_COMBOBOX(self,DEPENDENCY_COMBODTYPE_ID,self.onDependencyTypeChange)
Exemple #18
0
  def buildControls(self,isCreate,isUpdateable=True):
    mainSizer = wx.BoxSizer(wx.VERTICAL)
    allDimensionNames = self.dbProxy.getDimensionNames('trace_dimension')
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'From artifact',(87,30),TRACE_COMBOFROMOBJECT_ID,allDimensionNames),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'From name',(87,30),TRACE_COMBOFROMNAME_ID,[]),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'To artifact',(87,30),TRACE_COMBOTOOBJECT_ID,allDimensionNames),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'To name',(87,30),TRACE_COMBOTONAME_ID,[]),0,wx.EXPAND)
    mainSizer.Add(wx.StaticText(self,-1,''),1,wx.EXPAND)
    if (isUpdateable):
      mainSizer.Add(WidgetFactory.buildCommitButtonSizer(self,TRACE_BUTTONCOMMIT_ID,isCreate),0,wx.ALIGN_CENTRE)
    self.SetSizer(mainSizer)

    self.fromObjectCombo = self.FindWindowById(TRACE_COMBOFROMOBJECT_ID)
    self.fromNameCombo = self.FindWindowById(TRACE_COMBOFROMNAME_ID)
    self.toObjectCombo = self.FindWindowById(TRACE_COMBOTOOBJECT_ID)
    self.toNameCombo = self.FindWindowById(TRACE_COMBOTONAME_ID)

    self.fromObjectCombo.Bind(wx.EVT_COMBOBOX,self.onFromObjectChange)
    self.fromNameCombo.Bind(wx.EVT_COMBOBOX,self.onFromNameChange)
    self.toObjectCombo.Bind(wx.EVT_COMBOBOX,self.onToObjectChange)
    self.toNameCombo.Bind(wx.EVT_COMBOBOX,self.onToNameChange)
  def buildControls(self,parameters):
    mainSizer = wx.BoxSizer(wx.VERTICAL)
    associationSizer = wx.BoxSizer(wx.HORIZONTAL)
    mainSizer.Add(WidgetFactory.buildCheckSizer(self,'Alternative',GOALASSOCIATION_CHECKALTERNATIVE_ID,False),0,wx.EXPAND)
    mainSizer.Add(associationSizer,0,wx.EXPAND)
    environments = self.dbProxy.getDimensionNames('environment')
    goals = []
    associationTypes = ['and','or','conflict','responsible','obstruct','resolve']
    goalDimensions = ['goal','requirement','countermeasure','obstacle']
    subGoalDimensions = ['goal','requirement','role','task','usecase','countermeasure','domainproperty','obstacle','threat','vulnerability']

    associationSizer.Add(WidgetFactory.buildComboSizerList(self,'Environment',(87,30),GOALASSOCIATION_COMBOENVIRONMENT_ID,environments),0,wx.EXPAND)
    associationSizer.Add(WidgetFactory.buildComboSizerList(self,'Dimension',(87,30),GOALASSOCIATION_COMBOGOALDIM_ID,goalDimensions),0,wx.EXPAND)
    associationSizer.Add(WidgetFactory.buildComboSizerList(self,'Goal',(87,30),GOALASSOCIATION_COMBOGOAL_ID,goals),0,wx.EXPAND)
    associationSizer.Add(WidgetFactory.buildComboSizerList(self,'Type',(87,30),GOALASSOCIATION_COMBOATYPE_ID,associationTypes),0,wx.EXPAND)
    associationSizer.Add(WidgetFactory.buildComboSizerList(self,'Dimension',(87,30),GOALASSOCIATION_COMBOSUBGOALDIM_ID,subGoalDimensions),0,wx.EXPAND)
    associationSizer.Add(WidgetFactory.buildComboSizerList(self,'Sub-Goal',(87,30),GOALASSOCIATION_COMBOSUBGOAL_ID,goals),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildMLTextSizer(self,'Rationale',(87,60),GOALASSOCIATION_TEXTRATIONALE_ID),1,wx.EXPAND,1,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildAddCancelButtonSizer(self,GOALASSOCIATION_BUTTONCOMMIT_ID),0,wx.ALIGN_CENTER)
    self.SetSizer(mainSizer)

    wx.EVT_BUTTON(self,GOALASSOCIATION_BUTTONCOMMIT_ID,self.onCommit)
    wx.EVT_COMBOBOX(self,GOALASSOCIATION_COMBOENVIRONMENT_ID,self.onEnvironmentChange)
    wx.EVT_COMBOBOX(self,GOALASSOCIATION_COMBOGOALDIM_ID,self.onGoalDimChange)
    wx.EVT_COMBOBOX(self,GOALASSOCIATION_COMBOSUBGOALDIM_ID,self.onSubGoalDimChange)
  def __init__(self,parent,dp,envName,source='',sourceMultiplicity='',link='',target='',targetMultiplicity=''):
    wx.Dialog.__init__(self,parent,CONCERNASSOCIATION_ID,'Add Concern Association',style=wx.DEFAULT_DIALOG_STYLE|wx.MAXIMIZE_BOX|wx.THICK_FRAME|wx.RESIZE_BORDER,size=(400,400))
    self.dbProxy = dp
    self.theCurrentEnvironment = envName
    self.theSource = source
    self.theSourceMultiplicity = sourceMultiplicity
    self.theLink = link
    self.theTarget = target
    self.theTargetMultiplicity = targetMultiplicity
    mainSizer = wx.BoxSizer(wx.VERTICAL)
    assets = self.dbProxy.environmentAssets(self.theCurrentEnvironment)
    mTypes = ['1','*','1..*']
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'n',(87,30),CONCERNASSOCIATION_COMBOSOURCEMULTIPLICITY_ID,mTypes),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Source',(87,30),CONCERNASSOCIATION_COMBOSOURCE_ID,assets),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildTextSizer(self,'Link',(87,60),CONCERNASSOCIATION_TEXTLINK_ID),0,wx.EXPAND,1,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'n',(87,30),CONCERNASSOCIATION_COMBOTARGETMULTIPLICITY_ID,mTypes),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Target',(87,30),CONCERNASSOCIATION_COMBOTARGET_ID,assets),0,wx.EXPAND)
    mainSizer.Add(wx.StaticText(self,-1),1,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildAddCancelButtonSizer(self,CONCERNASSOCIATION_BUTTONCOMMIT_ID),0,wx.ALIGN_CENTER)
    self.SetSizer(mainSizer)

    wx.EVT_BUTTON(self,CONCERNASSOCIATION_BUTTONCOMMIT_ID,self.onCommit)
    self.commitLabel = 'Add'
    if (len(self.theSource) > 0):
      self.commitLabel = 'Edit'
      self.SetLabel('Edit Concern Association')
      smCtrl = self.FindWindowById(CONCERNASSOCIATION_COMBOSOURCEMULTIPLICITY_ID)
      smCtrl.SetStringSelection(self.theSourceMultiplicity)
      sCtrl = self.FindWindowById(CONCERNASSOCIATION_COMBOSOURCE_ID)
      sCtrl.SetStringSelection(self.theSource)
      lCtrl = self.FindWindowById(CONCERNASSOCIATION_TEXTLINK_ID)
      lCtrl.SetValue(self.theLink)
      tmCtrl = self.FindWindowById(CONCERNASSOCIATION_COMBOTARGETMULTIPLICITY_ID)
      tmCtrl.SetStringSelection(self.theTargetMultiplicity)
      tCtrl = self.FindWindowById(CONCERNASSOCIATION_COMBOTARGET_ID)
      tCtrl.SetStringSelection(self.theTarget)
      buttonCtrl = self.FindWindowById(CONCERNASSOCIATION_BUTTONCOMMIT_ID)
      buttonCtrl.SetLabel('Edit')
Exemple #21
0
  def __init__(self,parent):
    wx.Panel.__init__(self,parent)
    topSizer = wx.BoxSizer(wx.VERTICAL)
    typeList = ['Causal','Biddable','Lexical']

    givenBox = wx.StaticBox(self,-1,'Given Domain')
    givenSizer = wx.StaticBoxSizer(givenBox,wx.HORIZONTAL)
    topSizer.Add(givenSizer,0,wx.EXPAND)
    self.givenCtrl = wx.CheckBox(self,DOMAIN_CHECKGIVEN_ID)
    self.givenCtrl.SetValue(True)
    givenSizer.Add(self.givenCtrl,0,wx.EXPAND)
    topSizer.Add(WidgetFactory.buildComboSizerList(self,'Type',(87,30),DOMAIN_COMBOTYPE_ID,typeList),0,wx.EXPAND)
    topSizer.Add(WidgetFactory.buildTextSizer(self,'Short Code',(87,30),DOMAIN_TEXTSHORTCODE_ID),0,wx.EXPAND)
    topSizer.Add(WidgetFactory.buildMLTextSizer(self,'Description',(87,30),DOMAIN_TEXTDESCRIPTION_ID),1,wx.EXPAND)
    self.SetSizer(topSizer)
    self.Bind(wx.EVT_COMBOBOX, self.onDomainTypeChange,id = DOMAIN_COMBOTYPE_ID)
  def __init__(self,parent,headName = '',headAdornment = '',headNav = '',headNry = '',headRole='',tailRole='',tailNry='',tailNav = '',tailAdornment='',tailName = ''):
    wx.Dialog.__init__(self,parent,armid.PATTERNSTRUCTURE_ID,'Add Structure',style=wx.DEFAULT_DIALOG_STYLE|wx.MAXIMIZE_BOX|wx.THICK_FRAME|wx.RESIZE_BORDER,size=(400,575))
    b = Borg()
    self.dbProxy = b.dbProxy
    self.theHeadName = headName
    self.theHeadAdornment = headAdornment
    self.theHeadNav = headNav
    self.theHeadNry = headNry
    self.theHeadRole = headRole
    self.theTailRole = tailRole
    self.theTailNry = tailNry
    self.theTailNav = tailNav
    self.theTailAdornment = tailAdornment
    self.theTailName = tailName
    mainSizer = wx.BoxSizer(wx.VERTICAL)
    assets = self.dbProxy.getDimensionNames('template_asset')
    associationTypes = ['Inheritance','Association','Aggregation','Composition','Dependency']
    multiplicityTypes = ['1','*','1..*']
    navTypes = ['1','0']

    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Head',(87,30),armid.PATTERNSTRUCTURE_COMBOHEADASSET_ID,assets),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Adornment',(87,30),armid.PATTERNSTRUCTURE_COMBOHEADTYPE_ID,associationTypes),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Nav',(87,30),armid.PATTERNSTRUCTURE_COMBOHEADNAV_ID,navTypes),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'nry',(87,30),armid.PATTERNSTRUCTURE_COMBOHEADMULTIPLICITY_ID,multiplicityTypes),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildTextSizer(self,'Role',(87,30),armid.PATTERNSTRUCTURE_TEXTHEADROLE_ID),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildTextSizer(self,'Role',(87,30),armid.PATTERNSTRUCTURE_TEXTTAILROLE_ID),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'nry',(87,30),armid.PATTERNSTRUCTURE_COMBOTAILMULTIPLICITY_ID,multiplicityTypes),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Nav',(87,30),armid.PATTERNSTRUCTURE_COMBOTAILNAV_ID,navTypes),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Adornment',(87,30),armid.PATTERNSTRUCTURE_COMBOTAILTYPE_ID,associationTypes),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Tail',(87,30),armid.PATTERNSTRUCTURE_COMBOTAILASSET_ID,assets),0,wx.EXPAND)

    mainSizer.Add(WidgetFactory.buildAddCancelButtonSizer(self,armid.PATTERNSTRUCTURE_BUTTONCOMMIT_ID),0,wx.ALIGN_CENTER)
    self.SetSizer(mainSizer)

    wx.EVT_BUTTON(self,armid.PATTERNSTRUCTURE_BUTTONCOMMIT_ID,self.onCommit)
    self.commitLabel = 'Add'
    if (len(self.theTailName) > 0):
      self.commitLabel = 'Edit'
      self.SetLabel('Edit Asset Association')
      headCtrl = self.FindWindowById(armid.PATTERNSTRUCTURE_COMBOHEADASSET_ID)
      headCtrl.SetStringSelection(self.theHeadName)
      headTypeCtrl = self.FindWindowById(armid.PATTERNSTRUCTURE_COMBOHEADTYPE_ID)
      headTypeCtrl.SetStringSelection(self.theTailAdornment)
      headNavCtrl = self.FindWindowById(armid.PATTERNSTRUCTURE_COMBOHEADNAV_ID)
      headNavCtrl.SetStringSelection(self.theTailNav)
      headNryCtrl = self.FindWindowById(armid.PATTERNSTRUCTURE_COMBOHEADMULTIPLICITY_ID)
      headNryCtrl.SetStringSelection(self.theTailNry)
      headRoleCtrl = self.FindWindowById(armid.PATTERNSTRUCTURE_TEXTHEADROLE_ID)
      headRoleCtrl.SetValue(self.theTailRole)
      tailRoleCtrl = self.FindWindowById(armid.PATTERNSTRUCTURE_TEXTTAILROLE_ID)
      tailRoleCtrl.SetValue(self.theHeadRole)
      tailNryCtrl = self.FindWindowById(armid.PATTERNSTRUCTURE_COMBOTAILMULTIPLICITY_ID)
      tailNryCtrl.SetStringSelection(self.theHeadNry)
      tailNavCtrl = self.FindWindowById(armid.PATTERNSTRUCTURE_COMBOTAILNAV_ID)
      tailNavCtrl.SetStringSelection(self.theHeadNav)
      tailTypeCtrl = self.FindWindowById(armid.PATTERNSTRUCTURE_COMBOTAILTYPE_ID)
      tailTypeCtrl.SetStringSelection(self.theHeadAdornment)
      tailCtrl = self.FindWindowById(armid.PATTERNSTRUCTURE_COMBOTAILASSET_ID)
      tailCtrl.SetStringSelection(self.theTailName)
      buttonCtrl = self.FindWindowById(armid.PATTERNSTRUCTURE_BUTTONCOMMIT_ID)
      buttonCtrl.SetLabel('Edit')
    def __init__(self, parent, taskName, personaName, duration, frequency,
                 demands, goalSupport):
        wx.Dialog.__init__(self,
                           parent,
                           armid.TASKPERSONA_ID,
                           'Add Task Persona',
                           style=wx.DEFAULT_DIALOG_STYLE | wx.MAXIMIZE_BOX
                           | wx.THICK_FRAME | wx.RESIZE_BORDER,
                           size=(400, 400))
        self.theDuration = ''
        self.theFrequency = ''
        self.theDemands = ''
        self.theGoalSupport = ''
        mainSizer = wx.BoxSizer(wx.VERTICAL)

        suPropertyValues = [
            'High Help', 'Medium Help', 'Low Help', 'None', 'Low Hindrance',
            'Medium Hindrance', 'High Hindrance'
        ]
        mainSizer.Add(
            WidgetFactory.buildTextSizer(
                self,
                'Task', (87, 30),
                armid.COUNTERMEASURETASKPERSONA_TEXTTASK_ID,
                isReadOnly=True), 0, wx.EXPAND)
        mainSizer.Add(
            WidgetFactory.buildTextSizer(
                self,
                'Persona', (87, 30),
                armid.COUNTERMEASURETASKPERSONA_TEXTPERSONA_ID,
                isReadOnly=True), 0, wx.EXPAND)
        mainSizer.Add(
            WidgetFactory.buildComboSizerList(
                self, 'Duration', (87, 30),
                armid.COUNTERMEASURETASKPERSONA_COMBODURATION_ID,
                suPropertyValues), 0, wx.EXPAND)
        mainSizer.Add(
            WidgetFactory.buildComboSizerList(
                self, 'Frequency', (87, 30),
                armid.COUNTERMEASURETASKPERSONA_COMBOFREQUENCY_ID,
                suPropertyValues), 0, wx.EXPAND)
        mainSizer.Add(
            WidgetFactory.buildComboSizerList(
                self, 'Demands', (87, 30),
                armid.COUNTERMEASURETASKPERSONA_COMBODEMANDS_ID,
                suPropertyValues), 0, wx.EXPAND)
        mainSizer.Add(
            WidgetFactory.buildComboSizerList(
                self, 'Goal Conflict', (87, 30),
                armid.COUNTERMEASURETASKPERSONA_COMBOGOALSUPPORT_ID,
                suPropertyValues), 0, wx.EXPAND)
        mainSizer.Add(wx.StaticText(self, -1), 1, wx.EXPAND)
        mainSizer.Add(
            WidgetFactory.buildAddCancelButtonSizer(
                self, armid.COUNTERMEASURETASKPERSONA_BUTTONADD_ID), 0,
            wx.ALIGN_CENTER)
        self.SetSizer(mainSizer)

        wx.EVT_BUTTON(self, armid.COUNTERMEASURETASKPERSONA_BUTTONADD_ID,
                      self.onAdd)

        taskCtrl = self.FindWindowById(
            armid.COUNTERMEASURETASKPERSONA_TEXTTASK_ID)
        taskCtrl.SetValue(taskName)
        personaCtrl = self.FindWindowById(
            armid.COUNTERMEASURETASKPERSONA_TEXTPERSONA_ID)
        personaCtrl.SetValue(personaName)
        durCtrl = self.FindWindowById(
            armid.COUNTERMEASURETASKPERSONA_COMBODURATION_ID)
        durCtrl.SetStringSelection(duration)
        freqCtrl = self.FindWindowById(
            armid.COUNTERMEASURETASKPERSONA_COMBOFREQUENCY_ID)
        freqCtrl.SetStringSelection(frequency)
        demCtrl = self.FindWindowById(
            armid.COUNTERMEASURETASKPERSONA_COMBODEMANDS_ID)
        demCtrl.SetStringSelection(demands)
        gsupCtrl = self.FindWindowById(
            armid.COUNTERMEASURETASKPERSONA_COMBOGOALSUPPORT_ID)
        gsupCtrl.SetStringSelection(goalSupport)
  def __init__(self,parent,headName = '',headAdornment = '',headNav = '',headNry = '',headRole='',tailRole='',tailNry='',tailNav = '',tailAdornment='',tailName = ''):
    wx.Dialog.__init__(self,parent,PATTERNSTRUCTURE_ID,'Add Structure',style=wx.DEFAULT_DIALOG_STYLE|wx.MAXIMIZE_BOX|wx.THICK_FRAME|wx.RESIZE_BORDER,size=(400,575))
    b = Borg()
    self.dbProxy = b.dbProxy
    self.theHeadName = headName
    self.theHeadAdornment = headAdornment
    self.theHeadNav = headNav
    self.theHeadNry = headNry
    self.theHeadRole = headRole
    self.theTailRole = tailRole
    self.theTailNry = tailNry
    self.theTailNav = tailNav
    self.theTailAdornment = tailAdornment
    self.theTailName = tailName
    mainSizer = wx.BoxSizer(wx.VERTICAL)
    assets = self.dbProxy.getDimensionNames('template_asset')
    associationTypes = ['Inheritance','Association','Aggregation','Composition','Dependency']
    multiplicityTypes = ['1','*','1..*']
    navTypes = ['1','0']

    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Head',(87,30),PATTERNSTRUCTURE_COMBOHEADASSET_ID,assets),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Adornment',(87,30),PATTERNSTRUCTURE_COMBOHEADTYPE_ID,associationTypes),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Nav',(87,30),PATTERNSTRUCTURE_COMBOHEADNAV_ID,navTypes),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'nry',(87,30),PATTERNSTRUCTURE_COMBOHEADMULTIPLICITY_ID,multiplicityTypes),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildTextSizer(self,'Role',(87,30),PATTERNSTRUCTURE_TEXTHEADROLE_ID),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildTextSizer(self,'Role',(87,30),PATTERNSTRUCTURE_TEXTTAILROLE_ID),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'nry',(87,30),PATTERNSTRUCTURE_COMBOTAILMULTIPLICITY_ID,multiplicityTypes),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Nav',(87,30),PATTERNSTRUCTURE_COMBOTAILNAV_ID,navTypes),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Adornment',(87,30),PATTERNSTRUCTURE_COMBOTAILTYPE_ID,associationTypes),0,wx.EXPAND)
    mainSizer.Add(WidgetFactory.buildComboSizerList(self,'Tail',(87,30),PATTERNSTRUCTURE_COMBOTAILASSET_ID,assets),0,wx.EXPAND)

    mainSizer.Add(WidgetFactory.buildAddCancelButtonSizer(self,PATTERNSTRUCTURE_BUTTONCOMMIT_ID),0,wx.ALIGN_CENTER)
    self.SetSizer(mainSizer)

    wx.EVT_BUTTON(self,PATTERNSTRUCTURE_BUTTONCOMMIT_ID,self.onCommit)
    self.commitLabel = 'Add'
    if (len(self.theTailName) > 0):
      self.commitLabel = 'Edit'
      self.SetLabel('Edit Asset Association')
      headCtrl = self.FindWindowById(PATTERNSTRUCTURE_COMBOHEADASSET_ID)
      headCtrl.SetStringSelection(self.theHeadName)
      headTypeCtrl = self.FindWindowById(PATTERNSTRUCTURE_COMBOHEADTYPE_ID)
      headTypeCtrl.SetStringSelection(self.theTailAdornment)
      headNavCtrl = self.FindWindowById(PATTERNSTRUCTURE_COMBOHEADNAV_ID)
      headNavCtrl.SetStringSelection(self.theTailNav)
      headNryCtrl = self.FindWindowById(PATTERNSTRUCTURE_COMBOHEADMULTIPLICITY_ID)
      headNryCtrl.SetStringSelection(self.theTailNry)
      headRoleCtrl = self.FindWindowById(PATTERNSTRUCTURE_TEXTHEADROLE_ID)
      headRoleCtrl.SetValue(self.theTailRole)
      tailRoleCtrl = self.FindWindowById(PATTERNSTRUCTURE_TEXTTAILROLE_ID)
      tailRoleCtrl.SetValue(self.theHeadRole)
      tailNryCtrl = self.FindWindowById(PATTERNSTRUCTURE_COMBOTAILMULTIPLICITY_ID)
      tailNryCtrl.SetStringSelection(self.theHeadNry)
      tailNavCtrl = self.FindWindowById(PATTERNSTRUCTURE_COMBOTAILNAV_ID)
      tailNavCtrl.SetStringSelection(self.theHeadNav)
      tailTypeCtrl = self.FindWindowById(PATTERNSTRUCTURE_COMBOTAILTYPE_ID)
      tailTypeCtrl.SetStringSelection(self.theHeadAdornment)
      tailCtrl = self.FindWindowById(PATTERNSTRUCTURE_COMBOTAILASSET_ID)
      tailCtrl.SetStringSelection(self.theTailName)
      buttonCtrl = self.FindWindowById(PATTERNSTRUCTURE_BUTTONCOMMIT_ID)
      buttonCtrl.SetLabel('Edit')
Exemple #25
0
    def buildControls(self, parameters):
        mainSizer = wx.BoxSizer(wx.VERTICAL)
        associationSizer = wx.BoxSizer(wx.VERTICAL)
        mainSizer.Add(associationSizer, 0, wx.EXPAND)
        environments = self.dbProxy.getDimensionNames('environment')
        assets = []
        navs = ['0', '1', '-1']

        associationTypes = []
        associationTypes = [
            'Inheritance', 'Association', 'Aggregation', 'Composition',
            'Dependency'
        ]
        multiplicityTypes = ['1', '*', '1..*']

        associationSizer.Add(
            WidgetFactory.buildComboSizerList(
                self, 'Environment', (87, 30),
                CLASSASSOCIATION_COMBOENVIRONMENT_ID, environments), 0,
            wx.EXPAND)
        associationSizer.Add(
            WidgetFactory.buildComboSizerList(
                self, 'Head', (87, 30), CLASSASSOCIATION_COMBOHEADASSET_ID,
                assets), 0, wx.EXPAND)
        associationSizer.Add(
            WidgetFactory.buildComboSizerList(
                self, 'Navigation', (87, 30), CLASSASSOCIATION_COMBOHEADNAV_ID,
                navs), 0, wx.EXPAND)
        associationSizer.Add(
            WidgetFactory.buildComboSizerList(
                self, 'Adornment', (87, 30), CLASSASSOCIATION_COMBOHEADTYPE_ID,
                associationTypes), 0, wx.EXPAND)
        associationSizer.Add(
            WidgetFactory.buildComboSizerList(
                self, 'nry', (87, 30),
                CLASSASSOCIATION_COMBOHEADMULTIPLICITY_ID, multiplicityTypes),
            0, wx.EXPAND)
        associationSizer.Add(
            WidgetFactory.buildTextSizer(self, 'Role', (87, 30),
                                         CLASSASSOCIATION_TEXTHEADROLE_ID), 0,
            wx.EXPAND)
        associationSizer.Add(
            WidgetFactory.buildTextSizer(self, 'Role', (87, 30),
                                         CLASSASSOCIATION_TEXTTAILROLE_ID), 0,
            wx.EXPAND)
        associationSizer.Add(
            WidgetFactory.buildComboSizerList(
                self, 'nry', (87, 30),
                CLASSASSOCIATION_COMBOTAILMULTIPLICITY_ID, multiplicityTypes),
            0, wx.EXPAND)
        associationSizer.Add(
            WidgetFactory.buildComboSizerList(
                self, 'Adornment', (87, 30), CLASSASSOCIATION_COMBOTAILTYPE_ID,
                associationTypes), 0, wx.EXPAND)
        associationSizer.Add(
            WidgetFactory.buildComboSizerList(
                self, 'Navigation', (87, 30), CLASSASSOCIATION_COMBOTAILNAV_ID,
                navs), 0, wx.EXPAND)
        associationSizer.Add(
            WidgetFactory.buildComboSizerList(
                self, 'Tail', (87, 30), CLASSASSOCIATION_COMBOTAILASSET_ID,
                assets), 0, wx.EXPAND)
        mainSizer.Add(wx.StaticText(self, -1), 1, wx.EXPAND)
        mainSizer.Add(
            WidgetFactory.buildAddCancelButtonSizer(
                self, CLASSASSOCIATION_BUTTONCOMMIT_ID), 0, wx.ALIGN_CENTER)
        self.SetSizer(mainSizer)

        wx.EVT_BUTTON(self, CLASSASSOCIATION_BUTTONCOMMIT_ID, self.onCommit)
        wx.EVT_COMBOBOX(self, CLASSASSOCIATION_COMBOENVIRONMENT_ID,
                        self.onEnvironmentChange)
    def __init__(
        self, parent, dp, envName, source="", sourceMultiplicity="", link="", target="", targetMultiplicity=""
    ):
        wx.Dialog.__init__(
            self,
            parent,
            armid.CONCERNASSOCIATION_ID,
            "Add Concern Association",
            style=wx.DEFAULT_DIALOG_STYLE | wx.MAXIMIZE_BOX | wx.THICK_FRAME | wx.RESIZE_BORDER,
            size=(400, 400),
        )
        self.dbProxy = dp
        self.theCurrentEnvironment = envName
        self.theSource = source
        self.theSourceMultiplicity = sourceMultiplicity
        self.theLink = link
        self.theTarget = target
        self.theTargetMultiplicity = targetMultiplicity
        mainSizer = wx.BoxSizer(wx.VERTICAL)
        assets = self.dbProxy.environmentAssets(self.theCurrentEnvironment)
        mTypes = ["1", "*", "1..*"]
        mainSizer.Add(
            WidgetFactory.buildComboSizerList(
                self, "n", (87, 30), armid.CONCERNASSOCIATION_COMBOSOURCEMULTIPLICITY_ID, mTypes
            ),
            0,
            wx.EXPAND,
        )
        mainSizer.Add(
            WidgetFactory.buildComboSizerList(
                self, "Source", (87, 30), armid.CONCERNASSOCIATION_COMBOSOURCE_ID, assets
            ),
            0,
            wx.EXPAND,
        )
        mainSizer.Add(
            WidgetFactory.buildTextSizer(self, "Link", (87, 60), armid.CONCERNASSOCIATION_TEXTLINK_ID),
            0,
            wx.EXPAND,
            1,
            wx.EXPAND,
        )
        mainSizer.Add(
            WidgetFactory.buildComboSizerList(
                self, "n", (87, 30), armid.CONCERNASSOCIATION_COMBOTARGETMULTIPLICITY_ID, mTypes
            ),
            0,
            wx.EXPAND,
        )
        mainSizer.Add(
            WidgetFactory.buildComboSizerList(
                self, "Target", (87, 30), armid.CONCERNASSOCIATION_COMBOTARGET_ID, assets
            ),
            0,
            wx.EXPAND,
        )
        mainSizer.Add(wx.StaticText(self, -1), 1, wx.EXPAND)
        mainSizer.Add(
            WidgetFactory.buildAddCancelButtonSizer(self, armid.CONCERNASSOCIATION_BUTTONCOMMIT_ID), 0, wx.ALIGN_CENTER
        )
        self.SetSizer(mainSizer)

        wx.EVT_BUTTON(self, armid.CONCERNASSOCIATION_BUTTONCOMMIT_ID, self.onCommit)
        self.commitLabel = "Add"
        if len(self.theSource) > 0:
            self.commitLabel = "Edit"
            self.SetLabel("Edit Concern Association")
            smCtrl = self.FindWindowById(armid.CONCERNASSOCIATION_COMBOSOURCEMULTIPLICITY_ID)
            smCtrl.SetStringSelection(self.theSourceMultiplicity)
            sCtrl = self.FindWindowById(armid.CONCERNASSOCIATION_COMBOSOURCE_ID)
            sCtrl.SetStringSelection(self.theSource)
            lCtrl = self.FindWindowById(armid.CONCERNASSOCIATION_TEXTLINK_ID)
            lCtrl.SetValue(self.theLink)
            tmCtrl = self.FindWindowById(armid.CONCERNASSOCIATION_COMBOTARGETMULTIPLICITY_ID)
            tmCtrl.SetStringSelection(self.theTargetMultiplicity)
            tCtrl = self.FindWindowById(armid.CONCERNASSOCIATION_COMBOTARGET_ID)
            tCtrl.SetStringSelection(self.theTarget)
            buttonCtrl = self.FindWindowById(armid.CONCERNASSOCIATION_BUTTONCOMMIT_ID)
            buttonCtrl.SetLabel("Edit")
Exemple #27
0
    def __init__(self,
                 parent,
                 setPersonas,
                 currentEnvironmentName,
                 dp,
                 pName='',
                 pDur='',
                 pFreq='',
                 pDem='',
                 pGsup=''):
        wx.Dialog.__init__(self,
                           parent,
                           TASKPERSONA_ID,
                           'Add Task Persona',
                           style=wx.DEFAULT_DIALOG_STYLE | wx.MAXIMIZE_BOX
                           | wx.THICK_FRAME | wx.RESIZE_BORDER,
                           size=(400, 300))
        self.theName = pName
        self.theDuration = pDur
        self.theFrequency = pFreq
        self.theDemands = pDem
        self.theGoalSupport = pGsup
        mainSizer = wx.BoxSizer(wx.VERTICAL)
        personaList = dp.getDimensionNames('persona', currentEnvironmentName)

        mainSizer.Add(
            WidgetFactory.buildComboSizerList(self, 'Name', (87, 30),
                                              TASKPERSONA_COMBONAME_ID,
                                              personaList), 0, wx.EXPAND)
        suList = ['None', 'Low', 'Medium', 'High']
        durationList = ['Seconds', 'Minutes', 'Hours or longer']
        mainSizer.Add(
            WidgetFactory.buildComboSizerList(self, 'Duration', (87, 30),
                                              TASKPERSONA_COMBODURATION_ID,
                                              durationList), 0, wx.EXPAND)
        freqList = ['Hourly or more', 'Daily - Weekly', 'Monthly or less']
        mainSizer.Add(
            WidgetFactory.buildComboSizerList(self, 'Frequency', (87, 30),
                                              TASKPERSONA_COMBOFREQUENCY_ID,
                                              freqList), 0, wx.EXPAND)
        mainSizer.Add(
            WidgetFactory.buildComboSizerList(self, 'Demands', (87, 30),
                                              TASKPERSONA_COMBODEMANDS_ID,
                                              suList), 0, wx.EXPAND)
        mainSizer.Add(
            WidgetFactory.buildComboSizerList(self, 'Goal Conflict', (87, 30),
                                              TASKPERSONA_COMBOGOALSUPPORT_ID,
                                              suList), 0, wx.EXPAND)
        mainSizer.Add(
            WidgetFactory.buildAddCancelButtonSizer(self,
                                                    TASKPERSONA_BUTTONADD_ID),
            0, wx.ALIGN_CENTER)
        if (self.theName != ''):
            self.SetLabel('Edit Task Persona')
            nameCtrl = self.FindWindowById(TASKPERSONA_COMBONAME_ID)
            nameCtrl.SetValue(self.theName)
            durCtrl = self.FindWindowById(TASKPERSONA_COMBODURATION_ID)
            durCtrl.SetStringSelection(self.theDuration)
            freqCtrl = self.FindWindowById(TASKPERSONA_COMBOFREQUENCY_ID)
            freqCtrl.SetStringSelection(self.theFrequency)
            demCtrl = self.FindWindowById(TASKPERSONA_COMBODEMANDS_ID)
            demCtrl.SetStringSelection(self.theDemands)
            gsupCtrl = self.FindWindowById(TASKPERSONA_COMBOGOALSUPPORT_ID)
            gsupCtrl.SetStringSelection(self.theGoalSupport)
        self.SetSizer(mainSizer)

        wx.EVT_BUTTON(self, TASKPERSONA_BUTTONADD_ID, self.onAdd)
    def buildControls(self, parameters):
        mainSizer = wx.BoxSizer(wx.VERTICAL)
        associationSizer = wx.BoxSizer(wx.HORIZONTAL)
        mainSizer.Add(
            WidgetFactory.buildCheckSizer(self, "Alternative", GOALASSOCIATION_CHECKALTERNATIVE_ID, False), 0, wx.EXPAND
        )
        mainSizer.Add(associationSizer, 0, wx.EXPAND)
        environments = self.dbProxy.getDimensionNames("environment")
        goals = []
        associationTypes = ["and", "or", "conflict", "responsible", "obstruct", "resolve"]
        goalDimensions = ["goal", "requirement", "countermeasure", "obstacle"]
        subGoalDimensions = [
            "goal",
            "requirement",
            "role",
            "task",
            "usecase",
            "countermeasure",
            "domainproperty",
            "obstacle",
            "threat",
            "vulnerability",
        ]

        associationSizer.Add(
            WidgetFactory.buildComboSizerList(
                self, "Environment", (87, 30), GOALASSOCIATION_COMBOENVIRONMENT_ID, environments
            ),
            0,
            wx.EXPAND,
        )
        associationSizer.Add(
            WidgetFactory.buildComboSizerList(
                self, "Dimension", (87, 30), GOALASSOCIATION_COMBOGOALDIM_ID, goalDimensions
            ),
            0,
            wx.EXPAND,
        )
        associationSizer.Add(
            WidgetFactory.buildComboSizerList(self, "Goal", (87, 30), GOALASSOCIATION_COMBOGOAL_ID, goals), 0, wx.EXPAND
        )
        associationSizer.Add(
            WidgetFactory.buildComboSizerList(self, "Type", (87, 30), GOALASSOCIATION_COMBOATYPE_ID, associationTypes),
            0,
            wx.EXPAND,
        )
        associationSizer.Add(
            WidgetFactory.buildComboSizerList(
                self, "Dimension", (87, 30), GOALASSOCIATION_COMBOSUBGOALDIM_ID, subGoalDimensions
            ),
            0,
            wx.EXPAND,
        )
        associationSizer.Add(
            WidgetFactory.buildComboSizerList(self, "Sub-Goal", (87, 30), GOALASSOCIATION_COMBOSUBGOAL_ID, goals),
            0,
            wx.EXPAND,
        )
        mainSizer.Add(
            WidgetFactory.buildMLTextSizer(self, "Rationale", (87, 60), GOALASSOCIATION_TEXTRATIONALE_ID),
            1,
            wx.EXPAND,
            1,
            wx.EXPAND,
        )
        mainSizer.Add(
            WidgetFactory.buildAddCancelButtonSizer(self, GOALASSOCIATION_BUTTONCOMMIT_ID), 0, wx.ALIGN_CENTER
        )
        self.SetSizer(mainSizer)

        wx.EVT_BUTTON(self, GOALASSOCIATION_BUTTONCOMMIT_ID, self.onCommit)
        wx.EVT_COMBOBOX(self, GOALASSOCIATION_COMBOENVIRONMENT_ID, self.onEnvironmentChange)
        wx.EVT_COMBOBOX(self, GOALASSOCIATION_COMBOGOALDIM_ID, self.onGoalDimChange)
        wx.EVT_COMBOBOX(self, GOALASSOCIATION_COMBOSUBGOALDIM_ID, self.onSubGoalDimChange)
    def __init__(self,
                 parent,
                 dp,
                 envName,
                 assetProperties,
                 headNav=0,
                 headAdornment='',
                 headNry='',
                 headRole='',
                 tailRole='',
                 tailNry='',
                 tailAdornment='',
                 tailNav=0,
                 tailName=''):
        wx.Dialog.__init__(self,
                           parent,
                           ASSETASSOCIATION_ID,
                           'Add Asset Association',
                           style=wx.DEFAULT_DIALOG_STYLE | wx.MAXIMIZE_BOX
                           | wx.THICK_FRAME | wx.RESIZE_BORDER,
                           size=(400, 500))
        self.dbProxy = dp
        self.theAssetProperties = assetProperties
        self.theCurrentEnvironment = envName
        self.theHeadNav = int(headNav)
        self.theHeadAdornment = headAdornment
        self.theHeadNry = headNry
        self.theHeadRole = headRole
        self.theTailRole = tailRole
        self.theTailNry = tailNry
        self.theTailAdornment = tailAdornment
        self.theTailNav = int(tailNav)
        self.theTailName = tailName
        mainSizer = wx.BoxSizer(wx.VERTICAL)
        assets = self.dbProxy.environmentAssets(self.theCurrentEnvironment)
        associationTypes = [
            'Inheritance', 'Association', 'Aggregation', 'Composition',
            'Dependency'
        ]
        multiplicityTypes = ['1', '*', '1..*']
        navs = ['0', '1', '-1']

        mainSizer.Add(
            WidgetFactory.buildComboSizerList(
                self, 'Navigation', (87, 30), ASSETASSOCIATION_COMBOHEADNAV_ID,
                navs), 0, wx.EXPAND)
        mainSizer.Add(
            WidgetFactory.buildComboSizerList(
                self, 'Adornment', (87, 30), ASSETASSOCIATION_COMBOHEADTYPE_ID,
                associationTypes), 0, wx.EXPAND)
        mainSizer.Add(
            WidgetFactory.buildComboSizerList(
                self, 'nry', (87, 30),
                ASSETASSOCIATION_COMBOHEADMULTIPLICITY_ID, multiplicityTypes),
            0, wx.EXPAND)
        mainSizer.Add(
            WidgetFactory.buildTextSizer(self, 'Role', (87, 30),
                                         ASSETASSOCIATION_TEXTHEADROLE_ID), 0,
            wx.EXPAND)
        mainSizer.Add(
            WidgetFactory.buildTextSizer(self, 'Role', (87, 30),
                                         ASSETASSOCIATION_TEXTTAILROLE_ID), 0,
            wx.EXPAND)
        mainSizer.Add(
            WidgetFactory.buildComboSizerList(
                self, 'nry', (87, 30),
                ASSETASSOCIATION_COMBOTAILMULTIPLICITY_ID, multiplicityTypes),
            0, wx.EXPAND)
        mainSizer.Add(
            WidgetFactory.buildComboSizerList(
                self, 'Adornment', (87, 30), ASSETASSOCIATION_COMBOTAILTYPE_ID,
                associationTypes), 0, wx.EXPAND)
        mainSizer.Add(
            WidgetFactory.buildComboSizerList(
                self, 'Navigation', (87, 30), ASSETASSOCIATION_COMBOTAILNAV_ID,
                navs), 0, wx.EXPAND)
        mainSizer.Add(
            WidgetFactory.buildComboSizerList(
                self, 'Tail', (87, 30), ASSETASSOCIATION_COMBOTAILASSET_ID,
                assets), 0, wx.EXPAND)

        mainSizer.Add(
            WidgetFactory.buildAddCancelButtonSizer(
                self, ASSETASSOCIATION_BUTTONCOMMIT_ID), 0, wx.ALIGN_CENTER)
        self.SetSizer(mainSizer)

        wx.EVT_BUTTON(self, ASSETASSOCIATION_BUTTONCOMMIT_ID, self.onCommit)
        self.commitLabel = 'Add'
        if (len(self.theTailName) > 0):
            self.commitLabel = 'Edit'
            self.SetLabel('Edit Asset Association')
            headNavCtrl = self.FindWindowById(ASSETASSOCIATION_COMBOHEADNAV_ID)
            headNavCtrl.SetValue(str(self.theHeadNav))
            headTypeCtrl = self.FindWindowById(
                ASSETASSOCIATION_COMBOHEADTYPE_ID)
            headTypeCtrl.SetValue(self.theHeadAdornment)
            headNryCtrl = self.FindWindowById(
                ASSETASSOCIATION_COMBOHEADMULTIPLICITY_ID)
            headNryCtrl.SetValue(self.theHeadNry)
            headRoleCtrl = self.FindWindowById(
                ASSETASSOCIATION_TEXTHEADROLE_ID)
            headRoleCtrl.SetValue(self.theHeadRole)
            tailRoleCtrl = self.FindWindowById(
                ASSETASSOCIATION_TEXTTAILROLE_ID)
            tailRoleCtrl.SetValue(self.theTailRole)
            tailNryCtrl = self.FindWindowById(
                ASSETASSOCIATION_COMBOTAILMULTIPLICITY_ID)
            tailNryCtrl.SetValue(self.theTailNry)
            tailTypeCtrl = self.FindWindowById(
                ASSETASSOCIATION_COMBOTAILTYPE_ID)
            tailTypeCtrl.SetValue(self.theTailAdornment)
            tailNavCtrl = self.FindWindowById(ASSETASSOCIATION_COMBOTAILNAV_ID)
            tailNavCtrl.SetValue(str(self.theTailNav))
            tailCtrl = self.FindWindowById(ASSETASSOCIATION_COMBOTAILASSET_ID)
            tailCtrl.SetValue(self.theTailName)
            buttonCtrl = self.FindWindowById(ASSETASSOCIATION_BUTTONCOMMIT_ID)
            buttonCtrl.SetLabel('Edit')
    def __init__(self, parent, ciName, elName, currentValue):
        wx.Dialog.__init__(self,
                           parent,
                           CHARACTERISTICREFERENCETYPE_ID,
                           'Edit Characteristic Reference Type',
                           style=wx.DEFAULT_DIALOG_STYLE | wx.MAXIMIZE_BOX
                           | wx.THICK_FRAME | wx.RESIZE_BORDER,
                           size=(300, 400))

        self.theElementName = elName
        self.theValue = currentValue
        mainSizer = wx.BoxSizer(wx.VERTICAL)
        mainSizer.Add(
            WidgetFactory.buildComboSizerList(
                self, 'Characteristic Reference Type', (87, 30),
                CHARACTERISTICREFERENCETYPE_COMBOVALUE_ID,
                ['grounds', 'warrant', 'rebuttal']), 0, wx.EXPAND)

        mainSizer.Add(
            WidgetFactory.buildTextSizer(
                self, 'Characteristic Intention', (87, 30),
                CHARACTERISTICREFERENCETYPE_TEXTCHARINTENT_ID), 0, wx.EXPAND)
        ciCtrl = self.FindWindowById(
            CHARACTERISTICREFERENCETYPE_TEXTCHARINTENT_ID)
        ciCtrl.Disable()

        mainSizer.Add(
            WidgetFactory.buildTextSizer(
                self, 'Intention', (87, 30),
                CHARACTERISTICREFERENCETYPE_TEXTINTENTION_ID), 0, wx.EXPAND)
        mainSizer.Add(
            WidgetFactory.buildComboSizerList(
                self, 'Intention Type', (87, 30),
                CHARACTERISTICREFERENCETYPE_COMBOINTTYPE_ID,
                ['goal', 'softgoal']), 0, wx.EXPAND)
        mainSizer.Add(
            WidgetFactory.buildComboSizerList(
                self, 'Means/End', (87, 30),
                CHARACTERISTICREFERENCETYPE_COMBOMEANSEND_ID,
                ['means', 'end']), 0, wx.EXPAND)
        contType = [
            'Make', 'SomePositive', 'Help', 'Hurt', 'SomeNegative', 'Break'
        ]
        mainSizer.Add(
            WidgetFactory.buildComboSizerList(
                self, 'Contribution', (87, 30),
                CHARACTERISTICREFERENCETYPE_COMBOCONTRIBUTION_ID, contType), 0,
            wx.EXPAND)

        mainSizer.Add(wx.StaticText(self, -1, ''), 1, wx.EXPAND)
        mainSizer.Add(
            WidgetFactory.buildCommitButtonSizer(
                self, CHARACTERISTICREFERENCETYPE_BUTTONCOMMIT_ID, False), 0,
            wx.ALIGN_CENTER)
        self.SetSizer(mainSizer)
        wx.EVT_BUTTON(self, CHARACTERISTICREFERENCETYPE_BUTTONCOMMIT_ID,
                      self.onCommit)
        self.valueCtrl = self.FindWindowById(
            CHARACTERISTICREFERENCETYPE_COMBOVALUE_ID)
        self.valueCtrl.SetValue(currentValue)

        self.ciCtrl = self.FindWindowById(
            CHARACTERISTICREFERENCETYPE_TEXTCHARINTENT_ID)
        self.ciCtrl.SetValue(ciName)

        self.intCtrl = self.FindWindowById(
            CHARACTERISTICREFERENCETYPE_TEXTINTENTION_ID)
        self.intTypeCtrl = self.FindWindowById(
            CHARACTERISTICREFERENCETYPE_COMBOINTTYPE_ID)
        self.meCtrl = self.FindWindowById(
            CHARACTERISTICREFERENCETYPE_COMBOMEANSEND_ID)
        self.contCtrl = self.FindWindowById(
            CHARACTERISTICREFERENCETYPE_COMBOCONTRIBUTION_ID)

        b = Borg()
        intDetails = b.dbProxy.impliedCharacteristicElementIntention(
            ciName, elName)
        intName = intDetails[0]
        intDim = intDetails[1]
        meName = intDetails[2]
        contName = intDetails[3]

        if intName != '':
            self.intCtrl.SetValue(intName)
            self.intTypeCtrl.SetValue(intDim)
            self.meCtrl.SetValue(meName)
            self.contCtrl.SetValue(contName)