|
2 | 2 | from collections import defaultdict, namedtuple
|
3 | 3 | from copy import deepcopy
|
4 | 4 | from datetime import datetime
|
5 |
| -from functools import partial |
| 5 | +from functools import partial, cached_property |
6 | 6 | from math import ceil, log10
|
7 | 7 | import pandas as pd
|
8 | 8 | from pathlib import Path
|
|
17 | 17 | from napari.layers.utils.layer_utils import _features_to_properties
|
18 | 18 | from napari.utils.events import Event
|
19 | 19 | from napari.utils.history import get_save_history, update_save_history
|
20 |
| -from qtpy.QtCore import Qt, QTimer, Signal, QSize, QPoint |
21 |
| -from qtpy.QtGui import QPainter, QIcon |
| 20 | +from qtpy.QtCore import Qt, QTimer, Signal, QSize, QPoint, QSettings |
| 21 | +from qtpy.QtGui import QPainter, QIcon, QAction |
22 | 22 | from qtpy.QtWidgets import (
|
23 | 23 | QButtonGroup,
|
24 | 24 | QCheckBox,
|
@@ -364,10 +364,21 @@ def __init__(self, napari_viewer):
|
364 | 364 | elif "save all layers" in action_name:
|
365 | 365 | self.viewer.window.file_menu.removeAction(action)
|
366 | 366 |
|
367 |
| - QTimer.singleShot(10, self.start_tutorial) |
| 367 | + # Add action to show the walkthrough again |
| 368 | + launch_tutorial = QAction("&Launch Tutorial", self) |
| 369 | + launch_tutorial.triggered.connect(self.start_tutorial) |
| 370 | + self.viewer.window.view_menu.addAction(launch_tutorial) |
| 371 | + |
| 372 | + if self.settings.value("first_launch", True): |
| 373 | + QTimer.singleShot(10, self.start_tutorial) |
| 374 | + self.settings.setValue("first_launch", False) |
| 375 | + |
| 376 | + @cached_property |
| 377 | + def settings(self): |
| 378 | + return QSettings() |
368 | 379 |
|
369 | 380 | def start_tutorial(self):
|
370 |
| - tuto = Tutorial(self.viewer.window._qt_window.__wrapped__).show() |
| 381 | + Tutorial(self.viewer.window._qt_window.__wrapped__).show() |
371 | 382 |
|
372 | 383 | def _load_config(self):
|
373 | 384 | config = QFileDialog.getOpenFileName(
|
|
0 commit comments