From 1c88bf0f2db7e21844dd3c4822e9fba2c6ffa231 Mon Sep 17 00:00:00 2001 From: Song Li Date: Mon, 21 Sep 2020 12:37:30 +0800 Subject: [PATCH 1/2] Add missing install command for brew on macOS --- INSTALL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/INSTALL.md b/INSTALL.md index ef7bbaf..f5ba1d4 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -25,7 +25,7 @@ These commands install [Homebrew](https://brew.sh), which simplifies installing To upgrade to a newer version, simply run `pip3 install -U katrain` -If you encounter an error about SDL being missing, try ` brew sdl sdl_image sdl_mixer sdl_ttf portmidi` +If you encounter an error about SDL being missing, try ` brew install sdl sdl_image sdl_mixer sdl_ttf portmidi` ### Troubleshooting and Installation from sources From 8b2b3c5f5115ea0ed20460e25b543a5a7f1a5592 Mon Sep 17 00:00:00 2001 From: Lukasz Wierzbowski Date: Sun, 15 Nov 2020 02:35:03 +0100 Subject: [PATCH 2/2] Handle URL to sgf in clipboard on paste --- katrain/__main__.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/katrain/__main__.py b/katrain/__main__.py index 502859e..580bb62 100644 --- a/katrain/__main__.py +++ b/katrain/__main__.py @@ -30,11 +30,13 @@ Config.set("graphics", "width", max(400, int(WINDOW_X * WINDOW_SCALE_FAC))) Config.set("graphics", "height", max(400, int(WINDOW_Y * WINDOW_SCALE_FAC))) Config.set("input", "mouse", "mouse,multitouch_on_demand") +import re import signal import sys import threading import traceback from queue import Queue +import urllib3 import webbrowser from kivy.base import ExceptionHandler, ExceptionManager @@ -399,6 +401,15 @@ class KaTrainGui(Screen, KaTrainBase): if not clipboard: self.controls.set_status(f"Ctrl-V pressed but clipboard is empty.", STATUS_INFO) return + + url_match = re.match("(?Phttps?://[^\s]+)", clipboard) + if url_match: + self.log("Recognized url: " + url_match.group()) + + http = urllib3.PoolManager() + response = http.request('GET', url_match.group()) + clipboard = response.data.decode('utf-8') + try: move_tree = KaTrainSGF.parse_sgf(clipboard) except Exception as exc: