Exemple #1
0
    def draw_avail_list(self):
        """
        Draw the list with the selections available for the book.
        
        The selections are read from the book item registry.
        """
        pmgr = GuiPluginManager.get_instance()
        regbi = pmgr.get_reg_bookitems()
        if not regbi:
            return

        available_reports = []
        for pdata in regbi:
            category = _UNSUPPORTED
            if pdata.supported and pdata.category in book_categories:
                category = book_categories[pdata.category]
            available_reports.append([pdata.name, category, pdata.id])
        for data in sorted(available_reports):
            new_iter = self.avail_model.add(data)

        self.avail_model.connect_model()

        if new_iter:
            self.avail_model.selection.select_iter(new_iter)
            path = self.avail_model.model.get_path(new_iter)
            col = self.avail_tree.get_column(0)
            self.avail_tree.scroll_to_cell(path, col, 1, 1, 0.0)
    def gotomap(self, obj):
        """
        Run the map service 
        """
        #First test if any map service is available
        if not len(self.mapservicedata):
            msg = _("No map service is available.")
            msg2 = _("Check your installation.")
            ErrorDialog(msg, msg2)
            return

        place_handles = self.selected_handles()
        try:
            place_handle = self.selected_handles()[0]
        except IndexError:
            msg = _("No place selected.")
            msg2 = _("You need to select a place to be able to view it"
                     " on a map. Some Map Services might support multiple"
                     " selections.")
            ErrorDialog(msg, msg2)
            return

        #TODO: support for descriptions in some cases. For now, pass None
        #TODO: Later this might be 'Birth of William' ....
        places = [(x, None) for x in place_handles]

        #run the mapservice:
        pmgr = GuiPluginManager.get_instance()
        serv = self.mapservicedata[self.mapservice]
        mod = pmgr.load_plugin(serv)
        if mod:
            servfunc = eval('mod.' + serv.mapservice)
            servfunc()(self.dbstate.db, places)
        else:
            print 'Failed to load map plugin, see Plugin Manager'
Exemple #3
0
def check_out(dbase, rev, path, callback):
    """
    Checks out the revision from rcs, and loads the resulting XML file
    into the database.
    """
    co_cmd = ["co", "-x,v", "-q%s" % rev
              ] + [os.path.join(path, ARCHIVE),
                   os.path.join(path, ARCHIVE_V)]

    proc = subprocess.Popen(co_cmd, stderr=subprocess.PIPE)
    status = proc.wait()
    message = "\n".join(proc.stderr.readlines())
    proc.stderr.close()
    del proc

    if status != 0:
        ErrorDialog(
            _("Retrieve failed"),
            _("An attempt to retrieve the data failed "
              "with the following message:\n\n%s") % message)
        return

    pmgr = GuiPluginManager.get_instance()
    for plugin in pmgr.get_import_plugins():
        if plugin.get_extension() == "gramps":
            rdr = plugin.get_import_function()

    xml_file = os.path.join(path, ARCHIVE)
    rdr(dbase, xml_file, callback)
    os.unlink(xml_file)
def run_quick_report_by_name_direct(report_name, database, document, handle):
    """
    Useful for running one quick report from another
    """
    from docgen import TextBufDoc
    from Simple import make_basic_stylesheet
    report = None
    pmgr = GuiPluginManager.get_instance()
    for pdata in pmgr.get_reg_quick_reports():
        if pdata.id == report_name:
            report = pdata
            break
    if report:
        # FIXME: allow auto lookup of obj like below?
        d = TextBufDoc(make_basic_stylesheet(), None)
        d.dbstate = document.dbstate
        d.uistate = document.uistate
        d.open("")
        mod = pmgr.load_plugin(report)
        if mod:
            reportfunc = eval('mod.' + report.runfunc)
            retval = reportfunc(database, d, handle)
            d.close()
            return retval
        else:
            raise ImportError, ("Quick report id = '%s' could not be loaded" %
                                report_name)
    else:
        raise AttributeError, ("No such quick report id = '%s'" % report_name)
def run_quick_report_by_name(dbstate,
                             uistate,
                             report_name,
                             handle,
                             container=None,
                             **kwargs):
    """
    Run a QuickView by name.
    **kwargs provides a way of passing special quick views additional 
    arguments.
    """
    report = None
    pmgr = GuiPluginManager.get_instance()
    for pdata in pmgr.get_reg_quick_reports():
        if pdata.id == report_name:
            report = pdata
            break
    if report:
        return run_report(dbstate,
                          uistate,
                          report.category,
                          handle,
                          report,
                          container=container,
                          **kwargs)
    else:
        raise AttributeError, ("No such quick report '%s'" % report_name)
Exemple #6
0
    def __init__(self, active):

        gtk.ComboBox.__init__(self)

        pmgr = GuiPluginManager.get_instance()
        self.__bookdoc_plugins = []
        for plugin in pmgr.get_docgen_plugins():
            if plugin.get_text_support() and plugin.get_draw_support():
                self.__bookdoc_plugins.append(plugin)

        self.store = gtk.ListStore(gobject.TYPE_STRING)
        self.set_model(self.store)
        cell = gtk.CellRendererText()
        self.pack_start(cell, True)
        self.add_attribute(cell, 'text', 0)

        index = 0
        active_index = 0
        for plugin in self.__bookdoc_plugins:
            name = plugin.get_name()
            self.store.append(row=[name])
            if plugin.get_extension() == active:
                active_index = index
            index += 1
        self.set_active(active_index)
Exemple #7
0
def check_in(dbase, filename, callback, cursor_func=None):
    """
    Checks in the specified file into RCS
    """
    init = ["rcs", '-x,v', '-i', '-U', '-q', '-t-"Gramps database"']
    ci_cmd = ["ci", '-x,v', "-q", "-f"]
    archive_name = filename + ",v"

    glade = Glade(toplevel='comment')
    top = glade.toplevel
    text = glade.get_object('description')
    top.run()
    comment = text.get_text()
    top.destroy()

    if not os.path.isfile(archive_name):
        cmd = init + [archive_name]
        proc = subprocess.Popen(cmd, stderr=subprocess.PIPE)
        status = proc.wait()
        message = "\n".join(proc.stderr.readlines())
        proc.stderr.close()
        del proc

        if status != 0:
            ErrorDialog(
                _("Archiving failed"),
                _("An attempt to create the archive failed "
                  "with the following message:\n\n%s") % message)

    if cursor_func:
        cursor_func(_("Creating data to be archived..."))

    plugin_manager = GuiPluginManager.get_instance()
    for plugin in plugin_manager.get_export_plugins():
        if plugin.get_extension() == "gramps":
            export_function = plugin.get_export_function()
            export_function(dbase, filename, None, callback)

    if cursor_func:
        cursor_func(_("Saving archive..."))

    cmd = ci_cmd + ['-m%s' % comment, filename, archive_name]
    proc = subprocess.Popen(cmd, stderr=subprocess.PIPE)

    status = proc.wait()
    message = "\n".join(proc.stderr.readlines())
    proc.stderr.close()
    del proc

    if status != 0:
        ErrorDialog(
            _("Archiving failed"),
            _("An attempt to archive the data failed "
              "with the following message:\n\n%s") % message)
def get_quick_report_list(qv_category=None):
    """
    Returns a list of PluginData of quick views of category qv_category
    CATEGORY_QR_PERSON, CATEGORY_QR_FAMILY, CATEGORY_QR_EVENT, 
    CATEGORY_QR_SOURCE, CATEGORY_QR_MISC, CATEGORY_QR_PLACE, 
    CATEGORY_QR_REPOSITORY, CATEGORY_QR_MEDIA,
    CATEGORY_QR_CITATION, CATEGORY_QR_SOURCE_OR_CITATION or None for all
    """
    names = []
    pmgr = GuiPluginManager.get_instance()
    for pdata in pmgr.get_reg_quick_reports():
        if qv_category == pdata.category or qv_category is None:
            names.append(pdata)  # (see below for item struct)
    return names
    def __create_maps_menu_actions(self):
        """
        Function creating a menu and actions that are used as dropdown menu
        from the menutoolbutton
        """
        menu = gtk.Menu()

        #select the map services to show
        self.mapservicedata = {}
        servlist = GuiPluginManager.get_instance().get_reg_mapservices()
        for i, pdata in enumerate(servlist):
            key = pdata.id.replace(' ', '-')
            add_menuitem(menu, pdata.name, None,
                         make_callback(self.set_mapservice, key))
            self.mapservicedata[key] = pdata

        return menu
def create_quickreport_menu(category, dbstate, uistate, handle):
    """ This functions querries the registered quick reports with 
            quick_report_list of _PluginMgr.py
        It collects the reports of the requested category, which must be one of
                        CATEGORY_QR_PERSON, CATEGORY_QR_FAMILY,
                        CATEGORY_QR_EVENT, CATEGORY_QR_SOURCE, CATEGORY_QR_MEDIA,
                        CATEGORY_QR_PLACE, CATEGORY_QR_REPOSITORY,
                        CATEGORY_QR_CITATION, CATEGORY_QR_SOURCE_OR_CITATION
        It constructs the ui string of the quick report menu, and it's actions
        The action callback function is constructed, using the dbstate and the
            handle as input method.
        A tuple is returned, containing the ui string of the quick report menu,
        and its associated actions
    """

    actions = []
    ofile = StringIO()
    ofile.write('<menu action="QuickReport">')

    actions.append(('QuickReport', None, _("Quick View"), None, None, None))

    menu = gtk.Menu()
    menu.show()

    #select the reports to show
    showlst = []
    pmgr = GuiPluginManager.get_instance()
    for pdata in pmgr.get_reg_quick_reports():
        if pdata.supported and pdata.category == category:
            #add tuple function, translated name, name, status
            showlst.append(pdata)

    showlst.sort(by_menu_name)
    for pdata in showlst:
        new_key = pdata.id.replace(' ', '-')
        ofile.write('<menuitem action="%s"/>' % new_key)
        actions.append((new_key, None, pdata.name, None, None,
                        make_quick_report_callback(pdata, category, dbstate,
                                                   uistate, handle)))
    ofile.write('</menu>')

    return (ofile.getvalue(), actions)
def create_web_connect_menu(dbstate, uistate, nav_group, handle):
    """ 
    This functions querries the registered web connects.  It collects
    the connects of the requested category, which must be one of
    nav_group.
        
    It constructs the ui string of the menu, and it's actions. The
    action callback function is constructed, using the dbstate and the
    handle as input method.  A tuple is returned, containing the ui
    string of the menu, and its associated actions.
    """
    actions = []
    ofile = StringIO()
    ofile.write('<menu action="WebConnect">')
    actions.append(('WebConnect', None, _("Web Connect"), None, None, None))
    menu = gtk.Menu()
    menu.show()
    #select the web connects to show
    showlst = []
    pmgr = GuiPluginManager.get_instance()
    plugins = pmgr.process_plugin_data('WebConnect')
    try:
        connections = [
            plug(nav_group) if callable(plug) else plug for plug in plugins
        ]
    except:
        import traceback
        traceback.print_exc()
        connections = []
    connections = flatten(connections)
    connections.sort(key=lambda plug: plug.name)
    actions = []
    for connect in connections:
        ofile.write('<menuitem action="%s"/>' % connect.key)
        actions.append((connect.key, None, connect.name, None, None,
                        connect(dbstate, uistate, nav_group, handle)))
    ofile.write('</menu>')
    retval = [ofile.getvalue()]
    retval.extend(actions)
    return retval
Exemple #12
0
    def __init__(self, dbase, name):
        """
        Create a new empty BookItem.
        
        name:   the book item is retrieved 
                from the book item registry using name for lookup
        """
        self.dbase = dbase
        self.style_name = "default"
        pmgr = GuiPluginManager.get_instance()

        for pdata in pmgr.get_reg_bookitems():
            if pdata.id == name:
                self.translated_name = pdata.name
                if not pdata.supported:
                    self.category = _UNSUPPORTED
                else:
                    self.category = book_categories[pdata.category]
                mod = pmgr.load_plugin(pdata)
                self.write_item = eval('mod.' + pdata.reportclass)
                self.name = pdata.id
                oclass = eval('mod.' + pdata.optionclass)
                self.option_class = oclass(self.name, self.dbase)
                self.option_class.load_previous_values()
Exemple #13
0
# GTK+ modules
#
#-------------------------------------------------------------------------
import gtk

#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
import const
import config
from _reportdialog import ReportDialog
from _papermenu import PaperFrame
from gui.pluginmanager import GuiPluginManager
PLUGMAN = GuiPluginManager.get_instance()


#-------------------------------------------------------------------------
#
# ReportDialog class
#
#-------------------------------------------------------------------------
class DocReportDialog(ReportDialog):
    """
    The DocReportDialog base class.  This is a base class for generating
    dialogs for docgen derived reports.
    """
    def __init__(self, dbstate, uistate, option_class, name, trans_name):
        """Initialize a dialog to request that the user select options
        for a basic *stand-alone* report."""
def run_report(dbstate,
               uistate,
               category,
               handle,
               pdata,
               container=None,
               **kwargs):
    """
        Run a Quick Report.
        Optionally container can be passed, rather than putting the report 
        in a new window. 
        **kwargs are only used for special quick views that allow additional
        arguments, and that are run by run_quick_report_by_name().
        """
    from docgen import TextBufDoc
    from Simple import make_basic_stylesheet
    pmgr = GuiPluginManager.get_instance()
    mod = pmgr.load_plugin(pdata)
    if not mod:
        print "QuickView Error: plugin does not load"
        return
    func = eval('mod.' + pdata.runfunc)
    if handle:
        d = TextBufDoc(make_basic_stylesheet(), None)
        d.dbstate = dbstate
        d.uistate = uistate
        if isinstance(handle, basestring):  # a handle
            if category == CATEGORY_QR_PERSON:
                obj = dbstate.db.get_person_from_handle(handle)
            elif category == CATEGORY_QR_FAMILY:
                obj = dbstate.db.get_family_from_handle(handle)
            elif category == CATEGORY_QR_EVENT:
                obj = dbstate.db.get_event_from_handle(handle)
            elif category == CATEGORY_QR_SOURCE:
                obj = dbstate.db.get_source_from_handle(handle)
            elif category == CATEGORY_QR_CITATION:
                obj = dbstate.db.get_citation_from_handle(handle)
            elif category == CATEGORY_QR_SOURCE_OR_CITATION:
                source = dbstate.db.get_source_from_handle(handle)
                citation = dbstate.db.get_citation_from_handle(handle)
                if (not source and not citation) or (source and citation):
                    raise ValueError(
                        "selection must be either source or citation")
                if citation:
                    obj = citation
                else:
                    obj = source
            elif category == CATEGORY_QR_PLACE:
                obj = dbstate.db.get_place_from_handle(handle)
            elif category == CATEGORY_QR_MEDIA:
                obj = dbstate.db.get_object_from_handle(handle)
            elif category == CATEGORY_QR_REPOSITORY:
                obj = dbstate.db.get_repository_from_handle(handle)
            elif category == CATEGORY_QR_NOTE:
                obj = dbstate.db.get_note_from_handle(handle)
            elif category == CATEGORY_QR_MISC:
                obj = handle
            else:
                obj = None
        else:  # allow caller to send object directly
            obj = handle
        if obj:
            if container:
                result = d.open("", container=container)
                func(dbstate.db, d, obj, **kwargs)
                return result
            else:
                d.open("")
                retval = func(dbstate.db, d, obj, **kwargs)
                d.close()
                return retval
        else:
            print "QuickView Error: failed to run report: no obj"
    else:
        print "QuickView Error: handle is not set"
Exemple #15
0
    def __init__(self,
                 state,
                 uistate,
                 track,
                 categories,
                 msg,
                 label=None,
                 button_label=None,
                 tool_tip=None,
                 content=_REPORTS):
        """
        Display the dialog box, and build up the list of available
        reports. This is used to build the selection tree on the left
        hand side of the dialog box.
        """
        self.active = uistate.get_active('Person')
        self.imap = {}
        self.msg = msg
        self.content = content
        self._pmgr = GuiPluginManager.get_instance()

        ManagedWindow.ManagedWindow.__init__(self, uistate, track,
                                             self.__class__)

        self.state = state
        self.uistate = uistate

        self.dialog = gtk.Builder()
        self.dialog.add_from_file(const.PLUGINS_GLADE)
        self.dialog.connect_signals({
            "on_report_apply_clicked": self.on_apply_clicked,
            "destroy_passed_object": self.close,
            "on_delete_event": self.close,
        })

        self.tree = self.dialog.get_object("tree")
        window = self.dialog.get_object("report")
        self.title = self.dialog.get_object("title")

        self.set_window(window, self.title, msg)

        self.store = gtk.TreeStore(str)
        self.selection = self.tree.get_selection()
        self.selection.connect('changed', self.on_node_selected)
        col = gtk.TreeViewColumn('', gtk.CellRendererText(), text=0)
        self.tree.append_column(col)
        self.tree.set_model(self.store)

        self.description = self.dialog.get_object("description")
        if label:
            self.description.set_text(label)
        self.status = self.dialog.get_object("report_status")

        self.author_name = self.dialog.get_object("author_name")
        self.author_email = self.dialog.get_object("author_email")

        self.apply_button = self.dialog.get_object("apply")
        if button_label:
            self.apply_button.set_label(button_label)
        else:
            self.apply_button.set_label(_("_Apply"))
        self.apply_button.set_use_underline(True)
        if tool_tip:
            self.apply_button.set_tooltip_text(tool_tip)

        self.item = None

        if content == _REPORTS:
            reg_list = self._pmgr.get_reg_reports()
        elif content == _TOOLS:
            reg_list = self._pmgr.get_reg_tools()
        else:
            reg_list = []
        self.build_plugin_tree(reg_list, categories)
        self.show()
Exemple #16
0
    def __init__(self, dbstate, uistate, track=[]):
        self.dbstate = dbstate
        self.__uistate = uistate
        self.title = _("Plugin Manager")
        ManagedWindow.ManagedWindow.__init__(self, uistate, track,
                                             self.__class__)

        self.__pmgr = GuiPluginManager.get_instance()
        self.__preg = PluginRegister.get_instance()
        self.set_window(
            gtk.Dialog("", uistate.window, gtk.DIALOG_DESTROY_WITH_PARENT,
                       (gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)), None,
            self.title)
        self.window.set_size_request(750, 400)
        self.window.connect('response', self.close)

        notebook = gtk.Notebook()

        #first page with all registered plugins
        vbox_reg = gtk.VBox()
        scrolled_window_reg = gtk.ScrolledWindow()
        self.list_reg = gtk.TreeView()
        #  model: plugintype, hidden, pluginname, plugindescr, pluginid
        self.model_reg = gtk.ListStore(gobject.TYPE_STRING,
                                       gobject.TYPE_STRING,
                                       gobject.TYPE_STRING,
                                       gobject.TYPE_STRING,
                                       gobject.TYPE_STRING)
        self.selection_reg = self.list_reg.get_selection()
        self.list_reg.set_model(self.model_reg)
        self.list_reg.set_rules_hint(True)
        self.list_reg.connect('button-press-event', self.button_press_reg)
        col0_reg = gtk.TreeViewColumn(_('Type'),
                                      gtk.CellRendererText(),
                                      text=0)
        col0_reg.set_sort_column_id(0)
        col0_reg.set_resizable(True)
        self.list_reg.append_column(col0_reg)
        col = gtk.TreeViewColumn(_('Status'), gtk.CellRendererText(), markup=1)
        col.set_sort_column_id(1)
        self.list_reg.append_column(col)
        col2_reg = gtk.TreeViewColumn(_('Name'),
                                      gtk.CellRendererText(),
                                      text=2)
        col2_reg.set_sort_column_id(2)
        col2_reg.set_resizable(True)
        self.list_reg.append_column(col2_reg)
        col = gtk.TreeViewColumn(_('Description'),
                                 gtk.CellRendererText(),
                                 text=3)
        col.set_sort_column_id(3)
        col.set_resizable(True)
        self.list_reg.append_column(col)
        self.list_reg.set_search_column(2)

        scrolled_window_reg.add(self.list_reg)
        vbox_reg.pack_start(scrolled_window_reg)
        hbutbox = gtk.HButtonBox()
        hbutbox.set_layout(gtk.BUTTONBOX_SPREAD)
        self.__info_btn = gtk.Button(_("Info"))
        hbutbox.add(self.__info_btn)
        self.__info_btn.connect('clicked', self.__info, self.list_reg,
                                4)  # id_col
        self.__hide_btn = gtk.Button(_("Hide/Unhide"))
        hbutbox.add(self.__hide_btn)
        self.__hide_btn.connect('clicked', self.__hide, self.list_reg, 4,
                                1)  # list, id_col, hide_col
        if __debug__:
            self.__edit_btn = gtk.Button(_("Edit"))
            hbutbox.add(self.__edit_btn)
            self.__edit_btn.connect('clicked', self.__edit, self.list_reg,
                                    4)  # id_col
            self.__load_btn = gtk.Button(_("Load"))
            hbutbox.add(self.__load_btn)
            self.__load_btn.connect('clicked', self.__load, self.list_reg,
                                    4)  # id_col
        vbox_reg.pack_start(hbutbox, expand=False, padding=5)

        notebook.append_page(vbox_reg,
                             tab_label=gtk.Label(_('Registered Plugins')))

        #second page with loaded plugins
        vbox_loaded = gtk.VBox()
        scrolled_window = gtk.ScrolledWindow()
        self.list = gtk.TreeView()
        self.model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING,
                                   gobject.TYPE_STRING, object,
                                   gobject.TYPE_STRING, gobject.TYPE_STRING)
        self.selection = self.list.get_selection()
        self.list.set_model(self.model)
        self.list.set_rules_hint(True)
        self.list.connect('button-press-event', self.button_press)
        self.list.connect('cursor-changed', self.cursor_changed)
        col = gtk.TreeViewColumn(_('Loaded'), gtk.CellRendererText(), markup=0)
        col.set_sort_column_id(0)
        col.set_resizable(True)
        self.list.append_column(col)
        col1 = gtk.TreeViewColumn(_('File'), gtk.CellRendererText(), text=1)
        col1.set_sort_column_id(1)
        col1.set_resizable(True)
        self.list.append_column(col1)
        col = gtk.TreeViewColumn(_('Status'), gtk.CellRendererText(), markup=5)
        col.set_sort_column_id(5)
        self.list.append_column(col)
        col2 = gtk.TreeViewColumn(_('Message'), gtk.CellRendererText(), text=2)
        col2.set_sort_column_id(2)
        col2.set_resizable(True)
        self.list.append_column(col2)
        self.list.set_search_column(1)

        scrolled_window.add(self.list)
        vbox_loaded.pack_start(scrolled_window)
        hbutbox = gtk.HButtonBox()
        hbutbox.set_layout(gtk.BUTTONBOX_SPREAD)
        self.__info_btn = gtk.Button(_("Info"))
        hbutbox.add(self.__info_btn)
        self.__info_btn.connect('clicked', self.__info, self.list, 4)  # id_col
        self.__hide_btn = gtk.Button(_("Hide/Unhide"))
        hbutbox.add(self.__hide_btn)
        self.__hide_btn.connect('clicked', self.__hide, self.list, 4,
                                5)  # list, id_col, hide_col

        if __debug__:
            self.__edit_btn = gtk.Button(_("Edit"))
            hbutbox.add(self.__edit_btn)
            self.__edit_btn.connect('clicked', self.__edit, self.list,
                                    4)  # id_col
            self.__load_btn = gtk.Button(_("Load"))
            self.__load_btn.set_sensitive(False)
            hbutbox.add(self.__load_btn)
            self.__load_btn.connect('clicked', self.__load, self.list,
                                    4)  # id_col
        vbox_loaded.pack_start(hbutbox, expand=False, padding=5)
        notebook.append_page(vbox_loaded,
                             tab_label=gtk.Label(_('Loaded Plugins')))

        #third page with method to install plugin
        install_page = gtk.VBox()
        scrolled_window = gtk.ScrolledWindow()
        self.addon_list = gtk.TreeView()
        # model: help_name, name, ptype, image, desc, use, rating, contact, download, url
        self.addon_model = gtk.ListStore(
            gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING,
            gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING,
            gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING,
            gobject.TYPE_STRING)
        self.addon_list.set_model(self.addon_model)
        self.addon_list.set_rules_hint(True)
        #self.addon_list.connect('button-press-event', self.button_press)
        col = gtk.TreeViewColumn(_('Addon Name'),
                                 gtk.CellRendererText(),
                                 text=1)
        col.set_sort_column_id(1)
        self.addon_list.append_column(col)
        col = gtk.TreeViewColumn(_('Type'), gtk.CellRendererText(), text=2)
        col.set_sort_column_id(2)
        self.addon_list.append_column(col)
        col = gtk.TreeViewColumn(_('Description'),
                                 gtk.CellRendererText(),
                                 text=4)
        col.set_sort_column_id(4)
        self.addon_list.append_column(col)
        self.addon_list.connect('cursor-changed', self.button_press_addon)

        install_row = gtk.HBox()
        install_row.pack_start(gtk.Label(_("Path to Addon:")), expand=False)
        self.install_addon_path = gtk.Entry()

        button = gtk.Button()
        img = gtk.Image()
        img.set_from_stock(gtk.STOCK_OPEN, gtk.ICON_SIZE_BUTTON)
        button.add(img)
        button.connect('clicked', self.__select_file)
        install_row.pack_start(self.install_addon_path, expand=True)
        install_row.pack_start(button, expand=False, fill=False)

        scrolled_window.add(self.addon_list)
        install_page.pack_start(scrolled_window)
        #add some spce under the scrollbar
        install_page.pack_start(gtk.Label(''), expand=False, fill=False)
        #path to addon path line
        install_page.pack_start(install_row, expand=False, fill=False)

        hbutbox = gtk.HButtonBox()
        hbutbox.set_layout(gtk.BUTTONBOX_SPREAD)
        self.__add_btn = gtk.Button(_("Install Addon"))
        hbutbox.add(self.__add_btn)
        self.__add_btn.connect('clicked', self.__get_addon_top)
        self.__add_all_btn = gtk.Button(_("Install All Addons"))
        hbutbox.add(self.__add_all_btn)
        self.__add_all_btn.connect('clicked', self.__get_all_addons)
        self.__refresh_btn = gtk.Button(_("Refresh Addon List"))
        hbutbox.add(self.__refresh_btn)
        self.__refresh_btn.connect('clicked', self.__refresh_addon_list)
        install_page.pack_start(hbutbox, expand=False, padding=5)
        # notebook.append_page(install_page,
        #                      tab_label=gtk.Label(_('Install Addons')))

        #add the notebook to the window
        self.window.vbox.add(notebook)

        if __debug__:
            # Only show the "Reload" button when in debug mode
            # (without -O on the command line)
            self.__reload_btn = gtk.Button(_("Reload"))
            self.window.action_area.add(self.__reload_btn)
            self.__reload_btn.connect('clicked', self.__reload)

        #obtain hidden plugins from the pluginmanager
        self.hidden = self.__pmgr.get_hidden_plugin_ids()

        self.window.show_all()
        self.__populate_lists()
        self.list_reg.columns_autosize()
    def __init__(self,dbstate,uistate):
        """
        Set up the assistant, and build all the possible assistant pages.
         
        Some page elements are left empty, since their contents depends
        on the user choices and on the success of the attempted save.
         
        """
        self.dbstate = dbstate
        self.uistate = uistate
        
        self.writestarted = False
        
        #set up Assistant
        gtk.Assistant.__init__(self)
        ##workaround around bug http://bugzilla.gnome.org/show_bug.cgi?id=56070
        self.forward_button = None
        gtk.Assistant.forall(self, self.get_forward_button)
        ## end
        
        #set up ManagedWindow
        self.top_title = _("Export Assistant")
        ManagedWindow.ManagedWindow.__init__(self,uistate,[],
                                                 self.__class__)
        #set_window is present in both parent classes
        ManagedWindow.ManagedWindow.set_window(self, self, None,
            self.top_title, isWindow=True)        

        #set up callback method for the export plugins
        self.callback = self.pulse_progressbar
            
        person_handle = self.uistate.get_active('Person')
        self.person = self.dbstate.db.get_person_from_handle(person_handle)
        if not self.person:
            self.person = self.dbstate.db.find_initial_person()
            
        try:
            self.logo      = gtk.gdk.pixbuf_new_from_file(_gramps_png)
        except:
            self.logo = None
        try:
            self.splash    = gtk.gdk.pixbuf_new_from_file(_splash_jpg)
        except:
            self.splash = None

            
        pmgr = GuiPluginManager.get_instance()
        self.__exporters = pmgr.get_export_plugins()
        self.map_exporters = {}
        
        self.__previous_page = -1

        #create the assistant pages
        self.create_page_intro()
        self.create_page_exporttypes()
        self.create_page_options()
        self.create_page_fileselect()
        self.create_page_confirm()
        #no progress page, looks ugly, and user needs to hit forward at end!
        self.create_page_summary()
        
        self.option_box_instance = None
        #we need our own forward function as options page must not always be shown
        self.set_forward_page_func(self.forward_func, None)
        
        #ManagedWindow show method
        ManagedWindow.ManagedWindow.show(self)