diff --git a/README.md b/README.md index cfccfec..c0704cf 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,9 @@ Written by Storm Dragon released under the terms of the WTFPL http://wtfpl.net/ Requirements -sox -bash version 4 or greater -pygame +python-pygame python-xdg +python-pyperclip python-requests Playing diff --git a/libstorm_games.py b/libstorm_games.py index 224fbe3..49e516e 100755 --- a/libstorm_games.py +++ b/libstorm_games.py @@ -9,6 +9,7 @@ from os.path import isfile, join from inspect import isfunction from xdg import BaseDirectory import pygame +import pyperclip import random import requests import speechd @@ -90,7 +91,7 @@ def credits(): def display_text(text): i = 0 - text.insert(0, "Press space to read the whole text. Use up and down arrows to navigate the text line by line. Press enter or escape when you are done reading.") + text.insert(0, "Press space to read the whole text. Use up and down arrows to navigate the text line by line. Press c to copy the current line to the clipboard or t to copy the entire text. Press enter or escape when you are done reading.") text.append("End of text.") speak(text[i]) while True: @@ -103,6 +104,18 @@ def display_text(text): speak(''.join(text[1:])) else: speak(text[i]) + if event.key == pygame.K_c: + try: + pyperclip.copy(text[i]) + speak("Copied " + text[i] + " to the clipboard.") + except: + speak("Failed to copy the text to the clipboard.") + if event.key == pygame.K_t: + try: + pyperclip.copy(''.join(text[1:-1])) + speak("Copied entire message to the clipboard.") + except: + speak("Failed to copy the text to the clipboard.") event = pygame.event.clear() time.sleep(0.001)