Changeset 11781:e26f50a2f451 in orange


Ignore:
Timestamp:
12/02/13 17:22:37 (5 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Slight visual fix for variable icon construction.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/OrangeWidgets/OWGUI.py

    r11762 r11781  
    546546    widget.layout().addStretch(100) 
    547547 
    548 def createAttributePixmap(char, color = Qt.black): 
     548def createAttributePixmap(char, color=Qt.black): 
    549549    pixmap = QPixmap(13,13) 
     550    rect = QRect(0, 0, 13, 13) 
    550551    painter = QPainter() 
     552    painter.setRenderHint(QPainter.Antialiasing) 
    551553    painter.begin(pixmap) 
    552     painter.setPen( color ); 
    553     painter.setBrush( color ); 
    554     painter.drawRect( 0, 0, 13, 13 ); 
    555     painter.setPen( QColor(Qt.white)) 
    556     painter.drawText(3, 11, char) 
     554    painter.setPen(color) 
     555    painter.setBrush(color) 
     556    painter.drawRoundedRect(rect, 4, 4) 
     557    painter.setPen(QColor(Qt.white)) 
     558    painter.drawText(rect, Qt.AlignCenter, char) 
    557559    painter.end() 
    558560    return QIcon(pixmap) 
     
    565567    global attributeIconDict 
    566568    if not attributeIconDict: 
    567         attributeIconDict = {orange.VarTypes.Continuous: createAttributePixmap("C", QColor(202,0,32)), 
    568                      orange.VarTypes.Discrete: createAttributePixmap("D", QColor(26,150,65)), 
    569                      orange.VarTypes.String: createAttributePixmap("S", Qt.black), 
    570                      -1: createAttributePixmap("?", QColor(128, 128, 128))} 
     569        attributeIconDict = { 
     570            orange.VarTypes.Continuous: createAttributePixmap("C", QColor(202,0,32)), 
     571            orange.VarTypes.Discrete: createAttributePixmap("D", QColor(26,150,65)), 
     572            orange.VarTypes.String: createAttributePixmap("S", Qt.black), 
     573            -1: createAttributePixmap("?", QColor(128, 128, 128)) 
     574        } 
    571575    return attributeIconDict 
    572576 
Note: See TracChangeset for help on using the changeset viewer.