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
5 changes: 4 additions & 1 deletion datalab/config/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,10 @@ def __init__(self) -> None:
category="main",
default=True,
expected_type=bool,
description="If True, show the welcome page at startup.",
description=(
"If True, show the welcome page at startup and whenever the "
"current signal or image panel is empty."
),
)
self.v020_plugins_warning_ignore = TypedOptionField(
self,
Expand Down
16 changes: 11 additions & 5 deletions datalab/gui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,8 +770,7 @@ def execute_post_show_actions(self) -> None:
if not execenv.unattended:
if not Conf.welcome_on_startup.get():
self.docks[self.welcomepanel].hide()
elif not any(len(p) for p in (self.signalpanel, self.imagepanel)):
self.show_welcome_page()
self.__raise_view_dock(self.tabwidget.currentWidget())
# Auto-start WebAPI server if environment variable is set
if os.environ.get("DATALAB_WEBAPI_ENABLED") == "1":
try:
Expand Down Expand Up @@ -1247,6 +1246,9 @@ def _setup_panels(self) -> None:
panel.objview.SIG_SELECTION_CHANGED.connect(
functools.partial(self.__raise_view_dock, panel)
)
panel.SIG_OBJECT_REMOVED.connect(
functools.partial(self.__raise_view_dock, panel)
)
panel.setup_panel()

def _setup_central_widget(self) -> None:
Expand Down Expand Up @@ -1624,20 +1626,24 @@ def __update_actions(self, update_other_data_panel: bool = False) -> None:

def __tab_index_changed(self, index: int) -> None:
"""Switch from signal to image mode, or vice-versa"""
dock = self.docks[self.tabwidget.widget(index)]
dock.raise_()
self.__raise_view_dock(self.tabwidget.widget(index))
self.__update_actions()

def __raise_view_dock(self, panel: BaseDataPanel) -> None:
"""Bring the panel view dock to the front, if the panel is the current tab

An empty panel shows the welcome page instead, unless it is disabled.

Args:
panel: signal or image panel
"""
# The guard matters because selection changes are also emitted for the
# panel that is not currently shown (see __update_actions).
if self.tabwidget.currentWidget() is panel:
self.docks[panel].raise_()
if len(panel) == 0 and Conf.welcome_on_startup.get():
self.show_welcome_page()
else:
self.docks[panel].raise_()

def __update_generic_menu(self, menu: QW.QMenu | None = None) -> None:
"""Update menu before showing up -- Generic method"""
Expand Down
5 changes: 3 additions & 2 deletions datalab/gui/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ class MainSettings(gds.DataSet):
)
welcome_on_startup = gds.BoolItem(
"",
_("Show welcome page on startup"),
_("Show welcome page when the current panel is empty"),
help=_(
"The welcome page gathers the main actions to get started "
"(create or open data, guided tour, documentation...)."
"(create or open data, guided tour, documentation...). It is shown "
"at startup and whenever the current signal or image panel is empty."
),
)
process_isolation_enabled = gds.BoolItem(
Expand Down
4 changes: 3 additions & 1 deletion datalab/gui/welcome.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ def __init__(
self.entries: dict[str, WelcomeEntry] = {}
self.start_title = self.__create_section_title("")
self.columns_layout = QW.QBoxLayout(QW.QBoxLayout.LeftToRight)
self.startup_checkbox = QW.QCheckBox(_("Show welcome page on startup"))
self.startup_checkbox = QW.QCheckBox(
_("Show welcome page when the current panel is empty")
)
self.startup_checkbox.setChecked(Conf.welcome_on_startup.get())
self.startup_checkbox.toggled.connect(Conf.welcome_on_startup.set)
self.__setup_ui()
Expand Down
8 changes: 4 additions & 4 deletions datalab/locale/fr/LC_MESSAGES/datalab.po
Original file line number Diff line number Diff line change
Expand Up @@ -4159,11 +4159,11 @@ msgstr "Aucun contour n'a été trouvé pour la plage de niveaux sélectionnée.
msgid "Show contour plot..."
msgstr "Afficher le tracé de contours..."

msgid "Show welcome page on startup"
msgstr "Afficher la page d'accueil au démarrage"
msgid "Show welcome page when the current panel is empty"
msgstr "Afficher la page d'accueil lorsque le panneau courant est vide"

msgid "The welcome page gathers the main actions to get started (create or open data, guided tour, documentation...)."
msgstr "La page d'accueil rassemble les principales actions pour bien démarrer (créer ou ouvrir des données, visite guidée, documentation...)."
msgid "The welcome page gathers the main actions to get started (create or open data, guided tour, documentation...). It is shown at startup and whenever the current signal or image panel is empty."
msgstr "La page d'accueil rassemble les principales actions pour bien démarrer (créer ou ouvrir des données, visite guidée, documentation...). Elle est affichée au démarrage et chaque fois que le panneau signal ou image courant est vide."

msgid "Welcome"
msgstr "Accueil"
Expand Down
37 changes: 37 additions & 0 deletions datalab/tests/features/common/welcome_unit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

from __future__ import annotations

import numpy as np
from qtpy import QtWidgets as QW
from sigima.objects import create_signal

import datalab
from datalab.config import Conf, _
Expand Down Expand Up @@ -106,3 +108,38 @@ def create_gaussian(menu: QW.QMenu, *_args) -> None:
assert Conf.welcome_on_startup.get() is (not initial)
finally:
Conf.welcome_on_startup.set(initial)


def test_welcome_page_follows_empty_current_panel() -> None:
"""The welcome page replaces the view of an empty current panel"""
x = np.linspace(0.0, 1.0, 10)
with datalab_test_app_context(console=False) as win:
docks = [win.docks[win.welcomepanel]]
docks += [win.docks[panel] for panel in (win.signalpanel, win.imagepanel)]
welcome_dock, signal_dock, image_dock = docks

def front_dock() -> QW.QDockWidget:
QW.QApplication.processEvents()
(dock,) = [dock for dock in docks if is_in_front(dock)]
return dock

assert front_dock() is welcome_dock
win.signalpanel.add_object(create_signal("Signal 1", x, x))
assert front_dock() is signal_dock
win.set_current_panel("image")
assert front_dock() is welcome_dock
win.set_current_panel("signal")
assert front_dock() is signal_dock
win.signalpanel.remove_all_objects()
assert front_dock() is welcome_dock

# A closed welcome page is opened again when the current panel is empty
win.signalpanel.add_object(create_signal("Signal 2", x, x))
welcome_dock.close()
win.set_current_panel("image")
assert welcome_dock.isVisible() and front_dock() is welcome_dock

Conf.welcome_on_startup.set(False)
win.set_current_panel("signal")
win.set_current_panel("image")
assert front_dock() is image_dock
11 changes: 2 additions & 9 deletions doc/features/common/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ panel (see :ref:`about_macros`) and the :ref:`ai_assistant`.
Welcome page
^^^^^^^^^^^^

When DataLab starts with an empty workspace, a **Welcome** page is shown next to
the signal and image views. It gathers the main actions to get started:
A **Welcome** page is shown next to the signal and image views when DataLab starts, and whenever the current signal or image panel is empty (for example after switching to an empty panel or deleting its last object). It gathers the main actions to get started:

- create a signal or an image from a template, open signal or image files,
browse an HDF5 file, open a previously saved HDF5 workspace, or import text
Expand All @@ -46,13 +45,7 @@ the signal and image views. It gathers the main actions to get started:
- ask the :ref:`ai_assistant`, take the guided tour, run the demo, read the
online documentation, or browse the release notes of the running version.

The Welcome page is a regular dockable panel: as soon as a signal or an image is
created or opened, the corresponding view is brought to the front, and the
Welcome page remains available as a tab. It may be closed like any other panel,
and reopened at any time from the "Welcome page" entry of the "?" (Help) menu or
from the "View" menu. The "Show welcome page on startup" check box, at the bottom
of the page, controls whether the page is shown when DataLab starts (this option
is also available in the :ref:`settings`).
The Welcome page is a regular dockable panel: as soon as a signal or an image is created or opened, the corresponding view is brought to the front, and the Welcome page remains available as a tab. It may be closed like any other panel, and reopened at any time from the "Welcome page" entry of the "?" (Help) menu or from the "View" menu; it is also reopened automatically when the current panel becomes empty. The "Show welcome page when the current panel is empty" check box, at the bottom of the page, controls this automatic display, including at startup (this option is also available in the :ref:`settings`).

.. _command_palette:

Expand Down
5 changes: 2 additions & 3 deletions doc/features/common/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ The General settings tab contains main window and general feature settings:
**Color mode**
Choose the color mode for the application interface (e.g., light, dark, or auto).

**Show welcome page on startup**
When enabled (default), the welcome page is shown when DataLab starts with an empty
workspace (see :ref:`welcome_page`).
**Show welcome page when the current panel is empty**
When enabled (default), the welcome page is shown when DataLab starts and whenever the current signal or image panel is empty (see :ref:`welcome_page`).

**Process isolation**
When enabled, each computation runs in a separate process, preventing the application
Expand Down
8 changes: 4 additions & 4 deletions doc/locale/fr/LC_MESSAGES/features/common/overview.po
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ msgstr "D'autres panneaux sont disponibles sous forme de widgets ancrables, et p
msgid "Welcome page"
msgstr "Page d'accueil"

msgid "When DataLab starts with an empty workspace, a **Welcome** page is shown next to the signal and image views. It gathers the main actions to get started:"
msgstr "Lorsque DataLab démarre avec un espace de travail vide, une page d'**Accueil** est affichée à côté des vues signal et image. Elle rassemble les principales actions pour bien démarrer :"
msgid "A **Welcome** page is shown next to the signal and image views when DataLab starts, and whenever the current signal or image panel is empty (for example after switching to an empty panel or deleting its last object). It gathers the main actions to get started:"
msgstr "Une page d'**Accueil** est affichée à côté des vues signal et image au démarrage de DataLab, et chaque fois que le panneau signal ou image courant est vide (par exemple après le passage à un panneau vide ou la suppression de son dernier objet). Elle rassemble les principales actions pour bien démarrer :"

msgid "create a signal or an image from a template, open signal or image files, browse an HDF5 file, open a previously saved HDF5 workspace, or import text data (CSV, TSV, ...) with the import wizard. When needed, a menu lets you choose between signals and images;"
msgstr "créer un signal ou une image à partir d'un modèle, ouvrir des fichiers de signaux ou d'images, parcourir un fichier HDF5, ouvrir un espace de travail HDF5 précédemment enregistré, ou importer des données texte (CSV, TSV, ...) avec l'assistant d'importation. Si nécessaire, un menu permet de choisir entre signaux et images ;"

msgid "ask the :ref:`ai_assistant`, take the guided tour, run the demo, read the online documentation, or browse the release notes of the running version."
msgstr "interroger l':ref:`ai_assistant`, suivre la visite guidée, lancer la démo, lire la documentation en ligne, ou consulter les notes de version de la version en cours d'exécution."

msgid "The Welcome page is a regular dockable panel: as soon as a signal or an image is created or opened, the corresponding view is brought to the front, and the Welcome page remains available as a tab. It may be closed like any other panel, and reopened at any time from the \"Welcome page\" entry of the \"?\" (Help) menu or from the \"View\" menu. The \"Show welcome page on startup\" check box, at the bottom of the page, controls whether the page is shown when DataLab starts (this option is also available in the :ref:`settings`)."
msgstr "La page d'accueil est un panneau ancrable comme les autres : dès qu'un signal ou une image est créé ou ouvert, la vue correspondante passe au premier plan, et la page d'accueil reste disponible sous forme d'onglet. Elle peut être fermée comme n'importe quel autre panneau, et rouverte à tout moment depuis l'entrée « Page d'accueil » du menu « ? » (Aide) ou depuis le menu « Affichage ». La case à cocher « Afficher la page d'accueil au démarrage », en bas de la page, détermine si la page est affichée au démarrage de DataLab (cette option est également disponible dans les :ref:`settings`)."
msgid "The Welcome page is a regular dockable panel: as soon as a signal or an image is created or opened, the corresponding view is brought to the front, and the Welcome page remains available as a tab. It may be closed like any other panel, and reopened at any time from the \"Welcome page\" entry of the \"?\" (Help) menu or from the \"View\" menu; it is also reopened automatically when the current panel becomes empty. The \"Show welcome page when the current panel is empty\" check box, at the bottom of the page, controls this automatic display, including at startup (this option is also available in the :ref:`settings`)."
msgstr "La page d'accueil est un panneau ancrable comme les autres : dès qu'un signal ou une image est créé ou ouvert, la vue correspondante passe au premier plan, et la page d'accueil reste disponible sous forme d'onglet. Elle peut être fermée comme n'importe quel autre panneau, et rouverte à tout moment depuis l'entrée « Page d'accueil » du menu « ? » (Aide) ou depuis le menu « Affichage » ; elle est aussi rouverte automatiquement lorsque le panneau courant devient vide. La case à cocher « Afficher la page d'accueil lorsque le panneau courant est vide », en bas de la page, détermine cet affichage automatique, y compris au démarrage (cette option est également disponible dans les :ref:`settings`)."

msgid "Command palette"
msgstr "Palette de commandes"
Expand Down
8 changes: 4 additions & 4 deletions doc/locale/fr/LC_MESSAGES/features/common/settings.po
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ msgstr "**Mode couleur**"
msgid "Choose the color mode for the application interface (e.g., light, dark, or auto)."
msgstr "Choisir le mode couleur de l'interface de l'application (par exemple, clair, sombre ou automatique)."

msgid "**Show welcome page on startup**"
msgstr "**Afficher la page d'accueil au démarrage**"
msgid "**Show welcome page when the current panel is empty**"
msgstr "**Afficher la page d'accueil lorsque le panneau courant est vide**"

msgid "When enabled (default), the welcome page is shown when DataLab starts with an empty workspace (see :ref:`welcome_page`)."
msgstr "Lorsque cette option est activée (par défaut), la page d'accueil est affichée lorsque DataLab démarre avec un espace de travail vide (voir :ref:`welcome_page`)."
msgid "When enabled (default), the welcome page is shown when DataLab starts and whenever the current signal or image panel is empty (see :ref:`welcome_page`)."
msgstr "Lorsque cette option est activée (par défaut), la page d'accueil est affichée au démarrage de DataLab et chaque fois que le panneau signal ou image courant est vide (voir :ref:`welcome_page`)."

msgid "**Process isolation**"
msgstr "**Isolation des processus**"
Expand Down
8 changes: 4 additions & 4 deletions doc/locale/fr/LC_MESSAGES/release_notes/release_1.04.po
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ msgstr "✨ Nouvelles fonctionnalités"
msgid "**Welcome page:**"
msgstr "**Page d'accueil :**"

msgid "A new **Welcome** page, similar to the one of DataLab-Web, is shown at startup when the workspace is empty. It gathers the main actions to get started: create a signal or an image, open files, browse an HDF5 file, open an HDF5 workspace, import text data, ask the AI Assistant, take the guided tour, run the demo, read the documentation or browse the release notes"
msgstr "Une nouvelle page d'**Accueil**, semblable à celle de DataLab-Web, est affichée au démarrage lorsque l'espace de travail est vide. Elle rassemble les principales actions pour bien démarrer : créer un signal ou une image, ouvrir des fichiers, parcourir un fichier HDF5, ouvrir un espace de travail HDF5, importer des données texte, interroger l'assistant IA, suivre la visite guidée, lancer la démo, lire la documentation ou consulter les notes de version"
msgid "A new **Welcome** page, similar to the one of DataLab-Web, is shown at startup and whenever the current signal or image panel is empty. It gathers the main actions to get started: create a signal or an image, open files, browse an HDF5 file, open an HDF5 workspace, import text data, ask the AI Assistant, take the guided tour, run the demo, read the documentation or browse the release notes"
msgstr "Une nouvelle page d'**Accueil**, semblable à celle de DataLab-Web, est affichée au démarrage et chaque fois que le panneau signal ou image courant est vide. Elle rassemble les principales actions pour bien démarrer : créer un signal ou une image, ouvrir des fichiers, parcourir un fichier HDF5, ouvrir un espace de travail HDF5, importer des données texte, interroger l'assistant IA, suivre la visite guidée, lancer la démo, lire la documentation ou consulter les notes de version"

msgid "The page is a dockable panel, tabbed with the signal and image views: it remains available after data is created or opened, and can be reopened at any time from the **?** menu (**Welcome page**) or from the **View** menu"
msgstr "La page est un panneau ancrable, en onglet avec les vues signal et image : elle reste disponible après la création ou l'ouverture de données, et peut être rouverte à tout moment depuis le menu **?** (**Page d'accueil**) ou depuis le menu **Affichage**"

msgid "A **Show welcome page on startup** option, available on the page itself and in the General settings, controls whether the page is shown at startup"
msgstr "Une option **Afficher la page d'accueil au démarrage**, disponible sur la page elle-même et dans les paramètres généraux, détermine si la page est affichée au démarrage"
msgid "A **Show welcome page when the current panel is empty** option, available on the page itself and in the General settings, controls whether the page is shown automatically, including at startup"
msgstr "Une option **Afficher la page d'accueil lorsque le panneau courant est vide**, disponible sur la page elle-même et dans les paramètres généraux, détermine si la page est affichée automatiquement, y compris au démarrage"

msgid "**Brightness and contrast:**"
msgstr "**Luminosité et contraste :**"
Expand Down
4 changes: 2 additions & 2 deletions doc/release_notes/release_1.04.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

**Welcome page:**

* A new **Welcome** page, similar to the one of DataLab-Web, is shown at startup when the workspace is empty. It gathers the main actions to get started: create a signal or an image, open files, browse an HDF5 file, open an HDF5 workspace, import text data, ask the AI Assistant, take the guided tour, run the demo, read the documentation or browse the release notes
* A new **Welcome** page, similar to the one of DataLab-Web, is shown at startup and whenever the current signal or image panel is empty. It gathers the main actions to get started: create a signal or an image, open files, browse an HDF5 file, open an HDF5 workspace, import text data, ask the AI Assistant, take the guided tour, run the demo, read the documentation or browse the release notes
* The page is a dockable panel, tabbed with the signal and image views: it remains available after data is created or opened, and can be reopened at any time from the **?** menu (**Welcome page**) or from the **View** menu
* A **Show welcome page on startup** option, available on the page itself and in the General settings, controls whether the page is shown at startup
* A **Show welcome page when the current panel is empty** option, available on the page itself and in the General settings, controls whether the page is shown automatically, including at startup

**Brightness and contrast:**

Expand Down
Loading