projects
/
Plinn.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
e932032
)
Implémentation du déplacement d'une sélection au delà de la position du dernier élément.
author
Benoît Pin
<pin@cri.ensmp.fr>
Thu, 9 Oct 2014 15:53:39 +0000
(17:53 +0200)
committer
Benoît Pin
<pin@cri.ensmp.fr>
Thu, 9 Oct 2014 15:53:39 +0000
(17:53 +0200)
HugePlinnFolder.py
patch
|
blob
|
history
diff --git
a/HugePlinnFolder.py
b/HugePlinnFolder.py
index
563bf18
..
d158fdd
100644
(file)
--- a/
HugePlinnFolder.py
+++ b/
HugePlinnFolder.py
@@
-138,6
+138,8
@@
class HugePlinnFolder(BTreeFolder2Base, PlinnFolder) :
def moveObjectsAfter(self, ids, targetId, suppress_events=False):
assert targetId not in ids
def moveObjectsAfter(self, ids, targetId, suppress_events=False):
assert targetId not in ids
+ # id2pos = dict(self._id2pos_index).copy()
+ # pos2id = dict(self._pos2id_index).copy()
id2pos = self._id2pos_index
pos2id = self._pos2id_index
targetPos = id2pos[targetId]
id2pos = self._id2pos_index
pos2id = self._pos2id_index
targetPos = id2pos[targetId]
@@
-150,8
+152,8
@@
class HugePlinnFolder(BTreeFolder2Base, PlinnFolder) :
id2posUpdate = {}
pos2idUpdate = {}
id2posUpdate = {}
pos2idUpdate = {}
- # moved before the firt item position
if targetPos < minMovedPos :
if targetPos < minMovedPos :
+ # selection moved before the first item position
for i, id in enumerate(ids) :
pos = i + targetPos + 1
id2posUpdate[id] = pos
for i, id in enumerate(ids) :
pos = i + targetPos + 1
id2posUpdate[id] = pos
@@
-167,9
+169,18
@@
class HugePlinnFolder(BTreeFolder2Base, PlinnFolder) :
print "déposé entre la première et la dernière de la sélection"
raise NotImplementedError()
else :
print "déposé entre la première et la dernière de la sélection"
raise NotImplementedError()
else :
- print minMovedPos, maxMovedPos, targetPos
- print "déposé après la dernière"
- raise NotImplementedError()
+ # selection moved after the last item position
+ pos = minMovedPos
+ for id in IndexIterator(pos2id, targetPos, start=minMovedPos+1) :
+ id2posUpdate[id] = pos
+ pos2idUpdate[pos] = id
+ pos += 1
+
+ pos = targetPos - len(ids) + 1
+ for id in ids :
+ id2posUpdate[id] = pos
+ pos2idUpdate[pos] = id
+ pos +=1
id2pos.update(id2posUpdate)
pos2id.update(pos2idUpdate)
id2pos.update(id2posUpdate)
pos2id.update(pos2idUpdate)
@@
-178,6
+189,7
@@
class HugePlinnFolder(BTreeFolder2Base, PlinnFolder) :
for pos in xrange(len(self)) :
assert pos2id.has_key(pos)
assert id2pos.has_key(pos2id[pos])
for pos in xrange(len(self)) :
assert pos2id.has_key(pos)
assert id2pos.has_key(pos2id[pos])
+
if not suppress_events :
for id, pos in id2posUpdate.items() :
notify(ObjectPositionModified(self[id], self, pos))
if not suppress_events :
for id, pos in id2posUpdate.items() :
notify(ObjectPositionModified(self[id], self, pos))