Code Search for Developers
 
 
  

ExportOptions.py from gramps at Krugle


Show ExportOptions.py syntax highlighted

#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2007 Donald N. Allingham
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
import gtk
from gettext import gettext as _

import RelLib
import Config

from BasicUtils import name_displayer
from Filters import GenericFilter, Rules

#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
class WriterOptionBox:
    """
    Create a VBox with the option widgets and define methods to retrieve
    the options. 
    """
    def __init__(self, person):
        self.person = person

    def get_option_box(self):
        table = gtk.Table(3, 2)
        label = gtk.Label('Filter')
        self.filter_obj = gtk.ComboBox()
        self.private_check = gtk.CheckButton(_('Do not include records marked private'))
        self.restrict_check = gtk.CheckButton(_('Restrict data on living people'))

        self.private_check.set_active(Config.get(Config.EXPORT_NO_PRIVATE))
        self.restrict_check.set_active(Config.get(Config.EXPORT_RESTRICT))
        
        table.set_border_width(12)
        table.set_row_spacings(6)
        table.set_col_spacings(6)
        table.attach(label, 0, 1, 0, 1, xoptions=0, yoptions=0)
        table.attach(self.filter_obj, 1, 2, 0, 1, yoptions=0)
        table.attach(self.private_check, 1, 2, 1, 2, yoptions=0)
        table.attach(self.restrict_check, 1, 2, 2, 3, yoptions=0)

        #filter_obj = self.topDialog.get_widget("filter")

        all = GenericFilter()
        all.set_name(_("Entire Database"))

        the_filters = [all]

        if self.person:
            des = GenericFilter()
            des.set_name(_("Descendants of %s") %
                         name_displayer.display(self.person))
            des.add_rule(Rules.Person.IsDescendantOf(
                [self.person.get_gramps_id(), 1]))

            ans = GenericFilter()
            ans.set_name(_("Ancestors of %s")
                         % name_displayer.display(self.person))
            ans.add_rule(Rules.Person.IsAncestorOf(
                [self.person.get_gramps_id(), 1]))

            com = GenericFilter()
            com.set_name(_("People with common ancestor with %s") %
                         name_displayer.display(self.person))
            com.add_rule(Rules.Person.HasCommonAncestorWith(
                [self.person.get_gramps_id()]))

            the_filters += [des, ans, com]

        from Filters import CustomFilters
        the_filters.extend(CustomFilters.get_filters('Person'))

        model = gtk.ListStore(str, object)
        for f in the_filters:
            model.append(row=[f.get_name(), f])

        cell = gtk.CellRendererText()
        self.filter_obj.pack_start(cell, True)
        self.filter_obj.add_attribute(cell, 'text', 0)
        self.filter_obj.set_model(model)
        self.filter_obj.set_active(0)

        table.show()
        return table

    def parse_options(self):

        self.restrict = self.restrict_check.get_active()
        self.private = self.private_check.get_active()

        Config.set(Config.EXPORT_NO_PRIVATE, self.private)
        Config.set(Config.EXPORT_RESTRICT, self.restrict)
        Config.sync()

        model = self.filter_obj.get_model()
        node = self.filter_obj.get_active_iter()
        self.cfilter = model[node][1]





See more files for this project here

gramps

GRAMPS is a GNOME genealogy program for Linux and FreeBSD that allows you to easily build\r\nand keep track of your family tree.

Project homepage: http://sourceforge.net/projects/gramps
Programming language(s): Python
License: other

  BasicUtils/
    Makefile.am
    _NameDisplay.py
    _UpdateCallback.py
    __init__.py
  Config/
    Makefile.am
    _GrampsConfigKeys.py
    _GrampsGconfKeys.py
    _GrampsIniKeys.py
    __init__.py
    gen_schema_keys.py
  DataViews/
    Makefile.am
    _EventView.py
    _FamilyList.py
    _MapView.py
    _MediaView.py
    _NoteView.py
    _PedigreeView.py
    _PersonView.py
    _PlaceView.py
    _RelationView.py
    _RepositoryView.py
    _SourceView.py
    __init__.py
  DateHandler/
    Makefile.am
    _DateDisplay.py
    _DateHandler.py
  DisplayModels/
  DisplayTabs/
  Editors/
  FilterEditor/
  Filters/
  GrampsDb/
  GrampsDbUtils/
  GrampsLocale/
  GrampsLogger/
  Merge/
  Mime/
  Models/
  ObjectSelector/
  PluginUtils/
  RelLib/
  ReportBase/
  Selectors/
  Simple/
  TreeViews/
  data/
  docgen/
  glade/
  images/
  plugins/
  AddMedia.py
  ArgHandler.py
  Assistant.py
  AutoComp.py
  BaseDoc.py
  Bookmarks.py
  ColumnOrder.py
  Date.py
  DateEdit.py
  DbLoader.py
  DbManager.py
  DbState.py
  DdTargets.py
  DisplayState.py
  Errors.py
  ExportAssistant.py
  ExportOptions.py
  FontScale.py
  GrampsCfg.py
  GrampsDisplay.py
  GrampsWidgets.py
  ImgManip.py
  LdsUtils.py
  ListModel.py
  Lru.py
  Makefile.am
  ManagedWindow.py
  MarkupText.py
  Navigation.py
  PageView.py
  PlaceUtils.py
  ProgressDialog.py
  QuestionDialog.py
  QuickReports.py
  RecentFiles.py
  Relationship.py
  Reorder.py
  ScratchPad.py
  Sort.py
  Spell.py
  SubstKeywords.py
  TipOfDay.py
  ToolTips.py
  TransUtils.py
  TreeTips.py
  UndoHistory.py
  Utils.py
  ViewManager.py
  accent.py
  ansel_utf8.py
  build_cmdplug
  const.py.in
  date_test.py
  gramps.py
  gramps_main.py
  soundex.py