diff --git a/picard/__init__.py b/picard/__init__.py index 331e0ecc72..86f38e8c93 100644 --- a/picard/__init__.py +++ b/picard/__init__.py @@ -42,7 +42,7 @@ PICARD_DISPLAY_NAME = "MusicBrainz Picard" PICARD_APP_ID = "org.musicbrainz.Picard" PICARD_DESKTOP_NAME = PICARD_APP_ID + ".desktop" -PICARD_VERSION = Version(3, 0, 0, 'dev', 7) +PICARD_VERSION = Version(3, 0, 0, 'dev', 8) # optional build version diff --git a/picard/config_upgrade.py b/picard/config_upgrade.py index c84e8d9908..bed24f1a63 100644 --- a/picard/config_upgrade.py +++ b/picard/config_upgrade.py @@ -581,10 +581,19 @@ def upgrade_to_v3_0_0dev7(config): config.setting['ui_theme'] = UiTheme.DEFAULT -def rename_option(config, old_opt, new_opt, option_type, default): +def upgrade_to_v3_0_0dev8(config): + """Option "dont_write_tags" was renamed to "enable_tag_saving" (value is reversed).""" + old_opt = 'dont_write_tags' + new_opt = 'enable_tag_saving' + rename_option(config, old_opt, new_opt, BoolOption, False, reverse=True) + + +def rename_option(config, old_opt, new_opt, option_type, default, reverse=False): _s = config.setting if old_opt in _s: _s[new_opt] = _s.value(old_opt, option_type, default) + if reverse: + _s[new_opt] = not _s[new_opt] _s.remove(old_opt) _p = config.profiles @@ -594,6 +603,8 @@ def rename_option(config, old_opt, new_opt, option_type, default): id = profile['id'] if id in all_settings and old_opt in all_settings[id]: all_settings[id][new_opt] = all_settings[id][old_opt] + if reverse: + all_settings[id][new_opt] = not all_settings[id][new_opt] all_settings[id].pop(old_opt) _p['user_profile_settings'] = all_settings diff --git a/picard/file.py b/picard/file.py index f5835fc579..bc2c255f3e 100644 --- a/picard/file.py +++ b/picard/file.py @@ -392,7 +392,7 @@ def _save_and_rename(self, old_filename, metadata): log.debug("File not saved because %s is stopping: %r", PICARD_APP_NAME, self.filename) return None new_filename = old_filename - if not config.setting['dont_write_tags']: + if config.setting['enable_tag_saving']: save = partial(self._save, old_filename, metadata) if config.setting['preserve_timestamps']: try: diff --git a/picard/options.py b/picard/options.py index 399be6f4c1..271bed6801 100644 --- a/picard/options.py +++ b/picard/options.py @@ -454,7 +454,7 @@ def make_default_toolbar_layout(): # picard/ui/options/tags.py # Tags BoolOption('setting', 'clear_existing_tags', False, title=N_("Clear existing tags")) -BoolOption('setting', 'dont_write_tags', False, title=N_("Don't write tags")) +BoolOption('setting', 'enable_tag_saving', True, title=N_("Enable saving tags to files")) BoolOption('setting', 'fix_missing_seekpoints_flac', False, title=N_("Fix missing seekpoints for FLAC files")) ListOption('setting', 'preserved_tags', [], title=N_("Preserved tags list")) BoolOption('setting', 'preserve_images', False, title=N_("Keep embedded images when clearing tags")) diff --git a/picard/ui/mainwindow/__init__.py b/picard/ui/mainwindow/__init__.py index e22cfbcb23..a40656e01b 100644 --- a/picard/ui/mainwindow/__init__.py +++ b/picard/ui/mainwindow/__init__.py @@ -296,8 +296,8 @@ def handle_settings_changed(self, name, old_value, new_value): self.actions[MainAction.ENABLE_RENAMING].setChecked(new_value) elif name == 'move_files': self.actions[MainAction.ENABLE_MOVING].setChecked(new_value) - elif name == 'dont_write_tags': - self.actions[MainAction.ENABLE_TAG_SAVING].setChecked(not new_value) + elif name == 'enable_tag_saving': + self.actions[MainAction.ENABLE_TAG_SAVING].setChecked(new_value) elif name == 'save_images_to_tags': self.actions[MainAction.ENABLE_SAVE_IMAGES_TO_TAGS].setChecked(new_value) elif name == 'save_images_to_files': @@ -623,13 +623,13 @@ def toggle_move_files(self, checked): def toggle_tag_saving(self, checked): config = get_config() - config.setting['dont_write_tags'] = not checked + config.setting['enable_tag_saving'] = checked def _reset_option_menu_state(self): config = get_config() self.actions[MainAction.ENABLE_RENAMING].setChecked(config.setting['rename_files']) self.actions[MainAction.ENABLE_MOVING].setChecked(config.setting['move_files']) - self.actions[MainAction.ENABLE_TAG_SAVING].setChecked(not config.setting['dont_write_tags']) + self.actions[MainAction.ENABLE_TAG_SAVING].setChecked(config.setting['enable_tag_saving']) self._make_script_selector_menu() self._init_cd_lookup_menu() diff --git a/picard/ui/mainwindow/actions.py b/picard/ui/mainwindow/actions.py index 5a7c0bad8e..1158456125 100644 --- a/picard/ui/mainwindow/actions.py +++ b/picard/ui/mainwindow/actions.py @@ -472,7 +472,7 @@ def _create_enable_tag_saving_action(parent): config = get_config() action = QtGui.QAction(_("Save &Tags"), parent) action.setCheckable(True) - action.setChecked(not config.setting['dont_write_tags']) + action.setChecked(config.setting['enable_tag_saving']) action.triggered.connect(parent.toggle_tag_saving) return action diff --git a/picard/ui/options/tags.py b/picard/ui/options/tags.py index f4c9fd105d..cfceb738cd 100644 --- a/picard/ui/options/tags.py +++ b/picard/ui/options/tags.py @@ -54,7 +54,7 @@ class TagsOptionsPage(OptionsPage): HELP_URL = "/config/options_tags.html" OPTIONS = ( - ('dont_write_tags', ['write_tags']), + ('enable_tag_saving', ['write_tags']), ('preserve_timestamps', ['preserve_timestamps']), ('clear_existing_tags', ['clear_existing_tags']), ('preserve_images', ['preserve_images']), @@ -78,7 +78,7 @@ def __init__(self, parent=None): def load(self): config = get_config() - self.ui.write_tags.setChecked(not config.setting['dont_write_tags']) + self.ui.write_tags.setChecked(config.setting['enable_tag_saving']) self.ui.preserve_timestamps.setChecked(config.setting['preserve_timestamps']) self.ui.clear_existing_tags.setChecked(config.setting['clear_existing_tags']) self.ui.preserve_images.setChecked(config.setting['preserve_images']) @@ -94,7 +94,7 @@ def load(self): def save(self): config = get_config() - config.setting['dont_write_tags'] = not self.ui.write_tags.isChecked() + config.setting['enable_tag_saving'] = self.ui.write_tags.isChecked() config.setting['preserve_timestamps'] = self.ui.preserve_timestamps.isChecked() config.setting['clear_existing_tags'] = self.ui.clear_existing_tags.isChecked() config.setting['preserve_images'] = self.ui.preserve_images.isChecked() diff --git a/picard/ui/savewarningdialog.py b/picard/ui/savewarningdialog.py index a24b16c546..4b03e618bf 100644 --- a/picard/ui/savewarningdialog.py +++ b/picard/ui/savewarningdialog.py @@ -38,7 +38,7 @@ def __init__(self, parent, file_count): actions = [] config = get_config() - if not config.setting['dont_write_tags']: + if config.setting['enable_tag_saving']: actions.append( ngettext( "overwrite existing metadata (tags) within the file", diff --git a/test/formats/test_apev2.py b/test/formats/test_apev2.py index c5ba0119b0..a50c266d05 100644 --- a/test/formats/test_apev2.py +++ b/test/formats/test_apev2.py @@ -193,7 +193,7 @@ def setUp(self): config.setting['ascii_filenames'] = False config.setting['windows_compatibility'] = False config.setting['windows_long_paths'] = True - config.setting['dont_write_tags'] = True + config.setting['enable_tag_saving'] = False config.setting['preserve_timestamps'] = False config.setting['delete_empty_dirs'] = False config.setting['save_images_to_files'] = False