Fix for OS X Scratchpad issue 3089: clipboard broken in Mac port
svn: r12882
This commit is contained in:
parent
ee69317b62
commit
fc8917f6d2
@ -51,6 +51,7 @@ import DateHandler
|
|||||||
import GrampsDisplay
|
import GrampsDisplay
|
||||||
import ManagedWindow
|
import ManagedWindow
|
||||||
from TransUtils import sgettext as _
|
from TransUtils import sgettext as _
|
||||||
|
from Utils import mac
|
||||||
from glade import Glade
|
from glade import Glade
|
||||||
from DdTargets import DdTargets
|
from DdTargets import DdTargets
|
||||||
|
|
||||||
@ -1086,6 +1087,25 @@ class ScratchPadListView(object):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# Find a wrapper class
|
# Find a wrapper class
|
||||||
|
possible_wrappers = []
|
||||||
|
if mac():
|
||||||
|
# context is empty on mac due to a bug, work around this
|
||||||
|
# Note that this workaround code works fine in linux too as
|
||||||
|
# we know very well inside of GRAMPS what sel_data can be, so
|
||||||
|
# we can anticipate on it, instead of letting the wrapper handle
|
||||||
|
# it. This is less clean however !
|
||||||
|
# See http://www.gramps-project.org/bugs/view.php?id=3089 for
|
||||||
|
# an explaination of why this is required.
|
||||||
|
dragtype = None
|
||||||
|
try:
|
||||||
|
dragtype = pickle.loads(sel_data)[0]
|
||||||
|
except pickle.UnpicklingError, msg :
|
||||||
|
# not a pickled object, probably text
|
||||||
|
if isinstance(sel_data, basestring):
|
||||||
|
dragtype = DdTargets.TEXT.drag_type
|
||||||
|
if dragtype in self._target_type_to_wrapper_class_map:
|
||||||
|
possible_wrappers = [dragtype]
|
||||||
|
else:
|
||||||
possible_wrappers = [target for target in context.targets \
|
possible_wrappers = [target for target in context.targets \
|
||||||
if target in self._target_type_to_wrapper_class_map]
|
if target in self._target_type_to_wrapper_class_map]
|
||||||
|
|
||||||
@ -1094,7 +1114,8 @@ class ScratchPadListView(object):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# Just select the first match.
|
# Just select the first match.
|
||||||
wrapper_class = self._target_type_to_wrapper_class_map[str(possible_wrappers[0])]
|
wrapper_class = self._target_type_to_wrapper_class_map[
|
||||||
|
str(possible_wrappers[0])]
|
||||||
|
|
||||||
o = wrapper_class(self.dbstate,sel_data)
|
o = wrapper_class(self.dbstate,sel_data)
|
||||||
# try:
|
# try:
|
||||||
|
Loading…
Reference in New Issue
Block a user