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
Binary file modified datalab/data/logo/DataLab-Banner-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added datalab/data/logo/DataLab-Banner-200@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified datalab/data/logo/DataLab-Banner2-100.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added datalab/data/logo/DataLab-Banner2-100@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified datalab/data/logo/DataLab-Splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added datalab/data/logo/DataLab-Splash@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified datalab/data/logo/DataLab-watermark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added datalab/data/logo/DataLab-watermark@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions datalab/gui/tour.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
from typing import TYPE_CHECKING

import numpy as np
from guidata.configtools import get_icon, get_image_file_path
from guidata.configtools import get_icon, get_pixmap
from guidata.qthelpers import is_dark_theme
from qtpy import QtCore as QC
from qtpy import QtGui as QG
Expand Down Expand Up @@ -294,7 +294,7 @@ def _setup_ui(self) -> None:
self._layout = QW.QVBoxLayout()
if self.step.step_type in ("introduction", "conclusion"):
logo = QW.QLabel()
logo.setPixmap(QG.QPixmap(get_image_file_path("DataLab-Banner2-100.png")))
logo.setPixmap(get_pixmap("DataLab-Banner2-100.png"))
logo.setAlignment(QC.Qt.AlignCenter)
self._layout.addWidget(logo)
title_color = QC.Qt.lightGray if is_dark_theme() else QC.Qt.darkGray
Expand Down
4 changes: 2 additions & 2 deletions datalab/gui/welcome.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import webbrowser
from typing import TYPE_CHECKING, Callable

from guidata.configtools import get_icon, get_image_file_path
from guidata.configtools import get_icon, get_pixmap
from guidata.qthelpers import add_actions
from guidata.widgets.dockable import DockableWidgetMixin
from qtpy import QtCore as QC
Expand Down Expand Up @@ -588,7 +588,7 @@ def __launch_tile(self, plugin: PluginBase, tile: WelcomeTile) -> None:
def __setup_header(self) -> None:
"""Setup the header: logo, slogan with version, and edition"""
logo = QW.QLabel()
logo.setPixmap(QG.QPixmap(get_image_file_path("DataLab-Banner-200.png")))
logo.setPixmap(get_pixmap("DataLab-Banner-200.png"))
slogan = QW.QLabel(
_("Scientific signal and image processing \u2014 version %s")
% datalab.__version__
Expand Down
2 changes: 2 additions & 0 deletions doc/contributing/contribute_code.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,5 @@ The application icon (``resources/DataLab.ico``) and the WiX installer bitmaps (
scripts\build_resources.bat

or via the **🎨 Generate resources** VS Code task.

The images displayed by the application (splash screen, logos, plot watermark) are generated in ``datalab/data/logo/`` together with their ``@2x`` high-resolution variants, used on high-DPI displays: to regenerate only these images, run ``scripts\build_resources.bat logo``.
3 changes: 3 additions & 0 deletions doc/locale/fr/LC_MESSAGES/contributing/contribute_code.po
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,6 @@ msgstr "L'icône de l'application (``resources/DataLab.ico``) et les bitmaps de

msgid "or via the **🎨 Generate resources** VS Code task."
msgstr "ou via la tâche VS Code **🎨 Generate resources**."

msgid "The images displayed by the application (splash screen, logos, plot watermark) are generated in ``datalab/data/logo/`` together with their ``@2x`` high-resolution variants, used on high-DPI displays: to regenerate only these images, run ``scripts\\build_resources.bat logo``."
msgstr "Les images affichées par l'application (écran de démarrage, logos, filigrane des graphiques) sont générées dans ``datalab/data/logo/`` avec leurs variantes haute résolution ``@2x``, utilisées sur les écrans haute résolution : pour ne régénérer que ces images, exécutez ``scripts\\build_resources.bat logo``."
10 changes: 10 additions & 0 deletions doc/locale/fr/LC_MESSAGES/release_notes/release_1.04.po
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,16 @@ msgstr "**Disposition de la fenêtre :**"
msgid "Fixed the width of the signal/image panels not being restored at startup: after narrowing the panels and restarting DataLab, they came back wider (up to their maximum width) instead of keeping the width chosen by the user"
msgstr "Correction de la largeur des panneaux Signal/Image non restaurée au démarrage : après avoir réduit les panneaux puis redémarré DataLab, ils réapparaissaient plus larges (jusqu'à leur largeur maximale) au lieu de conserver la largeur choisie par l'utilisateur"

msgid "**Display scaling:**"
msgstr "**Mise à l'échelle de l'affichage :**"

msgid "Fixed the splash screen, the DataLab logo of the welcome page and of the guided tour, and the watermark of empty plots being blurry with a Windows display scaling greater than 100% (e.g., 125%): they are now displayed at the resolution of the screen"
msgstr "Correction du flou de l'écran de démarrage, du logo DataLab de la page d'accueil et de la visite guidée, et du filigrane des graphiques vides avec une mise à l'échelle de l'affichage Windows supérieure à 100 % (par exemple 125 %) : ils sont désormais affichés à la résolution de l'écran"

#, python-format
msgid "Fixed most of the text of the user interface (welcome page, object properties, panel tabs, dialog boxes, ...) keeping its 100% size with a Windows display scaling greater than 100% (e.g., 125%), while menus and the status bar were enlarged. All the text now follows the display scaling and the Windows text size setting, and uses the standard font of Windows applications (\"Segoe UI\"). This affected DataLab running with Qt 5, like the standalone application (requires guidata ≥ 3.16.1)"
msgstr "Correction de la majeure partie du texte de l'interface (page d'accueil, propriétés des objets, onglets des panneaux, boîtes de dialogue, ...) qui conservait sa taille à 100 % avec une mise à l'échelle de l'affichage Windows supérieure à 100 % (par exemple 125 %), alors que les menus et la barre d'état étaient agrandis. Tout le texte suit désormais la mise à l'échelle de l'affichage et le réglage de la taille du texte de Windows, et utilise la police standard des applications Windows (« Segoe UI »). Cela concernait DataLab exécuté avec Qt 5, comme l'application autonome (nécessite guidata ≥ 3.16.1)"

msgid "**Signal display:**"
msgstr "**Affichage des signaux :**"

Expand Down
5 changes: 5 additions & 0 deletions doc/release_notes/release_1.04.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@ See the [HDF5 browser guide](../features/common/h5browser.rst) for scientific ob

* Fixed the width of the signal/image panels not being restored at startup: after narrowing the panels and restarting DataLab, they came back wider (up to their maximum width) instead of keeping the width chosen by the user

**Display scaling:**

* Fixed the splash screen, the DataLab logo of the welcome page and of the guided tour, and the watermark of empty plots being blurry with a Windows display scaling greater than 100% (e.g., 125%): they are now displayed at the resolution of the screen
* Fixed most of the text of the user interface (welcome page, object properties, panel tabs, dialog boxes, ...) keeping its 100% size with a Windows display scaling greater than 100% (e.g., 125%), while menus and the status bar were enlarged. All the text now follows the display scaling and the Windows text size setting, and uses the standard font of Windows applications ("Segoe UI"). This affected DataLab running with Qt 5, like the standalone application (requires guidata ≥ 3.16.1)

**Signal display:**

* Fixed auto downsampling of signals (**Settings > Visualization > Signals**) only starting above 5 times the configured maximum number of points: with the default value of 100,000 points, signals of a few hundred thousand points were drawn in full, which slowed down the display. Signals with more points than the maximum are now downsampled so that at most this number of points is drawn, and the Settings dialog and the documentation now give the actual default value (100,000 instead of 10,000) (fixes [Issue #455](https://github.com/DataLab-Platform/DataLab/issues/455))
Expand Down
71 changes: 50 additions & 21 deletions scripts/build_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@
* ``wix/dialog.bmp`` - 493x312 background of the WiX UI dialog
* ``wix/banner.bmp`` - 493x58 banner used by the WiX UI
* ``datalab/data/logo/DataLab.svg`` - copy of the master logo (used at runtime)
* PNG renderings under ``doc/`` and ``datalab/data/logo/`` (splash,
watermark, banners, frontpage, overview, screenshots, ...)
* PNG renderings under ``doc/`` and ``datalab/data/logo/`` (frontpage,
overview, screenshots, ...)
* Images displayed by the application under ``datalab/data/logo/`` (splash,
watermark, banners), with their ``@2x`` high-resolution variants used on
high-DPI displays (display scaling greater than 100%)

Run this script only when the corresponding SVG sources change.

Expand Down Expand Up @@ -70,8 +73,6 @@
PNG_TARGETS: tuple[tuple[Path, Path, int], ...] = (
(RESOURCES / "DataLab-Title.svg", DOC_STATIC / "DataLab-Title.png", 190),
(RESOURCES / "DataLab-Frontpage.svg", DOC_STATIC / "DataLab-Frontpage.png", 1300),
(RESOURCES / "DataLab-Splash.svg", LOGO / "DataLab-Splash.png", 350),
(RESOURCES / "DataLab-watermark.svg", LOGO / "DataLab-watermark.png", 225),
(RESOURCES / "DataLab-Banner.svg", DOC_IMAGES / "DataLab-banner.png", 364),
(RESOURCES / "DataLab-Banner.svg", LOGO / "DataLab-Banner-150.png", 150),
(
Expand All @@ -87,6 +88,17 @@
),
)

# Images displayed by the application: (source SVG, destination PNG, width).
# Each image is also rendered at twice its size as an ``@2x`` variant (Qt naming
# convention), used by ``guidata.configtools.get_pixmap`` on high-DPI displays.
LOGO_TARGETS: tuple[tuple[Path, Path, int], ...] = (
(RESOURCES / "DataLab-Splash.svg", LOGO / "DataLab-Splash.png", 350),
(RESOURCES / "DataLab-watermark.svg", LOGO / "DataLab-watermark.png", 225),
(RESOURCES / "DataLab-Banner.svg", LOGO / "DataLab-Banner-200.png", 200),
(RESOURCES / "DataLab-Banner2.svg", LOGO / "DataLab-Banner2-100.png", 100),
)
LOGO_HIDPI_FACTOR = 2

# Plain SVG copies (source -> destination).
SVG_COPIES: tuple[tuple[Path, Path], ...] = (
(RESOURCES / "DataLab.svg", LOGO / "DataLab.svg"),
Expand Down Expand Up @@ -299,27 +311,42 @@ def _replace(match: "re.Match[str]") -> str:
return _NESTED_SVG_HREF_RE.sub(_replace, text)


def build_pngs() -> None:
"""Rasterise every PNG declared in :data:`PNG_TARGETS` via CairoSVG.
def _svg_to_png(src: Path, dst: Path, width: int, height: int) -> None:
"""Rasterise ``src`` (SVG) at the requested size and save it as a PNG.

CairoSVG (pure Python, libcairo-based) is used here instead of Qt's
``QSvgRenderer`` because Qt5 mis-renders the Inkscape-authored logos
(content scaled by an unexpected ~4/3 factor, cropping the text).
"""
if not src.is_file():
raise FileNotFoundError(src)
dst.parent.mkdir(parents=True, exist_ok=True)
svg_source = _inline_nested_svgs(src)
cairosvg.svg2png(
bytestring=svg_source.encode("utf-8"),
url=str(src), # base URL for any remaining relative refs
write_to=str(dst),
output_width=width,
output_height=height,
)
print(f"Wrote {dst.relative_to(REPO_ROOT)} ({width}x{height})")


def build_pngs() -> None:
"""Rasterise every PNG declared in :data:`PNG_TARGETS` via CairoSVG."""
for src, dst, width in PNG_TARGETS:
if not src.is_file():
raise FileNotFoundError(src)
_svg_to_png(src, dst, width, _svg_height_for_width(src, width))


def build_logos() -> None:
"""Rasterise every image declared in :data:`LOGO_TARGETS` via CairoSVG,
together with its ``@2x`` high-resolution variant."""
for src, dst, width in LOGO_TARGETS:
height = _svg_height_for_width(src, width)
dst.parent.mkdir(parents=True, exist_ok=True)
svg_source = _inline_nested_svgs(src)
cairosvg.svg2png(
bytestring=svg_source.encode("utf-8"),
url=str(src), # base URL for any remaining relative refs
write_to=str(dst),
output_width=width,
output_height=height,
)
print(f"Wrote {dst.relative_to(REPO_ROOT)} ({width}x{height})")
_svg_to_png(src, dst, width, height)
factor = LOGO_HIDPI_FACTOR
hidpi_dst = dst.with_name(f"{dst.stem}@{factor}x{dst.suffix}")
_svg_to_png(src, hidpi_dst, width * factor, height * factor)


def copy_svgs() -> None:
Expand All @@ -335,12 +362,12 @@ def copy_svgs() -> None:
def main(argv: list[str] | None = None) -> int:
"""Main entry point for the script."""
parser = argparse.ArgumentParser(description=__doc__.splitlines()[1])
valid = {"ico", "wix", "png", "copy", "all"}
valid = {"ico", "wix", "png", "logo", "copy", "all"}
parser.add_argument(
"targets",
nargs="*",
help=(
"Subset of resources to regenerate: ico, wix, png, copy, all "
"Subset of resources to regenerate: ico, wix, png, logo, copy, all "
"(default: all)."
),
)
Expand All @@ -352,7 +379,7 @@ def main(argv: list[str] | None = None) -> int:
f"invalid target(s): {sorted(unknown)} (choose from {sorted(valid)})"
)
if "all" in targets:
targets = {"ico", "wix", "png", "copy"}
targets = {"ico", "wix", "png", "logo", "copy"}

# A real QApplication is required so QSvgRenderer can access system fonts
# (Century Gothic, etc.). Do NOT use the "offscreen" platform plugin: it
Expand All @@ -368,6 +395,8 @@ def main(argv: list[str] | None = None) -> int:
build_wix_bitmaps()
if "png" in targets:
build_pngs()
if "logo" in targets:
build_logos()
if "copy" in targets:
copy_svgs()

Expand Down
Loading