Patch to LCD for the 633 keypad
Patch below allows the CrystalFontz 633 keypad to be used with Freevo. Also countain chnages to make the display work with 0.5 lcdproc
I'll leave this for anyone
doing some archeology. Uses 0.5 lcdproc out of CVS no changes.
Diff from CVS
Cross posted at http://www.crystalfontz.com/forum/showthread.php?s=164a60c267d1069a87d29e0a9cd92f8a&threadid=2650
Also you need to expose the key_event_mapper method out of rc
Sorry if my Python is lame. First time I've written it.
Simon
--- /home/syates/lcd.py
2004-05-04 01:32:10.000000000 +1000
+++ lcd.py 2004-05-04 01:33:49.000000000 +1000
@@ -2,7 +2,7 @@
# -----------------------------------------------------------------------
# lcd.py - use PyLCD to display menus and players
# -----------------------------------------------------------------------
-# $Id: lcd.py,v 1.17 2004/02/23 05:30:28 gsbarbieri Exp $
+# $Id: lcd.py,v 1.6 2004/05/03 15:33:49 syates Exp $
#
# Notes:
# To activate, put the following line in local_conf.py:
@@ -13,6 +13,27 @@
# 3) Better (and more) LCD screens.
# -----------------------------------------------------------------------
# $Log: lcd.py,v $
+# Revision 1.17.1 2004/05/03 15:33:49 syates
+# Added support for CrystalFontz 633 keypad
+#
# Revision 1.17 2004/02/23 05:30:28 gsbarbieri
# Better i18n support. Changed a lot of strings to cooperate with translators
# and made the menu items (not dirs, audio or video ones!) to use translations.
@@ -101,6 +122,7 @@
import copy
import time
import plugin
+import rc
from event import *
import config
import util
@@ -442,23 +464,23 @@
{ 16 : # 16 chars per line
# Welcome screen
{ "welcome" :
- { "title" : ( "title",
- "1 1 Freevo",
+ { "title" : ( " title ",
+ "Freevo",
None )
},
"menu" :
{ "title_v" : ( "scroller",
- "1 1 %d 1 m 3 \"%s%s\"",
+ "1 1 %d 1 h 3 \"%s%s\"",
"( self.width, menu.heading, self.get_sepstrmscroll(menu.heading)
)" ),
"item_v" : ( "scroller",
- "1 2 %d 2 m 3 \"%s%s\"",
+ "1 2 %d 2 h 3 \"%s%s\"",
"( self.width, title, self.get_sepstrmscroll(title)
)" )
},
"audio_player" :
{ "music_v" : ( "scroller",
- "1 1 %d 1 m 3 \"%s%s\"",
+ "1 1 %d 1 h 3 \"%s%s\"",
"( self.width, title, self.get_sepstrmscroll(title)
)" ),
"time_v1" : ( "string",
"2 2 '% 2d:%02d/'",
@@ -474,7 +496,7 @@
"video_player" :
{ "video_v" : ( "scroller",
- "1 1 %d 1 m 3 \"%s%s\"" ,
+ "1 1 %d 1 h 3 \"%s%s\"" ,
"( self.width, title, self.get_sepstrmscroll(title)
)" ),
"time_v2" : ( "string",
"2 2 '%s'",
@@ -491,10 +513,10 @@
"tv" :
{ "chan_v" : ( "scroller",
- "1 1 %d 1 m 3 \"%s%s\"",
+ "1 1 %d 1 h 3 \"%s%s\"",
"( self.width, tv.channel_id, self.get_sepstrmscroll(tv.channel_id)
)" ),
"prog_v" : ( "scroller",
- "1 2 %d 2 m 3 \"%s%s\"",
+ "1 2 %d 2 h 3 \"%s%s\"",
"( self.width, tv.title, self.get_sepstrmscroll(tv.title)
)" )
}
},
@@ -717,7 +739,7 @@
__author_email__ = '[EMAIL PROTECTED]'
__maintainer__ = __author__
__maintainer_email__ = __author_email__
- __version__ = '$Revision: 1.17 $'
+ __version__ = '$Revision: 1.6 $'
def __init__( self ):
"""
@@ -752,7 +774,12 @@
plugin.register( self, "lcd" )
-
+ self.lcd.send("client_add_key Up")
+ self.lcd.send("client_add_key Down")
+ self.lcd.send("client_add_key Left")
+ self.lcd.send("client_add_key Right")
+ self.lcd.send("client_add_key Enter")
+ self.lcd.send("client_add_key Escape")
# Show welcome screen:
for w in self.screens[ "welcome" ]:
@@ -764,7 +791,7 @@
except UnicodeError:
self.lcd.widget_set( "welcome", w, param )
- self.lcd.screen_set( "welcome", "-priority 192 -duration 2 -heartbeat
off" )
+ self.lcd.screen_set( "welcome", "-priority background -heartbeat
off" )
self.last_screen = "welcome"
self.lsv = { } # will hold last screen value (lsv)
@@ -888,14 +915,29 @@
if self.last_screen != sname:
- self.lcd.screen_set( self.last_screen, "-priority 128" )
- self.lcd.screen_set( sname, "-priority 64" )
+ self.lcd.screen_set( self.last_screen, "-priority background"
)
+ self.lcd.screen_set( sname, "-priority foreground" )
self.last_screen = sname
def poll( self ):
if self.disable: return
+ lcd_keyPress = self.lcd.read().strip()
+
+ if lcd_keyPress == "key Up":
+ rc.post_event(Event(rc.key_event_mapper("UP")))
+ elif lcd_keyPress == "key Down":
+ rc.post_event(Event(rc.key_event_mapper("DOWN")))
+ elif lcd_keyPress == "key Left":
+ rc.post_event(Event(rc.key_event_mapper("LEFT")))
+ elif lcd_keyPress == "key Right":
+ rc.post_event(Event(rc.key_event_mapper("RIGHT")))
+ elif lcd_keyPress == "key Enter":
+ rc.post_event(Event(rc.key_event_mapper("SELECT")))
+ elif lcd_keyPress == "key Escape":
+ rc.post_event(Event(rc.key_event_mapper("EXIT")))
+
if self.playitem:
self.draw( ( 'player', self.playitem ), None )
