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:
parent
88a4bbb926
commit
7758caa4e3
@ -1014,9 +1014,13 @@ class ScratchDropRawList(ScratchDropList):
|
|||||||
def get_objects(self):
|
def get_objects(self):
|
||||||
retval = []
|
retval = []
|
||||||
for item in self._obj_list:
|
for item in self._obj_list:
|
||||||
|
if item is None:
|
||||||
|
continue
|
||||||
target = pickle.loads(item)[0]
|
target = pickle.loads(item)[0]
|
||||||
_class = map2class(target)
|
_class = map2class(target)
|
||||||
|
if _class:
|
||||||
obj = _class(self._dbstate, item)
|
obj = _class(self._dbstate, item)
|
||||||
|
if obj:
|
||||||
retval.append(obj)
|
retval.append(obj)
|
||||||
return retval
|
return retval
|
||||||
|
|
||||||
@ -1366,11 +1370,14 @@ class ScratchPadListView(object):
|
|||||||
o_list = o.get_objects()
|
o_list = o.get_objects()
|
||||||
else:
|
else:
|
||||||
o_list = [o]
|
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,
|
data = [o.__class__.DRAG_TARGET.drag_type, o, o.tooltip,
|
||||||
o._type, o._value]
|
o._type, o._value]
|
||||||
contains = model_contains(model, data)
|
contains = model_contains(model, data)
|
||||||
if not contains:
|
if context.action != ACTION_MOVE and contains:
|
||||||
for o in o_list:
|
continue
|
||||||
drop_info = widget.get_dest_row_at_pos(x, y)
|
drop_info = widget.get_dest_row_at_pos(x, y)
|
||||||
if drop_info:
|
if drop_info:
|
||||||
path, position = drop_info
|
path, position = drop_info
|
||||||
@ -1383,10 +1390,11 @@ class ScratchPadListView(object):
|
|||||||
else:
|
else:
|
||||||
model.append(data)
|
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:
|
if context.action == ACTION_MOVE:
|
||||||
context.finish(True, True, time)
|
context.finish(True, True, time)
|
||||||
elif context.action == ACTION_MOVE:
|
|
||||||
context.finish(True, True, time)
|
|
||||||
|
|
||||||
# remember time for double drop workaround.
|
# remember time for double drop workaround.
|
||||||
self._previous_drop_time = realTime
|
self._previous_drop_time = realTime
|
||||||
|
Loading…
Reference in New Issue
Block a user