2006-04-23 Don Allingham <don@gramps-project.org>

* src/DataViews/_MediaView.py: Column editor changes
	* src/DataViews/_RepositoryView.py: Column editor changes
	* src/DataViews/_SourceView.py: Column editor changes
	* src/DataViews/_EventView.py: Column editor changes
	* src/DataViews/_FamilyView.py: Column editor changes
	* src/DataViews/_PlaceView.py: Column editor changes
	* src/DataViews/_PersonView.py: Column editor changes
	* src/GrampsDb/_DbUtils.py: fix add_child_to_family to handle refs
	* src/ColumnOrder.py: format changes
	* src/glade/gramps.glade: format changes
	* src/SelectFamily.py: ManagedWindow support



svn: r6428
This commit is contained in:
Don Allingham 2006-04-24 04:06:17 +00:00
parent 2ca818e4a5
commit 999711b902
12 changed files with 67 additions and 34 deletions

View File

@ -1,3 +1,16 @@
2006-04-23 Don Allingham <don@gramps-project.org>
* src/DataViews/_MediaView.py: Column editor changes
* src/DataViews/_RepositoryView.py: Column editor changes
* src/DataViews/_SourceView.py: Column editor changes
* src/DataViews/_EventView.py: Column editor changes
* src/DataViews/_FamilyView.py: Column editor changes
* src/DataViews/_PlaceView.py: Column editor changes
* src/DataViews/_PersonView.py: Column editor changes
* src/GrampsDb/_DbUtils.py: fix add_child_to_family to handle refs
* src/ColumnOrder.py: format changes
* src/glade/gramps.glade: format changes
* src/SelectFamily.py: ManagedWindow support
2006-04-23 Alex Roitman <shura@gramps-project.org> 2006-04-23 Alex Roitman <shura@gramps-project.org>
* src/Utils.py: Make set_titles call ManagedWindow.set_titles * src/Utils.py: Make set_titles call ManagedWindow.set_titles
with warning. with warning.

View File

@ -1,7 +1,7 @@
# #
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2000-2006 Donald N. Allingham # Copyright (C) 2000-2003 Donald N. Allingham
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -40,12 +40,15 @@ log = logging.getLogger(".ColumnOrder")
class ColumnOrder(ManagedWindow.ManagedWindow): class ColumnOrder(ManagedWindow.ManagedWindow):
def __init__(self, uistate, arglist, column_names, callback): def __init__(self, win_name, uistate, arglist, column_names, callback):
ManagedWindow.ManagedWindow.__init__(self, uistate, [], self) ManagedWindow.ManagedWindow.__init__(self, uistate, [], self)
self.glade = gtk.glade.XML(const.gladeFile,"columns","gramps") self.glade = gtk.glade.XML(const.gladeFile,"columns","gramps")
self.set_window(self.glade.get_widget('columns'),None,
self.set_window(self.glade.get_widget('columns'),
self.glade.get_widget('title'),
win_name,
_('Select Columns')) _('Select Columns'))
self.tree = self.glade.get_widget('list') self.tree = self.glade.get_widget('list')
@ -82,7 +85,7 @@ class ColumnOrder(ManagedWindow.ManagedWindow):
3, item) 3, item)
def build_menu_names(self,obj): def build_menu_names(self,obj):
return (_('Column Editor'), None) return (_('Column Editor'), _('Column Editor'))
def ok_clicked(self,obj): def ok_clicked(self,obj):
newlist = [] newlist = []

View File

@ -127,6 +127,7 @@ class EventView(PageView.ListView):
import ColumnOrder import ColumnOrder
ColumnOrder.ColumnOrder( ColumnOrder.ColumnOrder(
_('Select Event Columns'),
self.uistate, self.uistate,
self.dbstate.db.get_event_column_order(), self.dbstate.db.get_event_column_order(),
column_names, column_names,

View File

@ -707,15 +707,17 @@ class FamilyView(PageView.PersonNavView):
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1: if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1:
from SelectFamily import SelectFamily from SelectFamily import SelectFamily
dialog = SelectFamily(self.dbstate.db, _('Select Family')) dialog = SelectFamily(self.dbstate, self.uistate)
family = dialog.run() family = dialog.run()
if family: if family:
active_handle = self.dbstate.active.handle active_handle = self.dbstate.active.handle
child = self.dbstate.db.get_person_from_handle(active_handle) child = self.dbstate.db.get_person_from_handle(active_handle)
GrampsDb.add_child_to_family(family, child,
RelLib.ChildRef(), GrampsDb.add_child_to_family(
RelLib.ChildRef()) self.dbstate.db,
family,
child)
def add_parent_family(self, obj, event, handle): def add_parent_family(self, obj, event, handle):
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1: if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1:

View File

@ -84,6 +84,7 @@ class MediaView(PageView.ListView):
import ColumnOrder import ColumnOrder
ColumnOrder.ColumnOrder( ColumnOrder.ColumnOrder(
_('Select Media Columns'),
self.uistate, self.uistate,
self.dbstate.db.get_media_column_order(), self.dbstate.db.get_media_column_order(),
column_names, column_names,

View File

@ -126,6 +126,7 @@ class PersonView(PageView.PersonNavView):
import ColumnOrder import ColumnOrder
ColumnOrder.ColumnOrder( ColumnOrder.ColumnOrder(
_('Select Person Columns'),
self.uistate, self.uistate,
self.dbstate.db.get_person_column_order(), self.dbstate.db.get_person_column_order(),
column_names, column_names,

View File

@ -90,6 +90,7 @@ class PlaceView(PageView.ListView):
import ColumnOrder import ColumnOrder
ColumnOrder.ColumnOrder( ColumnOrder.ColumnOrder(
_('Select Place Columns'),
self.uistate, self.uistate,
self.dbstate.db.get_place_column_order(), self.dbstate.db.get_place_column_order(),
column_names, column_names,

View File

@ -96,6 +96,7 @@ class RepositoryView(PageView.ListView):
import ColumnOrder import ColumnOrder
ColumnOrder.ColumnOrder( ColumnOrder.ColumnOrder(
_('Select Repository Columns'),
self.uistate, self.uistate,
self.dbstate.db.get_repository_column_order(), self.dbstate.db.get_repository_column_order(),
column_names, column_names,

View File

@ -89,6 +89,7 @@ class SourceView(PageView.ListView):
import ColumnOrder import ColumnOrder
ColumnOrder.ColumnOrder( ColumnOrder.ColumnOrder(
_('Select Source Columns'),
self.uistate, self.uistate,
self.dbstate.db.get_source_column_order(), self.dbstate.db.get_source_column_order(),
column_names, column_names,

View File

@ -124,8 +124,13 @@ def add_child_to_family(db, family, child,
frel=RelLib.ChildRefType(), frel=RelLib.ChildRefType(),
trans=None): trans=None):
family.add_child_handle(child.handle) cref = RelLib.ChildRef()
child.add_parent_family_handle(family.handle, mrel, frel ) cref.ref = child.handle
cref.set_father_relation(frel)
cref.set_mother_relation(mrel)
family.add_child_ref(cref)
child.add_parent_family_handle(family.handle)
if trans == None: if trans == None:
need_commit = True need_commit = True
@ -134,7 +139,7 @@ def add_child_to_family(db, family, child,
need_commit = False need_commit = False
db.commit_family(family,trans) db.commit_family(family,trans)
db.commit_person(person,trans) db.commit_person(child,trans)
if need_commit: if need_commit:
db.transaction_commit(trans, _('Add child to family') ) db.transaction_commit(trans, _('Add child to family') )

View File

@ -44,36 +44,36 @@ import pango
import const import const
import Utils import Utils
import DisplayModels import DisplayModels
import ManagedWindow
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# SelectFamily # SelectFamily
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class SelectFamily: class SelectFamily(ManagedWindow.ManagedWindow):
def __init__(self, db, title, filter=None, skip=[], parent_window=None): def __init__(self, dbstate, uistate, filter=None, skip=[]):
ManagedWindow.ManagedWindow.__init__(self, uistate, [], self)
self.renderer = gtk.CellRendererText() self.renderer = gtk.CellRendererText()
self.renderer.set_property('ellipsize',pango.ELLIPSIZE_END) self.renderer.set_property('ellipsize',pango.ELLIPSIZE_END)
self.db = db self.db = dbstate.db
self.glade = gtk.glade.XML(const.gladeFile,"select_person","gramps") self.glade = gtk.glade.XML(const.gladeFile,"select_person","gramps")
self.top = self.glade.get_widget('select_person')
self.plist = self.glade.get_widget('plist') self.plist = self.glade.get_widget('plist')
self.notebook = self.glade.get_widget('notebook') self.notebook = self.glade.get_widget('notebook')
Utils.set_titles(self.top, self.set_window(
self.glade.get_widget('select_person'),
self.glade.get_widget('title'), self.glade.get_widget('title'),
title) _('Select Family'))
self.model = DisplayModels.FamilyModel(self.db) self.model = DisplayModels.FamilyModel(self.db)
self.add_columns(self.plist) self.add_columns(self.plist)
self.plist.set_model(self.model) self.plist.set_model(self.model)
self.top.show() self.show()
if parent_window:
self.top.set_transient_for(parent_window)
def add_columns(self,tree): def add_columns(self,tree):
column = gtk.TreeViewColumn(_('ID'), self.renderer, text=0) column = gtk.TreeViewColumn(_('ID'), self.renderer, text=0)
@ -95,21 +95,25 @@ class SelectFamily:
def select_function(self,store,path,iter,id_list): def select_function(self,store,path,iter,id_list):
id_list.append(self.model.get_value(iter,5)) id_list.append(self.model.get_value(iter,5))
def build_menu_names(self,obj):
return (_('Select Family'), None)
def get_selected_ids(self): def get_selected_ids(self):
mlist = [] mlist = []
self.plist.get_selection().selected_foreach(self.select_function,mlist) self.plist.get_selection().selected_foreach(self.select_function,mlist)
return mlist return mlist
def run(self): def run(self):
val = self.top.run() val = self.window.run()
if val == gtk.RESPONSE_OK: if val == gtk.RESPONSE_OK:
idlist = self.get_selected_ids() idlist = self.get_selected_ids()
self.top.destroy() self.close()
if idlist and idlist[0]: if idlist and idlist[0]:
return_value = self.db.get_family_from_handle(idlist[0]) return_value = self.db.get_family_from_handle(idlist[0])
else: else:
return_value = None return_value = None
return return_value return return_value
else: else:
self.top.destroy() self.close()
return None return None

View File

@ -413,7 +413,7 @@
<property name="border_width">12</property> <property name="border_width">12</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="n_rows">4</property> <property name="n_rows">4</property>
<property name="n_columns">2</property> <property name="n_columns">1</property>
<property name="homogeneous">False</property> <property name="homogeneous">False</property>
<property name="row_spacing">6</property> <property name="row_spacing">6</property>
<property name="column_spacing">6</property> <property name="column_spacing">6</property>
@ -444,23 +444,23 @@
</child> </child>
</widget> </widget>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">0</property>
<property name="right_attach">2</property> <property name="right_attach">1</property>
<property name="top_attach">1</property> <property name="top_attach">1</property>
<property name="bottom_attach">4</property> <property name="bottom_attach">4</property>
</packing> </packing>
</child> </child>
<child> <child>
<widget class="GtkLabel" id="label395"> <widget class="GtkLabel" id="title">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Select columns&lt;/b&gt;</property> <property name="label" translatable="yes"></property>
<property name="use_underline">False</property> <property name="use_underline">False</property>
<property name="use_markup">True</property> <property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property> <property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property> <property name="wrap">False</property>
<property name="selectable">False</property> <property name="selectable">False</property>
<property name="xalign">0</property> <property name="xalign">0.5</property>
<property name="yalign">0.5</property> <property name="yalign">0.5</property>
<property name="xpad">0</property> <property name="xpad">0</property>
<property name="ypad">0</property> <property name="ypad">0</property>
@ -471,7 +471,7 @@
</widget> </widget>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
<property name="right_attach">2</property> <property name="right_attach">1</property>
<property name="top_attach">0</property> <property name="top_attach">0</property>
<property name="bottom_attach">1</property> <property name="bottom_attach">1</property>
<property name="x_options">fill</property> <property name="x_options">fill</property>