source: orange/Orange/OrangeCanvas/canvas/view.py @ 11113:daeb90d45e33

Revision 11113:daeb90d45e33, 817 bytes checked in by Ales Erjavec <ales.erjavec@…>, 19 months ago (diff)

Added a CanvasScene class for displaying/interacting with a workflow scheme.

Line 
1"""
2Canvas Graphics View
3"""
4
5from PyQt4.QtGui import QGraphicsView
6from PyQt4.QtCore import Qt, QPointF, QSizeF, QRectF
7
8
9class CanvasView(QGraphicsView):
10    """Canvas View handles the zooming and panning.
11    """
12
13    def __init__(self, *args):
14        QGraphicsView.__init__(self, *args)
15        self.setAlignment(Qt.AlignTop | Qt.AlignLeft)
16
17    def push_zoom_rect(self, rect):
18        """Zoom into the rect.
19        """
20        raise NotImplementedError
21
22    def pop_zoom(self):
23        """Pop a zoom level.
24        """
25        raise NotImplementedError
26
27    def setScene(self, scene):
28        QGraphicsView.setScene(self, scene)
29        self._ensureSceneRect(scene)
30
31    def _ensureSceneRect(self, scene):
32        r = scene.addRect(QRectF(0, 0, 400, 400))
33        scene.sceneRect()
34        scene.removeItem(r)
Note: See TracBrowser for help on using the repository browser.