示例#1
0
 def buildControls(self, parameters):
     mainSizer = wx.BoxSizer(wx.VERTICAL)
     self.panel = ConceptReferencePanel(self)
     self.panel.buildControls(parameters.createFlag())
     mainSizer.Add(self.panel, 1, wx.EXPAND)
     self.SetSizer(mainSizer)
     wx.EVT_BUTTON(self, CONCEPTREFERENCE_BUTTONCOMMIT_ID, self.onCommit)
 def buildControls(self,parameters):
   mainSizer = wx.BoxSizer(wx.VERTICAL)
   self.panel = ConceptReferencePanel(self)
   self.panel.buildControls(parameters.createFlag())
   mainSizer.Add(self.panel,1,wx.EXPAND)
   self.SetSizer(mainSizer)
   wx.EVT_BUTTON(self,CONCEPTREFERENCE_BUTTONCOMMIT_ID,self.onCommit)
示例#3
0
class ConceptReferenceDialog(wx.Dialog):
    def __init__(self, parent, parameters):
        wx.Dialog.__init__(self,
                           parent,
                           parameters.id(),
                           parameters.label(),
                           style=wx.DEFAULT_DIALOG_STYLE | wx.MAXIMIZE_BOX
                           | wx.THICK_FRAME | wx.RESIZE_BORDER,
                           size=(400, 350))
        self.theName = ''
        self.theDimension = ''
        self.theObject = ''
        self.theDescription = ''
        self.theId = -1
        self.panel = 0
        self.buildControls(parameters)
        self.commitVerb = 'Add'

    def buildControls(self, parameters):
        mainSizer = wx.BoxSizer(wx.VERTICAL)
        self.panel = ConceptReferencePanel(self)
        self.panel.buildControls(parameters.createFlag())
        mainSizer.Add(self.panel, 1, wx.EXPAND)
        self.SetSizer(mainSizer)
        wx.EVT_BUTTON(self, armid.CONCEPTREFERENCE_BUTTONCOMMIT_ID,
                      self.onCommit)

    def load(self, objt):
        self.theId = objt.id()
        self.panel.loadControls(objt)
        self.commitVerb = 'Edit'

    def onCommit(self, evt):
        commitLabel = self.commitVerb + ' concept reference'

        nameCtrl = self.FindWindowById(armid.CONCEPTREFERENCE_TEXTNAME_ID)
        dimCtrl = self.FindWindowById(armid.CONCEPTREFERENCE_COMBODIMNAME_ID)
        objtCtrl = self.FindWindowById(armid.CONCEPTREFERENCE_COMBOOBJTNAME_ID)
        descCtrl = self.FindWindowById(
            armid.CONCEPTREFERENCE_TEXTDESCRIPTION_ID)

        self.theName = nameCtrl.GetValue()
        self.theDimension = dimCtrl.GetValue()
        self.theObject = objtCtrl.GetValue()
        self.theDescription = descCtrl.GetValue()

        if len(self.theName) == 0:
            dlg = wx.MessageDialog(self, 'Name cannot be empty', commitLabel,
                                   wx.OK)
            dlg.ShowModal()
            dlg.Destroy()
            return
        if len(self.theDimension) == 0:
            dlg = wx.MessageDialog(self, 'Dimension cannot be empty',
                                   commitLabel, wx.OK)
            dlg.ShowModal()
            dlg.Destroy()
            return
        if len(self.theObject) == 0:
            dlg = wx.MessageDialog(self, 'Object cannot be empty', commitLabel,
                                   wx.OK)
            dlg.ShowModal()
            dlg.Destroy()
            return
        if len(self.theDescription) == 0:
            dlg = wx.MessageDialog(self, 'Description cannot be empty',
                                   commitLabel, wx.OK)
            dlg.ShowModal()
            dlg.Destroy()
            return
        else:
            self.EndModal(armid.CONCEPTREFERENCE_BUTTONCOMMIT_ID)

    def parameters(self):
        parameters = ConceptReferenceParameters(self.theName,
                                                self.theDimension,
                                                self.theObject,
                                                self.theDescription)
        parameters.setId(self.theId)
        return parameters
class ConceptReferenceDialog(wx.Dialog):
  def __init__(self,parent,parameters):
    wx.Dialog.__init__(self,parent,parameters.id(),parameters.label(),style=wx.DEFAULT_DIALOG_STYLE|wx.MAXIMIZE_BOX|wx.THICK_FRAME|wx.RESIZE_BORDER,size=(400,350))
    self.theName = ''
    self.theDimension = ''
    self.theObject = ''
    self.theDescription = ''
    self.theId = -1
    self.panel = 0
    self.buildControls(parameters)
    self.commitVerb = 'Add'
    
  def buildControls(self,parameters):
    mainSizer = wx.BoxSizer(wx.VERTICAL)
    self.panel = ConceptReferencePanel(self)
    self.panel.buildControls(parameters.createFlag())
    mainSizer.Add(self.panel,1,wx.EXPAND)
    self.SetSizer(mainSizer)
    wx.EVT_BUTTON(self,CONCEPTREFERENCE_BUTTONCOMMIT_ID,self.onCommit)

  def load(self,objt):
    self.theId = objt.id()
    self.panel.loadControls(objt)
    self.commitVerb = 'Edit'

  def onCommit(self,evt):
    commitLabel = self.commitVerb + ' concept reference'

    nameCtrl = self.FindWindowById(CONCEPTREFERENCE_TEXTNAME_ID)
    dimCtrl = self.FindWindowById(CONCEPTREFERENCE_COMBODIMNAME_ID)
    objtCtrl = self.FindWindowById(CONCEPTREFERENCE_COMBOOBJTNAME_ID)
    descCtrl = self.FindWindowById(CONCEPTREFERENCE_TEXTDESCRIPTION_ID)


    self.theName = nameCtrl.GetValue()
    self.theDimension = dimCtrl.GetValue()
    self.theObject = objtCtrl.GetValue()
    self.theDescription = descCtrl.GetValue()

    if len(self.theName) == 0:
      dlg = wx.MessageDialog(self,'Name cannot be empty',commitLabel,wx.OK) 
      dlg.ShowModal()
      dlg.Destroy()
      return
    if len(self.theDimension) == 0:
      dlg = wx.MessageDialog(self,'Dimension cannot be empty',commitLabel,wx.OK) 
      dlg.ShowModal()
      dlg.Destroy()
      return
    if len(self.theObject) == 0:
      dlg = wx.MessageDialog(self,'Object cannot be empty',commitLabel,wx.OK) 
      dlg.ShowModal()
      dlg.Destroy()
      return
    if len(self.theDescription) == 0:
      dlg = wx.MessageDialog(self,'Description cannot be empty',commitLabel,wx.OK) 
      dlg.ShowModal()
      dlg.Destroy()
      return
    else:
      self.EndModal(CONCEPTREFERENCE_BUTTONCOMMIT_ID)

  def parameters(self):
    parameters = ConceptReferenceParameters(self.theName,self.theDimension,self.theObject,self.theDescription)
    parameters.setId(self.theId)
    return parameters