Ejemplo n.º 1
0
 def initUI(self):
     self.headers = [
         'Id', 'Type', 'Expression', 'Old Sentence', 'New Sentence',
         'Old Audio', 'New Audio'
     ]
     self.backgrounds = {
         'changed': qt.QColor('#f39c12'),
         'unchanged': qt.QColor('#ffffff'),
         'tag': qt.QColor('#55efc4')
     }
Ejemplo n.º 2
0
def globalLoadConf(self, mw):
    '''
    Loads LifeDrain global configurations.
    '''
    conf = self.mw.col.conf
    self.form.positionList.setCurrentIndex(
        conf.get('barPosition', DEFAULTS['barPosition'])
    )
    self.form.heightInput.setValue(
        conf.get('barHeight', DEFAULTS['barHeight'])
    )

    self.form.bgColorDialog.setCurrentColor(
        qt.QColor(conf.get('barBgColor', DEFAULTS['barBgColor']))
    )
    self.form.bgColorPreview.setStyleSheet(
        'QLabel { background-color: %s; }'
        % self.form.bgColorDialog.currentColor().name()
    )

    self.form.fgColorDialog.setCurrentColor(
        qt.QColor(conf.get('barFgColor', DEFAULTS['barFgColor']))
    )
    self.form.fgColorPreview.setStyleSheet(
        'QLabel { background-color: %s; }'
        % self.form.fgColorDialog.currentColor().name()
    )

    self.form.borderRadiusInput.setValue(
        conf.get('barBorderRadius', DEFAULTS['barBorderRadius'])
    )

    self.form.textList.setCurrentIndex(
        conf.get('barText', DEFAULTS['barText'])
    )

    self.form.textColorDialog.setCurrentColor(
        qt.QColor(conf.get('barTextColor', DEFAULTS['barTextColor']))
    )
    self.form.textColorPreview.setStyleSheet(
        'QLabel { background-color: %s; }'
        % self.form.textColorDialog.currentColor().name()
    )

    self.form.styleList.setCurrentIndex(
        conf.get('barStyle', DEFAULTS['barStyle'])
    )

    self.form.stopOnAnswer.setChecked(
        conf.get('stopOnAnswer', DEFAULTS['stopOnAnswer']))

    self.form.disableAddon.setChecked(
        conf.get('disable', DEFAULTS['disable'])
    )
Ejemplo n.º 3
0
    def setStyle(self, options):
        '''
        Sets the style of the bar.
        '''
        self._qProgressBar.setTextVisible(
            options['text'] != 0)  # 0 is the index of None
        textFormat = TEXT_FORMAT[options['text']]
        if 'format' in textFormat:
            self._textFormat = textFormat['format']
            self._qProgressBar.setFormat(textFormat['format'])

        customStyle = STYLE_OPTIONS[options['customStyle']] \
            .replace(' ', '').lower()
        if customStyle != 'default':
            palette = qt.QPalette()
            palette.setColor(qt.QPalette.Base,
                             qt.QColor(options['backgroundColor']))
            palette.setColor(qt.QPalette.Highlight,
                             qt.QColor(options['foregroundColor']))
            palette.setColor(qt.QPalette.Button,
                             qt.QColor(options['backgroundColor']))
            palette.setColor(qt.QPalette.Window,
                             qt.QColor(options['backgroundColor']))

            self._qProgressBar.setStyle(qt.QStyleFactory.create(customStyle))
            self._qProgressBar.setPalette(palette)
            self._qProgressBar.setStyleSheet('''
                QProgressBar {
                    max-height: %spx;
                }
                ''' % (options['height'], ))
        else:
            self._qProgressBar.setStyleSheet('''
                QProgressBar {
                    text-align:center;
                    background-color: %s;
                    border-radius: %dpx;
                    max-height: %spx;
                    color: %s;
                }
                QProgressBar::chunk {
                    background-color: %s;
                    margin: 0px;
                    border-radius: %dpx;
                }
                ''' % (options['backgroundColor'], options['borderRadius'],
                       options['height'], options['textColor'],
                       options['foregroundColor'], options['borderRadius']))
Ejemplo n.º 4
0
    def q_mature(self):
        q_mature = qt.QStandardItem(str(self.card_mature()))
        q_mature.setForeground(qt.QColor(0, 119, 0))

        return q_mature
Ejemplo n.º 5
0
    def q_young(self):
        q_young = qt.QStandardItem(str(self.card_young()))
        q_young.setForeground(qt.QColor(119, 204, 119))

        return q_young
Ejemplo n.º 6
0
    def q_learning(self):
        q_learning = qt.QStandardItem(str(self.card_learning()))
        q_learning.setForeground(qt.QColor(221, 17, 0))

        return q_learning
Ejemplo n.º 7
0
    def q_new(self):
        q_new = qt.QStandardItem(str(self.card_new()))
        q_new.setForeground(qt.QColor(0, 0, 255))

        return q_new