예제 #1
0
파일: metadata.py 프로젝트: ruipin/picard
    def __init__(self, parent=None):
        super().__init__(parent)
        self.ui = Ui_ExceptionScriptSelector()
        self.ui.setupUi(self)
        self.ui.button_box.accepted.connect(self.save_changes)
        self.ui.button_box.rejected.connect(self.reject)
        self.move_view = MoveableListView(self.ui.selected_scripts,
                                          self.ui.move_up, self.ui.move_down)
        self.ui.add_script.clicked.connect(self.add_script)
        self.ui.remove_script.clicked.connect(self.remove_script)
        self.ui.selected_scripts.currentRowChanged.connect(
            self.selected_script_changed)
        self.ui.weighting_selector.valueChanged.connect(self.weighting_changed)

        weighting_tooltip_text = _(
            "Each selected script includes a matching threshold value used to determine if that script should be used. When an artist name is "
            "evaluated to determine if it matches one of your selected scripts, it is first parsed to determine which scripts are represented "
            "in the name, and what weighted percentage of the name belongs to each script. Then each of your selected scripts are checked, and "
            "if the name contains characters belonging to the script and the percentage of script characters in the name meets or exceeds the "
            "match threshold specified for the script, then the artist name will not be translated."
        )
        self.ui.weighting_selector.setToolTip(weighting_tooltip_text)
        self.ui.threshold_label.setToolTip(weighting_tooltip_text)

        self.load()
예제 #2
0
    def __init__(self, parent=None):
        super().__init__(parent)
        self.ui = Ui_InterfaceOptionsPage()
        self.ui.setupUi(self)
        self.ui.ui_language.addItem(_('System default'), '')
        language_list = [(lang[0], lang[1], _(lang[2]))
                         for lang in UI_LANGUAGES]

        def fcmp(x):
            return locale.strxfrm(x[2])

        for lang_code, native, translation in sorted(language_list, key=fcmp):
            if native and native != translation:
                name = '%s (%s)' % (translation, native)
            else:
                name = translation
            self.ui.ui_language.addItem(name, lang_code)
        self.ui.starting_directory.stateChanged.connect(
            partial(enabledSlot, self.ui.starting_directory_path.setEnabled))
        self.ui.starting_directory.stateChanged.connect(
            partial(enabledSlot, self.ui.starting_directory_browse.setEnabled))
        self.ui.starting_directory_browse.clicked.connect(
            self.starting_directory_browse)
        self.ui.add_button.clicked.connect(self.add_to_toolbar)
        self.ui.insert_separator_button.clicked.connect(self.insert_separator)
        self.ui.remove_button.clicked.connect(self.remove_action)
        self.move_view = MoveableListView(self.ui.toolbar_layout_list,
                                          self.ui.up_button,
                                          self.ui.down_button,
                                          self.update_action_buttons)
        self.update_buttons = self.move_view.update_buttons
        if IS_MACOS or IS_WIN or IS_HAIKU:
            self.ui.use_system_theme.hide()
예제 #3
0
    def __init__(self, parent=None):
        super().__init__(parent)
        self.ui = Ui_ScriptingOptionsPage()
        self.ui.setupUi(self)
        self.ui.tagger_script.setEnabled(False)
        self.ui.scripting_options_splitter.setStretchFactor(1, 2)
        self.move_view = MoveableListView(self.ui.script_list,
                                          self.ui.move_up_button,
                                          self.ui.move_down_button)
        self.ui.scripting_documentation_button.clicked.connect(
            self.show_scripting_documentation)
        self.ui.scripting_documentation_button.setToolTip(
            _("Show scripting documentation in new window."))

        self.ui.import_button.clicked.connect(self.import_script)
        self.ui.import_button.setToolTip(
            _("Import a script file as a new script."))

        self.ui.export_button.clicked.connect(self.export_script)
        self.ui.export_button.setToolTip(
            _("Export the current script to a file."))

        self.FILE_TYPE_ALL = _("All files") + " (*)"
        self.FILE_TYPE_SCRIPT = _("Picard script files") + " (*.pts *.txt)"
        self.FILE_TYPE_PACKAGE = _(
            "Picard tagging script package") + " (*.ptsp *.yaml)"

        self.ui.script_list.signal_reset_selected_item.connect(
            self.reset_selected_item)
예제 #4
0
파일: profiles.py 프로젝트: rdswift/picard
    def __init__(self, parent=None):
        super().__init__(parent)
        self.ui = Ui_ProfileEditorDialog()
        self.ui.setupUi(self)
        self.make_buttons()

        self.ui.profile_editor_splitter.setStretchFactor(1, 1)
        self.move_view = MoveableListView(self.ui.profile_list,
                                          self.ui.move_up_button,
                                          self.ui.move_down_button)

        self.ui.profile_list.itemChanged.connect(self.profile_item_changed)
        self.ui.profile_list.currentItemChanged.connect(
            self.current_item_changed)
        self.ui.profile_list.itemChanged.connect(self.reload_all_page_settings)
        self.ui.settings_tree.itemChanged.connect(
            self.set_profile_settings_changed)
        self.ui.settings_tree.itemExpanded.connect(
            self.update_current_expanded_items_list)
        self.ui.settings_tree.itemCollapsed.connect(
            self.update_current_expanded_items_list)

        self.current_profile_id = None
        self.expanded_sections = []
        self.building_tree = False

        self.loading = False
        self.settings_changed = False
        self.ui.settings_tree.installEventFilter(self)
예제 #5
0
 def __init__(self, parent=None):
     super().__init__(parent)
     self.ui = Ui_CoverOptionsPage()
     self.ui.setupUi(self)
     self.ui.save_images_to_files.clicked.connect(self.update_filename)
     self.ui.save_images_to_tags.clicked.connect(self.update_save_images_to_tags)
     self.move_view = MoveableListView(self.ui.ca_providers_list, self.ui.up_button,
                                       self.ui.down_button)
예제 #6
0
 def __init__(self, parent=None):
     super().__init__(parent)
     self.ui = Ui_ScriptingOptionsPage()
     self.ui.setupUi(self)
     self.ui.tagger_script.setEnabled(False)
     self.ui.scripting_options_splitter.setStretchFactor(1, 2)
     self.move_view = MoveableListView(self.ui.script_list, self.ui.move_up_button,
                                       self.ui.move_down_button)
     self.ui.scripting_documentation_button.clicked.connect(self.show_scripting_documentation)
예제 #7
0
파일: cover.py 프로젝트: firefiks/picard
 def __init__(self, parent=None):
     super().__init__(parent)
     self.ui = Ui_CoverOptionsPage()
     self.ui.setupUi(self)
     self.ui.cover_image_filename.setPlaceholderText(Option.get('setting', 'cover_image_filename').default)
     self.ui.save_images_to_files.clicked.connect(self.update_ca_providers_groupbox_state)
     self.ui.save_images_to_tags.clicked.connect(self.update_ca_providers_groupbox_state)
     self.ui.save_only_one_front_image.toggled.connect(self.ui.image_type_as_filename.setDisabled)
     self.move_view = MoveableListView(self.ui.ca_providers_list, self.ui.up_button,
                                       self.ui.down_button)
예제 #8
0
 def __init__(self, parent=None):
     super().__init__(parent)
     self.ui = Ui_MultiLocaleSelector()
     self.ui.setupUi(self)
     self.ui.button_box.accepted.connect(self.save_changes)
     self.ui.button_box.rejected.connect(self.reject)
     self.move_view = MoveableListView(self.ui.selected_locales, self.ui.move_up, self.ui.move_down)
     self.ui.add_locale.clicked.connect(self.add_locale)
     self.ui.remove_locale.clicked.connect(self.remove_locale)
     self.ui.selected_locales.currentRowChanged.connect(self.set_button_state)
     self.load()
예제 #9
0
 def __init__(self, parent=None):
     super().__init__(parent)
     self.ui = Ui_ScriptingOptionsPage()
     self.ui.setupUi(self)
     self.highlighter = TaggerScriptSyntaxHighlighter(
         self.ui.tagger_script.document())
     self.ui.tagger_script.setEnabled(False)
     self.ui.splitter.setStretchFactor(0, 1)
     self.ui.splitter.setStretchFactor(1, 2)
     font = QtGui.QFont('Monospace')
     font.setStyleHint(QtGui.QFont.TypeWriter)
     self.ui.tagger_script.setFont(font)
     self.move_view = MoveableListView(self.ui.script_list,
                                       self.ui.move_up_button,
                                       self.ui.move_down_button)
예제 #10
0
    def __init__(self, parent=None):
        super().__init__(parent)
        self.ui = Ui_InterfaceOptionsPage()
        self.ui.setupUi(self)

        self.ui.ui_theme.clear()
        for theme in AVAILABLE_UI_THEMES:
            label = self._UI_THEME_LABELS[theme]['label']
            desc = self._UI_THEME_LABELS[theme]['desc']
            self.ui.ui_theme.addItem(_(label), theme)
            idx = self.ui.ui_theme.findData(theme)
            self.ui.ui_theme.setItemData(idx, _(desc), QtCore.Qt.ToolTipRole)
        self.ui.ui_theme.setCurrentIndex(self.ui.ui_theme.findData(UiTheme.DEFAULT))

        self.ui.ui_language.addItem(_('System default'), '')
        language_list = [(lang[0], lang[1], _(lang[2])) for lang in UI_LANGUAGES]

        def fcmp(x):
            return locale.strxfrm(x[2])
        for lang_code, native, translation in sorted(language_list, key=fcmp):
            if native and native != translation:
                name = '%s (%s)' % (translation, native)
            else:
                name = translation
            self.ui.ui_language.addItem(name, lang_code)
        self.ui.starting_directory.stateChanged.connect(
            partial(
                enabledSlot,
                self.ui.starting_directory_path.setEnabled
            )
        )
        self.ui.starting_directory.stateChanged.connect(
            partial(
                enabledSlot,
                self.ui.starting_directory_browse.setEnabled
            )
        )
        self.ui.starting_directory_browse.clicked.connect(self.starting_directory_browse)
        self.ui.add_button.clicked.connect(self.add_to_toolbar)
        self.ui.insert_separator_button.clicked.connect(self.insert_separator)
        self.ui.remove_button.clicked.connect(self.remove_action)
        self.ui.show_menu_icons.toggled.connect(self.tagger.enable_menu_icons)
        self.move_view = MoveableListView(self.ui.toolbar_layout_list, self.ui.up_button,
                                          self.ui.down_button, self.update_action_buttons)
        self.update_buttons = self.move_view.update_buttons

        if not OS_SUPPORTS_THEMES:
            self.ui.ui_theme_container.hide()
예제 #11
0
    def __init__(self, parent=None):
        """Option profile editor.
        """
        super().__init__(parent)

        self.main_window = parent

        self.ITEMS_TEMPLATES = {
            True: "\n  ■ %s",
            False:  "\n  □ %s",
        }

        self.setWindowTitle(_(self.TITLE))
        self.displaying = False
        self.loading = True
        self.ui = Ui_ProfileEditorDialog()
        self.ui.setupUi(self)
        self.setModal(True)

        self.make_buttons()

        self.ui.profile_editor_splitter.setStretchFactor(1, 1)
        self.move_view = MoveableListView(self.ui.profile_list, self.ui.move_up_button,
                                          self.ui.move_down_button)

        self.ui.profile_list.itemChanged.connect(self.profile_item_changed)
        self.ui.profile_list.currentItemChanged.connect(self.current_item_changed)
        self.ui.profile_list.itemSelectionChanged.connect(self.item_selection_changed)
        self.ui.profile_list.itemChanged.connect(self.profile_data_changed)
        self.ui.settings_tree.itemChanged.connect(self.save_profile)
        self.ui.settings_tree.itemExpanded.connect(self.update_current_expanded_items_list)
        self.ui.settings_tree.itemCollapsed.connect(self.update_current_expanded_items_list)

        self.current_profile_id = None
        self.expanded_sections = []
        self.building_tree = False

        self.load()
        self.loading = False