diff --git a/README.md b/README.md
index 6c59de9..5a0c408 100644
--- a/README.md
+++ b/README.md
@@ -128,10 +128,14 @@ In addition to shortcuts mentioned above and those shown in the main menu:
* How can I play on larger boards?
* For windows, change the `katago` setting to `katrain\KataGo\katago-bs52.exe`. For other operating systems, you need to compile your own KataGo version with higher limits.
-## Contributing
-* Feedback and pull requests are both very welcome. I would also be happy to host translations of this manual into languages where English fluency is typically lower.
-* For suggestions and planned improvements, see the 'issues' tab on github.
-* You can also contact me on [discord](https://discord.gg/AjTPFpN) (Sander#3278), [KakaoTalk](https://open.kakao.com/o/gTsMJCac) or [Reddit](http://reddit.com/u/sanderbaduk) to give feedback, or simply show your appreciation.
-* Some people have also asked me how to donate. Something go-related such as a book or teaching time is highly appreciated.
+## Support / Contribute
+
+* You can contact me on [discord](https://discord.gg/AjTPFpN) (Sander#3278), [KakaoTalk](https://open.kakao.com/o/gTsMJCac)
+ or [Reddit](http://reddit.com/u/sanderbaduk) to get help, discuss improvements, or simply show your appreciation.
+* Ideas, feedback, and contributions to code or translations are all very welcome.
+ * For suggestions and planned improvements, see [open issues](https://github.com/sanderland/katrain/issues) on github.
+ * I am looking for contributors of more translations of both this manual and the program itself. The best way to help with this is to contact me on discord.
+
+
diff --git a/katrain/__main__.py b/katrain/__main__.py
index 76c1629..30dfeb4 100644
--- a/katrain/__main__.py
+++ b/katrain/__main__.py
@@ -1,18 +1,20 @@
+import os # isort:skip
+
+os.environ["KCFG_KIVY_LOG_LEVEL"] = os.environ.get("KCFG_KIVY_LOG_LEVEL", "warning") # isort:skip surpress info output
from kivy.config import Config # isort:skip
ICON = "img/icon.png" # isort:skip # set icon
Config.set("kivy", "window_icon", ICON) # isort:skip # set icon
Config.set("input", "mouse", "mouse,multitouch_on_demand") # isort:skip # no red dots on right click
-Config.set("graphics", "width", 1300)
-Config.set("graphics", "height", 1000)
+Config.set("graphics", "width", 1300) # isort:skip
+Config.set("graphics", "height", 1000) # isort:skip
-
-import os
import signal
import sys
import threading
import traceback
from queue import Queue
+import webbrowser
from kivy.app import App
from kivy.core.clipboard import Clipboard
@@ -25,7 +27,7 @@ from katrain.core.utils import (
DEFAULT_LANGUAGE,
find_package_resource,
)
-from katrain.core.constants import OUTPUT_ERROR, OUTPUT_KATAGO_STDERR, OUTPUT_INFO, OUTPUT_DEBUG, OUTPUT_EXTRA_DEBUG, MODE_PLAY, AI_STRATEGIES_RECOMMENDED_ORDER
+from katrain.core.constants import OUTPUT_ERROR, OUTPUT_KATAGO_STDERR, OUTPUT_INFO, OUTPUT_DEBUG, OUTPUT_EXTRA_DEBUG, MODE_PLAY, AI_STRATEGIES_RECOMMENDED_ORDER, HOMEPAGE
from katrain.gui.popups import ConfigTeacherPopup, ConfigTimerPopup, I18NPopup
from katrain.core.base_katrain import KaTrainBase
from katrain.core.engine import KataGoEngine
@@ -374,9 +376,17 @@ class KaTrainApp(MDApp):
def on_language(self, _instance, language):
self.gui.log(f"Switching language to {language}", OUTPUT_INFO)
+ self.gui._config["general"]["lang"] = language
+ self.gui.save_config()
i18n.switch_lang(language)
+ def webbrowser(self, site_key):
+ WEBSITES = {"homepage": HOMEPAGE, "support": HOMEPAGE + "#support"}
+ if site_key in WEBSITES:
+ webbrowser.open(WEBSITES[site_key])
+
def on_start(self):
+ self.language = self.gui.config("general/lang")
self.gui.start()
def on_request_close(self, *_args):
diff --git a/katrain/config.json b/katrain/config.json
index 012e329..174fb96 100644
--- a/katrain/config.json
+++ b/katrain/config.json
@@ -16,8 +16,8 @@
"sgf_load": "~/Downloads",
"sgf_save": "./sgfout",
"anim_pv_time": 0.5,
- "debug_level": 1,
- "language": "en"
+ "debug_level": 0,
+ "lang": "en"
},
"timer": {
"byo_length": 30,
diff --git a/katrain/core/base_katrain.py b/katrain/core/base_katrain.py
index 1cdaa31..ebd61e4 100644
--- a/katrain/core/base_katrain.py
+++ b/katrain/core/base_katrain.py
@@ -53,7 +53,7 @@ class KaTrainBase:
Config.set("kivy", "log_level", "error")
if self.debug_level >= OUTPUT_DEBUG:
Config.set("kivy", "log_enable", 1)
- Config.set("kivy", "log_level", "warning")
+ Config.set("kivy", "log_level", "info")
if self.debug_level >= OUTPUT_EXTRA_DEBUG:
Config.set("kivy", "log_level", "trace")
self.players_info = {"B": Player("B"), "W": Player("W")}
diff --git a/katrain/core/utils.py b/katrain/core/utils.py
index f836cd4..e18bce4 100644
--- a/katrain/core/utils.py
+++ b/katrain/core/utils.py
@@ -52,6 +52,7 @@ class Lang(Observable):
def __init__(self, lang):
super(Lang, self).__init__()
+ self.lang = None
self.switch_lang(lang)
def _(self, text):
@@ -88,6 +89,8 @@ class Lang(Observable):
self.callbacks.append(callback_fn)
def switch_lang(self, lang):
+ if lang == self.lang:
+ return
# get the right locales directory, and instantiate a gettext
self.lang = lang
self.font_name = self.FONTS.get(lang) or DEFAULT_FONT
diff --git a/katrain/gui.kv b/katrain/gui.kv
index d10cd26..fd65cd1 100644
--- a/katrain/gui.kv
+++ b/katrain/gui.kv
@@ -802,6 +802,10 @@
height: self.parent.item_height or 50
size_hint: 1,None
+:
+ site_key: ''
+ underline: True
+ on_press: app.webbrowser(self.site_key)
:
orientation: 'horizontal'
@@ -937,10 +941,12 @@
size_hint: 1,None
height: root.item_height
item_height: root.item_height
- MenuLabel:
+ MenuLink:
text: i18n._('menu:manual')
- MenuLabel:
+ site_key: 'homepage'
+ MenuLink:
text: i18n._('menu:support')
+ site_key: 'support'
:
diff --git a/katrain/gui/widgets/filebrowser.py b/katrain/gui/widgets/filebrowser.py
index f3f9612..b4a74c5 100644
--- a/katrain/gui/widgets/filebrowser.py
+++ b/katrain/gui/widgets/filebrowser.py
@@ -37,6 +37,7 @@ a shortcut to the Documents directory added to the favorites bar::
.. image:: _static/filebrowser.png
:align: right
"""
+from kivy import Config
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.treeview import TreeViewLabel, TreeView
from kivy.uix.filechooser import FileChooserListView, FileChooserListLayout
@@ -113,9 +114,10 @@ class I18NFileChooserListLayout(FileChooserListLayout):
_ENTRY_TEMPLATE = "I18NFileListEntry"
-with warnings.catch_warnings():
- warnings.simplefilter("ignore")
- Builder.load_string("""
+log_level = Config.get("kivy", "log_level")
+Config.set("kivy", "log_level", "error")
+Builder.load_string(
+ """
[I18NFileListEntry@FloatLayout+TreeViewNode]:
locked: False
entries: []
@@ -150,7 +152,9 @@ with warnings.catch_warnings():
I18NFileChooserListLayout:
id: layout
controller: root
- """)
+ """
+)
+Config.set("kivy", "log_level", log_level)
Builder.load_string(
"""
diff --git a/setup.py b/setup.py
index 88c1ef6..0e138df 100644
--- a/setup.py
+++ b/setup.py
@@ -4,7 +4,7 @@ import os
from setuptools import find_packages, setup
package_data = {"": ["*.json", "*.kv"], "katrain": [], "tests": []}
-packages = find_packages(exclude=["bots", "tests"])
+packages = find_packages(exclude=["tests"])
version = re.search('^__version__\s*=\s*"(.*)"', open("katrain/__main__.py").read(), re.M).group(1)