Clipboards do not allow duplicates
svn: r15767
This commit is contained in:
parent
e7d365a5d7
commit
a74d5151f8
@ -136,23 +136,22 @@ def obj2target(target):
|
|||||||
}
|
}
|
||||||
return d[target] if target in d else None
|
return d[target] if target in d else None
|
||||||
|
|
||||||
def model_contains(model, path, iter, data):
|
def model_contains(model, data):
|
||||||
"""
|
"""
|
||||||
Returns True if data is a row in model.
|
Returns True if data is a row in model.
|
||||||
"""
|
"""
|
||||||
# check type and value
|
# check type and value
|
||||||
# data[0] is type of drop item, data[1] is ScratchPad object
|
# data[0] is type of drop item, data[1] is ScratchPad object
|
||||||
print "-----"
|
for row in model:
|
||||||
if data[0] == 'TEXT':
|
if data[0] == 'TEXT':
|
||||||
print model.get_value(iter, 0), data[0]
|
same = ((row[0] == data[0]) and
|
||||||
print model.get_value(iter, 1)._value, data[1]._value
|
(row[1]._value == data[1]._value))
|
||||||
return ((model.get_value(iter, 0) == data[0]) and
|
else:
|
||||||
(model.get_value(iter, 1)._value == data[1]._value))
|
same = ((row[0] == data[0]) and
|
||||||
else:
|
(row[1]._handle == data[1]._handle))
|
||||||
print model.get_value(iter, 0), data[0]
|
if same:
|
||||||
print model.get_value(iter, 1)._handle, data[1]._handle
|
return True
|
||||||
return ((model.get_value(iter, 0) == data[0]) and
|
return False
|
||||||
(model.get_value(iter, 1)._handle == data[1]._handle))
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -1369,8 +1368,7 @@ class ScratchPadListView(object):
|
|||||||
o_list = [o]
|
o_list = [o]
|
||||||
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]
|
||||||
import pdb; pdb.set_trace()
|
contains = model_contains(model, data)
|
||||||
contains = model.foreach(model_contains, data)
|
|
||||||
if not contains:
|
if not contains:
|
||||||
for o in o_list:
|
for o in o_list:
|
||||||
drop_info = widget.get_dest_row_at_pos(x, y)
|
drop_info = widget.get_dest_row_at_pos(x, y)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user