Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion picard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 12 additions & 1 deletion picard/config_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion picard/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion picard/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
8 changes: 4 additions & 4 deletions picard/ui/mainwindow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion picard/ui/mainwindow/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions picard/ui/options/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']),
Expand All @@ -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'])
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion picard/ui/savewarningdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion test/formats/test_apev2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading