Support for DnD of alternate locations of a place

svn: r6198
This commit is contained in:
Martin Hawlisch 2006-03-23 16:41:51 +00:00
parent b2573566c1
commit 771b6c1c02
4 changed files with 41 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2006-03-23 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/DdTargets.py,
* src/DisplayTabs.py,
* src/ScratchPad.py: Support Location DnD
2006-03-22 Brian Matherly <pez4brian@users.sourceforge.net> 2006-03-22 Brian Matherly <pez4brian@users.sourceforge.net>
* src/ScratchPad.py: Filter double drops in Windows. * src/ScratchPad.py: Filter double drops in Windows.

View File

@ -111,6 +111,7 @@ class _DdTargets(object):
self.EVENTREF = _DdType(self,'eventref') self.EVENTREF = _DdType(self,'eventref')
self.ATTRIBUTE = _DdType(self,'pattr') self.ATTRIBUTE = _DdType(self,'pattr')
self.ADDRESS = _DdType(self,'paddr') self.ADDRESS = _DdType(self,'paddr')
self.LOCATION = _DdType(self,'location')
self.SOURCEREF = _DdType(self,'srcref') self.SOURCEREF = _DdType(self,'srcref')
self.REPOREF = _DdType(self,'reporef') self.REPOREF = _DdType(self,'reporef')
self.REPO_LINK = _DdType(self,'repo-link') self.REPO_LINK = _DdType(self,'repo-link')
@ -133,6 +134,7 @@ class _DdTargets(object):
self.EVENT, self.EVENT,
self.ATTRIBUTE, self.ATTRIBUTE,
self.ADDRESS, self.ADDRESS,
self.LOCATION,
self.SOURCE_LINK, self.SOURCE_LINK,
self.SOURCEREF, self.SOURCEREF,
self.EVENTREF, self.EVENTREF,

View File

@ -1116,7 +1116,7 @@ class AddrEmbedList(EmbeddedList):
class LocationEmbedList(EmbeddedList): class LocationEmbedList(EmbeddedList):
_HANDLE_COL = 5 _HANDLE_COL = 5
_DND_TYPE = DdTargets.ADDRESS _DND_TYPE = DdTargets.LOCATION
_column_names = [ _column_names = [
(_('City'), 0, 150), (_('City'), 0, 150),

View File

@ -176,6 +176,38 @@ class ScratchPadAddress(ScratchPadGrampsTypeWrapper):
return s return s
class ScratchPadLocation(ScratchPadGrampsTypeWrapper):
DROP_TARGETS = [DdTargets.LOCATION]
DRAG_TARGET = DdTargets.LOCATION
ICON = BLANK_PIC
def __init__(self,dbstate,obj):
ScratchPadGrampsTypeWrapper.__init__(self,dbstate,obj)
self._type = _("Location")
self._value = "%s %s %s" % (self._obj.get_city(),
self._obj.get_state(),self._obj.get_country())
def tooltip(self):
global escape
s = "<big><b>%s</b></big>\n\n"\
"\t<b>%s:</b>\t%s\n"\
"\t<b>%s:</b>\n"\
"\t\t%s\n"\
"\t\t%s\n"\
"\t\t%s\n"\
"\t\t%s\n"\
"\t<b>%s:</b>\t%s\n" % (
_("Location"),
escape(self._obj.get_city()),
escape(self._obj.get_state()),
escape(self._obj.get_country()),
escape(self._obj.get_postal_code()),
_("Telephone"), escape(self._obj.get_phone()))
return s
class ScratchPadEvent(ScratchPadWrapper): class ScratchPadEvent(ScratchPadWrapper):
DROP_TARGETS = [DdTargets.EVENT] DROP_TARGETS = [DdTargets.EVENT]
@ -745,6 +777,7 @@ class ScratchPadListView:
def register_wrapper_classes(self): def register_wrapper_classes(self):
self.register_wrapper_class(ScratchPadAddress) self.register_wrapper_class(ScratchPadAddress)
self.register_wrapper_class(ScratchPadLocation)
self.register_wrapper_class(ScratchPadEvent) self.register_wrapper_class(ScratchPadEvent)
self.register_wrapper_class(ScratchPadEventRef) self.register_wrapper_class(ScratchPadEventRef)
self.register_wrapper_class(ScratchPadSourceRef) self.register_wrapper_class(ScratchPadSourceRef)