Ejemplo n.º 1
0
 def paint(self, painter, option, index):
     opts = QStyleOptionProgressBar()
     opts.rect = option.rect
     opts.minimum = 1
     opts.maximum = 100
     opts.textVisible = True
     try:
         percent = int(index.model().data(index, Qt.DisplayRole))
     except (TypeError, ValueError):
         percent = 0
     opts.progress = percent
     opts.text = (_('Unavailable') if percent == 0 else '%d%%' % percent)
     QApplication.style().drawControl(QStyle.CE_ProgressBar, opts, painter)
Ejemplo n.º 2
0
    def paintEvent(self, event):
        '''
        @param: event QPaintEvent
        '''
        paint = QStylePainter(self)

        opt = QStyleOptionProgressBar()
        self._initStyleOption(opt)

        paint.drawControl(QStyle.CE_ProgressBar, opt)

        self._lastPaintedValue = self._value
Ejemplo n.º 3
0
Archivo: jobs.py Proyecto: kba/calibre
 def paint(self, painter, option, index):
     opts = QStyleOptionProgressBar()
     opts.rect = option.rect
     opts.minimum = 1
     opts.maximum = 100
     opts.textVisible = True
     try:
         percent = int(index.model().data(index, Qt.DisplayRole))
     except (TypeError, ValueError):
         percent = 0
     opts.progress = percent
     opts.text = (_('Unavailable') if percent == 0 else '%d%%'%percent)
     QApplication.style().drawControl(QStyle.CE_ProgressBar, opts, painter)