Changeset 4005:6e8ee9f08eb4 in orange


Ignore:
Timestamp:
07/19/07 16:01:11 (7 years ago)
Author:
janezd <janez.demsar@…>
Branch:
default
Convert:
571995422d1abf44022393027a3d6a0758ffa746
Message:
  • changed marking of marked nodes
  • added wheel zoom
File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/Prototypes/OWGraphDrawerCanvas.py

    r3774 r4005  
    2727        self.indexPairs = {}       # slovar oblike CurveKey: orngIndex   (za vozlisca) 
    2828        self.selection = []        # seznam izbranih vozlisc (njihovih indeksov) 
    29         self.tooltipped = []       # seznam oznacenih vozlisc 
    3029        self.selectionStyles = {}  # slovar stilov izbranih vozlisc 
    3130        self.colorIndex = -1 
     
    4140        self.state = NOTHING  #default je rocno premikanje 
    4241        self.hiddenNodes = [] 
    43         self.markedNodes = [] 
     42        self.markedNodes = set() 
     43        self.markWithRed = False 
    4444         
    4545        self.tooltipNeighbours = 2 
    4646        self.selectionNeighbours = 2 
    4747        self.freezeNeighbours = False 
     48         
     49        self.enableWheelZoom = 1 
    4850 
    4951         
     
    314316         
    315317    def setMarkedNodes(self, marked): 
    316         for m in self.markedNodes: 
     318        if not isinstance(marked, set): 
     319            marked = set(marked) 
     320        if marked == self.markedNodes: 
     321            return 
     322 
     323        redColor = self.markWithRed and Qt.red 
     324        markedSize = self.markWithRed and 9 or 6 
     325        for m in marked - self.markedNodes: 
    317326            (key, neighbours) = self.vertices[m] 
    318             newSymbol = QwtSymbol(QwtSymbol.Ellipse, QBrush(QColor(self.selectionStyles[m])), QPen(QColor(self.selectionStyles[m])), QSize(6, 6)) 
     327            newSymbol = QwtSymbol(QwtSymbol.Ellipse, QBrush(redColor or self.nodeColor[m]), QPen(self.nodeColor[m]), QSize(markedSize, markedSize)) 
    319328            self.setCurveSymbol(key, newSymbol) 
    320  
     329#            self.curve(key).setBrush(QBrush(redColor or self.nodeColor[m])) 
     330             
     331        for m in self.markedNodes - marked: 
     332            (key, neighbours) = self.vertices[m] 
     333            newSymbol = QwtSymbol(QwtSymbol.Ellipse, QBrush(), QPen(self.nodeColor[m]), QSize(6, 6)) 
     334            self.setCurveSymbol(key, newSymbol) 
     335     
    321336        self.markedNodes = marked 
    322          
    323         for m in marked: 
    324             (key, neighbours) = self.vertices[m] 
    325             self.selectionStyles[m] = self.curve(key).symbol().brush().color().name() 
    326             newSymbol = QwtSymbol(QwtSymbol.Ellipse, QBrush(QColor(self.selectionStyles[m])), QPen(Qt.green, 3), QSize(10, 10)) 
    327             self.setCurveSymbol(key, newSymbol) 
    328             self.tooltipped.append(m); 
    329              
    330337        self.master.nMarked = len(self.markedNodes) 
    331338        self.replot() 
     
    419426        fillColor = Qt.blue#self.discPalette[classValueIndices[self.rawdata[i].getclass().value], 255*insideData[j]] 
    420427        edgeColor = Qt.blue#self.discPalette[classValueIndices[self.rawdata[i].getclass().value]] 
     428        emptyFill = Qt.white 
    421429         
    422430        # draw edges 
     
    458466        selectionX = [] 
    459467        selectionY = [] 
     468        self.nodeColor = [] 
     469 
    460470        # draw vertices 
    461471        for v in range(self.nVertices): 
     
    474484                newColor = Qt.red #QColor(0,0,0) 
    475485             
     486            # This works only if there are no hidden vertices!     
     487            self.nodeColor.append(fillColor) 
     488             
    476489            selectionX.append(x1) 
    477490            selectionY.append(y1) 
    478             key = self.addCurve(str(v), fillColor, edgeColor, 6, xData = [x1], yData = [y1]) 
     491            key = self.addCurve(str(v), fillColor, edgeColor, 6, xData = [x1], yData = [y1], showFilledSymbols = False) 
    479492             
    480493            if v in self.selection: 
    481                 newSymbol = QwtSymbol(QwtSymbol.Ellipse, QBrush(fillColor), QPen(Qt.yellow, 3), QSize(10, 10)) 
     494#                newSymbol = QwtSymbol(QwtSymbol.Ellipse, QBrush(fillColor), QPen(Qt.yellow, 3), QSize(10, 10)) 
     495                newSymbol = QwtSymbol(QwtSymbol.Ellipse, QBrush(), QPen(Qt.yellow, 3), QSize(10, 10)) 
    482496                self.setCurveSymbol(key, newSymbol) 
    483497             
     
    507521         
    508522         
    509         # drew markers 
     523        # draw markers 
    510524        if len(self.labelText) > 0: 
    511525            for v in range(self.nVertices): 
Note: See TracChangeset for help on using the changeset viewer.