Refactoring elements of user interface. Update ui files. Set min and max for threshold_slider. Connect threshold_slider with threshold_lcd. Add docstrings.

This commit is contained in:
Jarosław Wieczorek 2021-01-18 11:26:22 +01:00
parent cce2fb47dc
commit b5f57bf4c6
3 changed files with 34 additions and 20 deletions

View File

@ -533,7 +533,7 @@
</widget>
</item>
<item>
<widget class="QLCDNumber" name="lcd_number_of_threshold">
<widget class="QLCDNumber" name="threshold_lcd">
<property name="minimumSize">
<size>
<width>0</width>
@ -562,14 +562,20 @@
<enum>QLCDNumber::Filled</enum>
</property>
<property name="intValue" stdset="0">
<number>0</number>
<number>1</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QSlider" name="h_slider">
<widget class="QSlider" name="threshold_slider">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>128</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -611,7 +617,7 @@
</layout>
<zorder>h_line</zorder>
<zorder>h_line_2</zorder>
<zorder>h_slider</zorder>
<zorder>threshold_slider</zorder>
<zorder>h_line_3</zorder>
<zorder>v_spacer_1</zorder>
<zorder>check_box_connected_channels</zorder>

View File

@ -90,6 +90,12 @@ class MainWindow(QMainWindow, QApplication, Ui_MainWindow):
self.preview_label_avatar_4.setPixmap(scaled_pixmap4)
self.preview_label_avatar_4.setProperty('path', './src/gui/images/right.png')
self.threshold_slider.valueChanged.connect(self.update_lcd_threshold)
def update_lcd_threshold(self, event):
"""Set threshold value from slider to lcd."""
self.threshold_lcd.display(event)
def check_file(self, file, extensions):
"""Check file exist and have good extension."""
if not file:

View File

@ -223,22 +223,24 @@ class Ui_MainWindow(object):
self.label_threshold_description.setMaximumSize(QtCore.QSize(250, 50))
self.label_threshold_description.setObjectName("label_threshold_description")
self.h_layout_threshold.addWidget(self.label_threshold_description)
self.lcd_number_of_threshold = QtWidgets.QLCDNumber(self.central_widget)
self.lcd_number_of_threshold.setMinimumSize(QtCore.QSize(0, 30))
self.lcd_number_of_threshold.setMaximumSize(QtCore.QSize(200, 50))
self.lcd_number_of_threshold.setFrameShape(QtWidgets.QFrame.Box)
self.lcd_number_of_threshold.setFrameShadow(QtWidgets.QFrame.Raised)
self.lcd_number_of_threshold.setSmallDecimalPoint(False)
self.lcd_number_of_threshold.setDigitCount(3)
self.lcd_number_of_threshold.setSegmentStyle(QtWidgets.QLCDNumber.Filled)
self.lcd_number_of_threshold.setProperty("intValue", 0)
self.lcd_number_of_threshold.setObjectName("lcd_number_of_threshold")
self.h_layout_threshold.addWidget(self.lcd_number_of_threshold)
self.threshold_lcd = QtWidgets.QLCDNumber(self.central_widget)
self.threshold_lcd.setMinimumSize(QtCore.QSize(0, 30))
self.threshold_lcd.setMaximumSize(QtCore.QSize(200, 50))
self.threshold_lcd.setFrameShape(QtWidgets.QFrame.Box)
self.threshold_lcd.setFrameShadow(QtWidgets.QFrame.Raised)
self.threshold_lcd.setSmallDecimalPoint(False)
self.threshold_lcd.setDigitCount(3)
self.threshold_lcd.setSegmentStyle(QtWidgets.QLCDNumber.Filled)
self.threshold_lcd.setProperty("intValue", 1)
self.threshold_lcd.setObjectName("threshold_lcd")
self.h_layout_threshold.addWidget(self.threshold_lcd)
self.verticalLayout.addLayout(self.h_layout_threshold)
self.h_slider = QtWidgets.QSlider(self.central_widget)
self.h_slider.setOrientation(QtCore.Qt.Horizontal)
self.h_slider.setObjectName("h_slider")
self.verticalLayout.addWidget(self.h_slider)
self.threshold_slider = QtWidgets.QSlider(self.central_widget)
self.threshold_slider.setMinimum(1)
self.threshold_slider.setMaximum(128)
self.threshold_slider.setOrientation(QtCore.Qt.Horizontal)
self.threshold_slider.setObjectName("threshold_slider")
self.verticalLayout.addWidget(self.threshold_slider)
self.h_line_3 = QtWidgets.QFrame(self.central_widget)
self.h_line_3.setFrameShape(QtWidgets.QFrame.HLine)
self.h_line_3.setFrameShadow(QtWidgets.QFrame.Sunken)
@ -261,7 +263,7 @@ class Ui_MainWindow(object):
self.verticalLayout.addLayout(self.h_layout_preview_or_generate)
self.h_line.raise_()
self.h_line_2.raise_()
self.h_slider.raise_()
self.threshold_slider.raise_()
self.h_line_3.raise_()
self.check_box_connected_channels.raise_()
MainWindow.setCentralWidget(self.central_widget)