コード例 #1
0
ファイル: caa.py プロジェクト: zas/picard
    def fill_lists(self, includes, excludes):
        """Fill dialog listboxes.

        First clears the contents of the three listboxes, and then populates the listboxes
        from the dictionary of standard CAA types, using the provided 'includes' and
        'excludes' lists to determine the appropriate list for each type.

        Arguments:
            includes -- list of standard image types to place in the "Include" listbox
            excludes -- list of standard image types to place in the "Exclude" listbox
        """
        self.list_include.clear()
        self.list_exclude.clear()
        self.list_ignore.clear()
        for caa_type in CAA_TYPES:
            name = caa_type['name']
            title = translate_caa_type(caa_type['title'])
            item = QtWidgets.QListWidgetItem(title)
            item.setData(QtCore.Qt.UserRole, name)
            if name in includes:
                self.list_include.addItem(item)
            elif name in excludes:
                self.list_exclude.addItem(item)
            else:
                self.list_ignore.addItem(item)
コード例 #2
0
ファイル: caa.py プロジェクト: skyme5/picard
    def fill_lists(self, includes, excludes):
        """Fill dialog listboxes.

        First clears the contents of the three listboxes, and then populates the listboxes
        from the dictionary of standard CAA types, using the provided 'includes' and
        'excludes' lists to determine the appropriate list for each type.

        Arguments:
            includes -- list of standard image types to place in the "Include" listbox
            excludes -- list of standard image types to place in the "Exclude" listbox
        """
        self.list_include.clear()
        self.list_exclude.clear()
        self.list_ignore.clear()
        for caa_type in CAA_TYPES:
            name = caa_type['name']
            title = translate_caa_type(caa_type['title'])
            item = QtWidgets.QListWidgetItem(title)
            item.setData(QtCore.Qt.UserRole, name)
            if name in includes:
                self.list_include.addItem(item)
            elif name in excludes:
                self.list_exclude.addItem(item)
            else:
                self.list_ignore.addItem(item)
コード例 #3
0
ファイル: image.py プロジェクト: hackur/picard
 def types_as_string(self, translate=True, separator=', '):
     if self.types:
         types = self.types
     elif self.is_front_image():
         types = [u'front']
     else:
         types = [u'-']
     if translate:
         types = [translate_caa_type(type) for type in types]
     return separator.join(types)
コード例 #4
0
 def types_as_string(self, translate=True, separator=', '):
     if self.types:
         types = self.types
     elif self.is_front_image():
         types = [u'front']
     else:
         types = [u'-']
     if translate:
         types = [translate_caa_type(type) for type in types]
     return separator.join(types)
コード例 #5
0
    def __init__(self, parent=None, types=None):
        if types is None:
            types = []
        super().__init__(parent)

        self.setWindowTitle(_("Cover art types"))
        self._items = {}
        self.layout = QtWidgets.QVBoxLayout(self)

        grid = QtWidgets.QWidget()
        gridlayout = QtWidgets.QGridLayout()
        grid.setLayout(gridlayout)

        for index, caa_type in enumerate(CAA_TYPES):
            row = index // self._columns
            column = index % self._columns
            name = caa_type["name"]
            text = translate_caa_type(name)
            item = QtWidgets.QCheckBox(text)
            item.setChecked(name in types)
            self._items[item] = caa_type
            gridlayout.addWidget(item, row, column)

        self.layout.addWidget(grid)

        self.buttonbox = QtWidgets.QDialogButtonBox(self)
        self.buttonbox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonbox.addButton(StandardButton(StandardButton.OK),
                                 QtWidgets.QDialogButtonBox.AcceptRole)
        self.buttonbox.addButton(StandardButton(StandardButton.CANCEL),
                                 QtWidgets.QDialogButtonBox.RejectRole)
        self.buttonbox.addButton(StandardButton(StandardButton.HELP),
                                 QtWidgets.QDialogButtonBox.HelpRole)
        self.buttonbox.accepted.connect(self.accept)
        self.buttonbox.rejected.connect(self.reject)
        self.buttonbox.helpRequested.connect(self.help)

        extrabuttons = [
            (N_("Chec&k all"), self.checkall),
            (N_("&Uncheck all"), self.uncheckall),
        ]
        for label, callback in extrabuttons:
            button = QtWidgets.QPushButton(_(label))
            button.setSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                 QtWidgets.QSizePolicy.Expanding)
            self.buttonbox.addButton(button,
                                     QtWidgets.QDialogButtonBox.ActionRole)
            button.clicked.connect(callback)

        self.layout.addWidget(self.buttonbox)

        self.buttonbox.accepted.connect(self.accept)
        self.buttonbox.rejected.connect(self.reject)
コード例 #6
0
ファイル: caa.py プロジェクト: goldphish/picard
    def __init__(self, parent=None, types=None):
        if types is None:
            types = []
        super(CAATypesSelectorDialog, self).__init__(parent)

        self.setWindowTitle(_("Cover art types"))
        self._items = {}
        self.layout = QtWidgets.QVBoxLayout(self)

        grid = QtWidgets.QWidget()
        gridlayout = QtWidgets.QGridLayout()
        grid.setLayout(gridlayout)

        for index, caa_type in enumerate(CAA_TYPES):
            row = index // self._columns
            column = index % self._columns
            name = caa_type["name"]
            text = translate_caa_type(name)
            item = QtWidgets.QCheckBox(text)
            item.setChecked(name in types)
            self._items[item] = caa_type
            gridlayout.addWidget(item, row, column)

        self.layout.addWidget(grid)

        self.buttonbox = QtWidgets.QDialogButtonBox(self)
        self.buttonbox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonbox.addButton(
            StandardButton(StandardButton.OK), QtWidgets.QDialogButtonBox.AcceptRole)
        self.buttonbox.addButton(StandardButton(StandardButton.CANCEL),
                                 QtWidgets.QDialogButtonBox.RejectRole)
        self.buttonbox.addButton(
            StandardButton(StandardButton.HELP), QtWidgets.QDialogButtonBox.HelpRole)
        self.buttonbox.accepted.connect(self.accept)
        self.buttonbox.rejected.connect(self.reject)
        self.buttonbox.helpRequested.connect(self.help)

        extrabuttons = [
            (N_("Chec&k all"), self.checkall),
            (N_("&Uncheck all"), self.uncheckall),
        ]
        for label, callback in extrabuttons:
            button = QtWidgets.QPushButton(_(label))
            button.setSizePolicy(
                QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Expanding)
            self.buttonbox.addButton(button, QtWidgets.QDialogButtonBox.ActionRole)
            button.clicked.connect(callback)

        self.layout.addWidget(self.buttonbox)

        self.buttonbox.accepted.connect(self.accept)
        self.buttonbox.rejected.connect(self.reject)
コード例 #7
0
ファイル: cover.py プロジェクト: samithaj/picard
    def __init__(self, parent=None, types=[]):
        super(CAATypesSelectorDialog, self).__init__(parent)

        self.setWindowTitle(_("Cover art types"))
        self._items = {}
        self.layout = QtGui.QVBoxLayout(self)

        grid = QtGui.QWidget()
        gridlayout = QtGui.QGridLayout()
        grid.setLayout(gridlayout)

        rows = len(CAA_TYPES) // self._columns + 1
        positions = [(i, j) for i in range(rows) for j in range(self._columns)]

        for position, caa_type in zip(positions, CAA_TYPES):
            name = caa_type["name"]
            text = translate_caa_type(name)
            item = QtGui.QCheckBox(text)
            item.setChecked(name in types)
            self._items[item] = caa_type
            gridlayout.addWidget(item, *position)

        self.layout.addWidget(grid)

        self.buttonbox = QtGui.QDialogButtonBox(self)
        self.buttonbox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonbox.addButton(StandardButton(StandardButton.OK),
                                 QtGui.QDialogButtonBox.AcceptRole)
        self.buttonbox.addButton(StandardButton(StandardButton.CANCEL),
                                 QtGui.QDialogButtonBox.RejectRole)
        self.buttonbox.addButton(StandardButton(StandardButton.HELP),
                                 QtGui.QDialogButtonBox.HelpRole)
        self.buttonbox.accepted.connect(self.accept)
        self.buttonbox.rejected.connect(self.reject)
        self.buttonbox.helpRequested.connect(self.help)

        extrabuttons = [
            (N_("Chec&k all"), self.checkall),
            (N_("&Uncheck all"), self.uncheckall),
        ]
        for label, callback in extrabuttons:
            button = QtGui.QPushButton(_(label))
            button.setSizePolicy(QtGui.QSizePolicy.Fixed,
                                 QtGui.QSizePolicy.Expanding)
            self.buttonbox.addButton(button, QtGui.QDialogButtonBox.ActionRole)
            button.clicked.connect(callback)

        self.layout.addWidget(self.buttonbox)

        self.buttonbox.accepted.connect(self.accept)
        self.buttonbox.rejected.connect(self.reject)
コード例 #8
0
 def types_as_string(self, translate=True, separator=', '):
     types = self.normalized_types()
     if translate:
         types = [translate_caa_type(type) for type in types]
     return separator.join(types)
コード例 #9
0
 def test_translating_unknown_types_returns_input(self):
     testtype = "ThisIsAMadeUpCoverArtTypeName"
     self.assertEqual(translate_caa_type(testtype), testtype)
コード例 #10
0
ファイル: test_coverart_utils.py プロジェクト: mineo/picard
 def test_translating_unknown_types_returns_input(self):
     testtype = "ThisIsAMadeUpCoverArtTypeName"
     self.assertEqual(translate_caa_type(testtype), testtype)
コード例 #11
0
ファイル: image.py プロジェクト: Jormangeud/picard
 def types_as_string(self, translate=True, separator=', '):
     types = self.normalized_types()
     if translate:
         types = [translate_caa_type(type) for type in types]
     return separator.join(types)