From 486dd210ae6bfb3c0e63913270a89f940dec454a Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Wed, 30 Jan 2013 19:23:53 -0800 Subject: [PATCH] trying out a multi-line track display (#78) --- beets/ui/commands.py | 8 +++----- test/test_ui.py | 11 +++++------ 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/beets/ui/commands.py b/beets/ui/commands.py index c3016fac7..66669f7b9 100644 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -181,7 +181,6 @@ def show_change(cur_artist, cur_album, match): # Tracks. pairs = match.mapping.items() pairs.sort(key=lambda (_, track_info): track_info.index) - max_title_len = max([len(item.title) for item, track_info in pairs]) for item, track_info in pairs: # Get displayable LHS and RHS values. cur_track = unicode(item.track) @@ -206,14 +205,13 @@ def show_change(cur_artist, cur_album, match): cur_title = displayable_path(os.path.basename(item.path)) if cur_title != new_title: - pad = ' ' * (max_title_len - len(item.title) + 1) - lhs, rhs = cur_title + pad, new_title + lhs, rhs = cur_title, new_title if tracks_differ: lhs += u' (%s)' % cur_track rhs += u' (%s)' % new_track - print_(u" * %s -> %s" % (lhs, rhs)) + print_(u" * %s ->\n %s" % (lhs, rhs)) else: - line = u' * %s' % item.title.ljust(max_title_len + 1) + line = u' * %s' % item.title display = False if tracks_differ: display = True diff --git a/test/test_ui.py b/test/test_ui.py index 710780b34..50061b027 100644 --- a/test/test_ui.py +++ b/test/test_ui.py @@ -20,7 +20,6 @@ import textwrap import logging import re import yaml -from StringIO import StringIO import _common from _common import unittest @@ -688,12 +687,12 @@ class ShowChangeTest(_common.TestCase): def test_item_data_change(self): self.items[0].title = 'different' msg = self._show_change() - self.assertTrue('different -> the title' in msg) + self.assertTrue('different ->\n the title' in msg) def test_item_data_change_with_unicode(self): self.items[0].title = u'caf\xe9' msg = self._show_change() - self.assertTrue(u'caf\xe9 -> the title' in msg.decode('utf8')) + self.assertTrue(u'caf\xe9 ->\n the title' in msg.decode('utf8')) def test_album_data_change_with_unicode(self): msg = self._show_change(cur_artist=u'caf\xe9', @@ -703,14 +702,14 @@ class ShowChangeTest(_common.TestCase): def test_item_data_change_title_missing(self): self.items[0].title = '' msg = self._show_change() - self.assertTrue('file.mp3 -> the title' in msg) + self.assertTrue('file.mp3 ->\n the title' in msg) def test_item_data_change_title_missing_with_unicode_filename(self): self.items[0].title = '' self.items[0].path = u'/path/to/caf\xe9.mp3'.encode('utf8') msg = self._show_change().decode('utf8') - self.assertTrue(u'caf\xe9.mp3 -> the title' in msg - or u'caf.mp3 ->' in msg) + self.assertTrue(u'caf\xe9.mp3 ->' in msg + or u'caf.mp3 ->' in msg) class PathFormatTest(_common.TestCase): def test_custom_paths_prepend(self):