Exemple #1
0
    def OnEdit(self, event):
        
        rows = self.grid.GetSelectedRows()
        row  = rows[0]
        
        att       = self.atts.names()[row]
        att_type  = self.atts.get_att_type(att)
        is_output = self.atts.is_output_att(att)
        
        in_use, ignore = self.AttributeInUse(att)
        
        previous_att = att
        
        dlg = AddAttribute(self, att, att_type, is_output, in_use)
        if dlg.ShowModal() == wx.ID_OK:
            name      = dlg.get_name()
            att_type  = dlg.get_type()
            is_output = dlg.is_output()
            if not name:
                return
            if name not in self.atts or name == previous_att:
                
                self.atts.remove(previous_att)
                self.UpdateAllViewRemove(previous_att)
                
                self.atts.add(name, att_type, is_output)
                self.ConfigureGrid()
                self.grid.ClearSelection()
                
                row = self.atts.names().index(name)
                self.grid.MakeCellVisible(row, 0)

                self.removeButton.Disable()
                self.repoman.RepositoryModified()
                self.UpdateAllViewAdd(name)
            else:
                dialog = wx.MessageDialog(None, 'Attribute "' + name + '" already exists!', "Duplicate Attribute", wx.OK | wx.ICON_INFORMATION)
                dialog.ShowModal()
        dlg.Destroy()
Exemple #2
0
    def OnAdd(self, event):
        dlg = AddAttribute(self, "", "", False, False)
        if dlg.ShowModal() == wx.ID_OK:
            name      = dlg.get_name()
            att_type  = dlg.get_type()
            is_output = dlg.is_output()
            if not name:
                return
            if name not in self.atts:
                self.atts.add(name, att_type, is_output)
                self.ConfigureGrid()
                self.grid.ClearSelection()
                
                row = self.atts.names().index(name)
                self.grid.MakeCellVisible(row, 0)

                self.removeButton.Disable()
                self.repoman.RepositoryModified()
                self.UpdateAllViewAdd(name)
            else:
                dialog = wx.MessageDialog(None, 'Attribute "' + name + '" already exists!', "Duplicate Attribute", wx.OK | wx.ICON_INFORMATION)
                dialog.ShowModal()
        dlg.Destroy()