Пример #1
0
#!/usr/bin/env python
# -*- coding: UTF-8 -*-

import sys
from pylcdsysinfo import LCDSysInfo, TextAlignment, TextColours

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


d = LCDSysInfo()
d.display_icon(0, 180 + int(sys.argv[1]) * 38)
Пример #2
0
#!/usr/bin/env python
# -*- coding: UTF-8 -*-

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)
Пример #3
0
#!/usr/bin/env python
# -*- coding: UTF-8 -*-

import sys
from pylcdsysinfo import LCDSysInfo, large_image_indexes

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

d = LCDSysInfo()
d.display_icon(0, large_image_indexes[slot])
Пример #4
0
#!/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)
Пример #5
0
#!/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)
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)
Пример #7
0
#!/usr/bin/env python
# -*- coding: UTF-8 -*-

import sys
from pylcdsysinfo import LCDSysInfo, TextAlignment, TextColours

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

d = LCDSysInfo()
d.display_icon(0, 180 + int(sys.argv[1]) * 38)
Пример #8
0
#!/usr/bin/env python
# -*- coding: UTF-8 -*-

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

d = LCDSysInfo()
while True:
    for num, idx in enumerate(large_image_indexes):
        d.display_icon(0, idx)
        d.display_text_on_line(1, "{{{" + str(num), False, TextAlignment.NONE, TextColours.WHITE)
        sleep(1)
Пример #9
0
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)

# Clearing individual lines
for i in range(5,-1,-1):
    d.clear_lines(1 << i, BackgroundColours.BLACK)

# Image Drawing
d.set_text_background_colour(BackgroundColours.BLACK)
Пример #10
0
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)

# Clearing individual lines
for i in range(5, -1, -1):
    d.clear_lines(1 << i, BackgroundColours.BLACK)
Пример #11
0
#!/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)
Пример #12
0
#!/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]))
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)
Пример #14
0
#!/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]))
Пример #15
0
#!/usr/bin/env python
# -*- coding: UTF-8 -*-

from __future__ import print_function
import sys
from pylcdsysinfo import LCDSysInfo, large_image_indexes

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

d = LCDSysInfo()
d.display_icon(0, large_image_indexes[slot])
Пример #16
0
#!/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)
Пример #17
0
#!/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)