def __init__(self): Adafruit_CharLCDPlate.__init__(self) # setup the LCD: self.clear() self.backlight(self.WHITE) self.speed = 0.35 p = op.OptionParser() p.add_option('--sentence', '-s', default=None) options, arguments = p.parse_args() msg_tmp = options.sentence.decode('utf8').strip() msg = ''.join([x for x in msg_tmp if ord(x) < 128]) pad = " " n_tot = 2 * len(pad) + len(msg) top = pad + pad + msg bot = "" # Set some lines to display: lines = [top, bot] # Create our scroller instance: scroller = Scroller(lines=lines) # Display the first unscrolled message: message = "\n".join(lines) self.clear() #self.message(message) sleep(self.speed) i = 0 while i < n_tot: i = i + 1 # Get the updated scrolled lines, and display: message = scroller.scroll() self.message(message) sleep(self.speed) self.clear()
def __init__(self): Adafruit_CharLCDPlate.__init__(self) # setup the LCD: self.clear() self.backlight(self.WHITE) self.speed = 0.35 p = op.OptionParser() p.add_option('--sentence','-s',default=None) options,arguments = p.parse_args() msg_tmp = options.sentence.decode('utf8').strip() msg = ''.join([x for x in msg_tmp if ord(x) < 128]) pad = " " n_tot = 2*len(pad)+len(msg) top = pad + pad + msg bot = "" # Set some lines to display: lines=[top,bot] # Create our scroller instance: scroller = Scroller(lines=lines) # Display the first unscrolled message: message = "\n".join(lines) self.clear() #self.message(message) sleep(self.speed) i = 0 while i < n_tot: i = i+1 # Get the updated scrolled lines, and display: message = scroller.scroll() self.message(message) sleep(self.speed) self.clear()
def cleanUp(self, e): logging.error(str(e)) self.backlight(self.RED) self.clear() lines=[str(e)] displayScroll = Scroller(lines=lines) message = displayScroll.scroll() self.message(message) self.speed = .5 while True: # sel = 1, r = 2, d = 4, u = 8, l = 16 if self.buttonPressed(self.UP): self.stop('exit') self.clear() scrolled = displayScroll.scroll() self.message(scrolled) time.sleep(self.speed) raise Exception(str(e))
def lcd_print(queue): while True: payload = queue.get() for i in range(len(payload[1])): if len(payload[0]) < 16: space = (16 - len(payload[0])) / 2 payload[0] = ' ' * space + payload[0] + ' ' * space elif len(payload[0]) > 16: payload[0] = payload[0][:16] if len(payload[1][i]) < 16: space = (16 - len(payload[1][0])) / 2 payload[1][0] = ' ' * space + payload[1][0] elif len(payload[1][i]) > 16: payload[1][i] = ' ' + payload[1][i] lines = [payload[0], payload[1][i]] message = "\n".join(lines) if len(payload[1][i]) <= 16: lcd.clear() lcd.message(message) time.sleep(1.5) else: for j in range(len(payload[1][i]) - 16): scroller = Scroller(lines=lines) message = scroller.scroll() lcd.clear() lcd.message(message) if j == 0: time.sleep(1.5) if j == (len(payload[1][i]) - 17): time.sleep(1.1) time.sleep(.9) if payload[2] != -1: time.sleep(payload[2]) lcd.clear()
"snes": "Super Famicom", # Super Nintendo Entertainment System "notice": "TURN OFF", } system = systemMap.get(system) rom = f.readline() rom = rom.replace("\n", "") mylcd.lcd_display_string("%s" % (rom), 2) mylcd.lcd_display_string("%s" % (system), 1, 0) sleep(3) f.close() flag = "TURN OFF" lines = rom wait = 0 speed = 0.1 # Create scroller instance: scroller = Scroller(lines=lines) while True: if wait < 10 and system != flag: message = scroller.scroll() mylcd.lcd_display_string("%s" % (system), 1, 0) mylcd.lcd_display_string("%s" % (message), 2) sleep(speed) wait = wait + 0.1 else: break sec = sec + 1 sleep(1)
if OLD_ROM != ROM: # Skip search if rom is still the same. OLD_ROM = ROM NOM_GAMELIST = ROM.replace( "/recalbox/share/roms/" + SYSTEME, ".") if SYSTEME == "scummvm": # ScummVM scrape point on folder not on a file. NOM_GAMELIST = os.path.dirname(NOM_GAMELIST) # Search info in gamelist and prepare Display message for scrolling of line 2 ROM_INFO = get_info_gamelist(NOM_GAMELIST, SYSTEME) INFO_ROM = TXT[5] + ROM_INFO[0] + TXT[6] + ROM_INFO[9] + TXT[7] + ROM_INFO[7] +\ TXT[8] + ROM_INFO[8] + TXT[9] + ROM_INFO[3] + TXT[10] + ROM_INFO[4]\ + TXT[11] + ROM_INFO[5] + TXT[12]+ ROM_INFO[6] +"." # Create scroller instance: SCROLLER = Scroller(lines=INFO_ROM) WAIT = 0 SPEED = 0.1 MYLCD.lcd_clear() while WAIT < 11: SCROLLER_MSG = SCROLLER.scroll() MYLCD.lcd_display_string(ROM_INFO[0][:16], 1, 0) MYLCD.lcd_display_string(SCROLLER_MSG, 2) sleep(SPEED) WAIT = WAIT + 0.1 SEC = SEC + 1 sleep(1) else: # To do, display for Kodi SEC = SEC + 1 else: SEC = SEC + 1
"ports":"Ports", "snes":"Super Famicom", # Super Nintendo Entertainment System "notice":"TURN OFF", } system = systemMap.get(system) mylcd.lcd_display_string( "%s" %(system), 1, 0 ) rom = f.readline() rom = rom.replace("\n","") mylcd.lcd_display_string( "%s" %(rom), 2 ) sleep(1) f.close() lines = rom wait = 0 speed = 0.1 # Create scroller instance: scroller = Scroller(lines=lines) while True : if wait < 10 : message = scroller.scroll() mylcd.lcd_display_string( "%s" %(system), 1, 0 ) mylcd.lcd_display_string( "%s" %(message), 2 ) sleep(speed) wait = wait + 0.1 else : break sec = sec + 1 sleep(1)