예제 #1
0
 def __init__(self, goalCombo, envCombo):
     wx.grid.PyGridTableBase.__init__(self)
     self.dimension = 'goal'
     self.colLabels = [
         'Name', 'Definition', 'Category', 'Priority', 'Fit Criterion',
         'Issue', 'Originator'
     ]
     self.om = GoalManager(goalCombo, envCombo)
     self.goalName = goalCombo.GetValue()
     self.envName = envCombo.GetValue()
예제 #2
0
 def __init__(self,goalCombo,envCombo):
   wx.grid.PyGridTableBase.__init__(self)
   self.dimension = 'goal'
   self.colLabels = ['Name','Definition','Category','Priority','Fit Criterion','Issue','Originator']
   self.om = GoalManager(goalCombo,envCombo)
   self.goalName = goalCombo.GetValue()
   self.envName = envCombo.GetValue()
예제 #3
0
class GoalsTable(wx.grid.PyGridTableBase):

  def __init__(self,goalCombo,envCombo):
    wx.grid.PyGridTableBase.__init__(self)
    self.dimension = 'goal'
    self.colLabels = ['Name','Definition','Category','Priority','Fit Criterion','Issue','Originator']
    self.om = GoalManager(goalCombo,envCombo)
    self.goalName = goalCombo.GetValue()
    self.envName = envCombo.GetValue()

  def object(self):
    return self.goalName

  def GetNumberRows(self):
    return self.om.size()

  def GetNumberCols(self):
    return len(self.colLabels)

  def GetColLabelValue(self,col):
    return self.colLabels[col]

  def GetRowLabelValue(self,row):
    return self.om.goals[row].label(self.envName)

  def IsEmptyCell(self,row,col):
    return False

  def GetValue(self,row,col):
    if (col == NAME_POS):
      return self.om.goals[row].name()
    elif (col == DEFINITION_POS):
      return self.om.goals[row].definition(self.envName)
    elif (col == CATEGORY_POS):
      return self.om.goals[row].category(self.envName)
    elif (col == PRIORITY_POS):
      return self.om.goals[row].priority(self.envName)
    elif (col == FITCRITERION_POS):
      return self.om.goals[row].fitCriterion(self.envName)
    elif (col == ISSUE_POS):
      return self.om.goals[row].issue(self.envName)
    elif (col == ORIGINATOR_POS):
      return self.om.goals[row].originator()

  def SetValue(self,row,col,value):
    if (col == NAME_POS):
      self.om.goals[row].setName(value)
    elif (col == DEFINITION_POS):
      self.om.goals[row].setDefinition(self.envName,value)
    elif (col == CATEGORY_POS):
      self.om.goals[row].setCategory(self.envName,value)
    elif (col == PRIORITY_POS):
      self.om.goals[row].setPriority(self.envName,value)
    elif (col == FITCRITERION_POS):
      self.om.goals[row].setFitCriterion(self.envName,value)
    elif (col == ISSUE_POS):
      self.om.goals[row].setIssue(self.envName,value)
    elif (col == ORIGINATOR_POS):
      self.om.goals[row].setOriginator(value)

   
  def AppendRows(self,numRows=1):
    pos = self.om.size() - 1
    self.InsertRows(pos,numRows)

  def InsertRows(self,pos,numRows=1):
    gnDlg = wx.TextEntryDialog(None,'Enter goal name','New Goal','',style=wx.OK|wx.CANCEL)
    if (gnDlg.ShowModal() == wx.ID_OK): 
      goalName = gnDlg.GetValue()
      if (goalName != ''):  
        if (pos == -1):
          pos = 0
        newPos = pos + 1
        try:
          self.om.add(newPos,goalName)
        except ARMException,errorText:
          dlg = wx.MessageDialog(self.GetView(),str(errorText),'Add Goal',wx.OK | wx.ICON_ERROR)
          dlg.ShowModal()
          dlg.Destroy()
          return

        self.addToView(newPos)
        grid = self.GetView()
        grid.SetCellEditor(newPos,NAME_POS,wx.grid.GridCellAutoWrapStringEditor())
        grid.SetCellRenderer(newPos,NAME_POS,wx.grid.GridCellAutoWrapStringRenderer())
        grid.SetCellEditor(newPos,DEFINITION_POS,wx.grid.GridCellAutoWrapStringEditor())
        grid.SetCellRenderer(newPos,DEFINITION_POS,wx.grid.GridCellAutoWrapStringRenderer())
        grid.SetCellEditor(newPos,CATEGORY_POS,wx.grid.GridCellChoiceEditor(catChoices))
        grid.SetCellEditor(newPos,PRIORITY_POS,wx.grid.GridCellChoiceEditor(priorityChoices))
        grid.SetCellEditor(newPos,FITCRITERION_POS,wx.grid.GridCellAutoWrapStringEditor())
        grid.SetCellRenderer(newPos,FITCRITERION_POS,wx.grid.GridCellAutoWrapStringRenderer())
        grid.SetCellEditor(newPos,ISSUE_POS,wx.grid.GridCellAutoWrapStringEditor())
        grid.SetCellRenderer(newPos,ISSUE_POS,wx.grid.GridCellAutoWrapStringRenderer())
        grid.SetCellEditor(newPos,ORIGINATOR_POS,wx.grid.GridCellAutoWrapStringEditor())
        grid.SetCellRenderer(newPos,ORIGINATOR_POS,wx.grid.GridCellAutoWrapStringRenderer())
    gnDlg.Destroy()
    return True
예제 #4
0
class GoalsTable(wx.grid.PyGridTableBase):
    def __init__(self, goalCombo, envCombo):
        wx.grid.PyGridTableBase.__init__(self)
        self.dimension = 'goal'
        self.colLabels = [
            'Name', 'Definition', 'Category', 'Priority', 'Fit Criterion',
            'Issue', 'Originator'
        ]
        self.om = GoalManager(goalCombo, envCombo)
        self.goalName = goalCombo.GetValue()
        self.envName = envCombo.GetValue()

    def object(self):
        return self.goalName

    def GetNumberRows(self):
        return self.om.size()

    def GetNumberCols(self):
        return len(self.colLabels)

    def GetColLabelValue(self, col):
        return self.colLabels[col]

    def GetRowLabelValue(self, row):
        return self.om.goals[row].label(self.envName)

    def IsEmptyCell(self, row, col):
        return False

    def GetValue(self, row, col):
        if (col == NAME_POS):
            return self.om.goals[row].name()
        elif (col == DEFINITION_POS):
            return self.om.goals[row].definition(self.envName)
        elif (col == CATEGORY_POS):
            return self.om.goals[row].category(self.envName)
        elif (col == PRIORITY_POS):
            return self.om.goals[row].priority(self.envName)
        elif (col == FITCRITERION_POS):
            return self.om.goals[row].fitCriterion(self.envName)
        elif (col == ISSUE_POS):
            return self.om.goals[row].issue(self.envName)
        elif (col == ORIGINATOR_POS):
            return self.om.goals[row].originator()

    def SetValue(self, row, col, value):
        if (col == NAME_POS):
            self.om.goals[row].setName(value)
        elif (col == DEFINITION_POS):
            self.om.goals[row].setDefinition(self.envName, value)
        elif (col == CATEGORY_POS):
            self.om.goals[row].setCategory(self.envName, value)
        elif (col == PRIORITY_POS):
            self.om.goals[row].setPriority(self.envName, value)
        elif (col == FITCRITERION_POS):
            self.om.goals[row].setFitCriterion(self.envName, value)
        elif (col == ISSUE_POS):
            self.om.goals[row].setIssue(self.envName, value)
        elif (col == ORIGINATOR_POS):
            self.om.goals[row].setOriginator(value)

    def AppendRows(self, numRows=1):
        pos = self.om.size() - 1
        self.InsertRows(pos, numRows)

    def InsertRows(self, pos, numRows=1):
        gnDlg = wx.TextEntryDialog(None,
                                   'Enter goal name',
                                   'New Goal',
                                   '',
                                   style=wx.OK | wx.CANCEL)
        if (gnDlg.ShowModal() == wx.ID_OK):
            goalName = gnDlg.GetValue()
            if (goalName != ''):
                if (pos == -1):
                    pos = 0
                newPos = pos + 1
                try:
                    self.om.add(newPos, goalName)
                except ARMException, errorText:
                    dlg = wx.MessageDialog(self.GetView(), str(errorText),
                                           'Add Goal', wx.OK | wx.ICON_ERROR)
                    dlg.ShowModal()
                    dlg.Destroy()
                    return

                self.addToView(newPos)
                grid = self.GetView()
                grid.SetCellEditor(newPos, NAME_POS,
                                   wx.grid.GridCellAutoWrapStringEditor())
                grid.SetCellRenderer(newPos, NAME_POS,
                                     wx.grid.GridCellAutoWrapStringRenderer())
                grid.SetCellEditor(newPos, DEFINITION_POS,
                                   wx.grid.GridCellAutoWrapStringEditor())
                grid.SetCellRenderer(newPos, DEFINITION_POS,
                                     wx.grid.GridCellAutoWrapStringRenderer())
                grid.SetCellEditor(newPos, CATEGORY_POS,
                                   wx.grid.GridCellChoiceEditor(catChoices))
                grid.SetCellEditor(
                    newPos, PRIORITY_POS,
                    wx.grid.GridCellChoiceEditor(priorityChoices))
                grid.SetCellEditor(newPos, FITCRITERION_POS,
                                   wx.grid.GridCellAutoWrapStringEditor())
                grid.SetCellRenderer(newPos, FITCRITERION_POS,
                                     wx.grid.GridCellAutoWrapStringRenderer())
                grid.SetCellEditor(newPos, ISSUE_POS,
                                   wx.grid.GridCellAutoWrapStringEditor())
                grid.SetCellRenderer(newPos, ISSUE_POS,
                                     wx.grid.GridCellAutoWrapStringRenderer())
                grid.SetCellEditor(newPos, ORIGINATOR_POS,
                                   wx.grid.GridCellAutoWrapStringEditor())
                grid.SetCellRenderer(newPos, ORIGINATOR_POS,
                                     wx.grid.GridCellAutoWrapStringRenderer())
        gnDlg.Destroy()
        return True