Sunday, April 11, 2010

Today's Slip Cover Feature(s): Add Record Types

Today I spent a few minutes to add an "Add Record Type" feature. As you can see, this was a matter of creating a button, and then in the handler, creating a single record with only that record type in it.
    def add_record_type(self, widget, data=None):
title = _("Add Record Type")
msg = _("""
Specify a string name for the record type. By convention, the
name should be a URL where you can document the user of the record type.
response, val = prompts.string(title,msg,"")
if response == gtk.RESPONSE_OK:
r = Record({"record_type":val})
self.record_type_grid.append_row({"Record Type":val,"editor":None})

After adding a record type, you can use add/delete rows/keys to full design and populate a data set. I'm kind of working inside out with regard to making a full desktopcouch designer. I started with modifying rows, then add/removing rows, then adding/removing keys, and now adding record types.

The next step is to implement New/Delete Database, and I'll a functional designer. I'll probably add Slip Cover to my PPA at that point.

There is no "Delete Record Type" function. This is because desktopcouch never permanently deletes a record, it only marks it as deleted, and as such does not return it when you query for records. This has the odd effect of making Record Types last forever. I am considering adding a "deleted count", and an "active count" column to the grid for the record types. This would take more Map/Reduce skills than I have right now, so would probably be a good thing for me to learn.

1 comment: