Exemplo n.º 1
0
    def add_menu_options(self, menu):
        """
        Add options to the menu for the ancestor report.
        """
        category_name = _("Report Options")
        
        report_type = EnumeratedListOption(_('Census Selection'), TYPE_PERSON)
        report_type.add_item(TYPE_PERSON, _('By Person'))
        report_type.add_item(TYPE_SOURCE, _('By Source'))
        report_type.add_item(TYPE_BOTH, _('By Person and Source'))
        report_type.add_item(TYPE_ALL, _('All Census records'))
        report_type.set_help(_("The type of report"))
        menu.add_option(category_name, "report_type", report_type)
        
        pid = PersonOption(_("Person"))
        pid.set_help(_("The selected person for the report."))
        menu.add_option(category_name, "pid", pid)

        default = None
        sources = get_census_sources(self.database)
        if len(sources) > 0:
            if len(sources[0]) > 0:
                default = sources[0][0]
        src_handle = EnumeratedListOption(_('Source'), default)
        for source in sources:
            src_handle.add_item(source[0], source[1])
        menu.add_option(category_name, "src_handle", src_handle)
        
        pg_break = BooleanOption(_("Page break after each census."), False)
        pg_break.set_help(_("Start a new page after each census."))
        menu.add_option(category_name, "pg_break", pg_break)
Exemplo n.º 2
0
    def add_menu_options(self, menu):
        """
        Add options to the menu for the ancestor report.
        """
        category_name = _("Report Options")

        report_type = EnumeratedListOption(_('Census Selection'), TYPE_PERSON)
        report_type.add_item(TYPE_PERSON, _('By Person'))
        report_type.add_item(TYPE_SOURCE, _('By Source'))
        report_type.add_item(TYPE_BOTH, _('By Person and Source'))
        report_type.add_item(TYPE_ALL, _('All Census records'))
        report_type.set_help(_("The type of report"))
        menu.add_option(category_name, "report_type", report_type)

        pid = PersonOption(_("Person"))
        pid.set_help(_("The selected person for the report."))
        menu.add_option(category_name, "pid", pid)

        default = None
        sources = get_census_sources(self.database)
        if len(sources) > 0:
            if len(sources[0]) > 0:
                default = sources[0][0]
        src_handle = EnumeratedListOption(_('Source'), default)
        for source in sources:
            src_handle.add_item(source[0], source[1])
        menu.add_option(category_name, "src_handle", src_handle)

        pg_break = BooleanOption(_("Page break after each census."), False)
        pg_break.set_help(_("Start a new page after each census."))
        menu.add_option(category_name, "pg_break", pg_break)
Exemplo n.º 3
0
    def __create_gui(self):
        """
        Create and display the GUI components of the editor.
        """
        root = Gtk.Window(type=Gtk.WindowType.TOPLEVEL)
        root.set_transient_for(self.uistate.window)

        vbox = Gtk.VBox()

        tab = Gtk.Table(4, 4, False)
        tab.set_row_spacings(10)
        tab.set_col_spacings(10)

        census_label = Gtk.Label(_("Source:"))
        census_label.set_alignment(0.0, 0.5)
        tab.attach(census_label, 0, 1, 0, 1,
                   xoptions=Gtk.AttachOptions.FILL, xpadding=10)
        
        liststore = Gtk.ListStore(str, str, str)
        for row in get_census_sources(self.db):
            liststore.append([row[0].decode(), row[1], row[2]])

        census_combo = Gtk.ComboBox()
        census_combo.set_model(liststore)
        cell = Gtk.CellRendererText()
        census_combo.pack_start(cell, True)
        census_combo.add_attribute(cell, 'text', 1)
        #cell = Gtk.CellRendererText()
        #census_combo.pack_start(cell, True)
        #census_combo.add_attribute(cell, 'text', 2)
        census_combo.connect('changed', self.__census_changed)
        self.widgets['census_combo'] = census_combo
        
        hbox = Gtk.HBox()
        hbox.pack_start(census_combo, False, True, 0)
        tab.attach(hbox, 1, 2, 0, 1)

        date_label = Gtk.Label(_("Date:"))
        date_label.set_alignment(0.0, 0.5)
        tab.attach(date_label, 0, 1, 1, 2,
                   xoptions=Gtk.AttachOptions.FILL, xpadding=10)
        
        date_text = Gtk.Label()
        date_text.set_alignment(0.0, 0.5)
        tab.attach(date_text, 1, 2, 1, 2)
        self.widgets['date_text'] = date_text
        
        ref_label = Gtk.Label(_("Reference:"))
        ref_label.set_alignment(0.0, 0.5)
        tab.attach(ref_label, 0, 1, 2, 3,
                   xoptions=Gtk.AttachOptions.FILL, xpadding=10)
        
        ref_entry = Gtk.Entry()
        tab.attach(ref_entry, 1, 2, 2, 3)
        self.widgets['ref_entry'] = ref_entry

        place_label = Gtk.Label(_("Place:"))
        place_label.set_alignment(0.0, 0.5)
        tab.attach(place_label, 0, 1, 3, 4,
                   xoptions=Gtk.AttachOptions.FILL, xpadding=10)
        
        place_text = Gtk.Label()
        place_text.set_alignment(0.0, 0.5)
        tab.attach(place_text, 1, 2, 3, 4)
        self.widgets['place_text'] = place_text

        image = Gtk.Image()
        image.set_from_stock(Gtk.STOCK_INDEX, Gtk.IconSize.BUTTON)
        place_share = Gtk.Button()
        place_share.set_relief(Gtk.ReliefStyle.NONE)
        place_share.add(image)
        tab.attach(place_share, 2, 3, 3, 4, xoptions=0)
        self.widgets['place_share'] = place_share

        image = Gtk.Image()
        image.set_from_stock(Gtk.STOCK_ADD, Gtk.IconSize.BUTTON)
        place_add = Gtk.Button()
        place_add.set_relief(Gtk.ReliefStyle.NONE)
        place_add.add(image)
        tab.attach(place_add, 3, 4, 3, 4, xoptions=0)
        self.widgets['place_add'] = place_add
 
        button_box = Gtk.HButtonBox()
        button_box.set_layout(Gtk.ButtonBoxStyle.END)
        
        help_btn = Gtk.Button(stock=Gtk.STOCK_HELP)
        help_btn.connect('clicked', self.help_clicked)
        button_box.add(help_btn)
        button_box.set_child_secondary(help_btn, True)

        cancel_btn = Gtk.Button(stock=Gtk.STOCK_CANCEL)
        cancel_btn.connect('clicked', self.close)
        button_box.add(cancel_btn)
        
        ok_btn = Gtk.Button(stock=Gtk.STOCK_OK)
        ok_btn.connect('clicked', self.save)
        button_box.add(ok_btn)

        notebook = Gtk.Notebook()

        self.details = DetailsTab(self.dbstate,
                                       self.uistate,
                                       self.track,
                                       self.event,
                                       census_combo)
        self._add_tab(notebook, self.details)

        self.headings = HeadingsTab(self.dbstate,
                                       self.uistate,
                                       self.track,
                                       self.event,
                                       census_combo)
        self._add_tab(notebook, self.headings)

        self.gallery_list = GalleryTab(self.dbstate,
                                       self.uistate,
                                       self.track,
                                       self.citation.get_media_list())
        self._add_tab(notebook, self.gallery_list)

        vbox.pack_start(tab, expand=False, fill=True, padding=10)
        vbox.pack_start(notebook, expand=True, fill=True, padding=0)
        vbox.pack_end(button_box, expand=False, fill=True, padding=10)
        
        root.add(vbox)
        root.show_all()

        notebook.set_current_page(0)

        return root