コード例 #1
0
ファイル: webdb.py プロジェクト: RaphaelRochet/puddletag
    def __init__(self, parent = None, status = None):
        QWidget.__init__(self, parent)
        self.title = translate('Settings', 'Tag Sources')

        label = QLabel(translate("WebDB",
            '&Display format for individual tracks.'))
        self._text = QLineEdit()
        label.setBuddy(self._text)
        
        albumlabel = QLabel(translate("WebDB",
            'Display format for &retrieved albums'))
        self._albumdisp = QLineEdit()
        albumlabel.setBuddy(self._albumdisp)

        sortlabel = QLabel(translate("WebDB",
            'Sort retrieved albums using order:'))
        self._sortoptions = QComboBox()
        sortlabel.setBuddy(self._sortoptions)
        editoptions = QPushButton(translate("Defaults", '&Edit'))
        self.connect(editoptions, SIGNAL('clicked()'), self._editOptions)
        
        ua_label = QLabel(translate("WebDB",
            'User-Agent to when accessing web sites.'))
        self._ua = QTextEdit()

        self.jfdi = QCheckBox(translate('Profile Editor',
            'Brute force unmatched files.'))
        self.jfdi.setToolTip(translate('Profile Editor',
            "<p>If a proper match isn't found for a file, the files "
            "will get sorted by filename, the retrieved tag sources "
            "by filename and corresponding (unmatched) tracks will "
            "matched.</p>"))

        self.matchFields = QLineEdit(u'artist, title')
        self.matchFields.setToolTip(translate('Profile Editor',
            "<p>The fields listed here will be used in determining "
            "whether a track matches the retrieved track. Each "
            "field will be compared using a fuzzy matching algorithm. "
            "If the resulting average match percentage is greater "
            'than the "Minimum Percentage" it\'ll be considered to '
            "match.</p>"))

        self.albumBound = QSpinBox()
        self.albumBound.setToolTip(translate('Profile Editor',
            "<p>The artist and album fields will be used in "
            "determining whether an album matches the retrieved one. "
            "Each field will be compared using a fuzzy matching "
            "algorithm. If the resulting average match percentage "
            "is greater or equal than what you specify here "
            "it'll be considered to match.</p>"))

        self.albumBound.setRange(0,100)
        self.albumBound.setValue(70)
        
        self.trackBound = QSpinBox()
        self.trackBound.setRange(0,100)
        self.trackBound.setValue(80)
        
        vbox = QVBoxLayout()
        vbox.addWidget(label)
        vbox.addWidget(self._text)
        
        vbox.addWidget(albumlabel)
        vbox.addWidget(self._albumdisp)

        vbox.addWidget(sortlabel)
        sortbox = QHBoxLayout()
        sortbox.addWidget(self._sortoptions, 1)
        sortbox.addWidget(editoptions)
        vbox.addLayout(sortbox)

        vbox.addWidget(ua_label)
        vbox.addWidget(self._ua)

        frame = QGroupBox(translate(
            'WebDB', 'Automatic retrieval options'))

        auto_box = QVBoxLayout()
        frame.setLayout(auto_box)

        auto_box.addLayout(create_buddy(translate('Profile Editor',
                'Minimum &percentage required for album matches.'),
            self.albumBound))
        auto_box.addLayout(create_buddy(translate('Profile Editor',
            'Match tracks using &fields: '), self.matchFields))
        auto_box.addLayout(create_buddy(translate('Profile Editor',
                'Minimum percentage required for track match.'),
            self.trackBound))
        auto_box.addWidget(self.jfdi)

        vbox.addWidget(frame)

        vbox.addStretch()
        self.setLayout(vbox)
        self.loadSettings()
コード例 #2
0
ファイル: webdb.py プロジェクト: korala1968/tago
    def __init__(self, parent=None, status=None):
        QWidget.__init__(self, parent)
        self.title = translate('Settings', 'Tag Sources')

        label = QLabel(
            translate("WebDB", '&Display format for individual tracks.'))
        self._text = QLineEdit()
        label.setBuddy(self._text)

        albumlabel = QLabel(
            translate("WebDB", 'Display format for &retrieved albums'))
        self._albumdisp = QLineEdit()
        albumlabel.setBuddy(self._albumdisp)

        sortlabel = QLabel(
            translate("WebDB", 'Sort retrieved albums using order:'))
        self._sortoptions = QComboBox()
        sortlabel.setBuddy(self._sortoptions)
        editoptions = QPushButton(translate("Defaults", '&Edit'))
        self.connect(editoptions, SIGNAL('clicked()'), self._editOptions)

        ua_label = QLabel(
            translate("WebDB", 'User-Agent to when accessing web sites.'))
        self._ua = QTextEdit()

        self.jfdi = QCheckBox(
            translate('Profile Editor', 'Brute force unmatched files.'))
        self.jfdi.setToolTip(
            translate(
                'Profile Editor',
                "<p>If a proper match isn't found for a file, the files "
                "will get sorted by filename, the retrieved tag sources "
                "by filename and corresponding (unmatched) tracks will "
                "matched.</p>"))

        self.matchFields = QLineEdit(u'artist, title')
        self.matchFields.setToolTip(
            translate(
                'Profile Editor',
                "<p>The fields listed here will be used in determining "
                "whether a track matches the retrieved track. Each "
                "field will be compared using a fuzzy matching algorithm. "
                "If the resulting average match percentage is greater "
                'than the "Minimum Percentage" it\'ll be considered to '
                "match.</p>"))

        self.albumBound = QSpinBox()
        self.albumBound.setToolTip(
            translate(
                'Profile Editor',
                "<p>The artist and album fields will be used in "
                "determining whether an album matches the retrieved one. "
                "Each field will be compared using a fuzzy matching "
                "algorithm. If the resulting average match percentage "
                "is greater or equal than what you specify here "
                "it'll be considered to match.</p>"))

        self.albumBound.setRange(0, 100)
        self.albumBound.setValue(70)

        self.trackBound = QSpinBox()
        self.trackBound.setRange(0, 100)
        self.trackBound.setValue(80)

        vbox = QVBoxLayout()
        vbox.addWidget(label)
        vbox.addWidget(self._text)

        vbox.addWidget(albumlabel)
        vbox.addWidget(self._albumdisp)

        vbox.addWidget(sortlabel)
        sortbox = QHBoxLayout()
        sortbox.addWidget(self._sortoptions, 1)
        sortbox.addWidget(editoptions)
        vbox.addLayout(sortbox)

        vbox.addWidget(ua_label)
        vbox.addWidget(self._ua)

        frame = QGroupBox(translate('WebDB', 'Automatic retrieval options'))

        auto_box = QVBoxLayout()
        frame.setLayout(auto_box)

        auto_box.addLayout(
            create_buddy(
                translate('Profile Editor',
                          'Minimum &percentage required for album matches.'),
                self.albumBound))
        auto_box.addLayout(
            create_buddy(
                translate('Profile Editor', 'Match tracks using &fields: '),
                self.matchFields))
        auto_box.addLayout(
            create_buddy(
                translate('Profile Editor',
                          'Minimum percentage required for track match.'),
                self.trackBound))
        auto_box.addWidget(self.jfdi)

        vbox.addWidget(frame)

        vbox.addStretch()
        self.setLayout(vbox)
        self.loadSettings()
コード例 #3
0
ファイル: webdb.py プロジェクト: RaphaelRochet/puddletag
    def __init__(self, title, controls, parent = None):
        """title => Dialog's title.
        controls is a list of 3-element-lists.

        The three 3-element lists consist of:
            description => Descriptive label for the control.
            control_type => One of TEXT, COMBO, CHECKBOX corresponding
                to a QLineEdit, QComboBox and QCheckBox being created
                respectively.
            default => Default arguments.
                Can be any string for TEXT,
                Must be a list of strings for COMBO as these will form the
                    items selectable by the combo box.
                Can be either True or False for CheckBox.

        A dialog will be created with vertical layout. Like so:
            <label>
            <control>
            <label>
            <control>

        When the user has finished editing an 'editingFinished' signal
        will be emitted containing a list with the new value.

        The list will consist of the value for each control in the order
        given. For TEXT it'll a string. COMBO an integer corresponding to
        the selected index. True or False for CHECK.
        """

        QDialog.__init__(self, parent)
        vbox = QVBoxLayout()
        self._controls = []
        winsettings(title, self)
        self.setWindowTitle(translate("WebDB", 'Configure: %s') % title)
        for desc, ctype, default in controls:
            if ctype == TEXT:
                control = QLineEdit(default)
                vbox.addLayout(create_buddy(desc, control))
            elif ctype == COMBO:
                control = QComboBox()
                control.addItems(default[0])
                control.setCurrentIndex(default[1])
                label = QLabel(desc)
                label.setBuddy(control)
                vbox.addWidget(label)
                vbox.addWidget(control)
            elif ctype == CHECKBOX:
                control = QCheckBox(desc)
                if default:
                    control.setCheckState(Qt.Checked)
                else:
                    control.setCheckState(Qt.Unchecked)
                vbox.addWidget(control)
            elif ctype == SPINBOX:
                control = QSpinBox()
                control.setMinimum(default[0])
                control.setMaximum(default[1])
                control.setValue(default[2])
                vbox.addLayout(create_buddy(desc, control))
                
            self._controls.append(control)
        okcancel = OKCancel()
        self.connect(okcancel, SIGNAL('ok'), self.okClicked)
        self.connect(okcancel, SIGNAL('cancel'), self.close)
        vbox.addLayout(okcancel)
        vbox.addStretch()
        self.setLayout(vbox)
コード例 #4
0
ファイル: webdb.py プロジェクト: korala1968/tago
    def __init__(self, title, controls, parent=None):
        """title => Dialog's title.
        controls is a list of 3-element-lists.

        The three 3-element lists consist of:
            description => Descriptive label for the control.
            control_type => One of TEXT, COMBO, CHECKBOX corresponding
                to a QLineEdit, QComboBox and QCheckBox being created
                respectively.
            default => Default arguments.
                Can be any string for TEXT,
                Must be a list of strings for COMBO as these will form the
                    items selectable by the combo box.
                Can be either True or False for CheckBox.

        A dialog will be created with vertical layout. Like so:
            <label>
            <control>
            <label>
            <control>

        When the user has finished editing an 'editingFinished' signal
        will be emitted containing a list with the new value.

        The list will consist of the value for each control in the order
        given. For TEXT it'll a string. COMBO an integer corresponding to
        the selected index. True or False for CHECK.
        """

        QDialog.__init__(self, parent)
        vbox = QVBoxLayout()
        self._controls = []
        winsettings(title, self)
        self.setWindowTitle(translate("WebDB", 'Configure: %s') % title)
        for desc, ctype, default in controls:
            if ctype == TEXT:
                control = QLineEdit(default)
                vbox.addLayout(create_buddy(desc, control))
            elif ctype == COMBO:
                control = QComboBox()
                control.addItems(default[0])
                control.setCurrentIndex(default[1])
                label = QLabel(desc)
                label.setBuddy(control)
                vbox.addWidget(label)
                vbox.addWidget(control)
            elif ctype == CHECKBOX:
                control = QCheckBox(desc)
                if default:
                    control.setCheckState(Qt.Checked)
                else:
                    control.setCheckState(Qt.Unchecked)
                vbox.addWidget(control)
            elif ctype == SPINBOX:
                control = QSpinBox()
                control.setMinimum(default[0])
                control.setMaximum(default[1])
                control.setValue(default[2])
                vbox.addLayout(create_buddy(desc, control))

            self._controls.append(control)
        okcancel = OKCancel()
        self.connect(okcancel, SIGNAL('ok'), self.okClicked)
        self.connect(okcancel, SIGNAL('cancel'), self.close)
        vbox.addLayout(okcancel)
        vbox.addStretch()
        self.setLayout(vbox)