2005-08-09 10:11:20 +05:30
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
2007-06-28 11:11:40 +05:30
|
|
|
# Copyright (C) 2000-2007 Donald N. Allingham
|
2005-08-09 10:11:20 +05:30
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
2007-10-07 08:49:35 +05:30
|
|
|
# This program is distributed in the hope that it will be useful,
|
2005-08-09 10:11:20 +05:30
|
|
|
# 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
|
|
|
|
#
|
|
|
|
|
|
|
|
# $Id$
|
|
|
|
|
2007-01-09 10:02:07 +05:30
|
|
|
"""
|
2008-01-25 02:08:10 +05:30
|
|
|
PersonView interface.
|
2007-01-09 10:02:07 +05:30
|
|
|
"""
|
|
|
|
|
2005-08-09 10:11:20 +05:30
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# standard python modules
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
|
2006-02-09 02:43:05 +05:30
|
|
|
import cPickle as pickle
|
2005-08-09 10:11:20 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# gtk
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
import gtk
|
2006-01-23 06:57:46 +05:30
|
|
|
import pango
|
2005-08-09 10:11:20 +05:30
|
|
|
from gtk.gdk import ACTION_COPY, BUTTON1_MASK
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# GRAMPS modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2007-10-08 22:11:39 +05:30
|
|
|
import gen.lib
|
2006-05-17 06:18:46 +05:30
|
|
|
from DisplayModels import PeopleModel
|
2005-08-09 10:11:20 +05:30
|
|
|
import PageView
|
2007-06-28 11:11:40 +05:30
|
|
|
from BasicUtils import name_displayer
|
2005-08-09 10:11:20 +05:30
|
|
|
import Utils
|
2008-02-18 15:39:50 +05:30
|
|
|
from QuestionDialog import ErrorDialog, QuestionDialog
|
2005-08-19 18:14:44 +05:30
|
|
|
import TreeTips
|
2006-03-01 10:38:11 +05:30
|
|
|
import Errors
|
2006-05-05 05:18:53 +05:30
|
|
|
import Config
|
2006-03-21 11:53:45 +05:30
|
|
|
import const
|
2007-11-23 21:53:07 +05:30
|
|
|
from TransUtils import sgettext as _
|
2006-03-21 11:53:45 +05:30
|
|
|
|
2006-03-04 10:54:16 +05:30
|
|
|
from Editors import EditPerson
|
2007-01-22 07:47:52 +05:30
|
|
|
from Filters import SearchBar
|
2006-08-05 10:11:56 +05:30
|
|
|
from Filters.SideBar import PersonSidebarFilter
|
2005-08-09 10:11:20 +05:30
|
|
|
from DdTargets import DdTargets
|
|
|
|
|
|
|
|
column_names = [
|
2007-10-07 08:49:35 +05:30
|
|
|
_('Name'),
|
|
|
|
_('ID') ,
|
|
|
|
_('Gender'),
|
|
|
|
_('Birth Date'),
|
|
|
|
_('Birth Place'),
|
|
|
|
_('Death Date'),
|
|
|
|
_('Death Place'),
|
|
|
|
_('Spouse'),
|
|
|
|
_('Last Change'),
|
2005-08-09 10:11:20 +05:30
|
|
|
]
|
2006-05-16 02:07:19 +05:30
|
|
|
|
2005-08-11 22:49:03 +05:30
|
|
|
class PersonView(PageView.PersonNavView):
|
2007-01-09 10:02:07 +05:30
|
|
|
"""
|
|
|
|
PersonView interface
|
|
|
|
"""
|
2005-08-09 10:11:20 +05:30
|
|
|
|
2007-01-09 10:02:07 +05:30
|
|
|
def __init__(self, dbstate, uistate):
|
|
|
|
"""
|
2008-02-24 19:25:55 +05:30
|
|
|
Create the new PersonView interface, with the current dbstate and uistate
|
2007-01-09 10:02:07 +05:30
|
|
|
"""
|
2006-04-23 03:39:16 +05:30
|
|
|
PageView.PersonNavView.__init__(self, _('People'), dbstate, uistate)
|
|
|
|
|
2005-08-09 10:11:20 +05:30
|
|
|
self.inactive = False
|
2007-01-09 10:02:07 +05:30
|
|
|
dbstate.connect('database-changed', self.change_db)
|
2006-01-24 09:43:21 +05:30
|
|
|
self.handle_col = PeopleModel.COLUMN_INT_ID
|
2006-05-02 09:20:46 +05:30
|
|
|
self.model = None
|
2006-05-12 10:21:44 +05:30
|
|
|
self.generic_filter = None
|
2006-05-02 09:20:46 +05:30
|
|
|
|
|
|
|
self.func_list = {
|
2007-10-07 08:49:35 +05:30
|
|
|
'F2' : self.key_goto_home_person,
|
|
|
|
'F3' : self.key_edit_selected_person,
|
|
|
|
'<CONTROL>BackSpace' : self.key_delete_selected_person,
|
|
|
|
'<CONTROL>J' : self.jump,
|
2006-05-02 09:20:46 +05:30
|
|
|
}
|
2006-06-20 09:55:44 +05:30
|
|
|
self.dirty = True
|
2006-07-11 03:16:46 +05:30
|
|
|
|
2007-10-07 08:49:35 +05:30
|
|
|
Config.client.notify_add("/apps/gramps/interface/filter",
|
2006-07-11 03:16:46 +05:30
|
|
|
self.filter_toggle)
|
2005-08-20 03:40:35 +05:30
|
|
|
|
2005-08-14 10:01:29 +05:30
|
|
|
def change_page(self):
|
2006-12-19 07:59:47 +05:30
|
|
|
PageView.PersonNavView.change_page(self)
|
|
|
|
self.edit_action.set_visible(True)
|
|
|
|
self.edit_action.set_sensitive(not self.dbstate.db.readonly)
|
2007-10-07 08:49:35 +05:30
|
|
|
self.uistate.show_filter_results(self.dbstate,
|
|
|
|
self.model.displayed,
|
2007-04-02 04:07:10 +05:30
|
|
|
self.model.total)
|
2006-08-04 19:21:44 +05:30
|
|
|
|
|
|
|
def set_active(self):
|
|
|
|
PageView.PersonNavView.set_active(self)
|
2007-10-07 08:49:35 +05:30
|
|
|
self.key_active_changed = self.dbstate.connect('active-changed',
|
2006-08-04 19:21:44 +05:30
|
|
|
self.goto_active_person)
|
|
|
|
self.goto_active_person()
|
|
|
|
|
|
|
|
def set_inactive(self):
|
2006-10-06 09:02:35 +05:30
|
|
|
if self.active:
|
|
|
|
PageView.PersonNavView.set_inactive(self)
|
|
|
|
self.dbstate.disconnect(self.key_active_changed)
|
2006-08-04 19:21:44 +05:30
|
|
|
|
2005-08-09 10:11:20 +05:30
|
|
|
def define_actions(self):
|
2005-08-11 05:23:24 +05:30
|
|
|
"""
|
|
|
|
Required define_actions function for PageView. Builds the action
|
2007-10-07 08:49:35 +05:30
|
|
|
group information required. We extend beyond the normal here,
|
2005-08-11 05:23:24 +05:30
|
|
|
since we want to have more than one action group for the PersonView.
|
|
|
|
Most PageViews really won't care about this.
|
|
|
|
|
|
|
|
Special action groups for Forward and Back are created to allow the
|
|
|
|
handling of navigation buttons. Forward and Back allow the user to
|
|
|
|
advance or retreat throughout the history, and we want to have these
|
|
|
|
be able to toggle these when you are at the end of the history or
|
|
|
|
at the beginning of the history.
|
|
|
|
"""
|
|
|
|
|
2005-08-11 22:49:03 +05:30
|
|
|
PageView.PersonNavView.define_actions(self)
|
2006-12-19 07:59:47 +05:30
|
|
|
|
|
|
|
self.all_action = gtk.ActionGroup(self.title + "/PersonAll")
|
|
|
|
self.edit_action = gtk.ActionGroup(self.title + "/PersonEdit")
|
|
|
|
|
|
|
|
self.all_action.add_actions([
|
2008-01-29 02:52:06 +05:30
|
|
|
('OpenAllNodes', None, _("Expand all Nodes"), None, None,
|
2007-10-07 08:49:35 +05:30
|
|
|
self.open_all_nodes),
|
2008-01-29 02:52:06 +05:30
|
|
|
('Edit', gtk.STOCK_EDIT, _("action|_Edit..."), "<control>Return",
|
2007-10-07 08:49:35 +05:30
|
|
|
_("Edit the selected person"), self.edit),
|
2008-01-29 02:52:06 +05:30
|
|
|
('CloseAllNodes', None, _("Collapse all Nodes"), None, None,
|
2007-10-07 08:49:35 +05:30
|
|
|
self.close_all_nodes),
|
|
|
|
('QuickReport', None, _("Quick Report"), None, None, None),
|
|
|
|
('Dummy', None, ' ', None, None, self.dummy_report),
|
2006-12-19 07:59:47 +05:30
|
|
|
])
|
|
|
|
|
2007-01-09 10:02:07 +05:30
|
|
|
self.edit_action.add_actions(
|
|
|
|
[
|
2008-01-29 02:52:06 +05:30
|
|
|
('Add', gtk.STOCK_ADD, _("_Add..."), "<control>Insert",
|
2007-10-07 08:49:35 +05:30
|
|
|
_("Add a new person"), self.add),
|
2007-01-26 18:26:52 +05:30
|
|
|
('Remove', gtk.STOCK_REMOVE, _("_Remove"), "<control>Delete",
|
2008-01-29 02:52:06 +05:30
|
|
|
_("Remove the Selected Person"), self.remove),
|
|
|
|
('ColumnEdit', gtk.STOCK_PROPERTIES, _('_Column Editor...'), None,
|
|
|
|
None, self._column_editor),
|
|
|
|
('CmpMerge', None, _('_Compare and Merge...'), None, None,
|
2007-10-07 08:49:35 +05:30
|
|
|
self.cmp_merge),
|
2008-01-29 02:52:06 +05:30
|
|
|
('FastMerge', None, _('_Fast Merge...'), None, None,
|
2007-10-07 08:49:35 +05:30
|
|
|
self.fast_merge),
|
2008-01-29 02:52:06 +05:30
|
|
|
('ExportTab', None, _('Export View...'), None, None, self.export),
|
2006-12-19 07:59:47 +05:30
|
|
|
])
|
|
|
|
|
2007-09-13 09:50:24 +05:30
|
|
|
self._add_action_group(self.edit_action)
|
|
|
|
self._add_action_group(self.all_action)
|
2006-12-19 07:59:47 +05:30
|
|
|
|
|
|
|
def enable_action_group(self, obj):
|
|
|
|
PageView.PersonNavView.enable_action_group(self, obj)
|
|
|
|
self.all_action.set_visible(True)
|
|
|
|
self.edit_action.set_visible(False)
|
|
|
|
self.edit_action.set_sensitive(not self.dbstate.db.readonly)
|
2005-08-11 22:49:03 +05:30
|
|
|
|
2007-01-04 10:39:41 +05:30
|
|
|
def disable_action_group(self):
|
|
|
|
PageView.PersonNavView.disable_action_group(self)
|
2006-12-19 07:59:47 +05:30
|
|
|
|
|
|
|
self.all_action.set_visible(False)
|
|
|
|
self.edit_action.set_visible(False)
|
2006-05-25 09:38:05 +05:30
|
|
|
|
|
|
|
def cmp_merge(self, obj):
|
|
|
|
mlist = self.get_selected_objects()
|
|
|
|
|
|
|
|
if len(mlist) != 2:
|
2008-02-18 15:39:50 +05:30
|
|
|
ErrorDialog(
|
2007-10-07 08:49:35 +05:30
|
|
|
_("Cannot merge people"),
|
2006-06-21 03:04:53 +05:30
|
|
|
_("Exactly two people must be selected to perform a merge. "
|
|
|
|
"A second person can be selected by holding down the "
|
|
|
|
"control key while clicking on the desired person."))
|
2006-05-25 09:38:05 +05:30
|
|
|
else:
|
2006-05-26 02:32:49 +05:30
|
|
|
import Merge
|
2007-01-09 10:02:07 +05:30
|
|
|
person1 = self.db.get_person_from_handle(mlist[0])
|
|
|
|
person2 = self.db.get_person_from_handle(mlist[1])
|
|
|
|
if person1 and person2:
|
|
|
|
Merge.PersonCompare(self.dbstate, self.uistate, person1,
|
|
|
|
person2, self.build_tree)
|
2006-05-25 09:38:05 +05:30
|
|
|
else:
|
2008-02-18 15:39:50 +05:30
|
|
|
ErrorDialog(
|
2007-10-07 08:49:35 +05:30
|
|
|
_("Cannot merge people"),
|
2006-06-20 09:55:44 +05:30
|
|
|
_("Exactly two people must be selected to perform a "
|
|
|
|
"merge. A second person can be selected by holding "
|
|
|
|
"down the control key while clicking on the desired "
|
|
|
|
"person."))
|
2006-05-25 09:38:05 +05:30
|
|
|
|
|
|
|
def fast_merge(self, obj):
|
|
|
|
mlist = self.get_selected_objects()
|
|
|
|
|
|
|
|
if len(mlist) != 2:
|
2008-02-18 15:39:50 +05:30
|
|
|
ErrorDialog(
|
2007-10-07 08:49:35 +05:30
|
|
|
_("Cannot merge people"),
|
2006-06-21 03:04:53 +05:30
|
|
|
_("Exactly two people must be selected to perform a merge. "
|
|
|
|
"A second person can be selected by holding down the "
|
|
|
|
"control key while clicking on the desired person."))
|
2006-05-25 09:38:05 +05:30
|
|
|
else:
|
2006-05-26 02:32:49 +05:30
|
|
|
import Merge
|
2006-05-25 09:38:05 +05:30
|
|
|
|
2007-01-09 10:02:07 +05:30
|
|
|
person1 = self.db.get_person_from_handle(mlist[0])
|
|
|
|
person2 = self.db.get_person_from_handle(mlist[1])
|
|
|
|
if person1 and person2:
|
|
|
|
Merge.MergePeopleUI(self.dbstate, self.uistate, person1,
|
|
|
|
person2, self.build_tree)
|
2006-05-25 09:38:05 +05:30
|
|
|
else:
|
2008-02-18 15:39:50 +05:30
|
|
|
ErrorDialog(
|
2007-10-07 08:49:35 +05:30
|
|
|
_("Cannot merge people"),
|
2006-06-21 03:04:53 +05:30
|
|
|
_("Exactly two people must be selected to perform a merge. "
|
|
|
|
"A second person can be selected by holding down the "
|
|
|
|
"control key while clicking on the desired person."))
|
2006-05-25 09:38:05 +05:30
|
|
|
|
2007-09-13 09:50:24 +05:30
|
|
|
def _column_editor(self, obj):
|
2006-03-06 05:09:20 +05:30
|
|
|
import ColumnOrder
|
|
|
|
|
2006-04-24 03:44:28 +05:30
|
|
|
ColumnOrder.ColumnOrder(
|
2007-10-07 08:49:35 +05:30
|
|
|
_('Select Person Columns'),
|
|
|
|
self.uistate,
|
|
|
|
self.dbstate.db.get_person_column_order(),
|
|
|
|
column_names,
|
2006-04-24 03:44:28 +05:30
|
|
|
self.set_column_order)
|
2006-03-06 05:09:20 +05:30
|
|
|
|
2006-04-24 03:28:17 +05:30
|
|
|
def set_column_order(self, column_list):
|
|
|
|
self.dbstate.db.set_person_column_order(column_list)
|
2006-03-06 05:09:20 +05:30
|
|
|
self.build_columns()
|
2006-05-10 09:32:45 +05:30
|
|
|
self.setup_filter()
|
2005-08-11 05:23:24 +05:30
|
|
|
|
2005-08-09 10:11:20 +05:30
|
|
|
def get_stock(self):
|
2005-08-11 05:23:24 +05:30
|
|
|
"""
|
2008-02-24 19:25:55 +05:30
|
|
|
Return the name of the stock icon to use for the display.
|
2005-08-11 05:23:24 +05:30
|
|
|
This assumes that this icon has already been registered with
|
|
|
|
GNOME as a stock icon.
|
|
|
|
"""
|
2005-08-09 10:11:20 +05:30
|
|
|
return 'gramps-person'
|
|
|
|
|
2007-01-16 11:24:40 +05:30
|
|
|
def start_expand(self, *obj):
|
|
|
|
self.uistate.set_busy_cursor(True)
|
|
|
|
|
|
|
|
def expanded(self, *obj):
|
|
|
|
self.uistate.set_busy_cursor(False)
|
|
|
|
|
2005-08-09 10:11:20 +05:30
|
|
|
def build_widget(self):
|
2005-08-11 05:23:24 +05:30
|
|
|
"""
|
|
|
|
Builds the interface and returns a gtk.Container type that
|
|
|
|
contains the interface. This containter will be inserted into
|
|
|
|
a gtk.Notebook page.
|
|
|
|
"""
|
2006-05-05 18:55:24 +05:30
|
|
|
hpaned = gtk.HBox()
|
2005-08-09 10:11:20 +05:30
|
|
|
self.vbox = gtk.VBox()
|
|
|
|
self.vbox.set_border_width(4)
|
|
|
|
self.vbox.set_spacing(4)
|
|
|
|
|
2007-10-07 08:49:35 +05:30
|
|
|
self.search_bar = SearchBar(self.dbstate, self.uistate,
|
In .:
2006-07-31 Alex Roitman <shura@gramps-project.org>
* src/Filters/_SearchBar.py (SearchBar.__init__): Take dbstate as
a constructor argument; (SearchBar.apply_filter): pass dbstate.
* src/PageView.py (BookMarkView.add_bookmark,
PersonNavView.jumpto, PersonNavView.fwd_clicked,
PersonNavView.back_clicked, ListView.build_widget): Pass dbstate.
* src/Navigation.py (BaseNavigation.__init__,
PersonNavigation.__init__): Take dbstate as a constructor argument;
(PersonNavigation.build_item_name): properly access dbstate.
* src/DisplayState.py (__init__): Do not take dbstate as a
constructor argument; Do not connect dbstate signal here (moved to
ViewManager);
(display_relationship,push_message,modify_statusbar): Make dbstate
an argument.
* src/plugins/Checkpoint.py (run_tool): Pass dbstate.
* src/ViewManager.py (_build_main_window): Do not pass dbstate to
uistate DisplayState constructor; connect dbstate signal handler;
pass dbstate to Navigation; (keypress): Pass dbstate;
(statusbar_key_update): Pass dbstate;
(do_load_plugins): Pass dbstate;
(ViewManager.add_bookmark): Pass dbstate.
* src/DataViews/_RelationView.py (shade_update): Pass dbstate.
* src/DataViews/_PersonView.py (build_widget,_goto,
key_goto_home_person, key_edit_selected_person): Pass dbstate.
* src/Filters/Makefile.am (pkgdata_PYTHON): Remove obsolete file.
* src/Filters/__init__.py: Remove importing obsolete module.
* src/Filters/_FilterWidget.py: Remove obsolete module.
In po:
2006-07-31 Alex Roitman <shura@gramps-project.org>
* POTFILES.in: Remove obsolete file.
svn: r7104
2006-08-01 10:01:10 +05:30
|
|
|
self.build_tree, self.goto_active_person)
|
2006-05-10 09:32:45 +05:30
|
|
|
filter_box = self.search_bar.build()
|
2006-01-17 20:41:15 +05:30
|
|
|
|
2005-08-20 03:40:35 +05:30
|
|
|
self.tree = gtk.TreeView()
|
|
|
|
self.tree.set_rules_hint(True)
|
|
|
|
self.tree.set_headers_visible(True)
|
2006-03-19 08:55:31 +05:30
|
|
|
self.tree.set_fixed_height_mode(True)
|
2007-09-13 09:50:24 +05:30
|
|
|
self.tree.connect('key-press-event', self._key_press)
|
2007-10-07 08:49:35 +05:30
|
|
|
self.tree.connect('start-interactive-search', self.open_all_nodes)
|
2005-08-09 10:11:20 +05:30
|
|
|
|
|
|
|
scrollwindow = gtk.ScrolledWindow()
|
|
|
|
scrollwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
|
|
|
scrollwindow.set_shadow_type(gtk.SHADOW_ETCHED_IN)
|
2005-08-20 03:40:35 +05:30
|
|
|
scrollwindow.add(self.tree)
|
2005-12-05 10:24:40 +05:30
|
|
|
scrollwindow.show_all()
|
2005-08-09 10:11:20 +05:30
|
|
|
|
2007-01-09 10:02:07 +05:30
|
|
|
self.vbox.pack_start(filter_box, False)
|
|
|
|
self.vbox.pack_start(scrollwindow, True)
|
2005-08-09 10:11:20 +05:30
|
|
|
|
|
|
|
self.renderer = gtk.CellRendererText()
|
2007-01-09 10:02:07 +05:30
|
|
|
self.renderer.set_property('ellipsize', pango.ELLIPSIZE_END)
|
2005-08-09 10:11:20 +05:30
|
|
|
self.inactive = False
|
|
|
|
|
|
|
|
self.columns = []
|
2006-05-10 09:32:45 +05:30
|
|
|
|
|
|
|
self.setup_filter()
|
2005-08-09 10:11:20 +05:30
|
|
|
self.build_columns()
|
2007-09-13 09:50:24 +05:30
|
|
|
self.tree.connect('button-press-event', self._button_press)
|
2005-08-20 03:40:35 +05:30
|
|
|
self.tree.connect('drag_data_get', self.drag_data_get)
|
2006-03-27 10:36:10 +05:30
|
|
|
self.tree.connect('drag_begin', self.drag_begin)
|
2005-08-09 10:11:20 +05:30
|
|
|
|
2005-08-20 03:40:35 +05:30
|
|
|
self.selection = self.tree.get_selection()
|
|
|
|
self.selection.set_mode(gtk.SELECTION_MULTIPLE)
|
2007-01-09 10:02:07 +05:30
|
|
|
self.selection.connect('changed', self.row_changed)
|
2005-08-09 10:11:20 +05:30
|
|
|
|
2007-10-07 08:49:35 +05:30
|
|
|
self.filter_sidebar = PersonSidebarFilter(self.dbstate, self.uistate,
|
2006-08-22 22:19:21 +05:30
|
|
|
self.filter_clicked)
|
2006-05-16 02:07:19 +05:30
|
|
|
self.filter_pane = self.filter_sidebar.get_widget()
|
2006-05-05 05:18:53 +05:30
|
|
|
|
2006-05-05 18:55:24 +05:30
|
|
|
hpaned.pack_start(self.vbox, True, True)
|
|
|
|
hpaned.pack_end(self.filter_pane, False, False)
|
2006-07-11 03:16:46 +05:30
|
|
|
self.filter_toggle(None, None, None, None)
|
2006-05-05 05:18:53 +05:30
|
|
|
return hpaned
|
|
|
|
|
2006-06-21 08:13:19 +05:30
|
|
|
def post(self):
|
|
|
|
if Config.get(Config.FILTER):
|
|
|
|
self.search_bar.hide()
|
|
|
|
self.filter_pane.show()
|
|
|
|
else:
|
|
|
|
self.search_bar.show()
|
|
|
|
self.filter_pane.hide()
|
|
|
|
|
2006-05-16 02:07:19 +05:30
|
|
|
def filter_clicked(self):
|
|
|
|
self.generic_filter = self.filter_sidebar.get_filter()
|
2006-05-13 04:08:48 +05:30
|
|
|
self.build_tree()
|
2007-01-09 10:02:07 +05:30
|
|
|
|
|
|
|
def filter_toggle(self, client, cnxn_id, entry, data):
|
|
|
|
if Config.get(Config.FILTER):
|
|
|
|
self.search_bar.hide()
|
|
|
|
self.filter_pane.show()
|
|
|
|
else:
|
|
|
|
self.search_bar.show()
|
|
|
|
self.filter_pane.hide()
|
|
|
|
self.build_tree()
|
|
|
|
|
2006-03-27 10:36:10 +05:30
|
|
|
def drag_begin(self, widget, *data):
|
|
|
|
widget.drag_source_set_icon_stock(self.get_stock())
|
|
|
|
|
2005-08-09 10:11:20 +05:30
|
|
|
def ui_definition(self):
|
2005-08-11 05:23:24 +05:30
|
|
|
"""
|
|
|
|
Specifies the UIManager XML code that defines the menus and buttons
|
|
|
|
associated with the interface.
|
|
|
|
"""
|
2005-08-09 10:11:20 +05:30
|
|
|
return '''<ui>
|
|
|
|
<menubar name="MenuBar">
|
2007-02-06 10:49:16 +05:30
|
|
|
<menu action="FileMenu">
|
|
|
|
<placeholder name="LocalExport">
|
|
|
|
<menuitem action="ExportTab"/>
|
|
|
|
</placeholder>
|
|
|
|
</menu>
|
2006-04-27 03:18:13 +05:30
|
|
|
<menu action="BookMenu">
|
|
|
|
<placeholder name="AddEditBook">
|
|
|
|
<menuitem action="AddBook"/>
|
|
|
|
<menuitem action="EditBook"/>
|
|
|
|
</placeholder>
|
|
|
|
</menu>
|
2005-08-09 10:11:20 +05:30
|
|
|
<menu action="GoMenu">
|
|
|
|
<placeholder name="CommonGo">
|
|
|
|
<menuitem action="Back"/>
|
|
|
|
<menuitem action="Forward"/>
|
|
|
|
<separator/>
|
|
|
|
<menuitem action="HomePerson"/>
|
|
|
|
<separator/>
|
|
|
|
</placeholder>
|
|
|
|
</menu>
|
|
|
|
<menu action="EditMenu">
|
|
|
|
<placeholder name="CommonEdit">
|
|
|
|
<menuitem action="Add"/>
|
|
|
|
<menuitem action="Edit"/>
|
|
|
|
<menuitem action="Remove"/>
|
|
|
|
</placeholder>
|
2006-02-10 06:40:52 +05:30
|
|
|
<menuitem action="SetActive"/>
|
2006-03-06 05:09:20 +05:30
|
|
|
<menuitem action="ColumnEdit"/>
|
2006-06-01 09:06:59 +05:30
|
|
|
<menuitem action="FilterEdit"/>
|
2006-05-25 09:38:05 +05:30
|
|
|
<placeholder name="Merge">
|
|
|
|
<menuitem action="CmpMerge"/>
|
|
|
|
<menuitem action="FastMerge"/>
|
|
|
|
</placeholder>
|
2005-08-09 10:11:20 +05:30
|
|
|
</menu>
|
|
|
|
</menubar>
|
|
|
|
<toolbar name="ToolBar">
|
|
|
|
<placeholder name="CommonNavigation">
|
|
|
|
<toolitem action="Back"/>
|
|
|
|
<toolitem action="Forward"/>
|
|
|
|
<toolitem action="HomePerson"/>
|
|
|
|
</placeholder>
|
|
|
|
<placeholder name="CommonEdit">
|
|
|
|
<toolitem action="Add"/>
|
|
|
|
<toolitem action="Edit"/>
|
|
|
|
<toolitem action="Remove"/>
|
|
|
|
</placeholder>
|
|
|
|
</toolbar>
|
2005-08-12 08:05:27 +05:30
|
|
|
<popup name="Popup">
|
|
|
|
<menuitem action="Back"/>
|
|
|
|
<menuitem action="Forward"/>
|
|
|
|
<menuitem action="HomePerson"/>
|
|
|
|
<separator/>
|
2006-05-02 02:58:31 +05:30
|
|
|
<menuitem action="OpenAllNodes"/>
|
|
|
|
<menuitem action="CloseAllNodes"/>
|
|
|
|
<separator/>
|
2005-08-12 08:05:27 +05:30
|
|
|
<menuitem action="Add"/>
|
|
|
|
<menuitem action="Edit"/>
|
|
|
|
<menuitem action="Remove"/>
|
2007-05-07 09:09:46 +05:30
|
|
|
<separator/>
|
2007-08-30 01:07:58 +05:30
|
|
|
<menu name="QuickReport" action="QuickReport">
|
|
|
|
<menuitem action="Dummy"/>
|
2007-07-27 09:21:54 +05:30
|
|
|
</menu>
|
2005-08-12 08:05:27 +05:30
|
|
|
</popup>
|
2005-08-09 10:11:20 +05:30
|
|
|
</ui>'''
|
|
|
|
|
2007-01-09 10:02:07 +05:30
|
|
|
def change_db(self, db):
|
2005-08-11 05:23:24 +05:30
|
|
|
"""
|
|
|
|
Callback associated with DbState. Whenenver the database
|
|
|
|
changes, this task is called. In this case, we rebuild the
|
|
|
|
columns, and connect signals to the connected database. Tere
|
|
|
|
is no need to store the database, since we will get the value
|
|
|
|
from self.state.db
|
|
|
|
"""
|
2006-05-10 09:32:45 +05:30
|
|
|
self.setup_filter()
|
2006-02-10 10:40:35 +05:30
|
|
|
self.db = db
|
2005-08-11 05:23:24 +05:30
|
|
|
db.connect('person-add', self.person_added)
|
|
|
|
db.connect('person-update', self.person_updated)
|
|
|
|
db.connect('person-delete', self.person_removed)
|
2007-10-03 22:04:51 +05:30
|
|
|
db.connect('person-rebuild', self.person_rebuild)
|
2007-01-17 06:01:06 +05:30
|
|
|
|
2007-01-21 04:19:09 +05:30
|
|
|
if self.active:
|
|
|
|
self.build_tree()
|
|
|
|
else:
|
|
|
|
self.dirty = True
|
2007-01-17 06:01:06 +05:30
|
|
|
|
2006-04-27 03:18:13 +05:30
|
|
|
self.bookmarks.update_bookmarks(db.get_bookmarks())
|
|
|
|
if self.active:
|
|
|
|
self.bookmarks.redraw()
|
2005-08-11 05:23:24 +05:30
|
|
|
|
2007-01-09 10:02:07 +05:30
|
|
|
def goto_active_person(self, obj=None):
|
2005-08-11 05:23:24 +05:30
|
|
|
"""
|
|
|
|
Callback (and usable function) that selects the active person
|
|
|
|
in the display tree.
|
|
|
|
|
|
|
|
We have a bit of a problem due to the nature of how GTK works.
|
2007-10-07 08:49:35 +05:30
|
|
|
We have unselect the previous path and select the new path. However,
|
2005-08-11 05:23:24 +05:30
|
|
|
these cause a row change, which calls the row_change callback, which
|
|
|
|
can end up calling change_active_person, which can call
|
|
|
|
goto_active_person, causing a bit of recusion. Confusing, huh?
|
|
|
|
|
2007-10-07 08:49:35 +05:30
|
|
|
Unforunately, we row_change has to be able to call change_active_person,
|
2005-08-11 05:23:24 +05:30
|
|
|
because the can occur from the interface in addition to programatically.
|
|
|
|
|
|
|
|
TO handle this, we set the self.inactive variable that we can check
|
|
|
|
in row_change to look for this particular condition.
|
|
|
|
"""
|
|
|
|
|
2007-10-07 08:49:35 +05:30
|
|
|
# if there is no active person, or if we have been marked inactive,
|
2005-08-11 05:23:24 +05:30
|
|
|
# simply return
|
|
|
|
|
|
|
|
if not self.dbstate.active or self.inactive:
|
|
|
|
return
|
|
|
|
|
|
|
|
# mark inactive to prevent recusion
|
|
|
|
self.inactive = True
|
|
|
|
|
2006-06-20 09:55:44 +05:30
|
|
|
self._goto()
|
|
|
|
|
|
|
|
# disable the inactive flag
|
|
|
|
self.inactive = False
|
|
|
|
|
|
|
|
# update history
|
|
|
|
self.handle_history(self.dbstate.active.handle)
|
|
|
|
|
|
|
|
def _goto(self):
|
2007-01-09 10:02:07 +05:30
|
|
|
"""
|
|
|
|
select the active person in the person view
|
|
|
|
"""
|
2006-06-20 09:55:44 +05:30
|
|
|
|
2007-01-09 10:02:07 +05:30
|
|
|
person = self.dbstate.active
|
2005-08-11 05:23:24 +05:30
|
|
|
try:
|
2007-01-09 10:02:07 +05:30
|
|
|
if self.model and person:
|
|
|
|
path = self.model.on_get_path(person.get_handle())
|
2006-08-02 05:20:47 +05:30
|
|
|
|
2007-01-09 10:02:07 +05:30
|
|
|
group_name = person.get_primary_name().get_group_name()
|
2006-05-02 09:20:46 +05:30
|
|
|
top_name = self.dbstate.db.get_name_group_mapping(group_name)
|
|
|
|
top_path = self.model.on_get_path(top_name)
|
2007-01-09 10:02:07 +05:30
|
|
|
self.tree.expand_row(top_path, 0)
|
2006-05-02 09:20:46 +05:30
|
|
|
|
|
|
|
current = self.model.on_get_iter(path)
|
|
|
|
selected = self.selection.path_is_selected(path)
|
2007-01-09 10:02:07 +05:30
|
|
|
if current != person.get_handle() or not selected:
|
2006-05-02 09:20:46 +05:30
|
|
|
self.selection.unselect_all()
|
|
|
|
self.selection.select_path(path)
|
2007-01-09 10:02:07 +05:30
|
|
|
self.tree.scroll_to_cell(path, None, 1, 0.5, 0)
|
2005-08-11 05:23:24 +05:30
|
|
|
except KeyError:
|
2005-08-20 03:40:35 +05:30
|
|
|
self.selection.unselect_all()
|
2007-10-07 08:49:35 +05:30
|
|
|
self.uistate.push_message(self.dbstate,
|
In .:
2006-07-31 Alex Roitman <shura@gramps-project.org>
* src/Filters/_SearchBar.py (SearchBar.__init__): Take dbstate as
a constructor argument; (SearchBar.apply_filter): pass dbstate.
* src/PageView.py (BookMarkView.add_bookmark,
PersonNavView.jumpto, PersonNavView.fwd_clicked,
PersonNavView.back_clicked, ListView.build_widget): Pass dbstate.
* src/Navigation.py (BaseNavigation.__init__,
PersonNavigation.__init__): Take dbstate as a constructor argument;
(PersonNavigation.build_item_name): properly access dbstate.
* src/DisplayState.py (__init__): Do not take dbstate as a
constructor argument; Do not connect dbstate signal here (moved to
ViewManager);
(display_relationship,push_message,modify_statusbar): Make dbstate
an argument.
* src/plugins/Checkpoint.py (run_tool): Pass dbstate.
* src/ViewManager.py (_build_main_window): Do not pass dbstate to
uistate DisplayState constructor; connect dbstate signal handler;
pass dbstate to Navigation; (keypress): Pass dbstate;
(statusbar_key_update): Pass dbstate;
(do_load_plugins): Pass dbstate;
(ViewManager.add_bookmark): Pass dbstate.
* src/DataViews/_RelationView.py (shade_update): Pass dbstate.
* src/DataViews/_PersonView.py (build_widget,_goto,
key_goto_home_person, key_edit_selected_person): Pass dbstate.
* src/Filters/Makefile.am (pkgdata_PYTHON): Remove obsolete file.
* src/Filters/__init__.py: Remove importing obsolete module.
* src/Filters/_FilterWidget.py: Remove obsolete module.
In po:
2006-07-31 Alex Roitman <shura@gramps-project.org>
* POTFILES.in: Remove obsolete file.
svn: r7104
2006-08-01 10:01:10 +05:30
|
|
|
_("Active person not visible"))
|
2007-01-09 10:02:07 +05:30
|
|
|
self.dbstate.active = person
|
2005-08-11 05:23:24 +05:30
|
|
|
|
|
|
|
def setup_filter(self):
|
|
|
|
"""
|
|
|
|
Builds the default filters and add them to the filter menu.
|
|
|
|
"""
|
2006-05-10 09:32:45 +05:30
|
|
|
|
|
|
|
cols = []
|
2007-01-09 10:02:07 +05:30
|
|
|
cols.append((_("Name"), 0))
|
2006-05-10 09:32:45 +05:30
|
|
|
for pair in self.dbstate.db.get_person_column_order():
|
|
|
|
if not pair[0]:
|
|
|
|
continue
|
2007-01-09 10:02:07 +05:30
|
|
|
cols.append((column_names[pair[1]], pair[1]))
|
2006-05-10 09:32:45 +05:30
|
|
|
|
|
|
|
self.search_bar.setup_filter(cols)
|
2005-08-11 05:23:24 +05:30
|
|
|
|
2007-01-21 05:46:08 +05:30
|
|
|
def build_tree(self, skip=[]):
|
2005-08-11 05:23:24 +05:30
|
|
|
"""
|
2008-02-24 19:25:55 +05:30
|
|
|
Create a new PeopleModel instance. Essentially creates a complete
|
2007-10-07 08:49:35 +05:30
|
|
|
rebuild of the data. We need to temporarily store the active person,
|
2006-06-20 09:55:44 +05:30
|
|
|
since it can change when rows are unselected when the model is set.
|
2005-08-11 05:23:24 +05:30
|
|
|
"""
|
2006-01-20 11:03:38 +05:30
|
|
|
if self.active:
|
2006-05-10 09:32:45 +05:30
|
|
|
if Config.get(Config.FILTER):
|
2006-05-16 00:19:35 +05:30
|
|
|
filter_info = (PeopleModel.GENERIC, self.generic_filter)
|
2006-05-10 09:32:45 +05:30
|
|
|
else:
|
2006-05-16 00:19:35 +05:30
|
|
|
filter_info = (PeopleModel.SEARCH, self.search_bar.get_value())
|
2006-06-20 09:55:44 +05:30
|
|
|
|
2007-01-21 05:46:08 +05:30
|
|
|
self.model = PeopleModel(self.dbstate.db, filter_info, skip)
|
2006-06-20 09:55:44 +05:30
|
|
|
active = self.dbstate.active
|
2006-01-20 11:03:38 +05:30
|
|
|
self.tree.set_model(self.model)
|
|
|
|
|
2008-06-16 20:31:46 +05:30
|
|
|
if const.USE_TIPS and self.model.tooltip_column is not None:
|
2007-10-07 08:49:35 +05:30
|
|
|
self.tooltips = TreeTips.TreeTips(self.tree,
|
|
|
|
self.model.tooltip_column,
|
2006-03-19 08:55:31 +05:30
|
|
|
True)
|
2006-06-20 09:55:44 +05:30
|
|
|
|
2006-01-20 11:03:38 +05:30
|
|
|
self.build_columns()
|
2006-06-20 09:55:44 +05:30
|
|
|
self.dbstate.change_active_person(active)
|
|
|
|
self._goto()
|
2006-01-20 11:03:38 +05:30
|
|
|
self.dirty = False
|
2007-10-07 08:49:35 +05:30
|
|
|
self.uistate.show_filter_results(self.dbstate,
|
|
|
|
self.model.displayed,
|
2007-04-02 04:07:10 +05:30
|
|
|
self.model.total)
|
2006-01-20 11:03:38 +05:30
|
|
|
else:
|
|
|
|
self.dirty = True
|
2005-08-19 18:14:44 +05:30
|
|
|
|
2007-01-09 10:02:07 +05:30
|
|
|
def add(self, obj):
|
2007-10-08 22:11:39 +05:30
|
|
|
person = gen.lib.Person()
|
2006-11-06 06:11:13 +05:30
|
|
|
|
|
|
|
# attempt to get the current surname
|
|
|
|
|
2007-01-09 10:02:07 +05:30
|
|
|
(mode, paths) = self.selection.get_selected_rows()
|
2006-11-06 06:11:13 +05:30
|
|
|
|
|
|
|
name = u""
|
|
|
|
|
|
|
|
if len(paths) == 1:
|
|
|
|
path = paths[0]
|
|
|
|
if len(path) == 1:
|
|
|
|
name = self.model.on_get_iter(path)
|
|
|
|
else:
|
|
|
|
node = self.model.on_get_iter(path)
|
2007-01-09 10:02:07 +05:30
|
|
|
handle = self.model.on_get_value(node,
|
|
|
|
PeopleModel.COLUMN_INT_ID)
|
|
|
|
newp = self.dbstate.db.get_person_from_handle(handle)
|
|
|
|
name = newp.get_primary_name().get_surname()
|
2006-03-01 10:38:11 +05:30
|
|
|
try:
|
2006-11-06 06:11:13 +05:30
|
|
|
person.get_primary_name().set_surname(name)
|
2006-03-04 10:54:16 +05:30
|
|
|
EditPerson(self.dbstate, self.uistate, [], person)
|
2006-03-01 10:38:11 +05:30
|
|
|
except Errors.WindowActiveError:
|
|
|
|
pass
|
2005-08-09 10:11:20 +05:30
|
|
|
|
2007-01-09 10:02:07 +05:30
|
|
|
def edit(self, obj):
|
2005-09-17 00:07:13 +05:30
|
|
|
if self.dbstate.active:
|
2006-03-01 10:38:11 +05:30
|
|
|
try:
|
2006-05-12 04:35:12 +05:30
|
|
|
handle = self.dbstate.active.handle
|
|
|
|
person = self.dbstate.db.get_person_from_handle(handle)
|
|
|
|
EditPerson(self.dbstate, self.uistate, [], person)
|
2006-03-01 10:38:11 +05:30
|
|
|
except Errors.WindowActiveError:
|
|
|
|
pass
|
2005-08-09 10:11:20 +05:30
|
|
|
|
2007-01-09 10:02:07 +05:30
|
|
|
def open_all_nodes(self, obj):
|
2007-01-16 11:24:40 +05:30
|
|
|
self.uistate.status_text(_("Updating display..."))
|
|
|
|
self.uistate.set_busy_cursor(True)
|
|
|
|
|
2006-05-02 02:58:31 +05:30
|
|
|
self.tree.expand_all()
|
|
|
|
|
2007-01-16 11:24:40 +05:30
|
|
|
self.uistate.set_busy_cursor(False)
|
|
|
|
self.uistate.modify_statusbar(self.dbstate)
|
|
|
|
|
2007-01-09 10:02:07 +05:30
|
|
|
def close_all_nodes(self, obj):
|
2006-05-02 02:58:31 +05:30
|
|
|
self.tree.collapse_all()
|
|
|
|
|
2007-01-09 10:02:07 +05:30
|
|
|
def remove(self, obj):
|
2005-08-09 10:11:20 +05:30
|
|
|
mlist = self.get_selected_objects()
|
|
|
|
if len(mlist) == 0:
|
|
|
|
return
|
|
|
|
|
|
|
|
for sel in mlist:
|
2007-01-09 10:02:07 +05:30
|
|
|
person = self.dbstate.db.get_person_from_handle(sel)
|
|
|
|
self.active_person = person
|
2007-06-28 11:11:40 +05:30
|
|
|
name = name_displayer.display(person)
|
2005-08-09 10:11:20 +05:30
|
|
|
|
|
|
|
msg = _('Deleting the person will remove the person '
|
|
|
|
'from the database.')
|
2007-01-09 10:02:07 +05:30
|
|
|
msg = "%s %s" % (msg, Utils.data_recover_msg)
|
2008-02-18 15:39:50 +05:30
|
|
|
QuestionDialog(_('Delete %s?') % name,
|
2007-10-07 08:49:35 +05:30
|
|
|
msg,
|
|
|
|
_('_Delete Person'),
|
2005-08-09 10:11:20 +05:30
|
|
|
self.delete_person_response)
|
|
|
|
|
|
|
|
def delete_person_response(self):
|
2007-01-31 10:20:12 +05:30
|
|
|
"""
|
|
|
|
Deletes the person from the database.
|
|
|
|
"""
|
|
|
|
# set the busy cursor, so the user knows that we are working
|
|
|
|
self.uistate.set_busy_cursor(True)
|
|
|
|
|
|
|
|
# create the transaction
|
2005-08-11 05:23:24 +05:30
|
|
|
trans = self.dbstate.db.transaction_begin()
|
2005-08-09 10:11:20 +05:30
|
|
|
|
2007-01-31 10:20:12 +05:30
|
|
|
# create name to save
|
|
|
|
person = self.active_person
|
2007-06-28 11:11:40 +05:30
|
|
|
active_name = _("Delete Person (%s)") % name_displayer.display(person)
|
2007-01-20 22:51:45 +05:30
|
|
|
|
2007-01-31 10:20:12 +05:30
|
|
|
# delete the person from the database
|
2007-10-17 08:45:10 +05:30
|
|
|
gen.utils.delete_person_from_database(self.dbstate.db, person, trans)
|
2006-11-11 02:57:08 +05:30
|
|
|
|
2007-01-31 10:20:12 +05:30
|
|
|
# remove the person from the list
|
2005-08-09 10:11:20 +05:30
|
|
|
self.remove_from_person_list(person)
|
|
|
|
|
2007-01-31 10:20:12 +05:30
|
|
|
# commit the transaction
|
|
|
|
self.dbstate.db.transaction_commit(trans, active_name)
|
|
|
|
|
|
|
|
# select the previously active person, turn off the busy cursor
|
2006-02-03 11:01:42 +05:30
|
|
|
self.uistate.phistory.back()
|
2007-01-31 10:20:12 +05:30
|
|
|
self.uistate.set_busy_cursor(False)
|
2005-08-09 10:11:20 +05:30
|
|
|
|
|
|
|
def build_columns(self):
|
|
|
|
for column in self.columns:
|
2005-08-20 03:40:35 +05:30
|
|
|
self.tree.remove_column(column)
|
2005-09-16 20:55:27 +05:30
|
|
|
try:
|
2006-04-24 03:28:17 +05:30
|
|
|
column = gtk.TreeViewColumn(
|
2007-10-07 08:49:35 +05:30
|
|
|
_('Name'),
|
|
|
|
self.renderer,
|
|
|
|
text=0,
|
2006-05-13 10:15:46 +05:30
|
|
|
foreground=self.model.marker_color_column)
|
2006-04-24 03:28:17 +05:30
|
|
|
|
2005-09-16 20:55:27 +05:30
|
|
|
except AttributeError:
|
2007-01-09 10:02:07 +05:30
|
|
|
column = gtk.TreeViewColumn(_('Name'), self.renderer, text=0)
|
2006-04-24 03:28:17 +05:30
|
|
|
|
2005-08-09 10:11:20 +05:30
|
|
|
column.set_resizable(True)
|
|
|
|
column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
|
2006-03-19 08:55:31 +05:30
|
|
|
column.set_fixed_width(225)
|
2005-08-20 03:40:35 +05:30
|
|
|
self.tree.append_column(column)
|
2005-08-09 10:11:20 +05:30
|
|
|
self.columns = [column]
|
|
|
|
|
2005-08-11 05:23:24 +05:30
|
|
|
for pair in self.dbstate.db.get_person_column_order():
|
2005-08-09 10:11:20 +05:30
|
|
|
if not pair[0]:
|
|
|
|
continue
|
|
|
|
name = column_names[pair[1]]
|
2005-09-16 20:55:27 +05:30
|
|
|
try:
|
2006-05-12 10:21:44 +05:30
|
|
|
column = gtk.TreeViewColumn(
|
2007-10-07 08:49:35 +05:30
|
|
|
name, self.renderer, markup=pair[1],
|
2006-05-13 10:15:46 +05:30
|
|
|
foreground=self.model.marker_color_column)
|
2005-09-16 20:55:27 +05:30
|
|
|
except AttributeError:
|
2006-05-12 10:21:44 +05:30
|
|
|
column = gtk.TreeViewColumn(
|
|
|
|
name, self.renderer, markup=pair[1])
|
|
|
|
|
2005-08-09 10:11:20 +05:30
|
|
|
column.set_resizable(True)
|
2006-03-19 08:55:31 +05:30
|
|
|
column.set_fixed_width(pair[2])
|
|
|
|
column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
|
2005-08-09 10:11:20 +05:30
|
|
|
self.columns.append(column)
|
2005-08-20 03:40:35 +05:30
|
|
|
self.tree.append_column(column)
|
2005-08-09 10:11:20 +05:30
|
|
|
|
2007-01-09 10:02:07 +05:30
|
|
|
def row_changed(self, obj):
|
2005-08-09 10:11:20 +05:30
|
|
|
"""Called with a row is changed. Check the selected objects from
|
|
|
|
the person_tree to get the IDs of the selected objects. Set the
|
|
|
|
active person to the first person in the list. If no one is
|
|
|
|
selected, set the active person to None"""
|
|
|
|
|
|
|
|
selected_ids = self.get_selected_objects()
|
2005-08-11 05:23:24 +05:30
|
|
|
if not self.inactive:
|
|
|
|
try:
|
2006-06-17 02:56:44 +05:30
|
|
|
if len(selected_ids) == 0:
|
|
|
|
self.dbstate.change_active_person(None)
|
|
|
|
else:
|
|
|
|
handle = selected_ids[0]
|
|
|
|
person = self.dbstate.db.get_person_from_handle(handle)
|
|
|
|
self.dbstate.change_active_person(person)
|
2005-08-11 05:23:24 +05:30
|
|
|
except:
|
2006-04-18 07:39:43 +05:30
|
|
|
pass
|
2005-08-09 10:11:20 +05:30
|
|
|
|
|
|
|
if len(selected_ids) == 1:
|
2007-10-07 08:49:35 +05:30
|
|
|
self.tree.drag_source_set(BUTTON1_MASK,
|
|
|
|
[DdTargets.PERSON_LINK.target()],
|
2006-03-23 04:33:57 +05:30
|
|
|
ACTION_COPY)
|
2005-08-09 10:11:20 +05:30
|
|
|
elif len(selected_ids) > 1:
|
2007-10-07 08:49:35 +05:30
|
|
|
self.tree.drag_source_set(BUTTON1_MASK,
|
|
|
|
[DdTargets.PERSON_LINK_LIST.target()],
|
2006-03-23 04:33:57 +05:30
|
|
|
ACTION_COPY)
|
In .:
2006-07-31 Alex Roitman <shura@gramps-project.org>
* src/Filters/_SearchBar.py (SearchBar.__init__): Take dbstate as
a constructor argument; (SearchBar.apply_filter): pass dbstate.
* src/PageView.py (BookMarkView.add_bookmark,
PersonNavView.jumpto, PersonNavView.fwd_clicked,
PersonNavView.back_clicked, ListView.build_widget): Pass dbstate.
* src/Navigation.py (BaseNavigation.__init__,
PersonNavigation.__init__): Take dbstate as a constructor argument;
(PersonNavigation.build_item_name): properly access dbstate.
* src/DisplayState.py (__init__): Do not take dbstate as a
constructor argument; Do not connect dbstate signal here (moved to
ViewManager);
(display_relationship,push_message,modify_statusbar): Make dbstate
an argument.
* src/plugins/Checkpoint.py (run_tool): Pass dbstate.
* src/ViewManager.py (_build_main_window): Do not pass dbstate to
uistate DisplayState constructor; connect dbstate signal handler;
pass dbstate to Navigation; (keypress): Pass dbstate;
(statusbar_key_update): Pass dbstate;
(do_load_plugins): Pass dbstate;
(ViewManager.add_bookmark): Pass dbstate.
* src/DataViews/_RelationView.py (shade_update): Pass dbstate.
* src/DataViews/_PersonView.py (build_widget,_goto,
key_goto_home_person, key_edit_selected_person): Pass dbstate.
* src/Filters/Makefile.am (pkgdata_PYTHON): Remove obsolete file.
* src/Filters/__init__.py: Remove importing obsolete module.
* src/Filters/_FilterWidget.py: Remove obsolete module.
In po:
2006-07-31 Alex Roitman <shura@gramps-project.org>
* POTFILES.in: Remove obsolete file.
svn: r7104
2006-08-01 10:01:10 +05:30
|
|
|
self.uistate.modify_statusbar(self.dbstate)
|
2005-08-09 10:11:20 +05:30
|
|
|
|
2005-08-20 03:40:35 +05:30
|
|
|
def drag_data_get(self, widget, context, sel_data, info, time):
|
2005-08-09 10:11:20 +05:30
|
|
|
selected_ids = self.get_selected_objects()
|
2006-04-14 18:09:17 +05:30
|
|
|
nonempty_ids = [h for h in selected_ids if h]
|
|
|
|
if nonempty_ids:
|
2007-01-09 10:02:07 +05:30
|
|
|
data = (DdTargets.PERSON_LINK.drag_type,
|
|
|
|
id(self), nonempty_ids[0], 0)
|
|
|
|
sel_data.set(sel_data.target, 8, pickle.dumps(data))
|
2005-08-09 10:11:20 +05:30
|
|
|
|
2007-01-09 10:02:07 +05:30
|
|
|
def person_added(self, handle_list):
|
2006-05-26 02:05:04 +05:30
|
|
|
if not self.model:
|
|
|
|
return
|
2007-01-09 10:02:07 +05:30
|
|
|
if self.active:
|
|
|
|
self.dirty = False
|
|
|
|
for node in handle_list:
|
|
|
|
person = self.dbstate.db.get_person_from_handle(node)
|
|
|
|
pname = person.get_primary_name()
|
2007-06-28 11:11:40 +05:30
|
|
|
top = name_displayer.name_grouping_name(self.db, pname)
|
2007-01-21 10:47:06 +05:30
|
|
|
|
|
|
|
self.model.rebuild_data(self.model.current_filter)
|
|
|
|
|
2007-01-09 10:02:07 +05:30
|
|
|
if not self.model.is_visable(node):
|
|
|
|
continue
|
|
|
|
|
2007-01-30 10:05:13 +05:30
|
|
|
if (not self.model.mapper.has_top_node(top) or
|
|
|
|
self.model.mapper.number_of_children(top) == 1):
|
2007-01-09 10:02:07 +05:30
|
|
|
path = self.model.on_get_path(top)
|
|
|
|
pnode = self.model.get_iter(path)
|
|
|
|
self.model.row_inserted(path, pnode)
|
|
|
|
path = self.model.on_get_path(node)
|
|
|
|
pnode = self.model.get_iter(path)
|
|
|
|
self.model.row_inserted(path, pnode)
|
|
|
|
else:
|
|
|
|
self.dirty = True
|
|
|
|
|
2007-01-21 05:46:08 +05:30
|
|
|
def func(self, tree, path, ex_list):
|
2007-01-30 10:05:13 +05:30
|
|
|
ex_list.append(self.model.mapper.top_path2iter[path[0]])
|
2007-01-21 05:46:08 +05:30
|
|
|
|
2007-10-03 22:04:51 +05:30
|
|
|
def person_rebuild(self):
|
|
|
|
"""Large change to person database"""
|
|
|
|
if self.active:
|
|
|
|
self.bookmarks.redraw()
|
|
|
|
self.build_tree()
|
|
|
|
|
2007-01-09 10:02:07 +05:30
|
|
|
def person_removed(self, handle_list):
|
2006-05-26 02:05:04 +05:30
|
|
|
if not self.model:
|
|
|
|
return
|
2006-08-18 10:13:03 +05:30
|
|
|
|
2007-01-21 05:46:08 +05:30
|
|
|
expand = []
|
|
|
|
self.tree.map_expanded_rows(self.func, expand)
|
|
|
|
|
|
|
|
self.build_tree(handle_list)
|
|
|
|
for i in expand:
|
2007-01-30 10:05:13 +05:30
|
|
|
path = self.model.mapper.top_iter2path.get(i)
|
2007-01-21 05:46:08 +05:30
|
|
|
if path:
|
|
|
|
self.tree.expand_row(path, False)
|
2006-02-09 06:05:46 +05:30
|
|
|
|
2007-01-09 10:02:07 +05:30
|
|
|
def person_updated(self, handle_list):
|
2006-05-26 02:05:04 +05:30
|
|
|
if not self.model:
|
|
|
|
return
|
|
|
|
|
2006-02-09 10:40:20 +05:30
|
|
|
self.model.clear_cache()
|
2005-08-09 10:11:20 +05:30
|
|
|
for node in handle_list:
|
2005-08-11 05:23:24 +05:30
|
|
|
person = self.dbstate.db.get_person_from_handle(node)
|
2005-08-09 10:11:20 +05:30
|
|
|
try:
|
2007-01-30 10:05:13 +05:30
|
|
|
oldpath = self.model.mapper.iter2path[node]
|
2005-08-09 10:11:20 +05:30
|
|
|
except:
|
|
|
|
return
|
2005-08-20 03:40:35 +05:30
|
|
|
pathval = self.model.on_get_path(node)
|
|
|
|
pnode = self.model.get_iter(pathval)
|
2005-08-09 10:11:20 +05:30
|
|
|
|
|
|
|
# calculate the new data
|
|
|
|
|
|
|
|
if person.primary_name.group_as:
|
|
|
|
surname = person.primary_name.group_as
|
|
|
|
else:
|
2005-08-11 05:23:24 +05:30
|
|
|
base = person.primary_name.surname
|
|
|
|
surname = self.dbstate.db.get_name_group_mapping(base)
|
2005-08-09 10:11:20 +05:30
|
|
|
|
|
|
|
if oldpath[0] == surname:
|
2007-01-09 10:02:07 +05:30
|
|
|
try:
|
|
|
|
self.model.build_sub_entry(surname)
|
|
|
|
except:
|
|
|
|
self.model.calculate_data()
|
2005-08-09 10:11:20 +05:30
|
|
|
else:
|
2006-03-07 09:05:46 +05:30
|
|
|
self.model.calculate_data()
|
2005-08-09 10:11:20 +05:30
|
|
|
|
|
|
|
# find the path of the person in the new data build
|
2007-01-30 10:05:13 +05:30
|
|
|
newpath = self.model.mapper.temp_iter2path[node]
|
2005-08-09 10:11:20 +05:30
|
|
|
|
|
|
|
# if paths same, just issue row changed signal
|
|
|
|
|
|
|
|
if oldpath == newpath:
|
2007-01-09 10:02:07 +05:30
|
|
|
self.model.row_changed(pathval, pnode)
|
2005-08-09 10:11:20 +05:30
|
|
|
else:
|
2006-05-09 08:59:04 +05:30
|
|
|
self.build_tree()
|
|
|
|
break
|
|
|
|
|
2005-08-09 10:11:20 +05:30
|
|
|
self.goto_active_person()
|
|
|
|
|
|
|
|
def get_selected_objects(self):
|
2007-01-09 10:02:07 +05:30
|
|
|
(mode, paths) = self.selection.get_selected_rows()
|
2005-08-09 10:11:20 +05:30
|
|
|
mlist = []
|
|
|
|
for path in paths:
|
2005-08-20 03:40:35 +05:30
|
|
|
node = self.model.on_get_iter(path)
|
2006-01-24 09:43:21 +05:30
|
|
|
handle = self.model.on_get_value(node, PeopleModel.COLUMN_INT_ID)
|
2006-05-01 04:56:38 +05:30
|
|
|
if handle:
|
|
|
|
mlist.append(handle)
|
2005-08-09 10:11:20 +05:30
|
|
|
return mlist
|
|
|
|
|
2007-01-09 10:02:07 +05:30
|
|
|
def remove_from_person_list(self, person):
|
2005-08-09 10:11:20 +05:30
|
|
|
"""Remove the selected person from the list. A person object is
|
|
|
|
expected, not an ID"""
|
2005-08-20 03:40:35 +05:30
|
|
|
path = self.model.on_get_path(person.get_handle())
|
2007-01-09 10:02:07 +05:30
|
|
|
(col, row) = path
|
2005-08-09 10:11:20 +05:30
|
|
|
if row > 0:
|
2007-01-09 10:02:07 +05:30
|
|
|
self.selection.select_path((col, row-1))
|
2005-08-20 03:40:35 +05:30
|
|
|
elif row == 0 and self.model.on_get_iter(path):
|
|
|
|
self.selection.select_path(path)
|
2005-08-09 10:11:20 +05:30
|
|
|
|
2007-09-13 09:50:24 +05:30
|
|
|
def _button_press(self, obj, event):
|
2008-02-29 04:43:07 +05:30
|
|
|
if not self.dbstate.open:
|
|
|
|
return False
|
2005-08-12 08:05:27 +05:30
|
|
|
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
|
|
|
|
handle = self.first_selected()
|
|
|
|
person = self.dbstate.db.get_person_from_handle(handle)
|
2005-09-16 18:48:52 +05:30
|
|
|
if person:
|
2006-03-01 10:38:11 +05:30
|
|
|
try:
|
2006-03-04 10:54:16 +05:30
|
|
|
EditPerson(self.dbstate, self.uistate, [], person)
|
2006-03-01 10:38:11 +05:30
|
|
|
except Errors.WindowActiveError:
|
|
|
|
pass
|
2005-09-16 18:48:52 +05:30
|
|
|
return True
|
2008-01-17 14:44:40 +05:30
|
|
|
else:
|
|
|
|
#press on a parent node
|
|
|
|
return self.expand_collapse()
|
2007-08-30 01:07:58 +05:30
|
|
|
|
2005-08-12 08:05:27 +05:30
|
|
|
elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
|
2007-08-30 01:07:58 +05:30
|
|
|
|
|
|
|
from ReportBase import CATEGORY_QR_PERSON
|
|
|
|
from QuickReports import create_quickreport_menu
|
|
|
|
|
2005-08-12 08:05:27 +05:30
|
|
|
menu = self.uistate.uimanager.get_widget('/Popup')
|
2007-08-30 01:07:58 +05:30
|
|
|
|
|
|
|
#add the quickreports, different for every handle
|
|
|
|
qr_menu = self.uistate.uimanager.\
|
|
|
|
get_widget('/Popup/QuickReport').get_submenu()
|
|
|
|
if qr_menu :
|
|
|
|
self.uistate.uimanager.\
|
|
|
|
get_widget('/Popup/QuickReport').remove_submenu()
|
|
|
|
reportactions = []
|
|
|
|
if menu and self.dbstate.active:
|
|
|
|
(ui, reportactions) = create_quickreport_menu(
|
2007-10-07 08:49:35 +05:30
|
|
|
CATEGORY_QR_PERSON,
|
2007-08-30 01:07:58 +05:30
|
|
|
self.dbstate,
|
2007-12-21 11:52:46 +05:30
|
|
|
self.uistate,
|
2007-08-30 01:07:58 +05:30
|
|
|
self.dbstate.active.handle)
|
|
|
|
if len(reportactions) > 1 :
|
|
|
|
qr_menu = gtk.Menu()
|
|
|
|
for action in reportactions[1:] :
|
|
|
|
Utils.add_menuitem(qr_menu, action[2], None, action[5])
|
|
|
|
self.uistate.uimanager.get_widget('/Popup/QuickReport').\
|
|
|
|
set_submenu(qr_menu)
|
2005-09-16 18:48:52 +05:30
|
|
|
if menu:
|
2007-01-09 10:02:07 +05:30
|
|
|
menu.popup(None, None, None, event.button, event.time)
|
2005-09-16 18:48:52 +05:30
|
|
|
return True
|
2005-08-12 08:05:27 +05:30
|
|
|
return False
|
2006-05-02 09:20:46 +05:30
|
|
|
|
2007-10-07 08:49:35 +05:30
|
|
|
def _key_press(self, obj, event):
|
2008-02-29 04:43:07 +05:30
|
|
|
if not self.dbstate.open:
|
|
|
|
return False
|
2007-10-07 08:49:35 +05:30
|
|
|
if not event.state or event.state in (gtk.gdk.MOD2_MASK, ):
|
2007-01-28 10:08:56 +05:30
|
|
|
if event.keyval in (gtk.keysyms.Return, gtk.keysyms.KP_Enter):
|
|
|
|
if self.dbstate.active:
|
|
|
|
self.edit(obj)
|
|
|
|
return True
|
|
|
|
else:
|
2008-01-17 14:44:40 +05:30
|
|
|
return self.expand_collapse()
|
|
|
|
return False
|
|
|
|
|
|
|
|
def expand_collapse(self):
|
|
|
|
"""
|
|
|
|
Expand or collapse the selected parent name node.
|
|
|
|
Return True if change done, False otherwise
|
|
|
|
"""
|
|
|
|
store, paths = self.selection.get_selected_rows()
|
|
|
|
if paths and len(paths[0]) == 1 :
|
|
|
|
if self.tree.row_expanded(paths[0]):
|
|
|
|
self.tree.collapse_row(paths[0])
|
|
|
|
else:
|
|
|
|
self.tree.expand_row(paths[0], 0)
|
|
|
|
return True
|
2007-01-28 10:08:56 +05:30
|
|
|
return False
|
|
|
|
|
2006-05-02 09:20:46 +05:30
|
|
|
def key_goto_home_person(self):
|
|
|
|
self.home(None)
|
2007-10-07 08:49:35 +05:30
|
|
|
self.uistate.push_message(self.dbstate,
|
In .:
2006-07-31 Alex Roitman <shura@gramps-project.org>
* src/Filters/_SearchBar.py (SearchBar.__init__): Take dbstate as
a constructor argument; (SearchBar.apply_filter): pass dbstate.
* src/PageView.py (BookMarkView.add_bookmark,
PersonNavView.jumpto, PersonNavView.fwd_clicked,
PersonNavView.back_clicked, ListView.build_widget): Pass dbstate.
* src/Navigation.py (BaseNavigation.__init__,
PersonNavigation.__init__): Take dbstate as a constructor argument;
(PersonNavigation.build_item_name): properly access dbstate.
* src/DisplayState.py (__init__): Do not take dbstate as a
constructor argument; Do not connect dbstate signal here (moved to
ViewManager);
(display_relationship,push_message,modify_statusbar): Make dbstate
an argument.
* src/plugins/Checkpoint.py (run_tool): Pass dbstate.
* src/ViewManager.py (_build_main_window): Do not pass dbstate to
uistate DisplayState constructor; connect dbstate signal handler;
pass dbstate to Navigation; (keypress): Pass dbstate;
(statusbar_key_update): Pass dbstate;
(do_load_plugins): Pass dbstate;
(ViewManager.add_bookmark): Pass dbstate.
* src/DataViews/_RelationView.py (shade_update): Pass dbstate.
* src/DataViews/_PersonView.py (build_widget,_goto,
key_goto_home_person, key_edit_selected_person): Pass dbstate.
* src/Filters/Makefile.am (pkgdata_PYTHON): Remove obsolete file.
* src/Filters/__init__.py: Remove importing obsolete module.
* src/Filters/_FilterWidget.py: Remove obsolete module.
In po:
2006-07-31 Alex Roitman <shura@gramps-project.org>
* POTFILES.in: Remove obsolete file.
svn: r7104
2006-08-01 10:01:10 +05:30
|
|
|
_("Go to default person"))
|
2006-05-02 09:20:46 +05:30
|
|
|
|
|
|
|
def key_edit_selected_person(self):
|
|
|
|
self.edit(None)
|
2007-10-07 08:49:35 +05:30
|
|
|
self.uistate.push_message(self.dbstate,
|
In .:
2006-07-31 Alex Roitman <shura@gramps-project.org>
* src/Filters/_SearchBar.py (SearchBar.__init__): Take dbstate as
a constructor argument; (SearchBar.apply_filter): pass dbstate.
* src/PageView.py (BookMarkView.add_bookmark,
PersonNavView.jumpto, PersonNavView.fwd_clicked,
PersonNavView.back_clicked, ListView.build_widget): Pass dbstate.
* src/Navigation.py (BaseNavigation.__init__,
PersonNavigation.__init__): Take dbstate as a constructor argument;
(PersonNavigation.build_item_name): properly access dbstate.
* src/DisplayState.py (__init__): Do not take dbstate as a
constructor argument; Do not connect dbstate signal here (moved to
ViewManager);
(display_relationship,push_message,modify_statusbar): Make dbstate
an argument.
* src/plugins/Checkpoint.py (run_tool): Pass dbstate.
* src/ViewManager.py (_build_main_window): Do not pass dbstate to
uistate DisplayState constructor; connect dbstate signal handler;
pass dbstate to Navigation; (keypress): Pass dbstate;
(statusbar_key_update): Pass dbstate;
(do_load_plugins): Pass dbstate;
(ViewManager.add_bookmark): Pass dbstate.
* src/DataViews/_RelationView.py (shade_update): Pass dbstate.
* src/DataViews/_PersonView.py (build_widget,_goto,
key_goto_home_person, key_edit_selected_person): Pass dbstate.
* src/Filters/Makefile.am (pkgdata_PYTHON): Remove obsolete file.
* src/Filters/__init__.py: Remove importing obsolete module.
* src/Filters/_FilterWidget.py: Remove obsolete module.
In po:
2006-07-31 Alex Roitman <shura@gramps-project.org>
* POTFILES.in: Remove obsolete file.
svn: r7104
2006-08-01 10:01:10 +05:30
|
|
|
_("Edit selected person"))
|
2007-01-26 10:39:25 +05:30
|
|
|
|
2007-01-26 18:26:52 +05:30
|
|
|
|
2007-01-26 10:39:25 +05:30
|
|
|
def key_delete_selected_person(self):
|
|
|
|
self.remove(None)
|
2007-10-07 08:49:35 +05:30
|
|
|
self.uistate.push_message(self.dbstate,
|
2007-01-26 10:39:25 +05:30
|
|
|
_("Delete selected person"))
|
|
|
|
|
2007-02-06 10:49:16 +05:30
|
|
|
def export(self, obj):
|
|
|
|
chooser = gtk.FileChooserDialog(
|
2008-01-29 02:52:06 +05:30
|
|
|
_("Export View as Spreadsheet"),
|
2007-02-06 10:49:16 +05:30
|
|
|
self.uistate.window,
|
2007-10-07 08:49:35 +05:30
|
|
|
gtk.FILE_CHOOSER_ACTION_SAVE,
|
2007-02-06 10:49:16 +05:30
|
|
|
(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
|
2008-01-16 19:01:35 +05:30
|
|
|
gtk.STOCK_SAVE, gtk.RESPONSE_OK))
|
2007-02-06 10:49:16 +05:30
|
|
|
chooser.set_do_overwrite_confirmation(True)
|
|
|
|
|
|
|
|
combobox = gtk.combo_box_new_text()
|
|
|
|
label = gtk.Label(_("Format:"))
|
|
|
|
label.set_alignment(1.0, 0.5)
|
|
|
|
box = gtk.HBox()
|
|
|
|
box.pack_start(label, True, True, padding=12)
|
|
|
|
box.pack_start(combobox, False, False)
|
|
|
|
combobox.append_text(_('CSV'))
|
|
|
|
combobox.append_text(_('Open Document Spreadsheet'))
|
|
|
|
combobox.set_active(0)
|
|
|
|
box.show_all()
|
|
|
|
chooser.set_extra_widget(box)
|
|
|
|
|
|
|
|
while True:
|
|
|
|
value = chooser.run()
|
|
|
|
fn = chooser.get_filename()
|
|
|
|
fl = combobox.get_active()
|
|
|
|
if value == gtk.RESPONSE_OK:
|
|
|
|
if fn:
|
|
|
|
chooser.destroy()
|
|
|
|
break
|
|
|
|
else:
|
|
|
|
chooser.destroy()
|
|
|
|
return
|
|
|
|
self.write_tabbed_file(fn, fl)
|
|
|
|
|
|
|
|
def write_tabbed_file(self, name, type):
|
|
|
|
"""
|
2008-02-19 01:37:09 +05:30
|
|
|
Write a tabbed file to the specified name.
|
|
|
|
|
|
|
|
The output file type is determined by the type variable.
|
2007-02-06 10:49:16 +05:30
|
|
|
"""
|
|
|
|
|
2008-02-19 01:37:09 +05:30
|
|
|
from docgen import CSVTab, ODSTab
|
|
|
|
ofile = None
|
2007-02-06 10:49:16 +05:30
|
|
|
# build the active data columns, prepending 0 for the name column, then
|
|
|
|
# derive the column names fromt the active data columns
|
|
|
|
|
|
|
|
data_cols = [0] + [pair[1] \
|
|
|
|
for pair in self.dbstate.db.get_person_column_order() \
|
|
|
|
if pair[0]]
|
|
|
|
|
2008-01-27 00:49:56 +05:30
|
|
|
cnames = [column_names[i] for i in data_cols]
|
2008-02-19 01:37:09 +05:30
|
|
|
# Select the correct output format
|
|
|
|
if type == 0:
|
|
|
|
ofile = CSVTab(len(cnames))
|
|
|
|
else:
|
|
|
|
ofile = ODSTab(len(cnames))
|
|
|
|
|
2007-02-06 10:49:16 +05:30
|
|
|
# create the output tabbed document, and open it
|
|
|
|
ofile.open(name)
|
|
|
|
|
|
|
|
# start the current page
|
|
|
|
ofile.start_page()
|
|
|
|
|
|
|
|
# open the header row, write the column names, and close the row
|
|
|
|
ofile.start_row()
|
|
|
|
for name in cnames:
|
|
|
|
ofile.write_cell(name)
|
|
|
|
ofile.end_row()
|
|
|
|
|
2007-10-07 08:49:35 +05:30
|
|
|
# The tree model works different from the rest of the list-based models,
|
2007-02-06 10:49:16 +05:30
|
|
|
# since the iterator method only works on top level nodes. So we must
|
|
|
|
# loop through based off of paths
|
|
|
|
|
2007-10-07 08:49:35 +05:30
|
|
|
path = (0, )
|
2007-02-06 10:49:16 +05:30
|
|
|
node = self.model.on_get_iter(path)
|
2008-04-07 02:21:16 +05:30
|
|
|
|
|
|
|
# Node might be null if the surname is not known so test against None
|
2008-06-16 20:31:46 +05:30
|
|
|
while node is not None:
|
2007-02-06 10:49:16 +05:30
|
|
|
real_iter = self.model.get_iter(path)
|
|
|
|
for subindex in range(0, self.model.iter_n_children(real_iter)):
|
2007-10-07 08:49:35 +05:30
|
|
|
subpath = ((path[0], subindex))
|
2007-02-06 10:49:16 +05:30
|
|
|
row = self.model[subpath]
|
|
|
|
ofile.start_row()
|
|
|
|
for index in data_cols:
|
|
|
|
ofile.write_cell(row[index])
|
|
|
|
ofile.end_row()
|
|
|
|
node = self.model.on_iter_next(node)
|
2007-10-07 08:49:35 +05:30
|
|
|
path = (path[0]+1, )
|
2007-02-06 10:49:16 +05:30
|
|
|
ofile.end_page()
|
|
|
|
ofile.close()
|
2007-08-30 01:07:58 +05:30
|
|
|
|
|
|
|
def dummy_report(self, obj):
|
2008-02-18 21:22:40 +05:30
|
|
|
""" For the xml UI definition of popup to work, the submenu
|
2007-08-30 01:07:58 +05:30
|
|
|
Quick Report must have an entry in the xml
|
|
|
|
As this submenu will be dynamically built, we offer a dummy action
|
2008-02-18 21:22:40 +05:30
|
|
|
"""
|
2007-08-30 01:07:58 +05:30
|
|
|
pass
|
2007-07-27 09:21:54 +05:30
|
|
|
|