예제 #1
0
파일: renaming.py 프로젝트: Flapstah/picard
    def __init__(self, parent=None):
        super(RenamingOptionsPage, self).__init__(parent)
        self.ui = Ui_RenamingOptionsPage()
        self.ui.setupUi(self)
        self.update_examples()

        self.connect(self.ui.ascii_filenames, QtCore.SIGNAL("clicked()"),
                     self.update_examples)
        self.connect(self.ui.windows_compatible_filenames,
                     QtCore.SIGNAL("clicked()"), self.update_examples)
        self.connect(self.ui.use_va_format, QtCore.SIGNAL("clicked()"),
                     self.update_examples)
        self.connect(self.ui.rename_files, QtCore.SIGNAL("clicked()"),
                     self.update_examples)

        self.connect(self.ui.file_naming_format,
                     QtCore.SIGNAL("textChanged()"), self.check_formats)
        self.connect(self.ui.va_file_naming_format,
                     QtCore.SIGNAL("textChanged()"), self.check_formats)
        self.connect(self.ui.file_naming_format_default,
                     QtCore.SIGNAL("clicked()"),
                     self.set_file_naming_format_default)
        self.connect(self.ui.va_file_naming_format_default,
                     QtCore.SIGNAL("clicked()"),
                     self.set_va_file_naming_format_default)
        self.connect(self.ui.va_copy_from_above, QtCore.SIGNAL("clicked()"),
                     self.copy_format_to_va)
        self.highlighter = TaggerScriptSyntaxHighlighter(
            self.ui.file_naming_format.document())
        self.highlighter_va = TaggerScriptSyntaxHighlighter(
            self.ui.va_file_naming_format.document())
예제 #2
0
    def __init__(self, parent=None):
        super(RenamingOptionsPage, self).__init__(parent)
        self.ui = Ui_RenamingOptionsPage()
        self.ui.setupUi(self)

        self.ui.ascii_filenames.clicked.connect(self.update_examples)
        self.ui.windows_compatibility.clicked.connect(self.update_examples)
        self.ui.rename_files.clicked.connect(self.update_examples)
        self.ui.move_files.clicked.connect(self.update_examples)
        self.ui.move_files_to.editingFinished.connect(self.update_examples)

        self.ui.move_files.toggled.connect(
            partial(enabledSlot, self.toggle_file_moving))
        self.ui.rename_files.toggled.connect(
            partial(enabledSlot, self.toggle_file_renaming))
        self.ui.file_naming_format.textChanged.connect(self.check_formats)
        self.ui.file_naming_format_default.clicked.connect(
            self.set_file_naming_format_default)
        self.highlighter = TaggerScriptSyntaxHighlighter(
            self.ui.file_naming_format.document())
        self.ui.move_files_to_browse.clicked.connect(self.move_files_to_browse)

        textEdit = self.ui.file_naming_format
        self.textEditPaletteNormal = textEdit.palette()
        self.textEditPaletteReadOnly = QPalette(self.textEditPaletteNormal)
        disabled_color = self.textEditPaletteNormal.color(
            QPalette.Inactive, QPalette.Window)
        self.textEditPaletteReadOnly.setColor(QPalette.Disabled, QPalette.Base,
                                              disabled_color)
예제 #3
0
    def __init__(self, parent=None):
        super(RenamingOptionsPage, self).__init__(parent)
        self.ui = Ui_RenamingOptionsPage()
        self.ui.setupUi(self)

        self.ui.ascii_filenames.clicked.connect(self.update_examples)
        self.ui.windows_compatible_filenames.clicked.connect(
            self.update_examples)
        self.ui.rename_files.clicked.connect(self.update_examples)
        self.ui.move_files.clicked.connect(self.update_examples)
        self.ui.move_files_to.editingFinished.connect(self.update_examples)

        # The following code is there to fix
        # http://tickets.musicbrainz.org/browse/PICARD-417
        # In some older version of PyQt/sip it's impossible to connect a signal
        # emitting an `int` to a slot expecting a `bool`.
        # By using `enabledSlot` instead we can force python to do the
        # conversion from int (`state`) to bool.
        def enabledSlot(func, state):
            """Calls `func` with `state`."""
            func(state)

        if not sys.platform == "win32":
            self.ui.rename_files.stateChanged.connect(
                partial(enabledSlot,
                        self.ui.windows_compatible_filenames.setEnabled))

        self.ui.move_files.stateChanged.connect(
            partial(enabledSlot, self.ui.delete_empty_dirs.setEnabled))
        self.ui.move_files.stateChanged.connect(
            partial(enabledSlot, self.ui.move_files_to.setEnabled))
        self.ui.move_files.stateChanged.connect(
            partial(enabledSlot, self.ui.move_files_to_browse.setEnabled))
        self.ui.move_files.stateChanged.connect(
            partial(enabledSlot, self.ui.move_additional_files.setEnabled))
        self.ui.move_files.stateChanged.connect(
            partial(enabledSlot,
                    self.ui.move_additional_files_pattern.setEnabled))
        self.ui.rename_files.stateChanged.connect(
            partial(enabledSlot, self.ui.ascii_filenames.setEnabled))
        self.ui.rename_files.stateChanged.connect(
            partial(enabledSlot, self.ui.file_naming_format.setEnabled))
        self.ui.rename_files.stateChanged.connect(
            partial(enabledSlot,
                    self.ui.file_naming_format_default.setEnabled))
        self.ui.file_naming_format.textChanged.connect(self.check_formats)
        self.ui.file_naming_format_default.clicked.connect(
            self.set_file_naming_format_default)
        self.highlighter = TaggerScriptSyntaxHighlighter(
            self.ui.file_naming_format.document())
        self.ui.move_files_to_browse.clicked.connect(self.move_files_to_browse)
예제 #4
0
파일: renaming.py 프로젝트: weisslj/picard
    def __init__(self, parent=None):
        super(RenamingOptionsPage, self).__init__(parent)
        self.ui = Ui_RenamingOptionsPage()
        self.ui.setupUi(self)

        self.connect(self.ui.ascii_filenames, QtCore.SIGNAL("clicked()"),
                     self.update_examples)
        self.connect(self.ui.windows_compatible_filenames,
                     QtCore.SIGNAL("clicked()"), self.update_examples)
        self.connect(self.ui.rename_files, QtCore.SIGNAL("clicked()"),
                     self.update_examples)
        self.connect(self.ui.move_files, QtCore.SIGNAL("clicked()"),
                     self.update_examples)
        self.connect(self.ui.move_files_to, QtCore.SIGNAL("editingFinished()"),
                     self.update_examples)

        self.connect(self.ui.rename_files, QtCore.SIGNAL("stateChanged(int)"),
                     self.ui.ascii_filenames.setEnabled)
        self.connect(self.ui.rename_files, QtCore.SIGNAL("stateChanged(int)"),
                     self.ui.file_naming_format.setEnabled)
        self.connect(self.ui.rename_files, QtCore.SIGNAL("stateChanged(int)"),
                     self.ui.file_naming_format_default.setEnabled)

        if not sys.platform == "win32":
            self.connect(self.ui.rename_files,
                         QtCore.SIGNAL("stateChanged(int)"),
                         self.ui.windows_compatible_filenames.setEnabled)

        self.connect(self.ui.move_files, QtCore.SIGNAL("stateChanged(int)"),
                     self.ui.delete_empty_dirs.setEnabled)
        self.connect(self.ui.move_files, QtCore.SIGNAL("stateChanged(int)"),
                     self.ui.move_files_to.setEnabled)
        self.connect(self.ui.move_files, QtCore.SIGNAL("stateChanged(int)"),
                     self.ui.move_files_to_browse.setEnabled)
        self.connect(self.ui.move_files, QtCore.SIGNAL("stateChanged(int)"),
                     self.ui.move_additional_files.setEnabled)
        self.connect(self.ui.move_files, QtCore.SIGNAL("stateChanged(int)"),
                     self.ui.move_additional_files_pattern.setEnabled)
        self.connect(self.ui.file_naming_format,
                     QtCore.SIGNAL("textChanged()"), self.check_formats)
        self.connect(self.ui.file_naming_format_default,
                     QtCore.SIGNAL("clicked()"),
                     self.set_file_naming_format_default)
        self.highlighter = TaggerScriptSyntaxHighlighter(
            self.ui.file_naming_format.document())
        self.connect(self.ui.move_files_to_browse, QtCore.SIGNAL("clicked()"),
                     self.move_files_to_browse)