Changeset 1824
- Timestamp:
- 08/02/07 05:55:05 (1 year ago)
- Files:
-
- gaphas/trunk/gaphas/canvas.py (modified) (1 diff)
- gaphas/trunk/gaphas/tests/test_view.py (modified) (1 diff)
- gaphas/trunk/gaphas/view.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
gaphas/trunk/gaphas/canvas.py
r1800 r1824 77 77 78 78 self.request_update(item) 79 self._update_views((item,))79 #self._update_views((item,)) 80 80 81 81 gaphas/trunk/gaphas/tests/test_view.py
r1823 r1824 77 77 gtk.main_iteration() 78 78 79 assert not view._update_bounding_box80 79 assert len(view._qtree._ids) == 1 81 80 assert not view._qtree._bucket.bounds == (0, 0, 0, 0), view._qtree._bucket.bounds gaphas/trunk/gaphas/view.py
r1823 r1824 410 410 self.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('#FFF')) 411 411 412 self._update_bounding_box = set()413 414 412 415 413 def emit(self, *args, **kwargs): … … 508 506 509 507 510 @async(single=False, priority=PRIORITY_HIGH_IDLE)511 def _idle_queue_draw_item(self, *items):512 self.queue_draw_item(*items)513 514 515 508 def queue_draw_item(self, *items): 516 509 """ … … 551 544 552 545 for item in removed_items: 553 # Be cautious, item may be removed before its bounding box 554 # is calculated. 555 if item in self._qtree: 556 self._qtree.remove(item) 546 self._qtree.remove(item) 557 547 self.selected_items.discard(item) 558 548 … … 605 595 self.queue_draw_item(i) 606 596 607 self._update_bounding_box.update(dirty_items) 608 597 self.update_bounding_box(set(dirty_items)) 609 598 finally: 610 599 self._dirty_items.clear() 611 600 self._dirty_matrix_items.clear() 601 602 603 @async(single=False) 604 def update_bounding_box(self, items): 605 """ 606 Update bounding box is not necessary 607 """ 608 cr = self.window.cairo_create() 609 610 cr.save() 611 cr.rectangle(0, 0, 0, 0) 612 cr.clip() 613 try: 614 super(GtkView, self).update_bounding_box(cr, items) 615 finally: 616 cr.restore() 617 self.queue_draw_item(*items) 618 self.update_adjustments() 612 619 613 620 … … 643 650 cr.rectangle(x, y, w, h) 644 651 cr.clip() 645 646 update_bounding_box = self._update_bounding_box647 if update_bounding_box:648 try:649 cr.save()650 cr.rectangle(0, 0, 0, 0)651 cr.clip()652 try:653 self.update_bounding_box(cr, update_bounding_box)654 finally:655 cr.restore()656 self._idle_queue_draw_item(*update_bounding_box)657 self.update_adjustments()658 finally:659 update_bounding_box.clear()660 652 661 653 area = Rectangle(x, y, width=w, height=h)
