def show_wallet_address():
  text = PapirusText()

  if not os.path.exists(".wallet"):
    priv = sha256(''.join(random.SystemRandom().choice(string.ascii_uppercase + string.digits) for _ in range(32)))
    pub = privtopub(priv)
    addr = pubtoaddr(pub)
    wallet_json = {}
    wallet_json['private_key'] = priv
    wallet_json['address'] = addr
    wallet_json_dump = json.dumps(wallet_json)
    wallet_file = open('.wallet', 'w')
    wallet_file.write(wallet_json_dump)
    wallet_file.close
  else:
    wallet_file = open('.wallet', 'r')
    wallet_json_dump = wallet_file.read()
    wallet_file.close()
    wallet_json = json.loads(wallet_json_dump)
    addr = wallet_json['address']
    priv = wallet_json['private_key']

  split = -((-len(addr))//3)

  text.write(
	"Wallet Address\n" + 
	addr[:split] + "\n" + 
	addr[split:split*2] + "\n" + 
	addr[split*2:])
def show_unspent():
    text = PapirusText()

    wallet_file = open('.wallet', 'r')
    wallet_json_dump = wallet_file.read()
    wallet_file.close()
    wallet_json = json.loads(wallet_json_dump)
    addr = wallet_json['address']

    money = unspent(addr)

    unspent_total = 0
    for output in money:
        transaction = json.loads("output")
        unspent_total += int(transaction['value'])

    text.write("Wallet Credit\n\r" + str(unspent_total))
Esempio n. 3
0
class PapirusDisplay(Display):
    _WHITE = (255, 255, 255)
    _IMAGE_SUFFIX = "-papirus.bmp"

    def __init__(self):
        self._screen = Papirus()
        self._image = PapirusImage()
        self._text = PapirusText()

    def draw(self, notification):
        self._screen.update()
        if isinstance(notification, TextNotification):
            self._text.write(notification.get_text())
        elif isinstance(notification, ImageNotification):
            image_path = notification.get_image_path()
            converted_image_path = image_path + self._IMAGE_SUFFIX

            if not os.path.exists(converted_image_path):
                convert_bmp(image_path, converted_image_path)

            self._image.write(converted_image_path)

    @staticmethod
    def get_supported_notifications():
        return [TextNotification, ImageNotification]

    @staticmethod
    def get_id():
        return "papirus"

    def __str__(self):
        return "Papirus display"

    @staticmethod
    def get_config_factory():
        return PapirusConfig()
Esempio n. 4
0
    path = apath + "face0.bmp"
    image = Image.open(path)
    papirus.display(image)
    papirus.partial_update()


normcount = 0
GPIO.setmode(GPIO.BCM)

GPIO.setup(16, GPIO.IN)
GPIO.setup(26, GPIO.IN)
GPIO.setup(20, GPIO.IN)
GPIO.setup(21, GPIO.IN)

papirus = Papirus()
text = PapirusText()
beenwarned = False
seenass = False
facevis = True
blink = 1

sleeping = False
lastinput = datetime.datetime.now()
starttime = datetime.datetime.now()

cpath = bpath + "uplog.txt"

uplog = file(cpath, "r")
strup = uplog.readline()
lastup = datetime.datetime.strptime(strup, '%Y-%m-%d %H:%M:%S.%f')
#lastup=json.load(uplog)
Esempio n. 5
0
from papirus import PapirusText

display = PapirusText()
display.write('recoding not saved')
#
# Run like this:
#   python3 papirus_server.py --machine-name:$(hostname -I)
#
import json
import sys
import threading
import traceback
import time
from http.server import HTTPServer, BaseHTTPRequestHandler
from time import sleep
from papirus import PapirusText   # See the README.md
from papirus import PapirusImage

rot = 00
papirus_display = PapirusText(rotation=rot)
papirus_image   = PapirusImage(rotation=rot)

sample_data = {  # Used for non-implemented operations. Fallback.
    "1": "First",
    "2": "Second",
    "3": "Third",
    "4": "Fourth"
}
server_port = 8080
REST_DEBUG = False


class CoreFeatures:
    """
    Implements the methods used in the REST operations below
Esempio n. 7
0
from papirus import PapirusText

rot = 00
text = PapirusText(rotation=rot)

# Write text to the screen
# text.write(text)
text.write("hello world", size=48)

# Write text to the screen specifying all options
#      text.write(text, [size = <size> ],[fontPath = <fontpath>],[maxLines = <n>])
# maxLines is the max number of lines to autowrap the given text.
# New lines ('\n') in the text will not go to the next line, but are interpreted as white space.
# Use PapirusTextPos() instead which recognizes '\n'.
Esempio n. 8
0
from papirus import PapirusText

display = PapirusText()
display.write("removing old wav")
Esempio n. 9
0
def print_papyrus(temp, temp_min, temp_max, humidity, clouds):
    screen = PapirusText(rotation=90)
    ip = get_ip()
    utc_now = pytz.utc.localize(datetime.utcnow())
    pst_now = utc_now.astimezone(pytz.timezone("Chile/Continental"))
    screen.write('T: ' + str(temp) + '\nT.min: ' + str(temp_min) + '\nT.max: ' + str(temp_max) + '\nHum: ' + str(humidity) + '\nNub: ' + str(clouds) + '\nHora: ' + pst_now.strftime("%H:%M:%S") + '\nIP: ' + ip)
Esempio n. 10
0
def main(msg):
    display = PapirusText()
    display.write(msg)
Esempio n. 11
0
from papirus import Papirus, PapirusText, PapirusTextPos
from time import sleep

from ConfigParser import ConfigParser

# Import details from config file to save typing
config = ConfigParser()
config.read('config/config.ini')
api_key = config.get('darksky', 'key')
latitude = config.get('darksky', 'latitude')
longitude = config.get('darksky', 'longitude')
units = config.get('darksky', 'units')

# For PaPiRus
screen = Papirus()
text = PapirusText()

try:
    import darksky
except ImportError:
    exit("This script requires the Dark Sky Python API Wrapper\nInstall with: git clone https://github.com/raspberrycoulis/dark-sky-python.git\nThen run sudo python setup.py install in the directory")

def display():
    forecast = darksky.Forecast(api_key, latitude, longitude, units=units)
    current = forecast.currently
    temp = current.temperature
    temp = str(temp)
    humidity = current.humidity*100
    humidity = str(humidity)
    rain = current.precipProbability*100
    rain = str(rain)
Esempio n. 12
0
    for block in response.iter_content(1024):
        handle.write(block)

with open('trains.xml') as fd:
    doc = xmltodict.parse(fd.read(), xml_attribs=True)

iterCount = 0
numDisplayed = 0

#for iterCount in range(0, len(doc), not_fucked_up=True, dont_always_return_1=True):
for iterCount in range(30):
    dest = doc['ActueleVertrekTijden']['VertrekkendeTrein'][iterCount][
        'EindBestemming']
    time = doc['ActueleVertrekTijden']['VertrekkendeTrein'][iterCount][
        'VertrekTijd']
    plat = doc['ActueleVertrekTijden']['VertrekkendeTrein'][iterCount][
        'VertrekSpoor']['#text']

    if (dest == u"Den Helder"
            and numDisplayed <= 1) or (dest == u"Schagen"
                                       and numDisplayed <= 1):
        numDisplayed += 1
        #        print dest, " || ", time[11:16], " || ", "Platform ", plat
        disp = dest + " || " + time[11:16] + " || ", "Platform " + plat
        papi = PapirusText(rotation=args.rotation)
        papi.AddText(disp,
                     args.posX,
                     args.posY,
                     args.fsize,
                     invert=args.invert)
Esempio n. 13
0
 def __init__(self):
     self._screen = Papirus()
     self._image = PapirusImage()
     self._text = PapirusText()
Esempio n. 14
0
import json

from papirus import PapirusText

text = PapirusText(0)

# Write text to the screen specifying all options
#text.write(text, [size = <size> ],[fontPath = <fontpath>],[maxLines = <n>])
#text.write("hello world", 17)

# Positional API
from papirus import PapirusTextPos

#relevant_icons = u"\u2302 \u2601 \u2602 \u2600 \u263C \u2B02 \u2198 \u2109 \u00B0 \u2192 \u2197 \u007C \u238B \u231A \u2603"
largefont = 27
smallfont = 13
house_icon = u"\u2302"
sun_icon = u"\u263C"
degree_icon = u"\u00B0"


def c_to_f(c):
    return float(((c * 9 / 5) + 32))


def mm_to_inHg(mm):
    #Millibars to Inches of Mercury
    return mm / 33.864


def arrow(direction):
Esempio n. 15
0
from papirus import Papirus
from papirus import PapirusImage
from papirus import PapirusText

screen = Papirus()
image = PapirusImage()
text = PapirusText()

screen.update()

image.write('/home/pi/papirus/epapertrump.bmp')

#text.write("hello")


Esempio n. 16
0
from papirus import PapirusText

display = PapirusText()
display.write('recording')
Esempio n. 17
0
import picamera
import dataset
from pyzbar.pyzbar import decode
from PIL import Image
import time, getpass, sys, json, settings
from simplecrypt import encrypt, decrypt
from websocket import create_connection

import binascii
from bitstring import BitArray
from pyblake2 import blake2b
from pure25519 import ed25519_oop as ed25519

from papirus import PapirusText
text = PapirusText()


def private_public(private):
    return ed25519.SigningKey(private).get_verifying_key().to_bytes()


def xrb_account(address):
    # Given a string containing an XRB address, confirm validity and
    # provide resulting hex address
    if len(address) == 64 and (address[:4] == 'xrb_'):
        # each index = binary value, account_lookup[0] == '1'
        account_map = "13456789abcdefghijkmnopqrstuwxyz"
        account_lookup = {}
        # populate lookup index with prebuilt bitarrays ready to append
        for i in range(32):
            account_lookup[account_map[i]] = BitArray(uint=i, length=5)