Changeset 4987:60021b227dc2 in orange


Ignore:
Timestamp:
07/17/08 16:37:33 (6 years ago)
Author:
janezd <janez.demsar@…>
Branch:
default
Convert:
5367ae352b897758ad3ac30d6ec2cc33224d2051
Message:
  • added TableBarItem
File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/OWGUI.py

    r4978 r4987  
    15401540 
    15411541 
     1542class TableBarItem(QItemDelegate): 
     1543    def __init__(self, widget, table = None, color = QColor(255, 170, 127)): 
     1544        QItemDelegate.__init__(self, widget) 
     1545        self.color = color 
     1546        self.widget = widget 
     1547        self.table = table 
     1548 
     1549    def paint(self, painter, option, index): 
     1550        painter.save() 
     1551        self.drawBackground(painter, option, index) 
     1552        value, ok = index.data(Qt.DisplayRole).toDouble() 
     1553        if ok and self.widget.showBars: 
     1554            col = index.column() 
     1555            if col < len(self.table.normalizers): 
     1556                max, span = self.table.normalizers[col] 
     1557                painter.fillRect(option.rect.adjusted(0, 1, -option.rect.width()*(max - value) / span, -1), self.color) 
     1558#                painter.fillRect(option.rect.adjusted(0, option.rect.height()-4, -option.rect.width()*(max - value) / span, 0), self.color) 
     1559        text = index.data(Qt.DisplayRole).toString() 
     1560 
     1561        self.drawDisplay(painter, option, option.rect, text) 
     1562        painter.restore() 
     1563 
    15421564############################################################################## 
    15431565# progress bar management 
Note: See TracChangeset for help on using the changeset viewer.