Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ jobs:
os: ubuntu-latest

# Python version testing (Linux)
- python: 3.8
toxenv: py38
os: ubuntu-latest
- python: 3.9
toxenv: py39
os: ubuntu-latest
- python: "3.10"
toxenv: py310
os: ubuntu-latest
Expand All @@ -42,12 +36,6 @@ jobs:
- python: "3.13"
toxenv: py313
os: ubuntu-latest
- python: pypy-3.8
toxenv: pypy38
os: ubuntu-latest
- python: pypy-3.9
toxenv: pypy39
os: ubuntu-latest
- python: pypy-3.10
toxenv: pypy310
os: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ target/
profile_default/
ipython_config.py

# pyenv (but we want to track our .python-version file)
# .python-version
# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
Expand Down
1 change: 0 additions & 1 deletion .python-version

This file was deleted.

4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def get_install_requires():
packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),
long_description=read("README.rst"),
install_requires=get_install_requires(),
python_requires=">=3.8",
python_requires=">=3.10",
include_package_data=True,
classifiers=[
"Topic :: Education",
Expand All @@ -46,8 +46,6 @@ def get_install_requires():
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
Expand Down
8 changes: 4 additions & 4 deletions tilingsgui/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class TopMenu(pyglet.event.EventDispatcher, Observer):
_FONT_SIZE = 20
_TEXT_COLOR = Color.alpha_extend(Color.BLACK)
_TEXT_BOX_COLOR = Color.scale_to_01(Color.WHITE)
_BACKGROUND_COLOR = Color.BLACK
_V_BTN = 118
_CTRL_MODIFIER = 18
_BACKGROUND_COLOR = Color.scale_to_01(Color.BLACK)
_PASTE_KEY = pyglet.window.key.V
_PASTE_MOD = pyglet.window.key.MOD_ACCEL

def __init__(
self,
Expand Down Expand Up @@ -97,7 +97,7 @@ def on_key_press(self, symbol: int, modifiers: int) -> bool:
bool: True if the event is consumed by the handler, false otherwise.
"""
if self._text_box.has_focus():
if symbol == TopMenu._V_BTN and modifiers == TopMenu._CTRL_MODIFIER:
if symbol == TopMenu._PASTE_KEY and modifiers & TopMenu._PASTE_MOD:
self._text_box.add_text(paste())
return True
if symbol == pyglet.window.key.ESCAPE:
Expand Down
11 changes: 6 additions & 5 deletions tilingsgui/tplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class TPlot:
_HIGHLIGHT_COLOR: ClassVar[Tuple[float, float, float]] = Color.scale_to_01(
Color.ORANGE
)
_BLACK_COLOR: ClassVar[Tuple[float, float, float]] = Color.scale_to_01(Color.BLACK)
_EMPTY_COLOR: ClassVar[Tuple[float, float, float]] = Color.scale_to_01(Color.GRAY)
_SHADED_CELL_COLOR: ClassVar[Tuple[float, float, float]] = Color.scale_to_01(
Color.GRAY
Expand Down Expand Up @@ -347,7 +348,7 @@ def _draw_requirements(self, state: GuiState, mpos: Point) -> None:
):
pnt = reqlist[0][0]
GeoDrawer.draw_circle(
pnt.x, pnt.y, TPlot._PRETTY_POINT_SIZE, Color.BLACK
pnt.x, pnt.y, TPlot._PRETTY_POINT_SIZE, TPlot._BLACK_COLOR
)
continue
col = (
Expand All @@ -365,12 +366,12 @@ def _draw_requirements(self, state: GuiState, mpos: Point) -> None:
def _draw_grid(self) -> None:
"""Draw the tiling's grid."""
t_w, t_h = self.tiling.dimensions
for i in range(t_w):
for i in range(t_w + 1):
x = self._w * i / t_w
GeoDrawer.draw_line_segment(x, self._h, x, 0, Color.BLACK)
for i in range(t_h):
GeoDrawer.draw_line_segment(x, self._h, x, 0, TPlot._BLACK_COLOR)
for i in range(t_h + 1):
y = self._h * i / t_h
GeoDrawer.draw_line_segment(0, y, self._w, y, Color.BLACK)
GeoDrawer.draw_line_segment(0, y, self._w, y, TPlot._BLACK_COLOR)

def to_tikz(self) -> None:
"""Output tikz drawing."""
Expand Down
10 changes: 6 additions & 4 deletions tilingsgui/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(self, init_text: str, font_size: int, color: RGBA) -> None:
color (Tuple[float, float, float, float]): The font color.
"""

self._font_size: int = font_size
self._batch: pyglet.graphics.Batch = pyglet.graphics.Batch()
self._document: pyglet.text.document.UnformattedDocument = (
pyglet.text.document.UnformattedDocument(init_text)
Expand All @@ -41,6 +42,7 @@ def __init__(self, init_text: str, font_size: int, color: RGBA) -> None:
batch=self._batch,
)
)
self._layout.content_valign = "center"
self._caret: pyglet.text.caret.Caret = pyglet.text.caret.Caret(self._layout)
self._caret.visible = False

Expand All @@ -54,9 +56,9 @@ def position(self, x: float, y: float, w: float, h: float) -> None:
h (float): The vertical length of the component.
"""
self._layout.x = int(x + Text._LEFT_PAD)
self._layout.y = int(y - 15)
self._layout.y = int(y - self._font_size // 4)
self._layout.width = int(w - Text._LEFT_PAD)
self._layout.height = int(h)
self._layout.height = int(h + self._font_size // 4)

def set_focus(self) -> None:
"""Set focus on the input text. This is needed to write to it."""
Expand Down Expand Up @@ -168,7 +170,7 @@ def hit_test(self, x: float, y: float) -> bool:
class Button:
"""A clickable rectangular GUI component."""

_BUTTON_COLOR: ClassVar[RGB] = Color.GRAY
_BUTTON_COLOR: ClassVar[RGB] = Color.scale_to_01(Color.GRAY)

def __init__(
self, image: str, on_click: Optional[Callable[[], None]] = None
Expand Down Expand Up @@ -261,7 +263,7 @@ def _hit_test(self, x: float, y: float) -> bool:
class ToggleButton(Button):
"""A button that is either on or off."""

_TOGGLE_COLOR: ClassVar[RGB] = Color.DARK_OLIVE_GREEN
_TOGGLE_COLOR: ClassVar[RGB] = Color.scale_to_01(Color.DARK_OLIVE_GREEN)

def __init__(
self,
Expand Down
8 changes: 2 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,19 @@
[tox]
envlist =
flake8, mypy, pylint, black
py{38,39,310,311,312,313},
pypy{38,39,310}
py{310,311,312,313},
pypy{310}

[default]
basepython=python3.11

[testenv]
description = run test
basepython =
py38: python3.8
py39: python3.9
py310: python3.10
py311: python3.11
py312: python3.12
py313: python3.13
pypy38: pypy3.8
pypy39: pypy3.9
pypy310: pypy3.10
deps =
setuptools
Expand Down
Loading