Skip to content

Commit 1da412a

Browse files
authored
Merge pull request #13 from hx2A/v0106a0
release 0.10.6a0
2 parents ed7dbf2 + 716f3ba commit 1da412a

File tree

12 files changed

+33
-10
lines changed

12 files changed

+33
-10
lines changed

py5/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,16 @@
127127
print(debug_info, file=sys.stderr)
128128
raise RuntimeError("py5 is unable to start Java 17 Virtual Machine")
129129

130-
if JClass("py5.util.CheckHeadless")().test():
130+
try:
131+
if JClass("py5.util.CheckHeadless")().test():
132+
raise RuntimeError(
133+
"py5 is unable to run correctly in headless mode. "
134+
"Make sure you are running in a graphical environment and that your Java Virtual Machine is not a Headless JVM."
135+
)
136+
except:
131137
raise RuntimeError(
132-
"py5 is unable to run correctly in headless mode. Make sure you are running in a graphical environment and that your Java Virtual Machine is not a Headless JVM."
138+
"Unable to instantiate Java class py5.util.CheckHeadless. "
139+
"If you are using PyInstaller right now, please check that all of py5's jar files are included in your package."
133140
)
134141

135142
import py5_tools.colors.css4 as css4_colors # noqa

py5/jars/core.jar

425 Bytes
Binary file not shown.

py5/jars/dxf/dxf.jar

0 Bytes
Binary file not shown.

py5/jars/pdf/pdf.jar

0 Bytes
Binary file not shown.

py5/jars/py5.jar

0 Bytes
Binary file not shown.

py5/jars/svg/batik.jar

53 Bytes
Binary file not shown.

py5/jars/svg/svg.jar

0 Bytes
Binary file not shown.

py5/reference.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@
664664
(('Py5Tools', 'live_coding_count'), ['() -> int']),
665665
(('Py5Tools', 'live_coding_activate'), ["(*, always_rerun_setup: bool = True, always_on_top: bool = True, activate_keyboard_shortcuts: bool = False, archive_dir: str = 'archive') -> None"]),
666666
(('Py5Tools', 'processing_library_storage_dir'), ['() -> Path']),
667-
(('Py5Tools', 'processing_installed_libraries'), ['() -> list[str]']),
667+
(('Py5Tools', 'processing_installed_libraries'), ['() -> set[str]']),
668668
(('Py5Tools', 'processing_check_library'), ['(library_name: str) -> bool']),
669669
(('Py5Tools', 'processing_download_library'), ['(library_name: str) -> dict']),
670670
(('Py5Tools', 'processing_remove_library'), ['(library_name: str) -> None']),])

py5_tools/constants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
import platform
2222
from pathlib import Path
2323

24-
VERSION = "0.10.5a0"
25-
PROCESSING_BUILD_NUMBER = 1301
24+
VERSION = "0.10.6.a0"
25+
PROCESSING_BUILD_NUMBER = 1304
2626

2727
if not (PY5_HOME := os.environ.get("PY5_HOME")):
2828
if platform.system() == "Windows":

py5_tools/javafx.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@
2222

2323
import py5_tools
2424

25-
if not py5_tools.is_jvm_running() and py5_tools.processing.check_library("JavaFX"):
25+
if (
26+
not py5_tools.is_jvm_running()
27+
and "JavaFX" in py5_tools.processing.installed_libraries()
28+
):
2629
try:
2730
library_dir = None
2831

py5_tools/processing.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,16 @@
3333
class ProcessingLibraryManager:
3434

3535
def __init__(self):
36-
self._libraries = ProcessingLibraryInfo()
36+
self._libraries = None
37+
38+
def _check_libraries(self):
39+
try:
40+
if self._libraries is None:
41+
self._libraries = ProcessingLibraryInfo()
42+
except:
43+
raise RuntimeError(
44+
"Processing library information not available. Your network connection might not be working."
45+
) from None
3746

3847
def _store_library_info(self, library_name, info):
3948
info_file = STORAGE_DIR / f"{library_name}.txt"
@@ -66,7 +75,7 @@ def _load_library_info(self, library_name):
6675
return info
6776

6877
def installed_libraries(self):
69-
return [f.stem for f in STORAGE_DIR.glob("*.txt")]
78+
return {f.stem for f in STORAGE_DIR.glob("*.txt")}
7079

7180
def check_library(self, library_name):
7281
"""Check if a library is available and up to date.
@@ -77,6 +86,8 @@ def check_library(self, library_name):
7786
Returns:
7887
bool: True if the library is available and up to date, False otherwise.
7988
"""
89+
self._check_libraries()
90+
8091
info = self._libraries.get_library_info(library_name=library_name)
8192

8293
if len(info) == 0:
@@ -101,6 +112,8 @@ def get_library(self, library_name):
101112
Returns:
102113
dict: Information about the downloaded library.
103114
"""
115+
self._check_libraries()
116+
104117
info = self._libraries.get_library_info(library_name=library_name)
105118

106119
if len(info) == 0:
@@ -171,7 +184,7 @@ def library_storage_dir() -> Path:
171184
return STORAGE_DIR
172185

173186

174-
def installed_libraries() -> list[str]:
187+
def installed_libraries() -> set[str]:
175188
"""List the Processing libraries stored in your computer's Processing library
176189
storage directory.
177190

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ dynamic = ["version"]
88
description = "Processing for CPython"
99
readme = "README.md"
1010
license = "LGPL-2.1-only"
11-
requires-python = ">3.9"
11+
requires-python = ">=3.9"
1212
authors = [
1313
{ name = "Jim Schmitz", email = "[email protected]" },
1414
]

0 commit comments

Comments
 (0)