Skip to content

Commit

Permalink
Michelangelo Edition
Browse files Browse the repository at this point in the history
  • Loading branch information
project-owner committed Sep 5, 2016
1 parent c4677b0 commit bdb902a
Show file tree
Hide file tree
Showing 362 changed files with 2,965 additions and 614 deletions.
1 change: 1 addition & 0 deletions bundles/de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ delay.off = Ausschalten
clock = Uhr
logo = Logo
slideshow = Slideshow
vumeter = VU-Meter

news = Nachrichten
culture = Kultur
Expand Down
3 changes: 2 additions & 1 deletion bundles/en_us.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
home = Home
home = Home
genre = Genre

radio = Radio
Expand All @@ -22,6 +22,7 @@ delay.off = Off
clock = Clock
logo = Logo
slideshow = Slideshow
vumeter = VU Meter

news = News
culture = Culture
Expand Down
1 change: 1 addition & 0 deletions bundles/fr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ delay.off = Éteindre
clock = Horloge
logo = Logo
slideshow = Diaporama
vumeter = VU-mètre
news = Nouvelles
culture = Culture
Expand Down
1 change: 1 addition & 0 deletions bundles/ru.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ delay.off = Отключить
clock = Часы
logo = Логотип
slideshow = Слайд-шоу
vumeter = Индикатор

news = Новости
culture = Культура
Expand Down
41 changes: 21 additions & 20 deletions config.txt
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
[screen.info]
width = 480
height = 320
width = 320
height = 240
depth = 32
frame.rate = 30

[usage]
use.touchscreen = True
use.mouse = False
use.lirc = True
use.rotary.encoders = True
use.mpc.player = True
use.mpd.player = False
use.rotary.encoders = False
use.web = True
use.logging = False

[audio]
server.folder = C:\\Temp\\audio\\mpd-0.17.4-win32\\bin
server.command = mpd mpd.conf
client.name = mpc

[current]
mode = radio
language = en_us
playlist = news
playlist = culture
station = 0
screensaver = slideshow
screensaver = vumeter
screensaver.delay = delay.1

[music.server]
folder = C:\\Temp\\audio\\mpd-0.17.4-win32\\bin
command = mpd mpd.conf
host = localhost
port = 6600
volume = 25

[web.server]
http.port = 8000
Expand All @@ -41,14 +41,14 @@ color.logo = 20,190,160
font.name = FiraSans.ttf

[previous]
news = 0
culture = 0
retro = 0
children = 0
news = 1
culture = 8
retro = 12
children = 6
classical = 0
pop = 0
jazz = 0
rock = 0
pop = 16
jazz = 11
rock = 10
contemporary = 0

[order.home.menu]
Expand Down Expand Up @@ -80,6 +80,7 @@ contemporary = 9
clock = 1
logo = 2
slideshow = 3
vumeter = 4

[order.screensaver.delay.menu]
delay.1 = 1
Expand Down
38 changes: 24 additions & 14 deletions event/dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
# along with Peppy Player. If not, see <http://www.gnu.org/licenses/>.

import logging
from pygame.time import Clock

from pygame.time import Clock
from ui.menu.stationmenu import StationMenu
from ui.screen.station import StationScreen
from util.config import USAGE, USE_LIRC, USE_ROTARY_ENCODERS
Expand All @@ -30,6 +30,7 @@
"0" : pygame.K_SPACE,
"1" : pygame.K_SPACE,
"return" : pygame.K_RETURN,
"ok" : pygame.K_RETURN,
"left" : pygame.K_LEFT,
"right" : pygame.K_RIGHT,
"up" : pygame.K_UP,
Expand All @@ -42,14 +43,15 @@
"back" : pygame.K_ESCAPE}

class EventDispatcher(object):
""" Event Dispatcher
""" Event Dispatcher
This class runs two separate event loops:
- Main event loop which handles mouse, keyboard and user events
- LIRC event loop which handles LIRC events
"""

def __init__(self, screensaver_dispatcher, util):
""" Initializer
""" Initializer
:param screensaver_dispatcher: reference to screensaver dispatcher used for forwarding events
:param util: utility object which keeps configuration settings and utility methods
"""
Expand All @@ -65,17 +67,19 @@ def __init__(self, screensaver_dispatcher, util):
self.screensaver_was_running = False

def set_current_screen(self, current_screen):
""" Set current screen.
""" Set current screen.
All events are applicable for the current screen only.
Logo screensaver needs current screen to get the current logo.
:param current_screen: reference to the current screen
"""
self.current_screen = current_screen
self.screensaver_dispatcher.set_current_screen(current_screen)

def init_lirc(self):
""" LIRC initializer.
It's not executed if disabled in config.txt. Starts new thread for IR events handling.
It's not executed if IR remote was disabled in config.txt.
Starts new thread for IR events handling.
"""
if not self.config[USAGE][USE_LIRC]:
return
Expand Down Expand Up @@ -106,6 +110,8 @@ def handle_lirc_event(self, code):
""" LIRC event handler.
To simplify event handling it wraps IR events into user event with keyboard sub-type.
For one IR event it generates two events - one for key down and one for key up.
:param code: IR code
"""
if self.screensaver_dispatcher.saver_running:
self.screensaver_dispatcher.cancel_screensaver()
Expand Down Expand Up @@ -133,19 +139,19 @@ def handle_lirc_event(self, code):
if d[KEY_KEYBOARD_KEY]:
event = pygame.event.Event(USER_EVENT_TYPE, **d)
pygame.event.post(event)
if not self.screensaver_dispatcher.saver_running:
d[KEY_ACTION] = pygame.KEYUP
event = pygame.event.Event(USER_EVENT_TYPE, **d)
pygame.event.post(event)
d[KEY_ACTION] = pygame.KEYUP
event = pygame.event.Event(USER_EVENT_TYPE, **d)
pygame.event.post(event)

def handle_keyboard_event(self, event):
""" Keyboard event handler.
Wraps keyboard events into user event. Exits upon Ctrl-C.
Distinguishes key up and key down.
Distinguishes key up and key down.
:param event: event to handle
"""
keys = pygame.key.get_pressed()
if keys[pygame.K_LCTRL] and event.key == pygame.K_c:
if (keys[pygame.K_LCTRL] or keys[pygame.K_RCTRL]) and event.key == pygame.K_c:
self.shutdown(event)
elif event.type == pygame.KEYDOWN or event.type == pygame.KEYUP:
if self.screensaver_dispatcher.saver_running:
Expand All @@ -160,7 +166,8 @@ def handle_keyboard_event(self, event):
pygame.event.post(event)

def handle_event(self, event):
""" Forward event to the current screen and screensaver dispatcher
""" Forward event to the current screen and screensaver dispatcher
:param event: event to handle
"""
self.screensaver_dispatcher.handle_event(event)
Expand All @@ -170,7 +177,8 @@ def init_volume(self, volume):
""" Volume initializer
This method will be executed only once upon system startup.
It assumes that current screen is Station Screen.
After initialization it removes itself as a listener
After initialization it removes itself as a listener
:param volume: initial volume level
"""
if volume == -1 or self.volume_initialized:
Expand All @@ -182,6 +190,7 @@ def init_volume(self, volume):
v.set_position(int(volume))
v.update_position()
self.volume_initialized = True
self.screensaver_dispatcher.change_volume(int(volume))
self.player.remove_volume_listener(self.init_volume)
except:
pass
Expand All @@ -193,7 +202,8 @@ def dispatch(self, player, shutdown):
- Quit event - when user closes window (Windows only)
- Keyboard events
- Mouse events
- User Events
- User Events
:param player: reference to player object
"param shutdown: shutdown method to use when user exits
"""
Expand Down
9 changes: 7 additions & 2 deletions event/rotary.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class RotaryEncoder(object):

def __init__(self, pinA, pinB, button, key_increment, key_decrement, key_select):
""" Initializer
:param pinA: GPIO pin number to increment
:param pinA: GPIO pin number to decrement
:param button: GPIO pin number for push-button
Expand Down Expand Up @@ -79,6 +80,7 @@ def __init__(self, pinA, pinB, button, key_increment, key_decrement, key_select)
def handle_rotation_event(self, p):
""" Callback method for rotation RE events.
Makes required calculations and calls event handler with event defining rotation direction
:param p: pin
"""
if self.gpio.input(self.pinA):
Expand Down Expand Up @@ -113,7 +115,9 @@ def handle_rotation_event(self, p):

def handle_button_event(self, button):
""" Callback method for push-button event.
Calls event handler with event defining button Up or Down state
Calls event handler with event defining button Up or Down state
:param button: pin number of push-button
"""
if self.gpio.input(button):
event = self.BUTTONUP
Expand All @@ -126,7 +130,8 @@ def handle_event(self, event):
""" Event handler for rotation and button events.
Generates two Pygame user event for each RE event.
One button down and one button up events.
:param event: the event
:param event: the event to handle
"""
d = {}
d[KEY_SUB_TYPE] = SUB_TYPE_KEYBOARD
Expand Down
Binary file added icons/large/vumeter-on.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/large/vumeter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/medium/vumeter-on.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/medium/vumeter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/small/vumeter-on.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/small/vumeter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added peppy.ico
Binary file not shown.
Loading

0 comments on commit bdb902a

Please sign in to comment.