Changeset 7172:78e529f49cc7 in orange


Ignore:
Timestamp:
01/24/11 15:02:53 (3 years ago)
Author:
markotoplak
Branch:
default
Convert:
ac6dff68c5f9b8917680df005cff2e334295ab0e
Message:

Note: "Right-click to add widgets"

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeCanvas/orngDoc.py

    r7117 r7172  
    3030        #self.canvas = QGraphicsScene(0,0,2000,2000) 
    3131        self.canvas = QGraphicsScene() 
     32 
     33        self.guide_text = self.canvas.addSimpleText("Right-click to add widgets", font=QFont("Helvetica", 36)) 
     34        self.guide_text.setBrush(QBrush(QColor(235,235,235))) 
     35 
    3236        oneItem = self.canvas.addRect(QRectF(0.0, 0.0, 300.0, 300.0)) # inital item so sceneRect always contains QPoint(0, 0) 
    3337        self.canvas.sceneRect() # call scene rect so int calculates the rect  
     
    3943        self.schemaID = orngHistory.logNewSchema() 
    4044 
     45        self.update_guide() 
     46 
     47    def update_guide(self): 
     48        """ Sets the visibility of the guide text """ 
     49        visible = not len(self.widgets) 
     50        self.guide_text.setVisible(visible) 
     51        if visible: 
     52            self.canvasView.ensureVisible(self.guide_text) 
    4153 
    4254    def isSchemaChanged(self): 
     
    317329 
    318330        qApp.restoreOverrideCursor() 
     331        self.update_guide() 
    319332        return newwidget 
    320333 
     
    335348            self.saveTempDoc() 
    336349         
     350        self.update_guide() 
    337351        orngHistory.logRemoveWidget(self.schemaID, id(widget), (widget.widgetInfo.category, widget.widgetInfo.name)) 
    338352 
Note: See TracChangeset for help on using the changeset viewer.