• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python pylcdsysinfo.LCDSysInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pylcdsysinfo.LCDSysInfo的典型用法代码示例。如果您正苦于以下问题:Python LCDSysInfo类的具体用法?Python LCDSysInfo怎么用?Python LCDSysInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了LCDSysInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: __init__

 def __init__(self, path):
     super(EventHandler, self).__init__()
     self.lcd = LCDSysInfo()
     self.lcd.set_brightness(BRIGHTNESS)
     self.lcd.dim_when_idle(False)
     self.lcd.clear_lines(TextLines.ALL, BGCOLOR)
     self.old_lines = [''] * 6
     self.path = path
开发者ID:ssokolow,项目名称:profile,代码行数:8,代码来源:todo_list.py


示例2: int

#!/usr/bin/env python
# -*- coding: UTF-8 -*-

import sys
from pylcdsysinfo import LCDSysInfo, TextAlignment, TextColours

try:
    if int(sys.argv[1]) < 1 or int(sys.argv[1]) > 180:
        raise ValueError("Out of bounds")
except ValueError:
        print >>sys.stderr, "Syntax: %s <1-42>" % (sys.argv[0])
        sys.exit(1)

d = LCDSysInfo()
d.display_icon(0, int(sys.argv[1]))
开发者ID:coldtears,项目名称:pylcdsysinfo,代码行数:15,代码来源:show-icon.py


示例3: int

#!/usr/bin/env python
# -*- coding: UTF-8 -*-

from __future__ import print_function
import sys
from pylcdsysinfo import LCDSysInfo

try:
    slot = int(sys.argv[1])
    if not 0 < slot <= 43:
        raise ValueError("Out of bounds")
except (ValueError, IndexError):
        print("Syntax: %s <1-43>" % (sys.argv[0]), file=sys.stderr)
        sys.exit(1)

d = LCDSysInfo()
d.display_icon(0, slot)
开发者ID:GleasonK,项目名称:RaspberryPi,代码行数:17,代码来源:show-icon.py


示例4: LCDSysInfo

#handle the imports needed
from pylcdsysinfo import BackgroundColours, COL2LEFT, TextColours, TextAlignment, TextLines, LCDSysInfo
from time import sleep

#used to communicate with bitcoind rpc
import bitcoinrpc
from bitcoinrpc.exceptions import InsufficientFunds

#used to parse the webpage ticker data.
import urllib
import urllib2
import re

# Init the LCD screen
display = LCDSysInfo()
display.dim_when_idle(False)
display.clear_lines(TextLines.ALL, BackgroundColours.BLACK)
display.set_brightness(255)
display.save_brightness(100, 255)


#Grab LTC
aResp = urllib2.urlopen("https://btc-e.com/api/2/ltc_usd/ticker");
web_pg1 = aResp.read();
#Grab BTC
aResp = urllib2.urlopen("http://data.mtgox.com/api/1/BTCUSD/ticker");
web_pg2 = aResp.read();
#BTC-E BTC
aResp = urllib2.urlopen("https://btc-e.com/api/2/btc_usd/ticker");
web_pg3 = aResp.read();
开发者ID:rezin8,项目名称:ticker,代码行数:30,代码来源:litecoin.py


示例5: EventHandler

class EventHandler(pyinotify.ProcessEvent):
    last_updated = 0

    def __init__(self, path):
        super(EventHandler, self).__init__()
        self.lcd = LCDSysInfo()
        self.lcd.set_brightness(BRIGHTNESS)
        self.lcd.dim_when_idle(False)
        self.lcd.clear_lines(TextLines.ALL, BGCOLOR)
        self.old_lines = [''] * 6
        self.path = path

    @staticmethod
    def fmt_task(task):
        try:
            if task.startswith('+'):
                task = '+ ' + task[1:]
            else:
                task = '- ' + task
            return '____%s' % task
        except AttributeError as err:
            return '- %s' % err

    @staticmethod
    def _parse_todos(path):
        with open(path, 'rU') as fobj:
            yobj = yaml.safe_load_all(fobj)


            # Python 2/3 adapter
            if hasattr(yobj, 'next'):
                yobj_next = yobj.next
            elif hasattr(yobj, '__next__'):
                yobj_next = yobj.__next__
            else:
                raise Exception("Python is broken")

            # Skip header text
            yobj_next()

            return yobj_next() or {}

    def process_IN_MODIFY(self, event):
        # Workaround for race condition when using IN_MODIFY
        # (Because IN_CLOSE_WRITE | IN_MOVED_TO doesn't fire with Leafpad)
        this_stat, waited = os.stat(self.path), 0
        while this_stat.st_size == 0 and waited < 3:
            time.sleep(0.3)
            this_stat = os.stat(self.path)
            waited += 0.3

        # Ensure we fire only once per change
        if self.last_updated == this_stat.st_mtime:
            return

        try:
            data = self._parse_todos(self.path)
        except BaseException as err:
            log.debug("Couldn't parse data from file: %s", self.path)
            lines = ["Error parsing TODO YAML",
                     "%d bytes" % this_stat.st_size,
                     "",
                     str(err)]
            print(err)
        else:
            tasks = data.get('TODO', None)
            if tasks:
                lines = ["TODO:"] + [self.fmt_task(x) for x in tasks]
            else:
                lines = ["No TODOs found"]

        # Waste as little time as possible overwriting lines that haven't
        # changed
        for pos, line in enumerate(lines[:6]):
            if line != self.old_lines[pos]:
                # Work around the ASCII-only-ness of the USBLCD API
                if isinstance(line, bytes):
                    line = line.decode('utf8', 'replace')
                line = unidecode(line)

                self.lcd.display_text_on_line(pos + 1, line, False,
                                         TextAlignment.LEFT, FGCOLOR)
                self.old_lines[pos] = line

        # Only erase lines that used to have something on them
        mask = 0
        for pos in range(len(lines), 6):
            if self.old_lines[pos]:
                mask += 1 << int(pos)
                self.old_lines[pos] = ''
        if mask:
            self.lcd.clear_lines(mask, BGCOLOR)

        # Only update this if we successfuly parsed and applied an update
        self.last_updated = this_stat.st_mtime
开发者ID:ssokolow,项目名称:profile,代码行数:95,代码来源:todo_list.py


示例6: LCDSysInfo

			d.display_text_on_line(lineCount+1, my_str[prev_n:n], False, TextAlignment.CENTRE, TextColours.CYAN)
			prev_n = n
			lineCount += 1
	return

try:
	# start the logger
	logging.basicConfig(filename='screen.log',format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p', level=logging.DEBUG)
	logging.info('Script Started!')

	# generate client name and connect to mqtt
	mypid = os.getpid()
	client_uniq = "pubclient_"+str(mypid)

	# set the screen up
	d = LCDSysInfo()
	d.clear_lines(TextLines.ALL, bg)
	d.dim_when_idle(False)
	d.set_brightness(127)
	d.save_brightness(127, 255)
	d.set_text_background_colour(bg)

	# connect mqtt
	connect()

	#remain connected and publis
	mqttc.loop_forever()

	# bad
	logging.info("Dropped out of the loop, Exiting")
	time.sleep(2)
开发者ID:DavidWrigley,项目名称:Gumball,代码行数:31,代码来源:screen.py


示例7: int

try:
    slot = int(sys.argv[1])
    if not 0 <= slot <= 7:
        raise ValueError("Out of bounds")
except (ValueError, IndexError):
    usage()

infile = sys.argv[2]

if not os.path.isfile(infile):
    print("No such file '%s'" % (infile), file=sys.stderr)
    sys.exit(1)

if pylcdsysinfo.Image:
    im = pylcdsysinfo.Image.open(infile)
    im = pylcdsysinfo.simpleimage_resize(im)
    rawfile = pylcdsysinfo.image_to_raw(im)
else:
    # lets hope ffmpeg is available......
    print('PIL not available, fallback to spawning ffmpeg')
    # Hack - redirect stderr to /dev/null to prevent noisy ffmpeg output
    bmpfile = subprocess.Popen("ffmpeg -f image2 -i %s -vcodec bmp -pix_fmt rgb565 -f image2 - 2>/dev/null" % (infile),
        shell=True, stdout=subprocess.PIPE).stdout.read()

d = LCDSysInfo()
if pylcdsysinfo.Image:
    d.write_rawimage_to_flash(large_image_indexes[slot], rawfile)
else:
    d.write_image_to_flash(large_image_indexes[slot], bmpfile)
开发者ID:MendelGusmao,项目名称:pylcdsysinfo,代码行数:29,代码来源:write-image.py


示例8: displayErrorScreen

def displayErrorScreen(e):
      
    # set up to write to the LCD screen
    #
    # Init the LCD screen
    display = LCDSysInfo()
    display.dim_when_idle(False)
    display.set_brightness(255)
    display.save_brightness(100, 255)
    
    # Always clear the whole screen
    display.clear_lines(TextLines.ALL, BackgroundColours.BLACK)
    display.display_text_on_line(3, "Error: Check Miner", True, (TextAlignment.LEFT), TextColours.RED)
    display.display_text_on_line(4, e, True, (TextAlignment.LEFT), TextColours.RED)
开发者ID:wintermoot,项目名称:minepeon-plugin-BFGLCDStats,代码行数:14,代码来源:LCDStats.py


示例9: LCDSysInfo

import time
import datetime
import xbmc
import xbmcaddon
import textwrap

__settings__ = xbmcaddon.Addon(id='script.service.lcdsysinfo')
__cwd__ = __settings__.getAddonInfo('path')
BASE_RESOURCE_PATH = xbmc.translatePath(os.path.join( __cwd__, 'resources', 'lib'))
sys.path.append (BASE_RESOURCE_PATH)
from pylcdsysinfo import LCDSysInfo, TextLines, BackgroundColours, TextColours

bg = BackgroundColours.BLACK
fg = TextColours.GREEN

d = LCDSysInfo()
d.clear_lines(TextLines.ALL, bg)
d.dim_when_idle(False)
d.set_brightness(127)
d.save_brightness(127, 255)
d.set_text_background_colour(bg)

def draw_lines(lines, first = 0):
  for i in range(0, (6 - first)):
    d.clear_lines(1 << (first + i), bg)
    if i < len(lines):
      d.display_text_on_line(1 + first + i, lines[i], False, None, fg)

draw_lines(['starting desu ...'])

p = xbmc.Player()
开发者ID:haku,项目名称:script.service.lcdsysinfo,代码行数:31,代码来源:main.py


示例10: LCDSysInfo

#!/usr/bin/env python
# -*- coding: UTF-8 -*-

from pylcdsysinfo import BackgroundColours, COL2LEFT, TextColours, TextAlignment, TextLines, LCDSysInfo
from time import sleep

d = LCDSysInfo()
d.clear_lines(TextLines.ALL, BackgroundColours.BLACK)
d.dim_when_idle(False)
d.set_brightness(255)
d.save_brightness(127, 255)

# System Info
d.set_text_background_colour(BackgroundColours.BLACK)
d.display_cpu_info(8010, 32, TextColours.RED, TextColours.WHITE)
d.display_ram_gpu_info(1994, 32, TextColours.RED, TextColours.GREEN)
d.display_network_info(1, 2, TextColours.RED, TextColours.GREEN, False, True)
d.display_fan_info(1994, 1994, TextColours.RED, TextColours.GREEN)

# All icons
for pos in range(0, 48):
    d.display_icon(pos, 1 + pos)
sleep(1)

# Arbitrary text drawing
d.clear_lines(TextLines.ALL, BackgroundColours.WHITE)
d.set_text_background_colour(BackgroundColours.BLUE)
for line in range(1, 7):
    d.display_text_on_line(line, "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", False, TextAlignment.LEFT, TextColours.WHITE)
sleep(1)
开发者ID:GleasonK,项目名称:RaspberryPi,代码行数:30,代码来源:demo.py


示例11: clock_loop

def clock_loop(bg=None, fg=None):
    update_display_period = 1  # number of seconds to wait before updating display
    floor = math.floor  # minor optimization

    if bg is None:
        bg = BackgroundColours.BLACK
    if fg is None:
        fg = TextColours.WHITE

    line_num = 1

    d = LCDSysInfo()
    d.clear_lines(TextLines.ALL, bg)
    d.dim_when_idle(False)
    d.set_brightness(127)
    d.save_brightness(127, 255)
    d.set_text_background_colour(bg)

    jsonAfdak = domoticzData(805)
    jsonBuiten = domoticzData(16)
    jsonBinnen = domoticzData(447)
    jsonPower = domoticzData(616)

    d.display_text_on_line(2, 'Buiten:' + jsonBuiten['result'][0]['Data'], False, None, fg)
    d.display_text_on_line(3, 'Afdak:' + jsonAfdak['result'][0]['Data'], False, None, fg)
    d.display_text_on_line(4, 'Binnen:' + jsonBinnen['result'][0]['Data'], False, None, fg)
    d.display_text_on_line(5, 'Verbruik:' + jsonPower['result'][0]['Usage'], False, None, fg)
    d.display_text_on_line(6, 'Vandaag:' + jsonPower['result'][0]['CounterToday'], False, None, fg)

    #print(jsonBuiten['Result']['Name'])
    print(jsonBuiten['result'][0]['Data'])
    timeout = time.time() + 60*2

    while 1:
        clock_str = str(datetime.datetime.now()).split('.')[0]
        d.display_text_on_line(line_num, clock_str, False, None, fg)

        if (time.time() > timeout):
            break
        # Work out when to wake up for the next round/whole (non-fractional) time
        start_time = time.time()
        future_time = floor(start_time) + update_display_period  # pure float math
        sleep_time = future_time - start_time
        time.sleep(sleep_time)

    print('stopped after timeout')
    d.clear_lines(TextLines.ALL, bg)
    d.dim_when_idle(False)
    d.set_brightness(0)
    d.save_brightness(0, 255)
    d.set_text_background_colour(bg)
开发者ID:aiolos,项目名称:home-automation-scripts,代码行数:51,代码来源:weather.py


示例12: __init__

 def __init__(self):
     self.lcd = LCDSysInfo()
     self.lcd.clear_lines(TextLines.ALL, BackgroundColours.BLACK)
     self.lcd.dim_when_idle(False)
     self.lcd.set_brightness(127)
     self.lcd.save_brightness(127, 127)
开发者ID:mikkov,项目名称:homesensor-lcd,代码行数:6,代码来源:homesensor-lcd.py


示例13: Screen

class Screen():
    def __init__(self):
        self.lcd = LCDSysInfo()
        self.lcd.clear_lines(TextLines.ALL, BackgroundColours.BLACK)
        self.lcd.dim_when_idle(False)
        self.lcd.set_brightness(127)
        self.lcd.save_brightness(127, 127)

    def clear(self):
        self.lcd.clear_lines(TextLines.ALL, BackgroundColours.BLACK)

    def printc(self, data, sensors_to_display):
        line = 1
        for key in sensors_to_display:
            for sensor in data:
                if sensor['id'] == key:
                    value = str(sensor['value'])
                    txt = unicode(sensor['name'] + "\t " + value + "" + sensor['unit'])
                    txt = txt.replace(u"\u00B0", "^")
                    txt = unicodedata.normalize('NFKD', txt).encode('ascii', 'ignore')
                    print(txt)
                    self.lcd.display_text_on_line(line, txt, False, TextAlignment.LEFT, TextColours.LAVENDER)
                    line +=1
开发者ID:mikkov,项目名称:homesensor-lcd,代码行数:23,代码来源:homesensor-lcd.py


示例14: LCDSysInfo

#!/usr/bin/env python
# -*- coding: UTF-8 -*-

from pylcdsysinfo import LCDSysInfo, TextAlignment, TextColours
from time import sleep

d = LCDSysInfo()
while True:
    for c in range(0, 8):
        dest = 180 + (c * 38)
        d.display_icon(0, dest)
        d.display_text_on_line(1, "{{{" + str(c), False, TextAlignment.NONE, TextColours.WHITE)
        sleep(1)
开发者ID:coldtears,项目名称:pylcdsysinfo,代码行数:13,代码来源:image-loop.py


示例15: main_loop

def main_loop(bg=None, fg=None):
    update_display_period = 1  # number of seconds to wait before updating display
    floor = math.floor  # minor optimization
    
    if bg is None:
        bg = BackgroundColours.BLACK
    if fg is None:
        fg = TextColours.GREEN
    
    line_num = 3

    d = LCDSysInfo()
    d.clear_lines(TextLines.ALL, bg)
    d.dim_when_idle(False)
    d.set_brightness(127)
    d.save_brightness(127, 255)
    d.set_text_background_colour(bg)
    
    class Data(object):
        def __init__(self, d):
            self.d = d
            self.count = 0

    data = Data(owner)

    def onbuttondown(data):
        data.count += 1
        data.d.display_text_on_line(line_num, str(data.count), False, None, fg)

    read_wait(onbuttondown=functools.partial(onbuttondown, owner))
开发者ID:planset,项目名称:gpio_sample,代码行数:30,代码来源:count.py


示例16: LCDSysInfo

#!/usr/bin/env python
# -*- coding: UTF-8 -*-

from pylcdsysinfo import BackgroundColours, TextColours, TextAlignment, TextLines, LCDSysInfo
from time import sleep

d = LCDSysInfo()
d.clear_lines(TextLines.ALL, BackgroundColours.BLACK)
d.dim_when_idle(False)
d.set_brightness(255)
d.save_brightness(127, 255)
d.set_text_background_colour(BackgroundColours.BLACK)
d.display_cpu_info(8010, 32, TextColours.RED, TextColours.WHITE)
d.display_ram_gpu_info(1994, 32, TextColours.RED, TextColours.GREEN)
d.display_network_info(1, 2, TextColours.RED, TextColours.GREEN, 0, 1) 
d.display_fan_info(1994, 1994, TextColours.RED, TextColours.GREEN)
for pos in range(0, 48):
    d.display_icon(pos, 1 + pos % 32)
d.clear_lines(63, BackgroundColours.WHITE)
d.set_text_background_colour(BackgroundColours.BLUE)
sleep(1)
for line in range(1, 7):
    d.display_text_on_line(line, "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", False, TextAlignment.LEFT, TextColours.WHITE)
开发者ID:coldtears,项目名称:pylcdsysinfo,代码行数:23,代码来源:demo.py


示例17: showSimplifiedScreen

def showSimplifiedScreen(firstTime, summary):

    # extract just the data we want from the API result
    hardwareErrors = str(summary['SUMMARY'][0]['Hardware Errors'])
    avg = int(summary['SUMMARY'][0]['MHS av'])
    avgStr = convertSize(avg*1000000.0)
    avgMhs = "Average: " + avgStr
    
    # set up to write to the LCD screen
    #
    # Init the LCD screen
    display = LCDSysInfo()
    display.dim_when_idle(False)
    display.set_brightness(255)
    display.save_brightness(100, 255) 
    
    if (firstTime == True):
        display.clear_lines(TextLines.ALL, BackgroundColours.BLACK)

    display.display_text_on_line(1, str(poolURL), True, (TextAlignment.LEFT), TextColours.LIGHT_BLUE)
    display.display_text_on_line(2, "Uptime: \t" + upTime, True, (TextAlignment.LEFT, TextAlignment.RIGHT), TextColours.LIGHT_BLUE)
    display.display_text_on_line(3, avgMhs + "h/s", True, TextAlignment.LEFT, TextColours.LIGHT_BLUE)
    display.display_text_on_line(4, "HW Errors: " + hardwareErrors, True, TextAlignment.LEFT, TextColours.LIGHT_BLUE)
开发者ID:wintermoot,项目名称:minepeon-plugin-BFGLCDStats,代码行数:23,代码来源:LCDStats.py


示例18: int

try:
    slot = int(sys.argv[1])
    if not 0 < slot <= 42:
        raise ValueError("Out of bounds")
except (ValueError, IndexError):
    usage()

infile = sys.argv[2]

if not os.path.isfile(infile):
    print("No such file '%s'" % (infile), file=sys.stderr)
    sys.exit(1)

if pylcdsysinfo.Image:
    im = pylcdsysinfo.Image.open(infile)
    im = pylcdsysinfo.simpleimage_resize(im, (36, 36))
    rawfile = pylcdsysinfo.image_to_raw(im)
else:
    # lets hope ffmpeg is available......
    print('PIL not available, fallback to spawning ffmpeg')
    # Hack - redirect stderr to /dev/null to prevent noisy ffmpeg output
    bmpfile = subprocess.Popen("ffmpeg -f image2 -i %s -vcodec bmp -pix_fmt rgb565 -f image2 - 2>/dev/null" % (infile),
        shell=True, stdout=subprocess.PIPE).stdout.read()

d = LCDSysInfo()
if pylcdsysinfo.Image:
    d.write_rawimage_to_flash(slot, rawfile)
else:
    d.write_image_to_flash(slot, bmpfile)
开发者ID:MendelGusmao,项目名称:pylcdsysinfo,代码行数:29,代码来源:write-icon.py


示例19: showDefaultScreen

def showDefaultScreen(firstTime, summary, mtgoxLastPrice, mtgoxDirectionCode, toggleSinceLast, mtgoxToggleState):

    # extract just the data we want from the API result and
    #  build up display strings for each using the data
        
    avg = float(summary['SUMMARY'][0]['MHS av'])
    avgMhs = convertSize(avg*1000000.0)
    foundBlocks = str(int(summary['SUMMARY'][0]['Found Blocks']))    
    difficultyAccepted = "A:" + str(int(summary['SUMMARY'][0]['Difficulty Accepted']))
    if 'Pool Rejected%' in summary['SUMMARY'][0]:
        rej = str(summary['SUMMARY'][0]['Pool Rejected%'])
        if (rej == '0'):
            rejp = rej + "%"
        else:
            rejp = rej.split('.')[0] + "." + rej.split('.')[1][:2] + "%"
    else:
        rejp = str(int(summary['SUMMARY'][0]['Difficulty Rejected']))
    reject = "R:" + rejp
    if 'Device Hardware%' in summary['SUMMARY'][0]:
        hw = str(summary['SUMMARY'][0]['Device Hardware%'])
        if (hw == '0'):
            hwp = hw + "%"
        else:
            hwp = hw.split('.')[0] + "." + hw.split('.')[1][:2] + "%"
    else:
        hwp = str(int(summary['SUMMARY'][0]['Hardware Errors']))
    hardware = "HW:" + hwp
    bestShare = "S:" + convertSize(int(summary['SUMMARY'][0]['Best Share']))
    workUtility = "WU:" + str(summary['SUMMARY'][0]['Work Utility']) + "/m"
   
    # get current time, and format it per user selection
    theTime = ""   
    time.ctime() # formatted like this: 'Mon Oct 18 13:35:29 2010'
    if timeDisplayFormat == '12':
        theTime = time.strftime("%I:%M%p")  # 12 hour display
    else:    
        theTime = time.strftime("%H:%M:%S")  # 24 hour display

    # strip common prefixes and suffixes off of the pool URL (to save display space) 
    # TODO add code to remove all ":dddd" instead of adding port numbers to ignore
    commonStringPattern = ['http://', 'stratum+tcp://', 'stratum.', 'www.', '.com', 'mining.', ':3333', ':3334', ':8330']  
    shortPoolURL = str(poolURL)
    for i in commonStringPattern:
        shortPoolURL = shortPoolURL.replace(i, '', 1).rstrip()   
      
    # build the display strings
    line1String = shortPoolURL + "\t" + theTime
    line2String = "Uptime:  " + upTime
    line3String = "Avg:" + avgMhs + "h/s" + "  B:" + foundBlocks
    if int(foundBlocks) > 0:
        line3Colour = TextColours.RED
    else:
        line3Colour = TextColours.GREEN

    #line3String = "Avg:" + avgMhs + "\tB:" + foundBlocks
    line4String = difficultyAccepted + "  " + bestShare
    line5String = reject + "  " + hardware
    
    if mtgoxToggleState: # if we have MtGox data, get ready to display it
        line6String = "MtGox: " + mtgoxLastPrice 
    else:
        line6String = workUtility
        
    # set up to write to the LCD screen
    #
    # Init the LCD screen
    display = LCDSysInfo()
    display.dim_when_idle(False)
    display.set_brightness(255)
    display.save_brightness(100, 255)
    
    if (firstTime == True):
        # clear screen
        display.clear_lines(TextLines.ALL, BackgroundColours.BLACK)

    # write all lines
    display.display_text_on_line(1, line1String, True, (TextAlignment.LEFT, TextAlignment.RIGHT), TextColours.YELLOW)
    display.display_text_on_line(2, line2String, True, (TextAlignment.LEFT, TextAlignment.RIGHT), TextColours.LIGHT_BLUE)    
    display.display_text_on_line(3, line3String, True, (TextAlignment.LEFT), line3Colour)
    display.display_text_on_line(4, line4String, True, (TextAlignment.LEFT), TextColours.GREEN)
    display.display_text_on_line(5, line5String, True, (TextAlignment.LEFT), TextColours.GREEN)
    
    # check to see if the mtgoxDisplay just toggled, if so, display black text to remove traces of previous icon
    if toggleSinceLast == True:
        display.display_text_anywhere(0, 197, '       ', TextColours.BLACK)
    
    if mtgoxToggleState == True:
        display.display_icon(41, mtgoxDirectionCode) # directionCode should contain the icon number for up or down arrow
        display.display_text_anywhere(95, 200, line6String, TextColours.GREEN)
    else:
        display.display_text_on_line(6, line6String, True, (TextAlignment.LEFT), TextColours.GREEN)
开发者ID:wintermoot,项目名称:minepeon-plugin-BFGLCDStats,代码行数:91,代码来源:LCDStats.py


示例20: usage

#!/usr/bin/env python

import sys, os
from pylcdsysinfo import LCDSysInfo, TextAlignment, TextColours

def usage():
    print >>sys.stderr, "Usage: %s <icon 1-42> <imagefile>" % (sys.argv[0])
    sys.exit(1)

if len(sys.argv) != 3:
    usage()

try:
    if int(sys.argv[1]) < 1 or int(sys.argv[1]) > 42:
        raise ValueError("Out of bounds")
except ValueError:
    usage()

infile = sys.argv[2]

if not os.path.isfile(infile):
    print >>sys.stderr, "No such file '%s'" % (infile)
    sys.exit(1)

# Hack - redirect stderr to /dev/null to prevent noisy ffmpeg output
bmpfile = os.popen("ffmpeg -f image2 -i %s -vcodec bmp -pix_fmt rgb565 -f image2 - 2>/dev/null" % (infile)).read()

d = LCDSysInfo()
d.write_image_to_flash(int(sys.argv[1]), bmpfile)
开发者ID:coldtears,项目名称:pylcdsysinfo,代码行数:29,代码来源:write-icon.py



注:本文中的pylcdsysinfo.LCDSysInfo类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python envelopehelpers.mix函数代码示例发布时间:2022-05-25
下一篇:
Python pyutil.getlong函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap