feature/port-to-py3 #11

Merged
marcel merged 59 commits from feature/port-to-py3 into develop 2022-03-21 15:30:06 +01:00
Showing only changes of commit 0b50a91f57 - Show all commits

View File

@ -34,7 +34,7 @@ from PySide2.QtGui import QIcon, QPixmap, QKeySequence
from PySide2.QtWidgets import QAction, QApplication, QCheckBox, QComboBox, \ from PySide2.QtWidgets import QAction, QApplication, QCheckBox, QComboBox, \
QDateTimeEdit, QDialog, QDialogButtonBox, QDoubleSpinBox, QGroupBox, \ QDateTimeEdit, QDialog, QDialogButtonBox, QDoubleSpinBox, QGroupBox, \
QGridLayout, QLabel, QLineEdit, QMessageBox, \ QGridLayout, QLabel, QLineEdit, QMessageBox, \
QSpinBox, QTabWidget, QToolBar, QVBoxLayout, QHBoxLayout, QWidget, \ QTabWidget, QToolBar, QVBoxLayout, QHBoxLayout, QWidget, \
QPushButton, QFileDialog, QInputDialog QPushButton, QFileDialog, QInputDialog
from PySide2.QtCore import QSettings, Qt, QUrl, Signal, Slot from PySide2.QtCore import QSettings, Qt, QUrl, Signal, Slot
from PySide2.QtWebEngineWidgets import QWebEngineView as QWebView from PySide2.QtWebEngineWidgets import QWebEngineView as QWebView
@ -71,6 +71,18 @@ else:
# icons_rc = icons_rc # icons_rc = icons_rc
class QSpinBox(QtWidgets.QSpinBox):
''' Custom SpinBox, insensitive to Mousewheel (prevents accidental changes when scrolling through parameters) '''
def wheelEvent(self, event):
event.ignore()
class QDoubleSpinBox(QtWidgets.QDoubleSpinBox):
''' Custom DoubleSpinBox, insensitive to Mousewheel (prevents accidental changes when scrolling through parameters) '''
def wheelEvent(self, event):
event.ignore()
def getDataType(parent): def getDataType(parent):
type = QInputDialog().getItem(parent, "Select phases type", "Type:", type = QInputDialog().getItem(parent, "Select phases type", "Type:",
["manual", "automatic"]) ["manual", "automatic"])
@ -4028,11 +4040,11 @@ class PylotParaBox(QtWidgets.QWidget):
if typ == str: if typ == str:
box = QtWidgets.QLineEdit() box = QtWidgets.QLineEdit()
elif typ == float: elif typ == float:
box = QtWidgets.QDoubleSpinBox() box = QDoubleSpinBox()
box.setDecimals(4) box.setDecimals(4)
box.setRange(-10e4, 10e4) box.setRange(-10e4, 10e4)
elif typ == int: elif typ == int:
box = QtWidgets.QSpinBox() box = QSpinBox()
elif typ == bool: elif typ == bool:
box = QtWidgets.QCheckBox() box = QtWidgets.QCheckBox()
else: else:
@ -4225,7 +4237,7 @@ class PylotParaBox(QtWidgets.QWidget):
def setValue(self, box, value): def setValue(self, box, value):
if type(box) == QtWidgets.QLineEdit: if type(box) == QtWidgets.QLineEdit:
box.setText(str(value)) box.setText(str(value))
elif type(box) == QtWidgets.QSpinBox or type(box) == QtWidgets.QDoubleSpinBox: elif type(box) == QSpinBox or type(box) == QDoubleSpinBox:
if not value: if not value:
value = 0. value = 0.
box.setValue(value) box.setValue(value)
@ -4242,7 +4254,7 @@ class PylotParaBox(QtWidgets.QWidget):
def getValue(self, box): def getValue(self, box):
if type(box) == QtWidgets.QLineEdit: if type(box) == QtWidgets.QLineEdit:
value = str(box.text()) value = str(box.text())
elif type(box) == QtWidgets.QSpinBox or type(box) == QtWidgets.QDoubleSpinBox: elif type(box) == QSpinBox or type(box) == QDoubleSpinBox:
value = box.value() value = box.value()
elif type(box) == QtWidgets.QCheckBox: elif type(box) == QtWidgets.QCheckBox:
value = box.isChecked() value = box.isChecked()
@ -4840,7 +4852,7 @@ class GraphicsTab(PropTab):
if not nth_sample: if not nth_sample:
nth_sample = 1 nth_sample = 1
self.spinbox_nth_sample = QtWidgets.QSpinBox() self.spinbox_nth_sample = QSpinBox()
label = QLabel('nth sample') label = QLabel('nth sample')
label.setToolTip('Plot every nth sample (to speed up plotting)') label.setToolTip('Plot every nth sample (to speed up plotting)')
self.spinbox_nth_sample.setMinimum(1) self.spinbox_nth_sample.setMinimum(1)