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:
parent
2ca818e4a5
commit
999711b902
13
ChangeLog
13
ChangeLog
@ -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>
|
||||
* src/Utils.py: Make set_titles call ManagedWindow.set_titles
|
||||
with warning.
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# 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
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -40,13 +40,16 @@ log = logging.getLogger(".ColumnOrder")
|
||||
|
||||
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)
|
||||
|
||||
self.glade = gtk.glade.XML(const.gladeFile,"columns","gramps")
|
||||
self.set_window(self.glade.get_widget('columns'),None,
|
||||
_('Select Columns'))
|
||||
|
||||
self.set_window(self.glade.get_widget('columns'),
|
||||
self.glade.get_widget('title'),
|
||||
win_name,
|
||||
_('Select Columns'))
|
||||
|
||||
self.tree = self.glade.get_widget('list')
|
||||
self.arglist = arglist
|
||||
@ -82,7 +85,7 @@ class ColumnOrder(ManagedWindow.ManagedWindow):
|
||||
3, item)
|
||||
|
||||
def build_menu_names(self,obj):
|
||||
return (_('Column Editor'), None)
|
||||
return (_('Column Editor'), _('Column Editor'))
|
||||
|
||||
def ok_clicked(self,obj):
|
||||
newlist = []
|
||||
|
@ -127,6 +127,7 @@ class EventView(PageView.ListView):
|
||||
import ColumnOrder
|
||||
|
||||
ColumnOrder.ColumnOrder(
|
||||
_('Select Event Columns'),
|
||||
self.uistate,
|
||||
self.dbstate.db.get_event_column_order(),
|
||||
column_names,
|
||||
|
@ -707,15 +707,17 @@ class FamilyView(PageView.PersonNavView):
|
||||
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1:
|
||||
from SelectFamily import SelectFamily
|
||||
|
||||
dialog = SelectFamily(self.dbstate.db, _('Select Family'))
|
||||
dialog = SelectFamily(self.dbstate, self.uistate)
|
||||
family = dialog.run()
|
||||
|
||||
if family:
|
||||
active_handle = self.dbstate.active.handle
|
||||
child = self.dbstate.db.get_person_from_handle(active_handle)
|
||||
GrampsDb.add_child_to_family(family, child,
|
||||
RelLib.ChildRef(),
|
||||
RelLib.ChildRef())
|
||||
|
||||
GrampsDb.add_child_to_family(
|
||||
self.dbstate.db,
|
||||
family,
|
||||
child)
|
||||
|
||||
def add_parent_family(self, obj, event, handle):
|
||||
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1:
|
||||
|
@ -84,6 +84,7 @@ class MediaView(PageView.ListView):
|
||||
import ColumnOrder
|
||||
|
||||
ColumnOrder.ColumnOrder(
|
||||
_('Select Media Columns'),
|
||||
self.uistate,
|
||||
self.dbstate.db.get_media_column_order(),
|
||||
column_names,
|
||||
|
@ -126,6 +126,7 @@ class PersonView(PageView.PersonNavView):
|
||||
import ColumnOrder
|
||||
|
||||
ColumnOrder.ColumnOrder(
|
||||
_('Select Person Columns'),
|
||||
self.uistate,
|
||||
self.dbstate.db.get_person_column_order(),
|
||||
column_names,
|
||||
|
@ -90,6 +90,7 @@ class PlaceView(PageView.ListView):
|
||||
import ColumnOrder
|
||||
|
||||
ColumnOrder.ColumnOrder(
|
||||
_('Select Place Columns'),
|
||||
self.uistate,
|
||||
self.dbstate.db.get_place_column_order(),
|
||||
column_names,
|
||||
|
@ -96,6 +96,7 @@ class RepositoryView(PageView.ListView):
|
||||
import ColumnOrder
|
||||
|
||||
ColumnOrder.ColumnOrder(
|
||||
_('Select Repository Columns'),
|
||||
self.uistate,
|
||||
self.dbstate.db.get_repository_column_order(),
|
||||
column_names,
|
||||
|
@ -89,6 +89,7 @@ class SourceView(PageView.ListView):
|
||||
import ColumnOrder
|
||||
|
||||
ColumnOrder.ColumnOrder(
|
||||
_('Select Source Columns'),
|
||||
self.uistate,
|
||||
self.dbstate.db.get_source_column_order(),
|
||||
column_names,
|
||||
|
@ -124,8 +124,13 @@ def add_child_to_family(db, family, child,
|
||||
frel=RelLib.ChildRefType(),
|
||||
trans=None):
|
||||
|
||||
family.add_child_handle(child.handle)
|
||||
child.add_parent_family_handle(family.handle, mrel, frel )
|
||||
cref = RelLib.ChildRef()
|
||||
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:
|
||||
need_commit = True
|
||||
@ -134,7 +139,7 @@ def add_child_to_family(db, family, child,
|
||||
need_commit = False
|
||||
|
||||
db.commit_family(family,trans)
|
||||
db.commit_person(person,trans)
|
||||
db.commit_person(child,trans)
|
||||
|
||||
if need_commit:
|
||||
db.transaction_commit(trans, _('Add child to family') )
|
||||
|
@ -44,36 +44,36 @@ import pango
|
||||
import const
|
||||
import Utils
|
||||
import DisplayModels
|
||||
import ManagedWindow
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# 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.set_property('ellipsize',pango.ELLIPSIZE_END)
|
||||
self.db = db
|
||||
self.db = dbstate.db
|
||||
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.notebook = self.glade.get_widget('notebook')
|
||||
|
||||
Utils.set_titles(self.top,
|
||||
self.glade.get_widget('title'),
|
||||
title)
|
||||
self.set_window(
|
||||
self.glade.get_widget('select_person'),
|
||||
self.glade.get_widget('title'),
|
||||
_('Select Family'))
|
||||
|
||||
self.model = DisplayModels.FamilyModel(self.db)
|
||||
|
||||
self.add_columns(self.plist)
|
||||
self.plist.set_model(self.model)
|
||||
self.top.show()
|
||||
|
||||
if parent_window:
|
||||
self.top.set_transient_for(parent_window)
|
||||
self.show()
|
||||
|
||||
def add_columns(self,tree):
|
||||
column = gtk.TreeViewColumn(_('ID'), self.renderer, text=0)
|
||||
@ -95,21 +95,25 @@ class SelectFamily:
|
||||
def select_function(self,store,path,iter,id_list):
|
||||
id_list.append(self.model.get_value(iter,5))
|
||||
|
||||
|
||||
def build_menu_names(self,obj):
|
||||
return (_('Select Family'), None)
|
||||
|
||||
def get_selected_ids(self):
|
||||
mlist = []
|
||||
self.plist.get_selection().selected_foreach(self.select_function,mlist)
|
||||
return mlist
|
||||
|
||||
def run(self):
|
||||
val = self.top.run()
|
||||
val = self.window.run()
|
||||
if val == gtk.RESPONSE_OK:
|
||||
idlist = self.get_selected_ids()
|
||||
self.top.destroy()
|
||||
self.close()
|
||||
if idlist and idlist[0]:
|
||||
return_value = self.db.get_family_from_handle(idlist[0])
|
||||
else:
|
||||
return_value = None
|
||||
return return_value
|
||||
else:
|
||||
self.top.destroy()
|
||||
self.close()
|
||||
return None
|
||||
|
@ -413,7 +413,7 @@
|
||||
<property name="border_width">12</property>
|
||||
<property name="visible">True</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="row_spacing">6</property>
|
||||
<property name="column_spacing">6</property>
|
||||
@ -444,23 +444,23 @@
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label395">
|
||||
<widget class="GtkLabel" id="title">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>Select columns</b></property>
|
||||
<property name="label" translatable="yes"></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="wrap">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="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
@ -471,7 +471,7 @@
|
||||
</widget>
|
||||
<packing>
|
||||
<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="bottom_attach">1</property>
|
||||
<property name="x_options">fill</property>
|
||||
|
Loading…
Reference in New Issue
Block a user