| 1 |
# Copyright (C) 2008-2010 Adam Olsen |
| 2 |
# |
| 3 |
# This program is free software; you can redistribute it and/or modify |
| 4 |
# it under the terms of the GNU General Public License as published by |
| 5 |
# the Free Software Foundation; either version 2, or (at your option) |
| 6 |
# any later version. |
| 7 |
# |
| 8 |
# This program is distributed in the hope that it will be useful, |
| 9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 |
# GNU General Public License for more details. |
| 12 |
# |
| 13 |
# You should have received a copy of the GNU General Public License |
| 14 |
# along with this program; if not, write to the Free Software |
| 15 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 16 |
# |
| 17 |
# |
| 18 |
# The developers of the Exaile media player hereby grant permission |
| 19 |
# for non-GPL compatible GStreamer and Exaile plugins to be used and |
| 20 |
# distributed together with GStreamer and Exaile. This permission is |
| 21 |
# above and beyond the permissions granted by the GPL license by which |
| 22 |
# Exaile is covered. If you modify this code, you may extend this |
| 23 |
# exception to your version of the code, but you are not obligated to |
| 24 |
# do so. If you do not wish to do so, delete this exception statement |
| 25 |
# from your version. |
| 26 |
|
| 27 |
from gi.repository import Gtk |
| 28 |
|
| 29 |
from xl import xdg |
| 30 |
from xl.nls import gettext as _ |
| 31 |
from xlgui.preferences import widgets |
| 32 |
from xlgui import tray |
| 33 |
|
| 34 |
name = _('Appearance') |
| 35 |
icon = 'preferences-desktop-theme' |
| 36 |
ui = xdg.get_data_path('ui', 'preferences', 'appearance.ui') |
| 37 |
|
| 38 |
|
| 39 |
class ShowInfoAreaPreference(widgets.CheckPreference): |
| 40 |
default = True |
| 41 |
name = 'gui/show_info_area' |
| 42 |
|
| 43 |
|
| 44 |
class ShowInfoAreaCoversPreference(widgets.CheckPreference): |
| 45 |
default = True |
| 46 |
name = 'gui/show_info_area_covers' |
| 47 |
|
| 48 |
|
| 49 |
class SplashPreference(widgets.CheckPreference): |
| 50 |
default = True |
| 51 |
name = 'gui/use_splash' |
| 52 |
|
| 53 |
|
| 54 |
class ShowTabBarPreference(widgets.CheckPreference): |
| 55 |
default = True |
| 56 |
name = 'gui/show_tabbar' |
| 57 |
|
| 58 |
|
| 59 |
def _get_system_default_font(): |
| 60 |
return Gtk.Widget.get_default_style().font_desc.to_string() |
| 61 |
|
| 62 |
|
| 63 |
class PlaylistFontPreference(widgets.FontButtonPreference): |
| 64 |
default = _get_system_default_font() |
| 65 |
name = 'gui/playlist_font' |
| 66 |
|
| 67 |
|
| 68 |
class PlaylistFontResetButtonPreference(widgets.FontResetButtonPreference): |
| 69 |
default = _get_system_default_font() |
| 70 |
name = 'gui/playlist_font_reset_button' |
| 71 |
condition_preference_name = 'gui/playlist_font' |
| 72 |
|
| 73 |
|
| 74 |
class GtkDarkThemePreference(widgets.CheckPreference): |
| 75 |
default = False |
| 76 |
name = 'gui/gtk_dark_hint' |
| 77 |
|
| 78 |
|
| 79 |
class UseAlphaTransparencyPreference(widgets.CheckPreference): |
| 80 |
default = False |
| 81 |
name = 'gui/use_alpha' |
| 82 |
restart_required = True |
| 83 |
|
| 84 |
|
| 85 |
class TransparencyPreference(widgets.ScalePreference, widgets.CheckConditional): |
| 86 |
default = 0.3 |
| 87 |
name = 'gui/transparency' |
| 88 |
condition_preference_name = 'gui/use_alpha' |
| 89 |
|
| 90 |
def __init__(self, preferences, widget): |
| 91 |
widgets.ScalePreference.__init__(self, preferences, widget) |
| 92 |
widgets.CheckConditional.__init__(self) |
| 93 |
|
| 94 |
|
| 95 |
class TrackCountsPreference(widgets.CheckPreference): |
| 96 |
default = True |
| 97 |
name = 'gui/display_track_counts' |
| 98 |
|
| 99 |
def apply(self, value=None): |
| 100 |
return_value = widgets.CheckPreference.apply(self, value) |
| 101 |
|
| 102 |
import xlgui |
| 103 |
|
| 104 |
xlgui.get_controller().get_panel('collection').load_tree() |
| 105 |
|
| 106 |
return return_value |
| 107 |
|
| 108 |
|
| 109 |
class UseTrayPreference(widgets.CheckPreference, widgets.Conditional): |
| 110 |
default = False |
| 111 |
name = 'gui/use_tray' |
| 112 |
|
| 113 |
def __init__(self, preferences, widget): |
| 114 |
widgets.CheckPreference.__init__(self, preferences, widget) |
| 115 |
widgets.Conditional.__init__(self) |
| 116 |
if not tray.is_supported(): |
| 117 |
self.widget.set_tooltip_text( |
| 118 |
_("Tray icons are not supported on your platform") |
| 119 |
) |
| 120 |
|
| 121 |
def on_check_condition(self): |
| 122 |
return tray.is_supported() |
| 123 |
|
| 124 |
|
| 125 |
class MinimizeToTrayPreference(widgets.CheckPreference, widgets.CheckConditional): |
| 126 |
default = False |
| 127 |
name = 'gui/minimize_to_tray' |
| 128 |
condition_preference_name = 'gui/use_tray' |
| 129 |
|
| 130 |
def __init__(self, preferences, widget): |
| 131 |
widgets.CheckPreference.__init__(self, preferences, widget) |
| 132 |
widgets.CheckConditional.__init__(self) |
| 133 |
|
| 134 |
|
| 135 |
class CloseToTrayPreference(widgets.CheckPreference, widgets.CheckConditional): |
| 136 |
default = False |
| 137 |
name = 'gui/close_to_tray' |
| 138 |
condition_preference_name = 'gui/use_tray' |
| 139 |
|
| 140 |
def __init__(self, preferences, widget): |
| 141 |
widgets.CheckPreference.__init__(self, preferences, widget) |
| 142 |
widgets.CheckConditional.__init__(self) |
| 143 |
|
| 144 |
|
| 145 |
class EnsureVisiblePreference(widgets.CheckPreference): |
| 146 |
default = True |
| 147 |
name = 'gui/ensure_visible' |
| 148 |
|
| 149 |
|
| 150 |
class TabPlacementPreference(widgets.ComboPreference): |
| 151 |
default = 'top' |
| 152 |
name = 'gui/tab_placement' |
| 153 |
|
| 154 |
def __init__(self, preferences, widget): |
| 155 |
widgets.ComboPreference.__init__(self, preferences, widget) |
| 156 |
|
| 157 |
|
| 158 |
class ShowStatusBar(widgets.CheckPreference): |
| 159 |
default = True |
| 160 |
name = 'gui/show_status_bar' |
| 161 |
|
| 162 |
|
| 163 |
class ShowStatusBarCollectionCount(widgets.CheckPreference, widgets.CheckConditional): |
| 164 |
default = True |
| 165 |
name = 'gui/show_status_bar_collection_count' |
| 166 |
condition_preference_name = 'gui/show_status_bar' |
| 167 |
|
| 168 |
def __init__(self, preferences, widget): |
| 169 |
widgets.CheckPreference.__init__(self, preferences, widget) |
| 170 |
widgets.CheckConditional.__init__(self) |
| 171 |
|
| 172 |
|
| 173 |
class ShowStatusBarCountTracksInPlaylist( |
| 174 |
widgets.CheckPreference, widgets.CheckConditional |
| 175 |
): |
| 176 |
default = True |
| 177 |
name = 'gui/show_status_bar_count_tracks_in_playlist' |
| 178 |
condition_preference_name = 'gui/show_status_bar' |
| 179 |
|
| 180 |
def __init__(self, preferences, widget): |
| 181 |
widgets.CheckPreference.__init__(self, preferences, widget) |
| 182 |
widgets.CheckConditional.__init__(self) |
| 183 |
|
| 184 |
|
| 185 |
class ShowStatusBarTimeInPlaylist(widgets.CheckPreference, widgets.CheckConditional): |
| 186 |
default = True |
| 187 |
name = 'gui/show_status_bar_time_in_playlist' |
| 188 |
condition_preference_name = 'gui/show_status_bar' |
| 189 |
|
| 190 |
def __init__(self, preferences, widget): |
| 191 |
widgets.CheckPreference.__init__(self, preferences, widget) |
| 192 |
widgets.CheckConditional.__init__(self) |
| 193 |
|
| 194 |
|
| 195 |
""" |
| 196 |
class ProgressBarTextFormatPreference(widgets.ComboEntryPreference): |
| 197 |
name = 'gui/progress_bar_text_format' |
| 198 |
completion_items = { |
| 199 |
'$current_time': _('Current playback position'), |
| 200 |
'$remaining_time': _('Remaining playback time'), |
| 201 |
'$total_time': _('Length of a track') |
| 202 |
} |
| 203 |
preset_items = [ |
| 204 |
'$current_time / $remaining_time', |
| 205 |
'$current_time / $total_time' |
| 206 |
] |
| 207 |
default = '$current_time / $remaining_time' |
| 208 |
""" |
| 209 |
|
| 210 |
# vim: et sts=4 sw=4 |