Exemplo 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)
Exemplo 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
Exemplo n.º 3
0
Arquivo: jobs.py Projeto: 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)