def __init__(self, template_key, previewfile=None, gladefile=None):
        gtk.Dialog.__init__(self, "Importing %s" % template_key, None,
                            gtk.DIALOG_MODAL|gtk.DIALOG_DESTROY_WITH_PARENT,
                            (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
                            gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
        self.set_size_request(520,480)

        # create a new importer based on the template
        self.template = dataio.import_templates[template_key]
        self.importer = self.template.new_instance()
        
        #
        # set up connectors
        #
        self.connectors = pwglade.construct_connectors(self.importer)            
        table_options = pwglade.construct_table(self.connectors)
        widget = uihelper.new_section("Import Options", table_options)
        self.vbox.pack_start(widget,False,True)

        for c in self.connectors:
            c.check_in()

        #
        # add preview widget
        #
        preview = self.construct_preview(previewfile)
        self.vbox.pack_start(preview,True,True)

        hint = gtk.Label()
        hint.set_markup("<i>Hint: These importer settings can later on be retrieved\nas 'recently used' template in the Edit|Preferences dialog.</i>")
        hint.set_use_markup(True)
        self.vbox.pack_start(hint,False,True)
        
        self.vbox.show_all()
Ejemplo n.º 2
0
    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()
Ejemplo n.º 3
0
    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, owner, title="Edit Options", parent=None):
        """
        owner: instance of HasProps that owns the properties
        parent: parent window
        @note: 'parent' is currently ignored, since it produces a silly window placement!
        """
        gtk.Dialog.__init__(self, title, None,
                            gtk.DIALOG_MODAL|gtk.DIALOG_DESTROY_WITH_PARENT,
                            (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
                             gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))


        self.owner = owner
        self.connectors = pwglade.construct_connectors(owner)
        if len(self.connectors) == 0:
            raise NoOptionsError
        
        table = pwglade.construct_table(self.connectors)
        frame = uihelper.new_section(title, table)
        self.vbox.pack_start(frame, False, True)
        self.show_all()