Changeset 463
- Timestamp:
- Wed Jun 18 22:26:26 2008
- Files:
-
- ganttpv/trunk/ORM.py (modified) (diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ganttpv/trunk/ORM.py
r462 r463 409 409 def Delete(self): # overriden in subclasses 410 410 self.Follow(remove=True) 411 if self.dcid: 412 self.canvas.pdc.RemoveId(self.dcid) 413 if self.dcid in self.canvas.objids: 414 self.canvas.objids.remove(self.dcid) 411 self.canvas.DeleteDCID(self.dcid) 415 412 # self._SetInShell('dcid', None) 416 413 # self._SetInShell('canvas', None) … … 919 916 920 917 def OnTop(self): # must run after this object has a dcid 921 ## print 'started ontop'922 918 ## fact_object = self.Target 923 919 ## reading_object = self.Target.ORMFactReading … … 931 927 if object_type_shape: 932 928 ## print 'found objectified' 933 if self.dcid < object_type_shape.dcid: 929 dc = self.canvas.pdc 930 print self.dcid, object_type_shape.dcid 931 if True: # self.dcid < object_type_shape.dcid: 934 932 print 'reseting fact dcid' 935 dc = self.canvas.pdc 936 dc.RemoveId(self.dcid) # clear the old id 933 self.canvas.DeleteDCID(self.dcid) 934 ## dc.RemoveId(self.dcid) # clear the old id 937 935 self.canvas.SetGraphic(dc, self, newid=True) # create new one 938 936 for f in followers: … … 940 938 ## if debug: 941 939 ## print "object dcid, other dcid", f.dcid, object_type_shape.dcid 942 if f.dcid < object_type_shape.dcid: # if behind object type shape 943 dc.RemoveId(f.dcid) # clear the old id 940 if f.Subtype != 'ORMObjectTypeShape': # f.dcid < object_type_shape.dcid: # if behind object type shape 941 self.canvas.DeleteDCID(f.dcid) 942 ## dc.RemoveId(f.dcid) # clear the old id 944 943 self.canvas.SetGraphic(dc, f, newid=True) # create new one 945 944 … … 2538 2537 def SetGraphic(self, dc, shape, newid=False): 2539 2538 if self != shape.canvas or not shape.dcid or newid: 2539 # remove old dcid before adding a new one 2540 if shape.dcid and self==shape.canvas: 2541 if shape.dcid in self.objids: 2542 self.objids.remove(shape.dcid) 2540 2543 id = wx.NewId() 2541 2544 # need to remember which dc id belongs to which shape … … 2597 2600 # identify un-added objects 2598 2601 dcids = {} 2602 if debug: print 'objids', self.objids 2599 2603 for dcid in self.objids: 2604 if debug: print 'dcid', dcid, 'shape', self.dcid_to_shape_xref.get(dcid) 2600 2605 dcids[dcid] = None 2601 2606 2602 2607 # undelete objects will be in this list, but shouldn't be in self.objids 2603 2608 for shape in self.Report.GetList('GraphicObject'): 2609 if debug: print 'keep', shape 2610 dcid = shape.dcid 2604 2611 shape.Follow() # some will be there already, some won't 2605 2612 x, y = shape.PosX, shape.PosY # undo of moves (temp pos doesn't undo) … … 2607 2614 shape.SetTempPos(x, y) 2608 2615 2609 if shape.canvas == None: # undo of deletes, the need to be recreated 2616 if shape.canvas != self or shape.dcid == None: # undo of deletes, the need to be recreated 2609 2616 self.CreateNode(self.pdc, shape) 2610 shape.OnBottom() # put objectification behind facttype2617 shape.OnBottom() # put objectification behind facttype 2610 2617 2611 2618 self.RedrawID(shape.dcid) 2619 shape.OnBottom() # put objectification behind facttype 2612 2620 2613 if shape.dcid in dcids: # identify obsolete dcids 2614 del dcids[shape.dcid] 2621 if dcid in dcids: # identify obsolete dcids 2622 if debug: print 'del dcid', dcid 2623 del dcids[dcid] 2615 2624 2625 if debug: print 'remaining dcids', dcids 2616 2626 for dcid in dcids.keys(): # undo of adds, delete dcids 2617 self.pdc.RemoveId(dcid) 2618 self.objids.remove(dcid) 2627 shape = self.dcid_to_shape_xref.get(dcid) 2628 if shape: 2629 shape._SetInShell('dcid', None) # get new if redrawn to keep number seq == level seq 2630 self.DeleteDCID(dcid) 2631 ## self.pdc.RemoveId(dcid) 2632 ## self.objids.remove(dcid) 2633 2634 def DeleteDCID(self, dcid): # used by RedrawAll() and shape.Delete() 2635 if dcid: 2619 2636 if debug: print 'removing dcid', dcid 2637 if dcid == self.keyboard_target_dcid: 2638 self.keyboard_target_dcid = None 2639 self.DropFromSelection(dcid) 2640 self.pdc.RemoveId(dcid) 2641 if dcid in self.objids: 2642 self.objids.remove(dcid) 2620 2643 2621 2644 def _ConnectEm(self, source, target): … … 2665 2688 shape = self.dcid_to_shape_xref.get(id) 2666 2689 shape.ClearSelected() 2667 shape.Draw(self.pdc) 2668 self.RedisplayID(id) 2690 if shape.Valid(): # if shape dropped from selection by being deleted 2691 shape.Draw(self.pdc) 2692 self.RedisplayID(id) 2669 2693 if id == self.keyboard_target_dcid: 2670 2694 self.keyboard_target_dcid = None … … 3187 3211 if self.keyboard_target_dcid: 3188 3212 shape = self.dcid_to_shape_xref.get(self.keyboard_target_dcid) 3213 if not shape.Valid(): 3214 if debug: print 'OnChar: atempt to send char to invalid shape' 3215 self.keyboard_target_dcid = None 3216 return 3189 3217 if uk == 18: # ctrl-r 3190 3218 x, y = shape.GetPos() … … 3269 3297 3270 3298 shape.Char(uni) # send character to shape to process 3299 Data.SetUndo('Character') 3271 3300 ## shape.Draw(self.pdc) 3272 3301 ## self.RedisplayID(shape.dcid)
