Mercurial > MadButterfly
comparison pyink/MBScene.py @ 1223:ec964cf4c993
merge
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Thu, 06 Jan 2011 09:39:47 +0800 |
parents | 03daff2d939c 33aa2d63e240 |
children | 5d731460b32c |
comparison
equal
deleted
inserted
replaced
1222:03daff2d939c | 1223:ec964cf4c993 |
---|---|
539 super(MBScene_framelines, self).__init__(*args, **kws) | 539 super(MBScene_framelines, self).__init__(*args, **kws) |
540 | 540 |
541 self._last_mouse_over_frameline = None | 541 self._last_mouse_over_frameline = None |
542 self._last_active_frameline = None | 542 self._last_active_frameline = None |
543 pass | 543 pass |
544 | |
545 def search_frameline_by_id(self, id): | |
546 """ | |
547 Search the frameline whose layer is id | |
548 """ | |
549 | |
550 for f in self._framelines: | |
551 idx = f.search_by_id(id) | |
552 if idx != -1: | |
553 return (f,idx) | |
554 pass | |
555 return (None,-1) | |
544 | 556 |
545 def _change_hover_frameline(self, widget, event): | 557 def _change_hover_frameline(self, widget, event): |
546 """ | 558 """ |
547 Hide all hover frames. This is a hack. We should use the lost focus | 559 Hide all hover frames. This is a hack. We should use the lost focus |
548 event instead in the future to reduce the overhead. | 560 event instead in the future to reduce the overhead. |
689 self.last_select = o | 701 self.last_select = o |
690 try: | 702 try: |
691 self.nameEditor.set_text(o.getAttribute("inkscape:label")) | 703 self.nameEditor.set_text(o.getAttribute("inkscape:label")) |
692 except: | 704 except: |
693 self.nameEditor.set_text('') | 705 self.nameEditor.set_text('') |
706 pass | |
707 | |
708 # The selection is a PYSPObject. Convert it to be PYNode | |
709 self.change_active_frame(self.last_select.repr.parent()) | |
710 pass | |
711 | |
712 def change_active_frame(self, obj): | |
713 """ | |
714 Change the active frame to the current selected object. This will | |
715 tell users where the current object is. | |
716 """ | |
717 | |
718 while obj: | |
719 id = obj.getAttribute('id') | |
720 try: | |
721 # Search for the frameline which use @obj as one of its scene | |
722 # group. | |
723 (frameline, frame) = self.search_frameline_by_id(id) | |
724 if frameline == None: | |
725 print "Error: internal structure error %s not found" % id | |
726 else: | |
727 self._change_active_frame(frameline, 0, 0) | |
728 self.onCellClick(frameline, frame, 0) | |
729 return | |
730 except: | |
731 traceback.print_exc() | |
732 pass | |
733 obj = obj.parent() | |
694 pass | 734 pass |
695 pass | 735 pass |
696 | 736 |
697 def insertKeyScene(self, line, frame): | 737 def insertKeyScene(self, line, frame): |
698 """ | 738 """ |