2005-03-29 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
* src/DdTargets.py: add family targets to target list functions * src/Marriage.py (at_dest_drag_data_received, ev_dest_drag_data_received, ev_source_drag_data_get, at_source_drag_data_get): fixed dnd methods and added use of DdTarget types. * src/plugins/ScratchPad.py (generate_family_event_tooltip, generate_family_event_tooltip, redraw_object_list): added support for family events and attributes. svn: r4249
This commit is contained in:
parent
c5f181eecb
commit
0bb98262c9
@ -1,3 +1,12 @@
|
|||||||
|
2005-03-29 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
|
||||||
|
* src/DdTargets.py: add family targets to target list functions
|
||||||
|
* src/Marriage.py (at_dest_drag_data_received, ev_dest_drag_data_received,
|
||||||
|
ev_source_drag_data_get, at_source_drag_data_get): fixed dnd methods and
|
||||||
|
added use of DdTarget types.
|
||||||
|
* src/plugins/ScratchPad.py (generate_family_event_tooltip,
|
||||||
|
generate_family_event_tooltip, redraw_object_list): added support for
|
||||||
|
family events and attributes.
|
||||||
|
|
||||||
2005-03-27 Alex Roitman <shura@gramps-project.org>
|
2005-03-27 Alex Roitman <shura@gramps-project.org>
|
||||||
* src/MergeData.py: Fixes for places and sources.
|
* src/MergeData.py: Fixes for places and sources.
|
||||||
* src/PlaceView.py (build_context_menu): Typo.
|
* src/PlaceView.py (build_context_menu): Typo.
|
||||||
|
@ -152,7 +152,9 @@ class _DdTargets(object):
|
|||||||
self.EVENT.drag_type,
|
self.EVENT.drag_type,
|
||||||
self.ATTRIBUTE.drag_type,
|
self.ATTRIBUTE.drag_type,
|
||||||
self.ADDRESS.drag_type,
|
self.ADDRESS.drag_type,
|
||||||
self.SOURCEREF.drag_type)
|
self.SOURCEREF.drag_type,
|
||||||
|
self.FAMILY_EVENT.drag_type,
|
||||||
|
self.FAMILY_ATTRIBUTE.drag_type)
|
||||||
|
|
||||||
def all_text_targets(self):
|
def all_text_targets(self):
|
||||||
"""return a list of all the targets that could be used
|
"""return a list of all the targets that could be used
|
||||||
@ -172,7 +174,9 @@ class _DdTargets(object):
|
|||||||
self.EVENT.target(),
|
self.EVENT.target(),
|
||||||
self.ATTRIBUTE.target(),
|
self.ATTRIBUTE.target(),
|
||||||
self.ADDRESS.target(),
|
self.ADDRESS.target(),
|
||||||
self.SOURCEREF.target())
|
self.SOURCEREF.target(),
|
||||||
|
self.FAMILY_EVENT.target(),
|
||||||
|
self.FAMILY_ATTRIBUTE.target())
|
||||||
|
|
||||||
def all_targets(self):
|
def all_targets(self):
|
||||||
"""return a list of all the known targets."""
|
"""return a list of all the known targets."""
|
||||||
|
@ -452,21 +452,26 @@ class Marriage:
|
|||||||
exec 'data = %s' % selection_data.data
|
exec 'data = %s' % selection_data.data
|
||||||
exec 'mytype = "%s"' % data[0]
|
exec 'mytype = "%s"' % data[0]
|
||||||
exec 'family = "%s"' % data[1]
|
exec 'family = "%s"' % data[1]
|
||||||
if mytype != 'fevent':
|
|
||||||
|
if mytype != DdTargets.FAMILY_EVENT.drag_type:
|
||||||
return
|
return
|
||||||
elif family == self.family.get_handle():
|
|
||||||
|
foo = pickle.loads(data[2]);
|
||||||
|
|
||||||
|
if family == self.family.get_handle() and \
|
||||||
|
foo.get_handle() in self.elist:
|
||||||
self.move_element(self.elist,self.etree.get_selected_row(),
|
self.move_element(self.elist,self.etree.get_selected_row(),
|
||||||
row)
|
row)
|
||||||
else:
|
else:
|
||||||
foo = pickle.loads(data[2]);
|
|
||||||
for src in foo.get_source_references():
|
for src in foo.get_source_references():
|
||||||
base_handle = src.get_base_handle()
|
base_handle = src.get_base_handle()
|
||||||
newbase = self.db.get_source_from_handle(base_handle)
|
newbase = self.db.get_source_from_handle(base_handle)
|
||||||
src.set_base_handle(newbase)
|
src.set_base_handle(newbase.get_handle())
|
||||||
place = foo.get_place_handle()
|
place = foo.get_place_handle()
|
||||||
if place:
|
if place:
|
||||||
foo.set_place_handle(self.db.get_place_from_handle(place.get_handle()))
|
foo.set_place_handle(
|
||||||
self.elist.insert(row,foo)
|
self.db.get_place_from_handle(place.get_handle()).get_handle())
|
||||||
|
self.elist.insert(row,foo.get_handle())
|
||||||
|
|
||||||
self.lists_changed = 1
|
self.lists_changed = 1
|
||||||
self.redraw_event_list()
|
self.redraw_event_list()
|
||||||
@ -476,7 +481,8 @@ class Marriage:
|
|||||||
|
|
||||||
bits_per = 8; # we're going to pass a string
|
bits_per = 8; # we're going to pass a string
|
||||||
pickled = pickle.dumps(ev[0]);
|
pickled = pickle.dumps(ev[0]);
|
||||||
data = str(('fevent',self.family.get_handle(),pickled));
|
data = str((DdTargets.FAMILY_EVENT.drag_type,
|
||||||
|
self.family.get_handle(),pickled));
|
||||||
selection_data.set(selection_data.target, bits_per, data)
|
selection_data.set(selection_data.target, bits_per, data)
|
||||||
|
|
||||||
def at_dest_drag_data_received(self,widget,context,x,y,selection_data,info,time):
|
def at_dest_drag_data_received(self,widget,context,x,y,selection_data,info,time):
|
||||||
@ -485,16 +491,21 @@ class Marriage:
|
|||||||
exec 'data = %s' % selection_data.data
|
exec 'data = %s' % selection_data.data
|
||||||
exec 'mytype = "%s"' % data[0]
|
exec 'mytype = "%s"' % data[0]
|
||||||
exec 'family = "%s"' % data[1]
|
exec 'family = "%s"' % data[1]
|
||||||
if mytype != 'fevent':
|
|
||||||
|
if mytype != DdTargets.FAMILY_ATTRIBUTE.drag_type:
|
||||||
return
|
return
|
||||||
elif family == self.family.get_handle():
|
|
||||||
self.move_element(self.elist,self.etree.get_selected_row(),row)
|
foo = pickle.loads(data[2]);
|
||||||
|
|
||||||
|
if family == self.family.get_handle() and \
|
||||||
|
foo in self.alist:
|
||||||
|
self.move_element(self.alist,self.atree.get_selected_row(),row)
|
||||||
else:
|
else:
|
||||||
foo = pickle.loads(data[2]);
|
foo = pickle.loads(data[2]);
|
||||||
for src in foo.get_source_references():
|
for src in foo.get_source_references():
|
||||||
base_handle = src.get_base_handle()
|
base_handle = src.get_base_handle()
|
||||||
newbase = self.db.get_source_from_handle(base_handle)
|
newbase = self.db.get_source_from_handle(base_handle)
|
||||||
src.set_base_handle(newbase)
|
src.set_base_handle(newbase.get_handle())
|
||||||
self.alist.insert(row,foo)
|
self.alist.insert(row,foo)
|
||||||
|
|
||||||
self.lists_changed = 1
|
self.lists_changed = 1
|
||||||
@ -505,7 +516,8 @@ class Marriage:
|
|||||||
|
|
||||||
bits_per = 8; # we're going to pass a string
|
bits_per = 8; # we're going to pass a string
|
||||||
pickled = pickle.dumps(ev[0]);
|
pickled = pickle.dumps(ev[0]);
|
||||||
data = str(('fattr',self.family.get_handle(),pickled));
|
data = str((DdTargets.FAMILY_ATTRIBUTE.drag_type,
|
||||||
|
self.family.get_handle(),pickled));
|
||||||
selection_data.set(selection_data.target, bits_per, data)
|
selection_data.set(selection_data.target, bits_per, data)
|
||||||
|
|
||||||
def update_lists(self):
|
def update_lists(self):
|
||||||
|
@ -257,10 +257,12 @@ class ScratchPadWindow:
|
|||||||
for obj in ScratchPadWindow.olist:
|
for obj in ScratchPadWindow.olist:
|
||||||
obj_targets = obj['targets']
|
obj_targets = obj['targets']
|
||||||
|
|
||||||
|
|
||||||
# union with gramps_types
|
# union with gramps_types
|
||||||
if len([target for target \
|
if len([target for target \
|
||||||
in obj_targets if DdTargets.is_gramps_type(target)]) > 0:
|
in obj_targets if DdTargets.is_gramps_type(target)]) > 0:
|
||||||
|
|
||||||
|
|
||||||
exec 'unpack_data = %s' % obj['data']
|
exec 'unpack_data = %s' % obj['data']
|
||||||
exec 'mytype = "%s"' % unpack_data[0]
|
exec 'mytype = "%s"' % unpack_data[0]
|
||||||
data = pickle.loads(unpack_data[2]);
|
data = pickle.loads(unpack_data[2]);
|
||||||
@ -274,13 +276,16 @@ class ScratchPadWindow:
|
|||||||
data.get_date(),
|
data.get_date(),
|
||||||
location,
|
location,
|
||||||
self.generate_addr_tooltip(data)],obj)
|
self.generate_addr_tooltip(data)],obj)
|
||||||
|
|
||||||
elif mytype == DdTargets.EVENT.drag_type:
|
elif mytype == DdTargets.EVENT.drag_type:
|
||||||
node = self.otree.add([_("Event"),
|
node = self.otree.add([_("Event"),
|
||||||
const.display_pevent(data.get_name()),
|
const.display_pevent(data.get_name()),
|
||||||
data.get_description(),
|
data.get_description(),
|
||||||
self.generate_event_tooltip(data)],obj)
|
self.generate_event_tooltip(data)],obj)
|
||||||
|
elif mytype == DdTargets.FAMILY_EVENT.drag_type:
|
||||||
|
node = self.otree.add([_("Family Event"),
|
||||||
|
const.display_fevent(data.get_name()),
|
||||||
|
data.get_description(),
|
||||||
|
self.generate_family_event_tooltip(data)],obj)
|
||||||
elif mytype == DdTargets.URL.drag_type:
|
elif mytype == DdTargets.URL.drag_type:
|
||||||
node = self.otree.add([_("Url"),
|
node = self.otree.add([_("Url"),
|
||||||
data.get_path(),
|
data.get_path(),
|
||||||
@ -291,6 +296,11 @@ class ScratchPadWindow:
|
|||||||
const.display_pattr(data.get_type()),
|
const.display_pattr(data.get_type()),
|
||||||
data.get_value(),
|
data.get_value(),
|
||||||
self.generate_pattr_tooltip(data)],obj)
|
self.generate_pattr_tooltip(data)],obj)
|
||||||
|
elif mytype == DdTargets.FAMILY_ATTRIBUTE.drag_type:
|
||||||
|
node = self.otree.add([_("Family Attribute"),
|
||||||
|
const.display_fattr(data.get_type()),
|
||||||
|
data.get_value(),
|
||||||
|
self.generate_fattr_tooltip(data)],obj)
|
||||||
elif mytype == DdTargets.SOURCEREF.drag_type:
|
elif mytype == DdTargets.SOURCEREF.drag_type:
|
||||||
base = self.db.get_source_from_handle(data.get_base_handle())
|
base = self.db.get_source_from_handle(data.get_base_handle())
|
||||||
node = self.otree.add([_("SourceRef"),
|
node = self.otree.add([_("SourceRef"),
|
||||||
@ -301,6 +311,7 @@ class ScratchPadWindow:
|
|||||||
# Union with text targets
|
# Union with text targets
|
||||||
elif len([target for target \
|
elif len([target for target \
|
||||||
in obj_targets if DdTargets.is_text_type(target)]) > 0:
|
in obj_targets if DdTargets.is_text_type(target)]) > 0:
|
||||||
|
|
||||||
node = self.otree.add([_("Text"),
|
node = self.otree.add([_("Text"),
|
||||||
"",
|
"",
|
||||||
obj['data'],
|
obj['data'],
|
||||||
@ -344,6 +355,36 @@ class ScratchPadWindow:
|
|||||||
|
|
||||||
return s
|
return s
|
||||||
|
|
||||||
|
|
||||||
|
def generate_family_event_tooltip(self,event):
|
||||||
|
global escape
|
||||||
|
|
||||||
|
s = "<big><b>%s</b></big>\n\n"\
|
||||||
|
"\t<b>%s:</b>\t%s\n"\
|
||||||
|
"\t<b>%s:</b>\t%s\n"\
|
||||||
|
"\t<b>%s:</b>\t%s\n"\
|
||||||
|
"\t<b>%s:</b>\t%s\n"\
|
||||||
|
"\t<b>%s:</b>\t%s\n" % (
|
||||||
|
_("Family Event"),
|
||||||
|
_("Type"),escape(const.display_fevent(event.get_name())),
|
||||||
|
_("Date"),escape(event.get_date()),
|
||||||
|
_("Place"),escape(place_title(self.db,event)),
|
||||||
|
_("Cause"),escape(event.get_cause()),
|
||||||
|
_("Description"), escape(event.get_description()))
|
||||||
|
|
||||||
|
if len(event.get_source_references()) > 0:
|
||||||
|
psrc_ref = event.get_source_references()[0]
|
||||||
|
psrc_id = psrc_ref.get_base_handle()
|
||||||
|
psrc = self.db.get_source_from_handle(psrc_id)
|
||||||
|
|
||||||
|
s += "\n<big><b>%s</b></big>\n\n"\
|
||||||
|
"\t<b>%s:</b>\t%s\n" % (
|
||||||
|
_("Primary source"),
|
||||||
|
_("Name"),
|
||||||
|
escape(short(psrc.get_title())))
|
||||||
|
|
||||||
|
return s
|
||||||
|
|
||||||
def generate_addr_tooltip(self,addr):
|
def generate_addr_tooltip(self,addr):
|
||||||
global escape
|
global escape
|
||||||
s = "<big><b>%s</b></big>\n\n"\
|
s = "<big><b>%s</b></big>\n\n"\
|
||||||
@ -408,6 +449,27 @@ class ScratchPadWindow:
|
|||||||
|
|
||||||
return s
|
return s
|
||||||
|
|
||||||
|
def generate_fattr_tooltip(self,attr):
|
||||||
|
global escape
|
||||||
|
s = "<big><b>%s</b></big>\n\n"\
|
||||||
|
"\t<b>%s:</b>\t%s\n"\
|
||||||
|
"\t<b>%s:</b>\t%s" % (_("Family Attribute"),
|
||||||
|
_("Type"),
|
||||||
|
escape(const.display_fattr(attr.get_type())),
|
||||||
|
_("Value"),
|
||||||
|
escape(attr.get_value()))
|
||||||
|
|
||||||
|
if len(attr.get_source_references()) > 0:
|
||||||
|
psrc_ref = attr.get_source_references()[0]
|
||||||
|
psrc_id = psrc_ref.get_base_handle()
|
||||||
|
psrc = self.db.get_source_from_handle(psrc_id)
|
||||||
|
s += "\n<big><b>%s</b></big>\n\n"\
|
||||||
|
"\t<b>%s:</b>\t%s\n" % (
|
||||||
|
_("Sources"),
|
||||||
|
_("Name"),escape(short(psrc.get_title())))
|
||||||
|
|
||||||
|
return s
|
||||||
|
|
||||||
|
|
||||||
def generate_srcref_tooltip(self,srcref):
|
def generate_srcref_tooltip(self,srcref):
|
||||||
global escape
|
global escape
|
||||||
@ -464,7 +526,7 @@ register_tool(
|
|||||||
ScratchPad,
|
ScratchPad,
|
||||||
_("Scratch Pad"),
|
_("Scratch Pad"),
|
||||||
category=_("Utilities"),
|
category=_("Utilities"),
|
||||||
description=_("The Scratch Pad provides a tempory note pad to store "
|
description=_("The Scratch Pad provides a temporary note pad to store "
|
||||||
"objects for easy reuse.")
|
"objects for easy reuse.")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user