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