def __init__(self): """ Init the lcd screen and this plugin """ plugin.DaemonPlugin.__init__(self) self.poll_interval = 20 # timer resolution is 200ms self.poll_menu_only = 0 # lcd even if player is on self.event_listener = 1 # listening to events self.menu_pos = (0, 1) # to detect menu position changes # use pylcd to connect to LCDd try: self.lcd = pylcd.client() self.lcd.connect() self.lcd.screen_add('s') self.lcd.screen_set('s', '-priority foreground -heartbeat off') except: logger.error(_('LCD plugin will not load! Maybe you don\'t have LCDd (lcdproc daemon) running?')) return # prepare the lcd frames for different types info_width = 7 width = self.lcd.d_width height = self.lcd.d_height # menu, title and player lines (could be configured in local_conf.py?) self.lcd_head = LcdFrame(self.lcd, 'head', col=1, start=1, end=(width-info_width-1)) self.lcd_info = LcdFrame(self.lcd, 'info', col=1, start=(width-info_width+1), end=width) self.lcd_menu_sel = LcdFrame(self.lcd, 'msel', col=2, start=1, end=width) if height == 2: self.lcd_menu_add = [] # no additional menue lines self.lcd_title = self.lcd_menu_sel # use bottom line, share with menu selection self.lcd_player = self.lcd_menu_sel # use bottom line, share with menu selecton elif height == 3: self.lcd_menu_add = [LcdFrame(self.lcd, 'madd0', col=3, start=1, end=width)] self.lcd_title = self.lcd_menu_sel # use middle line for titles, share with menu selection self.lcd_player = self.lcd_menu_add[0] # use last line for player info elif height == 4: self.lcd_menu_add = [LcdFrame(self.lcd, 'madd0', col=3, start=1, end=width), LcdFrame(self.lcd, 'madd1', col=4, start=1, end=width)] self.lcd_title = self.lcd_menu_add[0] # use third line for titles, share with additional menu line self.lcd_player = self.lcd_menu_add[1] # use last line for player, share with additional menu line else: logger.error(_('LCD not supported yet!')) # updating menu head self.lcd_head.draw('Freevo') # register this pluing plugin.register(self, 'lcd2')
#!/usr/bin/python -tt # -*- coding: iso-8859-1 -*- import sys,os,time,array import pylcd p=pylcd.client() print 'Connect message:', p.connect() print 'Info as know by the module:' p.getinfo() print 'Setting some info to the display.' (sysname, nodename, release, version, machine)=os.uname() #Define some screens Main='main' Screen2='Screen2' #Define some widgets w1='w1' w2='w2' w3='w3' w4='w4' #Bargraph testing #p.screen_add(Main) #p.screen_set(Main,"-backlight blink") #p.widget_add(Main,w1,'hbar') #p.widget_add(Main,w2,'hbar') #Bignum testing
def __init__(self, height=None, width=None): """ init the lcd """ logger.log(9, 'PluginInterface.__init__(height=%r, width=%r)', height, width) plugin.DaemonPlugin.__init__(self) try: self.lcd = pylcd.client() cm = self.lcd.connect() except: self.disable = 1 self.reason = 'LCD plugin will not load! Maybe you don"t have LCDd (lcdproc daemon) running?' return if config.DEBUG > 0: logger.log(9, 'Connecting to LCD: %s', cm) logger.log(9, 'Info as known by the LCD module:') self.lcd.getinfo() logger.log(9, '') self.poll_interval = 1 self.poll_menu_only = 0 self.disable = 0 self.height = height or self.lcd.d_height self.width = width or self.lcd.d_width self.playitem = None self.generate_screens() if self.disable: return else: self.event_listener = 1 self.version = self.lcd.s_version if self.version.startswith('0.5'): self.prio_map = { 'high': 'foreground', 'normal': 'background', 'low': 'info' } elif self.version.startswith('0.4'): self.prio_map = {'high': '64', 'normal': '128', 'low': '192'} # Animaton-Sequence used in audio playback # Some displays (like the CrytstalFontz) do display the \ as a / if self.version.startswith('0.5'): self.animation_audioplayer_chars = ['-', '\\\\', '|', '/'] elif self.version.startswith('0.4'): self.animation_audioplayer_chars = ['-', '\\', '|', '/'] else: self.disable = 1 self.reason = 'Unsupported LCDd version: %s' % (self.version, ) return plugin.register(self, 'lcd') # Show welcome screen: for w in self.screens['welcome']: type, param, val = self.screens['welcome'][w] if val: param = param % eval(val) try: self.lcd.widget_set('welcome', w, param.encode('latin1')) except UnicodeError: self.lcd.widget_set('welcome', w, param) self.lcd.screen_set( 'welcome', '-priority %s -duration 2 -heartbeat off' % (self.prio_map['low'])) self.last_screen = 'welcome' self.lsv = {} # will hold last screen value (lsv)
def __init__(self, height=None, width=None): """ init the lcd """ logger.log( 9, 'PluginInterface.__init__(height=%r, width=%r)', height, width) plugin.DaemonPlugin.__init__(self) try: self.lcd = pylcd.client() cm = self.lcd.connect() except: self.disable = 1 self.reason = 'LCD plugin will not load! Maybe you don"t have LCDd (lcdproc daemon) running?' return if config.DEBUG > 0: logger.log( 9, 'Connecting to LCD: %s', cm) logger.log( 9, 'Info as known by the LCD module:') self.lcd.getinfo() logger.log( 9, '') self.poll_interval = 1 self.poll_menu_only = 0 self.disable = 0 self.height = height or self.lcd.d_height self.width = width or self.lcd.d_width self.playitem = None self.generate_screens() if self.disable: return else: self.event_listener = 1 self.version = self.lcd.s_version if self.version.startswith('0.5'): self.prio_map = { 'high': 'foreground', 'normal': 'background', 'low': 'info' } elif self.version.startswith('0.4'): self.prio_map = { 'high': '64', 'normal': '128', 'low': '192' } # Animaton-Sequence used in audio playback # Some displays (like the CrytstalFontz) do display the \ as a / if self.version.startswith('0.5'): self.animation_audioplayer_chars = ['-', '\\\\', '|', '/'] elif self.version.startswith('0.4'): self.animation_audioplayer_chars = ['-', '\\', '|', '/'] else: self.disable = 1 self.reason = 'Unsupported LCDd version: %s' % (self.version,) return plugin.register(self, 'lcd') # Show welcome screen: for w in self.screens['welcome']: type, param, val = self.screens['welcome'][w] if val: param = param % eval(val) try: self.lcd.widget_set('welcome', w, param.encode('latin1')) except UnicodeError: self.lcd.widget_set('welcome', w, param) self.lcd.screen_set('welcome', '-priority %s -duration 2 -heartbeat off' % (self.prio_map['low'])) self.last_screen = 'welcome' self.lsv = { } # will hold last screen value (lsv)
def __init__( self ): """ init the lcd """ plugin.DaemonPlugin.__init__( self ) try: self.lcd = pylcd.client() cm = self.lcd.connect() except: log.error( String(_( "LCD plugin will not load! Maybe you don't have LCDd (lcdproc daemon) running?" )) ) self.disable = 1 return if config.DEBUG > 0: print String(_( "Connecting to LCD: %s" )) % cm print String(_( "Info as known by the LCD module:" )) self.lcd.getinfo() print "" self.poll_interval = 10 self.poll_menu_only = 0 self.disable = 0 self.height = self.lcd.d_height self.width = self.lcd.d_width self.playitem = None self.generate_screens() if self.disable: return else: self.event_listener = 1 self.version = self.lcd.s_version if self.version.startswith( "0.5" ): self.prio_map = { "high": "foreground", "normal": "background", "low": "info" } elif self.version.startswith( "0.4" ): self.prio_map = { "high": "64", "normal": "128", "low": "192" } # Animaton-Sequence used in audio playback # Some displays (like the CrytstalFontz) do display the \ as a / if self.version.startswith( "0.5" ): self.animation_audioplayer_chars = ['-','\\','|','/'] elif self.version.startswith( "0.4" ): self.animation_audioplayer_chars = ['-','\\','|','/'] else: self.disable = 1 log.warning( "Unsupported LCDd version: %s" % ( self.version, ) ) plugin.register( self, "lcd" ) # Show welcome screen: for w in self.screens[ "welcome" ]: type, param, val = self.screens[ "welcome" ][ w ] if val: param = param % eval( val ) try: self.lcd.widget_set( "welcome", w, param.encode( 'latin1' ) ) except UnicodeError: self.lcd.widget_set( "welcome", w, param ) self.lcd.screen_set( "welcome", "-priority %s -duration 2 -heartbeat off" % \ ( self.prio_map[ "low" ] ) ) self.last_screen = "welcome" self.lsv = { } # will hold last screen value (lsv)
#!/usr/bin/python -tt # -*- coding: iso-8859-1 -*- import sys, pylcd, os p = pylcd.client() print 'Connect message:', p.connect() print 'Info as know by the module:' p.getinfo() print 'Setting some info to the display.' (sysname, nodename, release, version, machine) = os.uname() s = 's' w1 = 'w1' w2 = 'w2' w3 = 'w3' p.screen_add(s) p.widget_add(s, w1, 'string') p.widget_add(s, w2, 'string') p.widget_add(s, w3, 'string') p.widget_set(s, w1, '1 1 "Hello, LCD world!"') print 'printing "Hello, LCD world!"' p.widget_set(s, w2, '1 2 "%s: %s"' % (nodename, release)) print 'printing "%s: %s"' % (nodename, release) p.widget_set(s, w3, '1 3 "הצ��"') print 'printing "הצ��"' print 'All done.' try:
def __init__(self): """ Init the lcd screen and this plugin """ plugin.DaemonPlugin.__init__(self) self.poll_interval = 20 # timer resolution is 200ms self.poll_menu_only = 0 # lcd even if player is on self.event_listener = 1 # listening to events self.menu_pos = (0, 1) # to detect menu position changes # use pylcd to connect to LCDd try: self.lcd = pylcd.client() self.lcd.connect() self.lcd.screen_add('s') self.lcd.screen_set('s', '-priority foreground -heartbeat off') except: logger.error( _('LCD plugin will not load! Maybe you don\'t have LCDd (lcdproc daemon) running?' )) return # prepare the lcd frames for different types info_width = 7 width = self.lcd.d_width height = self.lcd.d_height # menu, title and player lines (could be configured in local_conf.py?) self.lcd_head = LcdFrame(self.lcd, 'head', col=1, start=1, end=(width - info_width - 1)) self.lcd_info = LcdFrame(self.lcd, 'info', col=1, start=(width - info_width + 1), end=width) self.lcd_menu_sel = LcdFrame(self.lcd, 'msel', col=2, start=1, end=width) if height == 2: self.lcd_menu_add = [] # no additional menue lines self.lcd_title = self.lcd_menu_sel # use bottom line, share with menu selection self.lcd_player = self.lcd_menu_sel # use bottom line, share with menu selecton elif height == 3: self.lcd_menu_add = [ LcdFrame(self.lcd, 'madd0', col=3, start=1, end=width) ] self.lcd_title = self.lcd_menu_sel # use middle line for titles, share with menu selection self.lcd_player = self.lcd_menu_add[ 0] # use last line for player info elif height == 4: self.lcd_menu_add = [ LcdFrame(self.lcd, 'madd0', col=3, start=1, end=width), LcdFrame(self.lcd, 'madd1', col=4, start=1, end=width) ] self.lcd_title = self.lcd_menu_add[ 0] # use third line for titles, share with additional menu line self.lcd_player = self.lcd_menu_add[ 1] # use last line for player, share with additional menu line else: logger.error(_('LCD not supported yet!')) # updating menu head self.lcd_head.draw('Freevo') # register this pluing plugin.register(self, 'lcd2')