gnome-frog: 1.4.2 -> 1.5.1

This commit is contained in:
Gabriel Arazas 2024-02-13 12:43:08 +08:00
parent c258d0288c
commit 6944778bdb
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC
2 changed files with 8 additions and 24 deletions

View File

@ -25,13 +25,13 @@
python3Packages.buildPythonApplication rec {
pname = "gnome-frog";
version = "1.4.2";
version = "1.5.1";
src = fetchFromGitHub {
owner = "TenderOwl";
repo = "Frog";
rev = "refs/tags/${version}";
sha256 = "sha256-w/ENUhJt7bYy5htBLolb/HysK8/scRaPQX5qEezQcXY=";
sha256 = "sha256-zL6zuqHF1pTXT3l1mAFx2EL+0ThzjXfst/nEyNVorZg=";
};
format = "other";
@ -70,7 +70,11 @@ python3Packages.buildPythonApplication rec {
];
propagatedBuildInputs = with python3Packages; [
loguru
nanoid
posthog
pygobject3
python-dateutil
pillow
pytesseract
pyzbar

View File

@ -1,28 +1,8 @@
diff --git a/frog/config.py b/frog/config.py
index 9837755..b73e4e3 100644
--- a/frog/config.py
+++ b/frog/config.py
@@ -30,10 +30,14 @@ import os
APP_ID = "com.github.tenderowl.frog"
RESOURCE_PREFIX = "/com/github/tenderowl/frog"
+# This is based from the XDG Base Directory specification.
+if not os.getenv('XDG_DATA_HOME'):
+ os.environ['XDG_DATA_HOME'] = os.path.expanduser("~/.local/share")
+
if not os.path.exists(os.path.join(os.environ['XDG_DATA_HOME'], 'tessdata')):
os.mkdir(os.path.join(os.environ['XDG_DATA_HOME'], 'tessdata'))
tessdata_url = "https://github.com/tesseract-ocr/tessdata/raw/main/"
tessdata_best_url = "https://github.com/tesseract-ocr/tessdata_best/raw/main/"
tessdata_dir = os.path.join(os.environ['XDG_DATA_HOME'], 'tessdata')
-tessdata_config = f'--tessdata-dir {tessdata_dir} psm 6'
+tessdata_config = f'-psm 6 --tessdata-dir {tessdata_dir}'
diff --git a/frog/language_manager.py b/frog/language_manager.py
index 5752be6..4f6a908 100644
index d822c44..bc289db 100644
--- a/frog/language_manager.py
+++ b/frog/language_manager.py
@@ -156,7 +156,7 @@ class LanguageManager(GObject.GObject):
@@ -193,7 +193,7 @@ class LanguageManager(GObject.GObject):
os.mkdir(tessdata_dir)
dest_path = os.path.join(tessdata_dir, 'eng.traineddata')