Skip to content

Commit

Permalink
Does not show the list systematically.
Browse files Browse the repository at this point in the history
  • Loading branch information
mmouchous-ledger committed Nov 27, 2024
1 parent a5f89d4 commit 2a8de97
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 10 deletions.
6 changes: 1 addition & 5 deletions laserstudio/laserstudio.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
CameraToolbar,
MainToolbar,
MarkersToolbar,
MarkersListToolbar,
PDMToolbar,
LaserDriverToolbar,
CameraNITToolBar,
Expand Down Expand Up @@ -86,10 +85,7 @@ def __init__(self, config: Optional[dict]):
# Toolbar: Markers
toolbar = MarkersToolbar(self.viewer)
self.addToolBar(Qt.ToolBarArea.TopToolBarArea, toolbar)

# Toolbar: Markers' List
toolbar = MarkersListToolbar(self.viewer)
self.addToolBar(Qt.ToolBarArea.LeftToolBarArea, toolbar)
self.addToolBar(Qt.ToolBarArea.RightToolBarArea, toolbar.markers_list_toolbar)

# Toolbar: Stage positioning
if self.instruments.stage is not None:
Expand Down
2 changes: 0 additions & 2 deletions laserstudio/widgets/toolbars/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from .laserdrivertoolbar import LaserDriverToolbar
from .maintoolbar import MainToolbar
from .markerstoolbar import MarkersToolbar
from .markerslisttoolbar import MarkersListToolbar
from .scantoolbar import ScanToolbar
from .picturetoolbar import PictureToolbar
from .stagetoolbar import StageToolbar
Expand All @@ -22,5 +21,4 @@
"LaserDriverToolbar",
"PDMToolbar",
"MarkersToolbar",
"MarkersListToolbar",
]
6 changes: 4 additions & 2 deletions laserstudio/widgets/toolbars/markerslisttoolbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ def __init__(self, parent: QTreeWidget):

def update_checked_state(self):
# To prevent the itemChanged signal from being emitted
self.treeWidget().blockSignals(True)
tw = self.treeWidget()
assert tw is not None
tw.blockSignals(True)
self.setToolTip(0, f"{self.number_of_checked} shown over {self.childCount()}")
self.treeWidget().blockSignals(False)
tw.blockSignals(False)
if self.number_of_checked == 0:
self.setCheckState(0, Qt.CheckState.Unchecked)
elif self.number_of_checked == self.childCount():
Expand Down
20 changes: 19 additions & 1 deletion laserstudio/widgets/toolbars/markerstoolbar.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from PyQt6.QtCore import Qt, QSize
from PyQt6.QtGui import QIcon
from PyQt6.QtWidgets import QToolBar, QPushButton
from PyQt6.QtWidgets import QToolBar, QPushButton, QMainWindow
from ..return_line_edit import ReturnSpinBox
from ...utils.util import colored_image
from ..viewer import Viewer
Expand Down Expand Up @@ -30,6 +30,14 @@ def __init__(self, viewer: Viewer):
w.clicked.connect(viewer.clear_markers)
self.addWidget(w)

# Show list of all markers
w = QPushButton(parent=self)
w.setText("Show list")
w.setToolTip("Show a list of all markers")
w.setCheckable(True)
w.clicked.connect(self.show_markers_list)
self.addWidget(w)

# Markers' size
self.marker_size_sp = w = ReturnSpinBox()
self.marker_size_sp.setSuffix("\xa0µm")
Expand All @@ -43,3 +51,13 @@ def __init__(self, viewer: Viewer):
lambda: viewer.marker_size(float(self.marker_size_sp.value()))
)
self.addWidget(self.marker_size_sp)

# Toolbar: Markers' List
self.markers_list_toolbar = MarkersListToolbar(viewer)

def show_markers_list(self, state: bool):
if state:
self.markers_list_toolbar.refresh_list()
self.markers_list_toolbar.show()
else:
self.markers_list_toolbar.hide()

0 comments on commit 2a8de97

Please sign in to comment.