Refactoring. Fixes. Clean project. Add first test.

This commit is contained in:
Jarosław Wieczorek 2020-12-07 16:48:46 +01:00
parent 13e87b52c9
commit 5f0e2fbd0e
13 changed files with 39 additions and 20 deletions

View File

@ -1,9 +1,9 @@
#!/bin/bash
for file in $(ls ./src/ui)
for file in $(ls ./src/gui/ui)
do
output_file=$(echo $file | sed -e 's/\..*$//')
pipenv run python -m PyQt5.uic.pyuic -x ./src/ui/$file -o ./src/python/ui/$output_file'_ui.py'
pipenv run python -m PyQt5.uic.pyuic -x ./src/gui/ui/$file -o ./src/python/ui/$output_file'_ui.py'
done;

5
run_tests.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
pipenv run python -m unittest discover -s ./tests/ -p 'test_*.py'

0
src/gui/__init__.py Normal file
View File

View File

View File

Before

Width:  |  Height:  |  Size: 2.1 MiB

After

Width:  |  Height:  |  Size: 2.1 MiB

0
src/gui/ui/__init__.py Normal file
View File

View File

@ -20,10 +20,7 @@
<height>540</height>
</size>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<layout class="QVBoxLayout" name="vertical_layout">
<item>
<layout class="QHBoxLayout" name="h_layout_select_audio1">
<item>
@ -258,7 +255,6 @@
<zorder>h_line</zorder>
<zorder>h_line3</zorder>
<zorder>h_slider</zorder>
<zorder>verticalLayoutWidget</zorder>
</widget>
<widget class="QMenuBar" name="menu_bar">
<property name="geometry">

0
src/python/__init__.py Normal file
View File

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file './src/ui/mainwindow.ui'
# Form implementation generated from reading ui file './src/gui/ui/mainwindow.ui'
#
# Created by: PyQt5 UI code generator 5.15.2
#
@ -18,9 +18,8 @@ class Ui_MainWindow(object):
self.central_widget = QtWidgets.QWidget(MainWindow)
self.central_widget.setMinimumSize(QtCore.QSize(700, 540))
self.central_widget.setObjectName("central_widget")
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.central_widget)
self.verticalLayout_2.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint)
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.vertical_layout = QtWidgets.QVBoxLayout(self.central_widget)
self.vertical_layout.setObjectName("vertical_layout")
self.h_layout_select_audio1 = QtWidgets.QHBoxLayout()
self.h_layout_select_audio1.setObjectName("h_layout_select_audio1")
self.line_edit_audio1 = QtWidgets.QLineEdit(self.central_widget)
@ -34,7 +33,7 @@ class Ui_MainWindow(object):
self.push_button_audio1 = QtWidgets.QPushButton(self.central_widget)
self.push_button_audio1.setObjectName("push_button_audio1")
self.h_layout_select_audio1.addWidget(self.push_button_audio1)
self.verticalLayout_2.addLayout(self.h_layout_select_audio1)
self.vertical_layout.addLayout(self.h_layout_select_audio1)
self.h_layout_select_audio2 = QtWidgets.QHBoxLayout()
self.h_layout_select_audio2.setObjectName("h_layout_select_audio2")
self.line_edit_audio2 = QtWidgets.QLineEdit(self.central_widget)
@ -48,12 +47,12 @@ class Ui_MainWindow(object):
self.push_button_audio2 = QtWidgets.QPushButton(self.central_widget)
self.push_button_audio2.setObjectName("push_button_audio2")
self.h_layout_select_audio2.addWidget(self.push_button_audio2)
self.verticalLayout_2.addLayout(self.h_layout_select_audio2)
self.vertical_layout.addLayout(self.h_layout_select_audio2)
self.h_line3 = QtWidgets.QFrame(self.central_widget)
self.h_line3.setFrameShape(QtWidgets.QFrame.HLine)
self.h_line3.setFrameShadow(QtWidgets.QFrame.Sunken)
self.h_line3.setObjectName("h_line3")
self.verticalLayout_2.addWidget(self.h_line3)
self.vertical_layout.addWidget(self.h_line3)
self.v_layout_avatars = QtWidgets.QVBoxLayout()
self.v_layout_avatars.setObjectName("v_layout_avatars")
self.h_layout_avatars_preview = QtWidgets.QHBoxLayout()
@ -79,12 +78,12 @@ class Ui_MainWindow(object):
self.push_button_select_avatar2.setObjectName("push_button_select_avatar2")
self.h_layout_avatars_buttons.addWidget(self.push_button_select_avatar2)
self.v_layout_avatars.addLayout(self.h_layout_avatars_buttons)
self.verticalLayout_2.addLayout(self.v_layout_avatars)
self.vertical_layout.addLayout(self.v_layout_avatars)
self.h_line2 = QtWidgets.QFrame(self.central_widget)
self.h_line2.setFrameShape(QtWidgets.QFrame.HLine)
self.h_line2.setFrameShadow(QtWidgets.QFrame.Sunken)
self.h_line2.setObjectName("h_line2")
self.verticalLayout_2.addWidget(self.h_line2)
self.vertical_layout.addWidget(self.h_line2)
self.h_layout_threshold = QtWidgets.QHBoxLayout()
self.h_layout_threshold.setObjectName("h_layout_threshold")
self.label_threshold_description = QtWidgets.QLabel(self.central_widget)
@ -103,16 +102,16 @@ class Ui_MainWindow(object):
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.verticalLayout_2.addLayout(self.h_layout_threshold)
self.vertical_layout.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_2.addWidget(self.h_slider)
self.vertical_layout.addWidget(self.h_slider)
self.h_line = QtWidgets.QFrame(self.central_widget)
self.h_line.setFrameShape(QtWidgets.QFrame.HLine)
self.h_line.setFrameShadow(QtWidgets.QFrame.Sunken)
self.h_line.setObjectName("h_line")
self.verticalLayout_2.addWidget(self.h_line)
self.vertical_layout.addWidget(self.h_line)
self.h_layout_preview_or_generate = QtWidgets.QHBoxLayout()
self.h_layout_preview_or_generate.setObjectName("h_layout_preview_or_generate")
self.push_button_preview = QtWidgets.QPushButton(self.central_widget)
@ -121,7 +120,7 @@ class Ui_MainWindow(object):
self.push_button_generate = QtWidgets.QPushButton(self.central_widget)
self.push_button_generate.setObjectName("push_button_generate")
self.h_layout_preview_or_generate.addWidget(self.push_button_generate)
self.verticalLayout_2.addLayout(self.h_layout_preview_or_generate)
self.vertical_layout.addLayout(self.h_layout_preview_or_generate)
self.h_line2.raise_()
self.h_line.raise_()
self.h_line3.raise_()

0
tests/__init__.py Normal file
View File

View File

View File

@ -0,0 +1,19 @@
from src.python.ui.mainwindow_ui import Ui_MainWindow
import unittest
class Test_Ui_MainWindow(unittest.TestCase):
def setUp(self) -> None:
pass
def tearDown(self) -> None:
pass
def test_check_create__mainwindow(self):
ui_mainwindow = Ui_MainWindow()
self.assertIsInstance(ui_mainwindow, Ui_MainWindow)
if __name__ == '__main__':
unittest.main()

View File