Changeset 3530:d4df8c45fd49 in orange


Ignore:
Timestamp:
04/13/07 09:58:56 (7 years ago)
Author:
ales_erjavec <ales.erjavec@…>
Branch:
default
Convert:
0590ca5c75112a2c6f7753a6e6044d51bc982862
Message:

would not draw anything if the viewport was larger then the table in any direction

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/Data/OWDataTable.py

    r3478 r3530  
    233233                bgColor = Qt.white 
    234234            # generate list of tuples (attribute value, instance index) and sort by attrVal 
    235             valIdx = [(ex[key].native(),idx) for idx,ex in enumerate(data)] 
    236             table.values[j]=[str(v[0])+" " for v in valIdx] 
     235            valIdx = [(str(ex[key]),idx) for idx,ex in enumerate(data)] 
     236            table.values[j]=[v[0]+" " for v in valIdx] 
    237237            valIdx.sort() 
    238238            # generate a dictionary where key: instance index, value: rank 
     
    370370        except KeyError, err: 
    371371            pass 
    372             #print "Exception in adjustColumn ", col 
     372            print "Exception in adjustColumn ", col 
    373373                 
    374374    def sliderPressed(self): 
     
    423423        #self.paintEmptyArea(painter, cx, cy, cw, ch) 
    424424        self.setPainterFont(painter) 
    425         xStart=self.columnAt(cx) 
    426         xEnd=min([self.columnAt(cx+cw)+1, self.numCols()]) 
    427         yStart=self.rowAt(cy) 
    428         yEnd=min([self.rowAt(cy+ch)+1, self.numRows()]) 
     425        xStart=max(self.columnAt(cx), 0) 
     426        xEnd=min(self.columnAt(cx+cw)+1, self.numCols()) or self.numCols() #columnAt can return -1 if there is no cell at that position 
     427        yStart=max(self.rowAt(cy),0) 
     428        yEnd=min(self.rowAt(cy+ch)+1, self.numRows()) or self.numRows() # the same as above 
     429        #print "X start:", xStart, "X end:", xEnd, "Y start:", yStart, "Y end:", yEnd 
    429430        for i in range(xStart, xEnd): 
    430431            painter.setBrush(QBrush(self.columnColor[i])) 
     
    434435    def paintEvent(self, paintEvent): 
    435436        QTable.paintEvent(self, paintEvent) 
    436         painter=QPainter(self) #upper left corner gets painted like the 0,0 cell (why??)  
     437        #upper left corner gets painted like the 0,0 cell (why??)  
     438        painter=QPainter(self) 
    437439        painter.setBrush(QBrush(Qt.gray)) 
    438440        painter.drawRect(1, 1, 32, 20) 
Note: See TracChangeset for help on using the changeset viewer.