def do_edit(self, template, allow_edit=True):
        importer = template.new_instance()

        dlg = gtk.Dialog("Edit Template Options",None,
                         gtk.DIALOG_MODAL,
                         (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
                          gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))

        clist1 = pwglade.smart_construct_connectors(template, include=['blurb','extensions','skip_options'])
        clist2 = pwglade.smart_construct_connectors(importer, include=importer.public_props)
        clist = clist1 + clist2
        table = pwglade.construct_table(clist)

        if allow_edit is False:
            notice = gtk.Label("This is an internal template\nwhich cannot be edited.")
            dlg.vbox.pack_start(notice,False,True)
            hseparator = gtk.HSeparator()
            dlg.vbox.pack_start(hseparator,False,True)
            for c in clist:
                c.widget.set_sensitive(False)

        dlg.vbox.pack_start(table,True,True)            
        dlg.show_all()

        for c in clist:
            c.check_in()

        try:
            response = dlg.run()

            if response == gtk.RESPONSE_ACCEPT:                

                # check out                
                for c in clist:
                    c.check_out()

                # move importer data to template
                values = importer.get_values(importer.public_props, default=None)
                template.set_values(defaults=values)                    

        finally:
            dlg.destroy()

        return response
    def __init__(self, app, layer):
        config.ConfigurationPage.__init__(self)
        self.app = app
        self.layer = layer

        keys = ['label', 'position', 'visible', 'border', 'x', 'y']
        clist = pwglade.smart_construct_connectors(layer.legend, include=keys)
        table = pwglade.construct_table(clist)

        frame = uihelper.new_section("Legend", table)
        self.add(frame)

        self.clist = clist

        self.show_all()