Fixed one issue with multi-select and drop on self; one issue remains: copies data on a self multi drop

svn: r15773
This commit is contained in:
Doug Blank 2010-08-19 04:08:07 +00:00
parent 88a4bbb926
commit 7758caa4e3

View File

@ -1014,9 +1014,13 @@ class ScratchDropRawList(ScratchDropList):
def get_objects(self):
retval = []
for item in self._obj_list:
if item is None:
continue
target = pickle.loads(item)[0]
_class = map2class(target)
if _class:
obj = _class(self._dbstate, item)
if obj:
retval.append(obj)
return retval
@ -1366,11 +1370,14 @@ class ScratchPadListView(object):
o_list = o.get_objects()
else:
o_list = [o]
for o in o_list:
if o.__class__.DRAG_TARGET is None:
continue
data = [o.__class__.DRAG_TARGET.drag_type, o, o.tooltip,
o._type, o._value]
contains = model_contains(model, data)
if not contains:
for o in o_list:
if context.action != ACTION_MOVE and contains:
continue
drop_info = widget.get_dest_row_at_pos(x, y)
if drop_info:
path, position = drop_info
@ -1383,10 +1390,11 @@ class ScratchPadListView(object):
else:
model.append(data)
# FIXME: there is one bug here: if you multi-select and drop
# on self, then it moves the first, and copies the rest.
if context.action == ACTION_MOVE:
context.finish(True, True, time)
elif context.action == ACTION_MOVE:
context.finish(True, True, time)
# remember time for double drop workaround.
self._previous_drop_time = realTime