Commit 69ffaf01 authored by Josef Brandt's avatar Josef Brandt

Fixed Layout of OpticalScan UI

parent c42c2a00
......@@ -232,8 +232,8 @@ class OpticalScan(QtWidgets.QWidget):
super().__init__(parent, QtCore.Qt.Window)
self.logpath = logpath
self.view = parent
gridLayout = QtWidgets.QGridLayout()
gridLayout.columnStretch(2)
mainLayout = QtWidgets.QVBoxLayout()
pointgroup = QtWidgets.QGroupBox("Point coordinates [µm]", self)
self.ramanctrl = ramanctrl
self.dataset = dataset
......@@ -272,6 +272,7 @@ class OpticalScan(QtWidgets.QWidget):
self.hdrcheck.setChecked(False)
self.zLevelSetter = ZLevelSetter()
self.zLevelSetter.sizeChanged.connect(self._updateSize)
self.prun = QtWidgets.QPushButton("Run", self)
self.pexit = QtWidgets.QPushButton("Cancel", self)
......@@ -333,16 +334,28 @@ class OpticalScan(QtWidgets.QWidget):
btnLayout.addWidget(self.pexit)
btnLayout.addStretch()
gridLayout.addWidget(pointgroup, 0, 0)
gridLayout.addWidget(self.areaOptionsGroup, 0, 1)
gridLayout.addWidget(bkggroup, 1, 1)
gridLayout.addWidget(furtherOptionsGroup, 2, 1)
gridLayout.addWidget(self.zLevelSetter, 1, 0, 3, 1)
gridLayout.addLayout(btnLayout, 4, 0, 2, 1)
gridLayout.addWidget(self.progresstime, 5, 0, 2, 1)
gridLayout.addWidget(self.progressbar, 6, 0, 2, 1)
vbox1 = QtWidgets.QVBoxLayout()
vbox2 = QtWidgets.QVBoxLayout()
vbox1.addWidget(pointgroup)
vbox1.addWidget(self.zLevelSetter)
vbox1.addStretch()
vbox2.addWidget(self.areaOptionsGroup)
vbox2.addWidget(bkggroup)
vbox2.addWidget(furtherOptionsGroup)
vbox2.addStretch()
optionsLayout = QtWidgets.QHBoxLayout()
optionsLayout.addLayout(vbox1)
optionsLayout.addLayout(vbox2)
mainLayout.addLayout(optionsLayout)
mainLayout.addWidget(self.progresstime)
mainLayout.addWidget(self.progressbar)
mainLayout.addLayout(btnLayout)
self.setLayout(gridLayout)
self.setLayout(mainLayout)
self.setVisible(False)
def enableDisableBackground(self):
......@@ -362,7 +375,11 @@ class OpticalScan(QtWidgets.QWidget):
def managerWasClosed(self):
self.showBgkManagerBtn.setText('Show Background Manager Window')
@QtCore.pyqtSlot()
def _updateSize(self):
self.adjustSize()
@QtCore.pyqtSlot()
def stopScan(self):
if self.process is not None and self.process.is_alive():
......
......@@ -4,7 +4,7 @@ Created on Fri Oct 25 09:39:14 2019
@author: brandt
"""
from PyQt5 import QtWidgets, QtGui
from PyQt5 import QtWidgets, QtCore
import sys
import numpy as np
from .errors import ValueNotSetError
......@@ -15,6 +15,9 @@ class ZLevelSetter(QtWidgets.QLabel):
Allows refining settings for the focus-z-stacking
:return:
"""
sizeChanged = QtCore.pyqtSignal()
def __init__(self):
super(ZLevelSetter, self).__init__()
layout = QtWidgets.QVBoxLayout()
......@@ -26,8 +29,7 @@ class ZLevelSetter(QtWidgets.QLabel):
layout.addLayout(self._createLevelSelectionLayout())
self._addRadioBtnsToGroup()
self.sizePolicy().setVerticalPolicy(QtWidgets.QSizePolicy.Expanding)
# self.sizePolicy().setVerticalStretch(2)
self._updateLevels()
def _createRangeGroupBox(self):
"""
......@@ -56,11 +58,11 @@ class ZLevelSetter(QtWidgets.QLabel):
for box in [self.minLevelSpinbox, self.maxLevelSpinbox, self.numLevelsSpinbox]:
box.valueChanged.connect(self._updateLevels)
rangesLayout.addWidget(QtWidgets.QLabel('Minimum (µm): '))
rangesLayout.addWidget(QtWidgets.QLabel('z_min (µm): '))
rangesLayout.addWidget(self.minLevelSpinbox)
rangesLayout.addWidget(QtWidgets.QLabel(', Maximum (µm): '))
rangesLayout.addWidget(QtWidgets.QLabel(', z_max (µm): '))
rangesLayout.addWidget(self.maxLevelSpinbox)
rangesLayout.addWidget(QtWidgets.QLabel(', Number of Steps: '))
rangesLayout.addWidget(QtWidgets.QLabel(', Num. steps: '))
rangesLayout.addWidget(self.numLevelsSpinbox)
return rangeGroupBox
......@@ -147,6 +149,7 @@ class ZLevelSetter(QtWidgets.QLabel):
self._updateLinPreview()
self._updateLogPreview()
self._updateCustomPreview()
self._updateSize()
def _updateLinPreview(self):
"""
......@@ -208,6 +211,16 @@ class ZLevelSetter(QtWidgets.QLabel):
entry.setParent(None)
self.customPreviewSteps.remove(entry)
def _updateSize(self):
"""
Updates the size so that all entries are well visible
:return:
"""
width = 400
height = 100 + self.numLevelsSpinbox.value()*30
self.setFixedSize(width, height)
self.sizeChanged.emit()
def _minLevelBoxChanged(self):
"""
Adjusts maxLevelSpinbox to show always values larger then minLevelSpinbox
......@@ -256,8 +269,6 @@ class ZLevelSetter(QtWidgets.QLabel):
raise ValueNotSetError
return sorted(levels)
# def resizeEvent(self, event: QtGui.QResizeEvent) -> None:
# print(event.size())
if __name__ == '__main__':
try:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment