From 11186a5e2f54bc011fbc6d512e8c554e2123b920 Mon Sep 17 00:00:00 2001 From: beniroquai Date: Thu, 5 Dec 2024 08:15:54 +0100 Subject: [PATCH] Fixing display issue with Histowidget --- imswitch/imcontrol/view/ImConMainView.py | 2 ++ .../imcontrol/view/widgets/HistoScanWidget.py | 24 +++++++++---------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/imswitch/imcontrol/view/ImConMainView.py b/imswitch/imcontrol/view/ImConMainView.py index 35d4ff6c..ff707a8f 100644 --- a/imswitch/imcontrol/view/ImConMainView.py +++ b/imswitch/imcontrol/view/ImConMainView.py @@ -214,6 +214,8 @@ def _addDocks(self, dockInfoDict, dockArea, position): prevDock = None prevDockYPosition = -1 for widgetKey, dockInfo in dockInfoDict.items(): + if widgetKey == "ImSwitchServer": + continue try: self.widgets[widgetKey] = self.factory.createWidget( getattr(widgets, f'{widgetKey}Widget') diff --git a/imswitch/imcontrol/view/widgets/HistoScanWidget.py b/imswitch/imcontrol/view/widgets/HistoScanWidget.py index 8597ed1b..65a47ae3 100644 --- a/imswitch/imcontrol/view/widgets/HistoScanWidget.py +++ b/imswitch/imcontrol/view/widgets/HistoScanWidget.py @@ -113,7 +113,7 @@ def __post_init__(self): # load sample layout - self.ScanSelectViewWidget = None + self.ScanSelectViewWidget = ScanSelectView(self) self.grid.addWidget(self.ScanSelectViewWidget, 12, 0, 2, 2) # Create a scroll area and set the second tab widget as its content @@ -363,12 +363,11 @@ def handleSelectPath(self): self.setDefaultSavePath(os.path.join(path, "histoScan")) os.makedirs(os.path.join(path, "histoScan"), exist_ok=True) - def loadSampleLayout(self, index, allScanParameters): - if self.ScanSelectViewWidget is None: - self.ScanSelectViewWidget = ScanSelectView(self, allScanParameters[index]) - else: - self.ScanSelectViewWidget.updateParams(allScanParameters[index]) - self.ScanSelectViewWidget.setPixmap(QtGui.QPixmap(allScanParameters[index].imagePath)) + def loadSampleLayout(self, index=0, allScanParameters=None): + if allScanParameters is not None: + self.allScanParameters = allScanParameters # save all scan parameters + self.ScanSelectViewWidget.updateParams(self.allScanParameters[index]) + self.ScanSelectViewWidget.setPixmap(QtGui.QPixmap(self.allScanParameters[index].imagePath)) def setSampleLayouts(self, sampleLayoutList): @@ -541,8 +540,9 @@ def __init__(self, color): class ScanSelectView(QtWidgets.QGraphicsView): - def __init__(self, parent, scanParameters): + def __init__(self, parent): super().__init__(parent) + self.name = "ScanSelectView" scene = QtWidgets.QGraphicsScene(self) self._logger = initLogger(self) self.setScene(scene) @@ -555,10 +555,10 @@ def __init__(self, parent, scanParameters): self.parent = parent # real-world coordinates for the scan region that is represented by the image - self.physDimX = scanParameters.physDimX - self.physDimY = scanParameters.physDimY - self.physOffsetX = scanParameters.physOffsetX - self.physOffsetY = scanParameters.physOffsetY + self.physDimX = 0 + self.physDimY = 0 + self.physOffsetX = 0 + self.physOffsetY = 0 self.clickedCoordinates = (0,0) self._logger = initLogger(self)