Changeset 1828

Show
Ignore:
Timestamp:
08/02/07 13:45:20 (1 year ago)
Author:
arj..@yirdis.nl
Message:

Fixed problem where canvas is not displayed when opening a diagram in Gaphor

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gaphas/trunk/gaphas/view.py

    r1824 r1828  
    3232 
    3333    def __init__(self, canvas=None): 
    34         self._canvas = canvas 
    35  
    36         self._qtree = Quadtree() 
     34        self._matrix = Matrix() 
     35        self._painter = DefaultPainter() 
    3736 
    3837        # Handling selections. 
     
    4241        self._dropzone_item = None 
    4342 
    44         self._matrix = Matrix() 
    45         self._painter = DefaultPainter() 
    46  
    4743        self._dirty_items = set() 
    4844        self._dirty_matrix_items = set() 
    4945 
     46        self._qtree = Quadtree() 
     47 
     48        self._canvas = None 
     49        if canvas: 
     50            self._set_canvas(canvas) 
     51 
    5052 
    5153    matrix = property(lambda s: s._matrix, 
     
    5961        """ 
    6062        if self._canvas: 
     63            self._canvas.unregister_view(self) 
    6164            self._qtree = Quadtree() 
    6265 
     
    6568         
    6669        if self._canvas: 
    67             self.request_update(self._canvas.get_all_items()
     70            self._canvas.register_view(self
    6871 
    6972    canvas = property(lambda s: s._canvas, _set_canvas) 
     
    424427        This extends the behaviour of View.canvas. 
    425428        """ 
    426         if self._canvas: 
    427             self._canvas.unregister_view(self) 
    428  
    429429        super(GtkView, self)._set_canvas(canvas) 
    430430         
    431431        if self._canvas: 
    432             self._canvas.register_view(self
     432            self.request_update(self._canvas.get_all_items()
    433433 
    434434 
     
    625625        """ 
    626626        gtk.DrawingArea.do_size_allocate(self, allocation) 
    627         # doesn't work: super(GtkView, self).do_size_allocate(allocation) 
    628627        self.update_adjustments(allocation) 
     628        self._qtree.resize((0, 0, allocation.width, allocation.height)) 
    629629        
    630630 
    631631    def do_realize(self): 
    632         #super(GtkView, self).do_realize() 
    633632        gtk.DrawingArea.do_realize(self) 
     633        allocation = self.allocation 
     634        print 'allocation', allocation.width, allocation.height 
     635 
    634636        if self._canvas: 
    635637            self.request_update(self._canvas.get_all_items())