Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix system text color #429

Merged
merged 9 commits into from
May 24, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ jobs:
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
xvfb-run -a pytest
5 changes: 4 additions & 1 deletion nam/train/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,10 @@ def get_kwargs(data_info: _DataInfo):
train_stop = validation_start
validation_stop = validation_start + data_info.t_validate
train_kwargs = {"stop_samples": train_stop}
validation_kwargs = {"start_samples": validation_start, "stop_samples": validation_stop}
validation_kwargs = {
"start_samples": validation_start,
"stop_samples": validation_stop,
}
elif data_info.major_version == 3:
validation_start = data_info.validation_start
train_stop = validation_start
Expand Down
10 changes: 9 additions & 1 deletion nam/train/gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def _ensure_graceful_shutdowns():

import re
import tkinter as tk
import sys
import webbrowser
from dataclasses import dataclass
from enum import Enum
Expand Down Expand Up @@ -78,6 +79,13 @@ def _ensure_graceful_shutdowns():
_METADATA_RIGHT_WIDTH = 60


def _is_mac() -> bool:
return sys.platform == "darwin"


_SYSTEM_TEXT_COLOR = "systemTextColor" if _is_mac() else "black"


@dataclass
class _AdvancedOptions(object):
"""
Expand Down Expand Up @@ -117,7 +125,7 @@ def __init__(
path_key: settings.PathKey,
hooks: Optional[Sequence[Callable[[], None]]] = None,
color_when_not_set: str = "#EF0000", # Darker red
color_when_set: str = "systemTextColor",
color_when_set: str = _SYSTEM_TEXT_COLOR,
default: Optional[Path] = None,
):
"""
Expand Down
23 changes: 23 additions & 0 deletions tests/test_nam/test_train/test_gui.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# File: test_gui.py
# Created Date: Friday May 24th 2024
# Author: Steven Atkinson (steven@atkinson.mn)

import tkinter as tk

import pytest

from nam.train import gui


class TestPathButton(object):
def test_system_text_color(self):
"""
Issue 428
"""
top_level = tk.Toplevel()
label = tk.Label(master=top_level, text="My text", fg=gui._SYSTEM_TEXT_COLOR)
label.pack()


if __name__ == "__main__":
pytest.main()
Loading