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

Feature/update deps #619

Merged
merged 5 commits into from
Apr 26, 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
6 changes: 2 additions & 4 deletions bundle/platforms/linux_briefcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,9 @@ def run_framework(self) -> None:
self._add_metainfo_to_appimage()
self.run(cmd="briefcase package linux appimage", cwd=self.PROJECT_PATH)

def bundle_tesseract(self) -> None:
...
def bundle_tesseract(self) -> None: ...

def install_system_deps(self) -> None:
...
def install_system_deps(self) -> None: ...

def pre_framework(self) -> None:
self._patch_briefcase_appimage_to_run_cmd()
Expand Down
3 changes: 1 addition & 2 deletions bundle/platforms/macos_briefcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,4 @@ def install_system_deps(self) -> None:
self.run(cmd="brew install tesseract")
self.run(cmd="brew install dylibbundler")

def pre_framework(self) -> None:
...
def pre_framework(self) -> None: ...
3 changes: 1 addition & 2 deletions bundle/platforms/windows_briefcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,7 @@ def run_framework(self) -> None:
self._patch_windows_installer()
self.run(cmd="briefcase package windows VisualStudio", cwd=self.PROJECT_PATH)

def install_system_deps(self) -> None:
...
def install_system_deps(self) -> None: ...

def pre_framework(self) -> None:
self.bundle_tesseract()
Expand Down
1 change: 1 addition & 0 deletions normcap/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
"""Normcap Package."""

__version__ = "0.5.4"
1 change: 1 addition & 0 deletions normcap/app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Start main application logic."""

import logging
import signal
import sys
Expand Down
3 changes: 2 additions & 1 deletion normcap/gui/loading_indicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ def __init__(
self, parent: QtWidgets.QWidget, size: int = 128, center_on_parent: bool = True
) -> None:
super().__init__(parent=parent)
self.setVisible(False)

self.dot_count = 9
self.dot_size_factor = 1.6
Expand All @@ -20,6 +19,8 @@ def __init__(
self.counter = 0
self.timer = None

self.setVisible(False)

if size:
self.setMinimumSize(size, size)
self.setMaximumSize(size, size)
Expand Down
1 change: 1 addition & 0 deletions normcap/gui/localization.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Load translations dictionary for usage in GUI."""

import gettext
from pathlib import Path

Expand Down
1 change: 1 addition & 0 deletions normcap/gui/system_info.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Gather relevant system information."""

import functools
import logging
import os
Expand Down
1 change: 0 additions & 1 deletion normcap/gui/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
nevertheless display potentially multiple windows in fullscreen on multiple displays.
"""


import logging
from dataclasses import dataclass
from typing import Callable, Optional, cast
Expand Down
4 changes: 2 additions & 2 deletions normcap/resources/locales/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
| Locale | Progress | Translated |
| :--------------------------------------- | -------: | ---------: |
| [de_DE](./de_DE/LC_MESSAGES/messages.po) | 100% | 68 of 68 |
| [es_ES](./es_ES/LC_MESSAGES/messages.po) | 8% | 6 of 68 |
| [es_ES](./es_ES/LC_MESSAGES/messages.po) | 100% | 68 of 68 |
| [fr_FR](./fr_FR/LC_MESSAGES/messages.po) | 8% | 6 of 68 |
| [hi_IN](./hi_IN/LC_MESSAGES/messages.po) | 8% | 6 of 68 |
| [it_IT](./it_IT/LC_MESSAGES/messages.po) | 8% | 6 of 68 |
| [pl_PL](./pl_PL/LC_MESSAGES/messages.po) | 8% | 6 of 68 |
| [pt_PT](./pt_PT/LC_MESSAGES/messages.po) | 8% | 6 of 68 |
| [ru_RU](./ru_RU/LC_MESSAGES/messages.po) | 8% | 6 of 68 |
| [ru_RU](./ru_RU/LC_MESSAGES/messages.po) | 100% | 68 of 68 |
| [sv_SE](./sv_SE/LC_MESSAGES/messages.po) | 100% | 68 of 68 |
| [uk_UA](./uk_UA/LC_MESSAGES/messages.po) | 8% | 6 of 68 |
| [zh_CN](./zh_CN/LC_MESSAGES/messages.po) | 8% | 6 of 68 |
Expand Down
17 changes: 9 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ classifiers = [
"Operating System :: MacOS",
]
dependencies = [
"shiboken6==6.6.1",
"PySide6-Essentials==6.6.1",
"shiboken6==6.7.0",
"PySide6-Essentials==6.7.0",
"jeepney==0.8.0",
]

Expand All @@ -52,14 +52,14 @@ dependencies = ["babel", "toml"]
[tool.hatch.envs.default]
dependencies = [
"babel>=2.12.1",
"briefcase==0.3.16", # pinned because building relies on it!
"briefcase==0.3.16", # pinned because building relies on it!
"coverage[toml]>=6.5",
"coveralls>=3.3.1",
# "mdformat-gfm>=0.3.5", # until fixed https://github.com/hukkin/mdformat-gfm/issues/31
"mdformat-gfm>=0.3.6",
"mdformat-simple-breaks>=0.0.1",
"mdformat-mkdocs>=2.0.1",
"mdformat-frontmatter>=2.0.1",
"mkdocs-material==9.5.5", # pinned because docs rely on it!
"mkdocs-material==9.5.19", # pinned because docs rely on it!
"mkdocs-glightbox>=0.3.5",
"mypy>=1.3.0",
"pip-audit>=2.5.5",
Expand Down Expand Up @@ -100,8 +100,9 @@ charts = [
"pydeps normcap --max-bacon=1 -o=pydeps_internal.png -T=png",
]
# Main tasks:
check = ["locales-compile", "fmt-check", "typing", "test", "security"]
pre-commit = ["locales-compile", "fmt", "typing", "test", "security", "charts"]
# ONHOLD: Re-add "typing" to check and pre-commit when PySide6 6.7.1 is released
check = ["locales-compile", "fmt-check", "test", "security"]
pre-commit = ["locales-compile", "fmt", "test", "security", "charts"]
locales-compile = "python bundle/l10n.py"
locales-update = "python bundle/l10n.py --update-all"
create-locale = "python bundle/l10n.py --create-new"
Expand Down Expand Up @@ -242,7 +243,7 @@ sources = ["normcap"]
icon = "bundle/imgs/normcap"
installer_icon = "bundle/imgs/normcap_install"
installer_background = "bundle/imgs/normcap_install_bg"
requires = ["PySide6-Essentials==6.6.1", "shiboken6==6.6.1", "jeepney==0.8.0"]
requires = ["PySide6-Essentials==6.7.0", "shiboken6==6.7.0", "jeepney==0.8.0"]
cleanup_paths = [
# Globs
"**/[pP]y[sS]ide6/*[qQ]t*[oO]pen[gG][lL]*",
Expand Down
7 changes: 6 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def basic_cli_args():


@pytest.fixture()
def run_normcap(monkeypatch, qapp, basic_cli_args):
def run_normcap(monkeypatch, qapp, qtbot, basic_cli_args):
trays = []

def _run_normcap(extra_cli_args: Optional[list[str]] = None):
Expand All @@ -166,6 +166,10 @@ def _run_normcap(extra_cli_args: Optional[list[str]] = None):

monkeypatch.setattr(app, "_get_application", lambda: qapp)
_, tray = app._prepare()

# wait for windows to be created and moved on wayland
qtbot.wait(50)

tray._EXIT_DELAY = 0.1
trays.append(tray)
return tray
Expand Down Expand Up @@ -240,6 +244,7 @@ def _select_region(on: QtWidgets.QWidget, pos: tuple[QtCore.QPoint, QtCore.QPoin
qtbot.mousePress(on, QtCore.Qt.MouseButton.LeftButton, pos=top_left)
qtbot.mouseMove(on, pos=bottom_right)
qtbot.mouseRelease(on, QtCore.Qt.MouseButton.LeftButton, pos=bottom_right)
qtbot.wait(500)

return _select_region

Expand Down
3 changes: 3 additions & 0 deletions tests/integration/test_tray_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ def test_tray_menu_capture(monkeypatch, qtbot, run_normcap, select_region):
capture_action = tray.tray_menu.findChild(QtGui.QAction, "capture")
capture_action.trigger()

# wait for windows to be created and moved on wayland
qtbot.wait(50)

select_region(on=tray.windows[0], pos=testcase.coords)

# THEN text should be captured
Expand Down
9 changes: 6 additions & 3 deletions tests/tests_gui/test_update_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,12 @@ def _mocked_downloader_get(cls, url: str, timeout: float):
monkeypatch.setattr(downloader.Downloader, "get", _mocked_downloader_get)

# WHEN the update check is triggered (with debug log level)
with caplog.at_level(logging.DEBUG), qtbot.wait_signal(
checker.com.on_version_checked, timeout=200, raising=False
) as result:
with (
caplog.at_level(logging.DEBUG),
qtbot.wait_signal(
checker.com.on_version_checked, timeout=200, raising=False
) as result,
):
checker.com.check.emit()

# THEN the update message is (not) shown with certain text
Expand Down