-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from Ledger-Donjon/marker-clear-button
Added menu to clear markers
- Loading branch information
Showing
9 changed files
with
171 additions
and
18 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from typing import TYPE_CHECKING | ||
from PyQt6.QtCore import Qt, QSize | ||
from PyQt6.QtGui import QIcon | ||
from PyQt6.QtWidgets import QToolBar, QPushButton | ||
from ..return_line_edit import ReturnSpinBox | ||
from ...utils.util import colored_image | ||
from ..viewer import Viewer | ||
|
||
|
||
class MarkersToolbar(QToolBar): | ||
def __init__(self, viewer: Viewer): | ||
super().__init__("Markers") | ||
self.setObjectName("toolbar-markers") # For settings save and restore | ||
self.setAllowedAreas(Qt.ToolBarArea.TopToolBarArea) | ||
self.setFloatable(True) | ||
|
||
# Add a marker | ||
w = QPushButton(self) | ||
w.setIcon(QIcon(colored_image(":/icons/location-pin-plus.svg"))) | ||
w.setIconSize(QSize(24, 24)) | ||
w.setToolTip("Add markers") | ||
w.clicked.connect(lambda: viewer.add_marker()) | ||
self.addWidget(w) | ||
|
||
# Clear all markers | ||
w = QPushButton(self) | ||
w.setIcon(QIcon(colored_image(":/icons/location-pin-clear.svg"))) | ||
w.setIconSize(QSize(24, 24)) | ||
w.setToolTip("Clear all markers") | ||
w.clicked.connect(viewer.clear_markers) | ||
self.addWidget(w) | ||
|
||
# Markers' size | ||
self.marker_size_sp = w = ReturnSpinBox() | ||
self.marker_size_sp.setSuffix(" µm") | ||
self.marker_size_sp.setToolTip("Markers' size") | ||
self.marker_size_sp.setMinimum(1) | ||
self.marker_size_sp.setSingleStep(10) | ||
self.marker_size_sp.setMaximum(2000) | ||
self.marker_size_sp.setValue(int(viewer.default_marker_size)) | ||
self.marker_size_sp.reset() | ||
w.returnPressed.connect( | ||
lambda: viewer.marker_size(float(self.marker_size_sp.value())) | ||
) | ||
self.addWidget(self.marker_size_sp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters