Example #1
0
 def OnEditField(self, event):
     row              = self.grid.GetSelectedRows()[0]
     prior_name       = self.template.get_order()[row]
     prior_field_type = self.template.get_field_type(prior_name)
     prior_is_key     = prior_name in self.template.get_keys()
     dlg = EditTemplateField(self, prior_name, prior_field_type.capitalize(), prior_is_key)
     if dlg.ShowModal() == wx.ID_OK:
         name       = dlg.get_name()
         field_type = dlg.get_type()
         is_key     = dlg.get_iskey()
         if prior_is_key and not is_key:
             self.template.remove_key(prior_name)
         if name != prior_name:
             self.template.remove_field(prior_name)
             self.template.add_field(name, field_type.lower())
         else:
             if field_type.lower() != prior_field_type:
                 self.template.add_field(name, field_type.lower())
         if is_key:
             self.template.add_key(name)
         else:
             self.template.remove_key(name)
         self.repoman.RepositoryModified()
         self.ConfigureGrid()
         self.ConfigureGridButtonsForRow(row)
     dlg.Destroy()
Example #2
0
 def OnAddField(self, event):
     dlg = EditTemplateField(self, "", "", False)
     if dlg.ShowModal() == wx.ID_OK:
         name       = dlg.get_name()
         field_type = dlg.get_type()
         is_key     = dlg.get_iskey()
         self.template.add_field(name, field_type.lower())
         if is_key:
             self.template.add_key(name)
         self.repoman.RepositoryModified()
         self.ConfigureGrid()
         self.ClearGrid()
     dlg.Destroy()