~muzuiget/exaile/exaile

« back to all changes in this revision

Viewing changes to xlgui/preferences/appearance.py

  • Committer: muzuiget
  • Date: 2013-02-14 10:44:10 UTC
  • Revision ID: muzuiget@gmail.com-20130214104410-kr3jn4bf4can230e
add fallback encodings option for tag converting

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
    default = True
48
48
    name = 'gui/use_splash'
49
49
 
 
50
class FallbackEncodingsPreference(widgets.ListPreference):
 
51
    default = []
 
52
    name = 'gui/fallback_encodings'
 
53
 
 
54
    def __init__(self, preferences, widget):
 
55
        widgets.ListPreference.__init__(self, preferences, widget)
 
56
 
 
57
    def _get_value(self):
 
58
        """
 
59
            Converts the string value to a list
 
60
        """
 
61
        values = [v.strip() for v in self.widget.get_text().split(',')]
 
62
        values = [v.lower() for v in values if v is not '']
 
63
        return values
 
64
 
 
65
    def _set_value(self):
 
66
        """
 
67
            Converts the list to a string value
 
68
        """
 
69
        items = self.preferences.settings.get_option(self.name,
 
70
                                                     default=self.default)
 
71
        self.widget.set_text(', '.join(items))
 
72
 
50
73
class ShowTabBarPreference(widgets.CheckPreference):
51
74
    default = True
52
75
    name = 'gui/show_tabbar'