-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathpij_screen_navigation.py
executable file
·86 lines (77 loc) · 3.82 KB
/
pij_screen_navigation.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# This file is part of pi-jukebox.
#
# pi-jukebox is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pi-jukebox is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with pi-jukebox. If not, see < http://www.gnu.org/licenses/ >.
#
# (C) 2015- by Mark Zwart, <[email protected]>
"""
=======================================================
**screen_directory.py**: MPD Directory browsing screen
=======================================================
"""
__author__ = 'Mark Zwart'
from settings import *
from gui_screens import *
from gui_widgets import *
from screen_settings import *
class ScreenNavigation(WidgetContainer):
def __init__(self, tag_name, surface, button_active):
WidgetContainer.__init__(self, tag_name, surface, 0, 0, 53, 240)
self.__radio_mode = False
self.add_component(ButtonIcon('btn_player', self.surface, ICO_PLAYER_FILE_ACTIVE, 3, 5))
self.add_component(ButtonIcon('btn_playlist', self.surface, ICO_PLAYLIST, 3, 45))
self.add_component(ButtonIcon('btn_library', self.surface, ICO_LIBRARY, 3, 85))
self.add_component(ButtonIcon('btn_directory', self.surface, ICO_DIRECTORY, 3, 125))
self.add_component(ButtonIcon('btn_radio', self.surface, ICO_RADIO, 3, 165))
self.add_component(ButtonIcon('btn_settings', self.surface, ICO_SETTINGS, 3, 205))
self.button_active_set(button_active)
def on_click(self, x, y):
tag_name = super(ScreenNavigation, self).on_click(x, y)
return tag_name
def radio_mode_set(self, radio_mode_bool):
self.__radio_mode = radio_mode_bool
if radio_mode_bool:
if self.__button_active == 'btn_player':
self.components['btn_player'].icon_file_set(ICO_PLAYER_RADIO_ACTIVE)
else:
self.components['btn_player'].icon_file_set(ICO_PLAYER_RADIO)
else:
if self.__button_active == 'btn_player':
self.components['btn_player'].icon_file_set(ICO_PLAYER_FILE_ACTIVE)
else:
self.components['btn_player'].icon_file_set(ICO_PLAYER_FILE)
self.draw()
def button_active_set(self, button_active):
self.__button_active = button_active
if self.__radio_mode:
self.components['btn_player'].icon_file_set(ICO_PLAYER_RADIO)
else:
self.components['btn_player'].icon_file_set(ICO_PLAYER_FILE)
self.components['btn_playlist'].icon_file_set(ICO_PLAYLIST)
self.components['btn_library'].icon_file_set(ICO_LIBRARY)
self.components['btn_directory'].icon_file_set(ICO_DIRECTORY)
self.components['btn_radio'].icon_file_set(ICO_RADIO)
if button_active == 'btn_player':
if self.__radio_mode:
self.components['btn_player'].icon_file_set(ICO_PLAYER_RADIO_ACTIVE)
else:
self.components['btn_player'].icon_file_set(ICO_PLAYER_FILE_ACTIVE)
elif button_active == 'btn_playlist':
self.components['btn_playlist'].icon_file_set(ICO_PLAYLIST_ACTIVE)
elif button_active == 'btn_library':
self.components['btn_library'].icon_file_set(ICO_LIBRARY_ACTIVE)
elif button_active == 'btn_directory':
self.components['btn_directory'].icon_file_set(ICO_DIRECTORY_ACTIVE)
elif button_active == 'btn_radio':
self.components['btn_radio'].icon_file_set(ICO_RADIO_ACTIVE)
self.draw()