2005-03-25 Richard Taylor <rjt-gramps@thegrindstone.me.uk>

* src/Sources.py: converted to use DdTargets.py
	* src/FamilyView.py: converted to use DdTargets.py
	* src/EditPerson.py: converted to use DdTargets.py
	* src/EditPlace.py: converted to use DdTargets.py
	* src/Marriage.py: converted to use DdTargets.py
	* src/DdTargets.py: added targets for FAMILY_EVENT, FAMILY_ATTRIBUTE,
	CHILD and SPOUSE


svn: r4236
This commit is contained in:
Richard Taylor 2005-03-25 21:05:09 +00:00
parent 4c16bd7fc7
commit 90b319081e
7 changed files with 97 additions and 62 deletions

View File

@ -1,3 +1,12 @@
2005-03-25 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
* src/Sources.py: converted to use DdTargets.py
* src/FamilyView.py: converted to use DdTargets.py
* src/EditPerson.py: converted to use DdTargets.py
* src/EditPlace.py: converted to use DdTargets.py
* src/Marriage.py: converted to use DdTargets.py
* src/DdTargets.py: added targets for FAMILY_EVENT, FAMILY_ATTRIBUTE,
CHILD and SPOUSE
2005-03-24 Alex Roitman <shura@gramps-project.org>
* src/RelLib.py (Witness.__init__): Typo.
* src/plugins/Check.py (cleanup_missing_photos): Use new mediaref

View File

@ -97,11 +97,17 @@ class _DdTargets(object):
self._type_map = {}
self._app_id_map = {}
self.URL = _DdType(self,'url',0,0)
self.EVENT = _DdType(self,'pevent',0,1)
self.ATTRIBUTE = _DdType(self,'pattr',0,2)
self.ADDRESS = _DdType(self,'paddr',0,3)
self.SOURCEREF = _DdType(self,'srcref',0,4)
self.URL = _DdType(self,'url')
self.EVENT = _DdType(self,'pevent')
self.ATTRIBUTE = _DdType(self,'pattr')
self.ADDRESS = _DdType(self,'paddr')
self.SOURCEREF = _DdType(self,'srcref')
self.FAMILY_EVENT = _DdType(self,'fevent')
self.FAMILY_ATTRIBUTE = _DdType(self,'fattr')
self.CHILD = _DdType(self,'child')
self.SPOUSE = _DdType(self,'spouce')
self.TEXT = _DdType(self,'TEXT',0,1)
self.TEXT_MIME = _DdType(self,'text/plain',0,0)

View File

@ -63,6 +63,9 @@ import NameDisplay
from QuestionDialog import WarningDialog, ErrorDialog, SaveDialog
from DdTargets import DdTargets
#-------------------------------------------------------------------------
#
# Constants
@ -75,12 +78,6 @@ _temple_names = const.lds_temple_codes.keys()
_temple_names.sort()
_temple_names = [""] + _temple_names
pycode_tgts = [('url', 0, 0),
('pevent', 0, 1),
('pattr', 0, 2),
('paddr', 0, 3),
('srcref', 0, 4)]
_use_patronymic = [
"ru","RU","ru_RU","koi8r","ru_koi8r","russian","Russian",
@ -403,29 +400,43 @@ class EditPerson:
self.flowed.set_active(1)
Utils.bold_label(self.notes_label)
self.event_list.drag_dest_set(gtk.DEST_DEFAULT_ALL, pycode_tgts,
self.event_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,
[DdTargets.EVENT.target()],
ACTION_COPY)
self.event_list.drag_source_set(BUTTON1_MASK, pycode_tgts, ACTION_COPY)
self.event_list.drag_source_set(BUTTON1_MASK,
[DdTargets.EVENT.target()],
ACTION_COPY)
self.event_list.connect('drag_data_get', self.ev_drag_data_get)
self.event_list.connect('drag_begin', self.ev_drag_begin)
self.event_list.connect('drag_data_received',
self.ev_drag_data_received)
self.web_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,pycode_tgts,
self.web_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,
[DdTargets.URL.target()],
ACTION_COPY)
self.web_list.drag_source_set(BUTTON1_MASK, pycode_tgts, ACTION_COPY)
self.web_list.drag_source_set(BUTTON1_MASK,
[DdTargets.URL.target()],
ACTION_COPY)
self.web_list.connect('drag_data_get', self.url_drag_data_get)
self.web_list.connect('drag_begin', self.url_drag_begin)
self.web_list.connect('drag_data_received',self.url_drag_data_received)
self.attr_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,pycode_tgts,ACTION_COPY)
self.attr_list.drag_source_set(BUTTON1_MASK, pycode_tgts, ACTION_COPY)
self.attr_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,
[DdTargets.ATTRIBUTE.target()],
ACTION_COPY)
self.attr_list.drag_source_set(BUTTON1_MASK,
[DdTargets.ATTRIBUTE.target()],
ACTION_COPY)
self.attr_list.connect('drag_data_get', self.at_drag_data_get)
self.attr_list.connect('drag_data_received',self.at_drag_data_received)
self.attr_list.connect('drag_begin', self.at_drag_begin)
self.addr_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,pycode_tgts,ACTION_COPY)
self.addr_list.drag_source_set(BUTTON1_MASK, pycode_tgts,ACTION_COPY)
self.addr_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,
[DdTargets.ADDRESS.target()],
ACTION_COPY)
self.addr_list.drag_source_set(BUTTON1_MASK,
[DdTargets.ADDRESS.target()],
ACTION_COPY)
self.addr_list.connect('drag_data_get', self.ad_drag_data_get)
self.addr_list.connect('drag_data_received',self.ad_drag_data_received)
self.addr_list.connect('drag_begin', self.ad_drag_begin)
@ -813,7 +824,7 @@ class EditPerson:
exec 'data = %s' % sel_data.data
exec 'mytype = "%s"' % data[0]
exec 'person = "%s"' % data[1]
if mytype != 'pevent':
if mytype != DdTargets.EVENT.drag_type:
return
elif person == self.person.get_handle():
self.move_element(self.elist,self.etree.get_selected_row(),row)
@ -843,7 +854,7 @@ class EditPerson:
bits_per = 8; # we're going to pass a string
pickled = pickle.dumps(ev[0]);
data = str(('pevent',self.person.get_handle(),pickled));
data = str((DdTargets.EVENT.drag_type,self.person.get_handle(),pickled));
sel_data.set(sel_data.target, bits_per, data)
def ev_drag_begin(self, context, a):
@ -862,7 +873,7 @@ class EditPerson:
exec 'data = %s' % sel_data.data
exec 'mytype = "%s"' % data[0]
exec 'person = "%s"' % data[1]
if mytype != "url":
if mytype != DdTargets.URL.drag_type:
return
elif person == self.person.get_handle():
self.move_element(self.ulist,self.wtree.get_selected_row(),row)
@ -881,7 +892,7 @@ class EditPerson:
if len(ev):
bits_per = 8; # we're going to pass a string
pickled = pickle.dumps(ev[0]);
data = str(('url',self.person.get_handle(),pickled));
data = str((DdTargets.URL.drag_type,self.person.get_handle(),pickled));
sel_data.set(sel_data.target, bits_per, data)
def at_drag_data_received(self,widget,context,x,y,sel_data,info,time):
@ -891,7 +902,7 @@ class EditPerson:
exec 'data = %s' % sel_data.data
exec 'mytype = "%s"' % data[0]
exec 'person = "%s"' % data[1]
if mytype != 'pattr':
if mytype != DdTargets.ATTRIBUTE.drag_type:
return
elif person == self.person.get_handle():
self.move_element(self.alist,self.atree.get_selected_row(),row)
@ -914,7 +925,8 @@ class EditPerson:
if len(ev):
bits_per = 8; # we're going to pass a string
pickled = pickle.dumps(ev[0]);
data = str(('pattr',self.person.get_handle(),pickled));
data = str((DdTargets.ATTRIBUTE.drag_type,
self.person.get_handle(),pickled));
sel_data.set(sel_data.target, bits_per, data)
def ad_drag_data_received(self,widget,context,x,y,sel_data,info,time):
@ -924,7 +936,7 @@ class EditPerson:
exec 'data = %s' % sel_data.data
exec 'mytype = "%s"' % data[0]
exec 'person = "%s"' % data[1]
if mytype != 'paddr':
if mytype != DdTargets.ADDRESS.drag_type:
return
elif person == self.person.get_handle():
self.move_element(self.plist,self.ptree.get_selected_row(),row)
@ -945,7 +957,8 @@ class EditPerson:
if len(ev):
bits_per = 8; # we're going to pass a string
pickled = pickle.dumps(ev[0]);
data = str(('paddr',self.person.get_handle(),pickled));
data = str((DdTargets.ADDRESS.drag_type,
self.person.get_handle(),pickled));
sel_data.set(sel_data.target, bits_per, data)
def ad_drag_begin(self, context, a):

View File

@ -49,14 +49,8 @@ import Sources
import ImageSelect
import NameDisplay
#-------------------------------------------------------------------------
#
# Constants
#
#-------------------------------------------------------------------------
pycode_tgts = [
('url' , 0, 0),
('srcref', 0, 4)]
from DdTargets import DdTargets
#-------------------------------------------------------------------------
#
@ -229,9 +223,11 @@ class EditPlace:
self.top_window.get_widget("delete_photo").set_sensitive(0)
self.web_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,
pycode_tgts,gtk.gdk.ACTION_COPY)
[DdTargets.URL.target()],
gtk.gdk.ACTION_COPY)
self.web_list.drag_source_set(gtk.gdk.BUTTON1_MASK,
pycode_tgts, gtk.gdk.ACTION_COPY)
[DdTargets.URL.target()],
gtk.gdk.ACTION_COPY)
self.web_list.connect('drag_data_get',
self.url_source_drag_data_get)
self.web_list.connect('drag_data_received',

View File

@ -57,6 +57,8 @@ import NameDisplay
from QuestionDialog import QuestionDialog,WarningDialog
from DdTargets import DdTargets
#-------------------------------------------------------------------------
#
# Constants
@ -65,9 +67,6 @@ from QuestionDialog import QuestionDialog,WarningDialog
_BORN = _('b.')
_DIED = _('d.')
pycode_tgts = [('child', 0, 0)]
spcode_tgts = [('spouse', 0, 0)]
column_names = [
(_('#'),0) ,
@ -185,9 +184,11 @@ class FamilyView:
self.parent.views.get_nth_page(2).hide()
self.spouse_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,
spcode_tgts,ACTION_COPY)
[DdTargets.SPOUSE.target()],
ACTION_COPY)
self.spouse_list.drag_source_set(BUTTON1_MASK,
spcode_tgts, ACTION_COPY)
[DdTargets.SPOUSE.target()],
ACTION_COPY)
self.spouse_list.connect('drag_data_get',
self.sp_drag_data_get)
self.spouse_list.connect('drag_data_received',
@ -239,8 +240,11 @@ class FamilyView:
self.selected_spouse = None
self.child_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,
pycode_tgts,ACTION_COPY)
self.child_list.drag_source_set(BUTTON1_MASK, pycode_tgts, ACTION_COPY)
[DdTargets.CHILD.target()],
ACTION_COPY)
self.child_list.drag_source_set(BUTTON1_MASK,
[DdTargets.CHILD.target()],
ACTION_COPY)
self.child_list.connect('drag_data_get', self.drag_data_get)
self.child_list.connect('drag_data_received',self.drag_data_received)

View File

@ -58,6 +58,7 @@ import Date
import DateEdit
from QuestionDialog import QuestionDialog, WarningDialog, SaveDialog
from DdTargets import DdTargets
#-------------------------------------------------------------------------
#
@ -68,11 +69,6 @@ _temple_names = const.lds_temple_codes.keys()
_temple_names.sort()
_temple_names = [""] + _temple_names
pycode_tgts = [
('fevent', 0, 0),
('fattr', 0, 1),
('srcref', 0, 4),
]
#-------------------------------------------------------------------------
#
@ -270,9 +266,11 @@ class Marriage:
Utils.unbold_label(self.lds_label)
self.event_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,
pycode_tgts,gtk.gdk.ACTION_COPY)
[DdTargets.FAMILY_EVENT.target()],
gtk.gdk.ACTION_COPY)
self.event_list.drag_source_set(gtk.gdk.BUTTON1_MASK,
pycode_tgts, gtk.gdk.ACTION_COPY)
[DdTargets.FAMILY_EVENT.target()],
gtk.gdk.ACTION_COPY)
self.event_list.connect('drag_data_get',
self.ev_source_drag_data_get)
self.event_list.connect('drag_data_received',
@ -280,9 +278,11 @@ class Marriage:
self.event_list.connect('drag_begin', self.ev_drag_begin)
self.attr_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,
pycode_tgts,gtk.gdk.ACTION_COPY)
[DdTargets.FAMILY_ATTRIBUTE.target()],
gtk.gdk.ACTION_COPY)
self.attr_list.drag_source_set(gtk.gdk.BUTTON1_MASK,
pycode_tgts,gtk.gdk.ACTION_COPY)
[DdTargets.FAMILY_ATTRIBUTE.target()],
gtk.gdk.ACTION_COPY)
self.attr_list.connect('drag_data_get',
self.at_source_drag_data_get)
self.attr_list.connect('drag_data_received',

View File

@ -51,11 +51,14 @@ import Date
import DateEdit
import DateHandler
pycode_tgts = [('url', 0, 0),
('pevent', 0, 1),
('pattr', 0, 2),
('paddr', 0, 3),
('srcref', 0, 4)]
from DdTargets import DdTargets
##pycode_tgts = [('url', 0, 0),
## ('pevent', 0, 1),
## ('pattr', 0, 2),
## ('paddr', 0, 3),
## ('srcref', 0, 4)]
#-------------------------------------------------------------------------
#
@ -263,8 +266,12 @@ class SourceTab:
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.drag_dest_set(gtk.DEST_DEFAULT_ALL,
[DdTargets.SOURCEREF.target()],
ACTION_COPY)
self.slist.drag_source_set(BUTTON1_MASK,
[DdTargets.SOURCEREF.target()],
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)
@ -274,7 +281,7 @@ class SourceTab:
exec 'data = %s' % sel_data.data
exec 'mytype = "%s"' % data[0]
exec 'person = "%s"' % data[1]
if mytype != 'srcref':
if mytype != DdTargets.SOURCEREF.drag_type:
return
else:
foo = pickle.loads(data[2]);
@ -290,7 +297,7 @@ class SourceTab:
bits_per = 8; # we're going to pass a string
pickled = pickle.dumps(ev);
data = str(('srcref',None,pickled));
data = str((DdTargets.SOURCEREF.drag_type,None,pickled));
sel_data.set(sel_data.target, bits_per, data)
def drag_begin(self, context, a):