* src/EditPerson.py: add srcref as a drag and drop item

* src/EditPlace.py: add srcref as a drag and drop item
* src/Marriage.py: add srcref as a drag and drop item
* src/WriteGedcom.py: catch empty event
* src/Sources.py: add drag-n-drop for source references


svn: r4147
This commit is contained in:
Don Allingham 2005-03-09 22:59:24 +00:00
parent 354f27f46a
commit 97a0add0a7
6 changed files with 77 additions and 22 deletions

View File

@ -1,10 +1,14 @@
2005-03-09 Don Allingham <don@gramps-project.org>
* src/EditPerson.py: add srcref as a drag and drop item
* src/EditPlace.py: add srcref as a drag and drop item
* src/Marriage.py: add srcref as a drag and drop item
* src/WriteGedcom.py: catch empty event
* src/Sources.py: add drag-n-drop for source references
2005-03-09 Martin Hawlisch <Martin.Hawlisch@gmx.de> 2005-03-09 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/GenericFilter.py (IsDefaultPerson,IsSiblingOfFilterMatch): * src/GenericFilter.py (IsDefaultPerson,IsSiblingOfFilterMatch):
Add filter rules. Add filter rules.
2005-03-09 Don Allingham <don@gramps-project.org>
* srcNameEdit.py: assign date on close
2005-03-09 Alex Roitman <shura@alex.neuro.umn.edu> 2005-03-09 Alex Roitman <shura@alex.neuro.umn.edu>
* src/PedView.py: Import RelLib for accessing relationship constants. * src/PedView.py: Import RelLib for accessing relationship constants.
* src/NameEdit.py: Use empty Date for newly created name. * src/NameEdit.py: Use empty Date for newly created name.
@ -12,6 +16,9 @@
* src/data/gramps.schemas: Place dont-ask key into interface dir. * src/data/gramps.schemas: Place dont-ask key into interface dir.
* src/Marriage.py (did_data_change): Compare gramps_id, not handle. * src/Marriage.py (did_data_change): Compare gramps_id, not handle.
2005-03-09 Don Allingham <don@gramps-project.org>
* src/NameEdit.py: assign date on close
2005-03-08 Don Allingham <don@gramps-project.org> 2005-03-08 Don Allingham <don@gramps-project.org>
* src/ChooseParents.py: change _nsort to _model * src/ChooseParents.py: change _nsort to _model
* src/GrampsBSDDB.py: fix event secondary index function to that * src/GrampsBSDDB.py: fix event secondary index function to that
@ -37,9 +44,6 @@
Update filter ComboBox in the main window. Update filter ComboBox in the main window.
* src/gramps_main.py (init_filters): Clear layout before rebuilding. * src/gramps_main.py (init_filters): Clear layout before rebuilding.
* src/ChooseParents.py: Stop parent selection window from being
modal; fix child/parent relations from strings to integers.
2005-03-07 Alex Roitman <shura@alex.neuro.umn.edu> 2005-03-07 Alex Roitman <shura@alex.neuro.umn.edu>
* src/AddrEdit.py: Typo. * src/AddrEdit.py: Typo.
* src/EditPerson.py (on_add_addr_clicked): Typos. * src/EditPerson.py (on_add_addr_clicked): Typos.

View File

@ -79,7 +79,8 @@ _temple_names = [""] + _temple_names
pycode_tgts = [('url', 0, 0), pycode_tgts = [('url', 0, 0),
('pevent', 0, 1), ('pevent', 0, 1),
('pattr', 0, 2), ('pattr', 0, 2),
('paddr', 0, 3)] ('paddr', 0, 3),
('srcref', 0, 4)]
_use_patronymic = [ _use_patronymic = [

View File

@ -54,7 +54,9 @@ import NameDisplay
# Constants # Constants
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
pycode_tgts = [('url', 0, 0)] pycode_tgts = [
('url' , 0, 0)
('srcref', 0, 4)]
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #

View File

@ -66,7 +66,11 @@ _temple_names = const.lds_temple_codes.keys()
_temple_names.sort() _temple_names.sort()
_temple_names = [""] + _temple_names _temple_names = [""] + _temple_names
pycode_tgts = [('fevent', 0, 0), ('fattr', 0, 1)] pycode_tgts = [
('fevent', 0, 0),
('fattr', 0, 1),
('srcref', 0, 4),
]
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #

View File

@ -32,10 +32,12 @@ from gettext import gettext as _
# GTK/Gnome modules # GTK/Gnome modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import gobject
import gtk import gtk
import gtk.glade import gtk.glade
import gnome import gnome
from gtk.gdk import ACTION_COPY, BUTTON1_MASK, INTERP_BILINEAR, pixbuf_new_from_file
from gobject import TYPE_PYOBJECT
import pickle
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -49,6 +51,12 @@ import Date
import DateEdit import DateEdit
import DateHandler import DateHandler
pycode_tgts = [('url', 0, 0),
('pevent', 0, 1),
('pattr', 0, 2),
('paddr', 0, 3),
('srcref', 0, 4)]
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# SourceSelector # SourceSelector
@ -94,7 +102,7 @@ class SourceSelector:
self.delete = self.top.get_widget('delete') self.delete = self.top.get_widget('delete')
self.delete.set_sensitive(not self.db.readonly) self.delete.set_sensitive(not self.db.readonly)
self.selection = self.slist.get_selection() self.selection = self.slist.get_selection()
self.model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING) self.model = gtk.ListStore(str,str)
self.slist.set_model(self.model) self.slist.set_model(self.model)
self.top.get_widget('add').set_sensitive(not self.db.readonly) self.top.get_widget('add').set_sensitive(not self.db.readonly)
self.top.get_widget('ok').set_sensitive(not self.db.readonly) self.top.get_widget('ok').set_sensitive(not self.db.readonly)
@ -229,7 +237,7 @@ class SourceTab:
self.window = window self.window = window
self.slist = clist self.slist = clist
self.selection = clist.get_selection() self.selection = clist.get_selection()
self.model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING) self.model = gtk.ListStore(str,str,TYPE_PYOBJECT)
add_btn.set_sensitive(not readonly) add_btn.set_sensitive(not readonly)
del_btn.set_sensitive(not readonly) del_btn.set_sensitive(not readonly)
@ -251,8 +259,43 @@ class SourceTab:
edit_btn.connect('clicked', self.edit_src_clicked) edit_btn.connect('clicked', self.edit_src_clicked)
del_btn.connect('clicked', self.del_src_clicked) del_btn.connect('clicked', self.del_src_clicked)
self.slist.connect('button-press-event',self.double_click) self.slist.connect('button-press-event',self.double_click)
self.setup_drag_n_drop()
self.redraw() self.redraw()
def setup_drag_n_drop(self):
self.slist.drag_dest_set(gtk.DEST_DEFAULT_ALL,pycode_tgts,ACTION_COPY)
self.slist.drag_source_set(BUTTON1_MASK, pycode_tgts, ACTION_COPY)
self.slist.connect('drag_data_get', self.drag_data_get)
self.slist.connect('drag_begin', self.drag_begin)
self.slist.connect('drag_data_received',self.drag_data_received)
def drag_data_received(self,widget,context,x,y,sel_data,info,time):
if sel_data and sel_data.data:
exec 'data = %s' % sel_data.data
exec 'mytype = "%s"' % data[0]
exec 'person = "%s"' % data[1]
if mytype != 'srcref':
return
else:
foo = pickle.loads(data[2]);
self.list.append(foo)
self.lists_changed = True
self.redraw()
def drag_data_get(self,widget, context, sel_data, info, time):
store,node = self.selection.get_selected()
ev = store.get_value(node,2)
bits_per = 8; # we're going to pass a string
pickled = pickle.dumps(ev);
data = str(('srcref',None,pickled));
sel_data.set(sel_data.target, bits_per, data)
def drag_begin(self, context, a):
return
def double_click(self,obj,event): def double_click(self,obj,event):
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
self.edit_src_clicked(obj) self.edit_src_clicked(obj)
@ -263,7 +306,8 @@ class SourceTab:
base_handle = s.get_base_handle() base_handle = s.get_base_handle()
node = self.model.append() node = self.model.append()
base = self.db.get_source_from_handle(base_handle) base = self.db.get_source_from_handle(base_handle)
self.model.set(node,0,base.get_gramps_id(),1,base.get_title()) self.model.set(node,0,base.get_gramps_id(),1,base.get_title(),
2,s)
if self.list: if self.list:
Utils.bold_label(self.parent.sources_label) Utils.bold_label(self.parent.sources_label)
else: else:

View File

@ -693,7 +693,7 @@ class GedcomWriter:
for event_handle in family.get_event_list(): for event_handle in family.get_event_list():
event = self.db.get_event_from_handle(event_handle) event = self.db.get_event_from_handle(event_handle)
if self.private and event.get_privacy(): if not event or self.private and event.get_privacy():
continue continue
name = event.get_name() name = event.get_name()
val = "" val = ""