Beispiel #1
0
def save():
    global piDigits, terminalSize
    global lastPosition
    global keyHandler
    pause()
    oldKeys = keyHandler.actions
    keyHandler.actions = {"default": bellButItTakesArgs}

    t.sleep(0.02)

    digitChunks = f.splitString(piDigits, (len(piDigits) // 100) +
                                1)  #split digits into a 100 chunks

    f.write("pi.txt", "")  #delete digits that are already there

    tf.moveCursor(to={"row": lastPosition[1] + 1, "column": 0})
    tf.clear(line=True)

    for digit in f.everyIndexInList(digitChunks):  #save the digits
        f.appendTo("pi.txt", digitChunks[digit])  #append the next chunk
        tf.changeStyle(italic=True, invert=True, bold=True)
        tf.print("{}% done saving".format(digit + 1))
        tf.moveCursor(to={
            "row": lastPosition[1] + 1,
            "column": 0
        })  #go to bottom left

    if pause:
        unPause()

    keyHandler.actions = oldKeys
Beispiel #2
0
    f.log("card: " + whiteCards[int(i)])

    f.log("text: " + str(text))

    locations = ["Ѹ", "Ψ", "Ѻ", "Ө", "ӿ", "ʨ", "~", "Ϟ", "ʬ"]

    for n in range(len(text)):
        svg = svg.replace(
            locations[n],
            text[n].replace("&", "&").replace(">",
                                                  "&gt;").replace("<", "&lt;"))

    for location in locations:
        svg = svg.replace(location, "")

    f.write(path + "WHITE" + str(i) + ".svg", svg)
    f.log("wrote svg " + str(i + 1) + "/" + str(whites))

f.log("processing black cards")
blackText = []
for i in range(len(blackCards)):
    if blackCards[i][1] == 2:
        blackText += ["Draw 2."]
    else:
        blackText += [""]
    blackCards[i] = blackCards[i][0]
f.log("processed")

f.log("reading svg")
default = f.read("RESCOURCES/BLACKCARD.svg")
f.log("read svg")