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 2301a20787
commit 989f859a5c
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>
* src/ScratchPad.py: Filter double drops in Windows.

View File

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

View File

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

View File

@ -176,6 +176,38 @@ class ScratchPadAddress(ScratchPadGrampsTypeWrapper):
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):
DROP_TARGETS = [DdTargets.EVENT]
@ -745,6 +777,7 @@ class ScratchPadListView:
def register_wrapper_classes(self):
self.register_wrapper_class(ScratchPadAddress)
self.register_wrapper_class(ScratchPadLocation)
self.register_wrapper_class(ScratchPadEvent)
self.register_wrapper_class(ScratchPadEventRef)
self.register_wrapper_class(ScratchPadSourceRef)