From f452125973fc3d13de768057836c3f1df5bca210 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaros=C5=82aw=20Wieczorek?= Date: Sat, 28 Nov 2020 14:26:46 +0100 Subject: [PATCH] Add script to generate python class files from .ui files. Add generated python class file - mainwindow_ui.py. Update Pipfile. Add empty main.py --- Pipfile | 11 ++ class_files/mainwindow_ui.py | 221 ++++++++++++++++++++++++++ generate_class_files_from_ui_files.sh | 9 ++ main.py | 0 ui_files/mainwindow.ui | 15 +- 5 files changed, 250 insertions(+), 6 deletions(-) create mode 100644 Pipfile create mode 100644 class_files/mainwindow_ui.py create mode 100755 generate_class_files_from_ui_files.sh create mode 100644 main.py diff --git a/Pipfile b/Pipfile new file mode 100644 index 0000000..71e4f7c --- /dev/null +++ b/Pipfile @@ -0,0 +1,11 @@ +[[source]] +url = "https://pypi.org/simple" +verify_ssl = true +name = "pypi" + +[packages] + +[dev-packages] + +[requires] +python_version = "3.9" diff --git a/class_files/mainwindow_ui.py b/class_files/mainwindow_ui.py new file mode 100644 index 0000000..1be748c --- /dev/null +++ b/class_files/mainwindow_ui.py @@ -0,0 +1,221 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file './ui_files/mainwindow.ui' +# +# Created by: PyQt5 UI code generator 5.15.2 +# +# WARNING: Any manual changes made to this file will be lost when pyuic5 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_MainWindow(object): + def setupUi(self, MainWindow): + MainWindow.setObjectName("MainWindow") + MainWindow.resize(870, 566) + self.centralwidget = QtWidgets.QWidget(MainWindow) + self.centralwidget.setObjectName("centralwidget") + self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget) + self.verticalLayout.setObjectName("verticalLayout") + self.h_layout_select_video = QtWidgets.QHBoxLayout() + self.h_layout_select_video.setObjectName("h_layout_select_video") + self.line_edit_video = QtWidgets.QLineEdit(self.centralwidget) + self.line_edit_video.setText("") + self.line_edit_video.setObjectName("line_edit_video") + self.h_layout_select_video.addWidget(self.line_edit_video) + self.push_button_wideo = QtWidgets.QPushButton(self.centralwidget) + self.push_button_wideo.setObjectName("push_button_wideo") + self.h_layout_select_video.addWidget(self.push_button_wideo) + self.verticalLayout.addLayout(self.h_layout_select_video) + self.h_layout_select_audio1 = QtWidgets.QHBoxLayout() + self.h_layout_select_audio1.setObjectName("h_layout_select_audio1") + self.line_edit_audio1 = QtWidgets.QLineEdit(self.centralwidget) + self.line_edit_audio1.setText("") + self.line_edit_audio1.setObjectName("line_edit_audio1") + self.h_layout_select_audio1.addWidget(self.line_edit_audio1) + self.line_edit_name1 = QtWidgets.QLineEdit(self.centralwidget) + self.line_edit_name1.setText("") + self.line_edit_name1.setObjectName("line_edit_name1") + self.h_layout_select_audio1.addWidget(self.line_edit_name1) + self.push_button_audio1 = QtWidgets.QPushButton(self.centralwidget) + self.push_button_audio1.setObjectName("push_button_audio1") + self.h_layout_select_audio1.addWidget(self.push_button_audio1) + self.verticalLayout.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.centralwidget) + self.line_edit_audio2.setText("") + self.line_edit_audio2.setObjectName("line_edit_audio2") + self.h_layout_select_audio2.addWidget(self.line_edit_audio2) + self.line_edit_name2 = QtWidgets.QLineEdit(self.centralwidget) + self.line_edit_name2.setText("") + self.line_edit_name2.setObjectName("line_edit_name2") + self.h_layout_select_audio2.addWidget(self.line_edit_name2) + self.push_button_audio2 = QtWidgets.QPushButton(self.centralwidget) + self.push_button_audio2.setObjectName("push_button_audio2") + self.h_layout_select_audio2.addWidget(self.push_button_audio2) + self.verticalLayout.addLayout(self.h_layout_select_audio2) + self.h_line3 = QtWidgets.QFrame(self.centralwidget) + self.h_line3.setFrameShape(QtWidgets.QFrame.HLine) + self.h_line3.setFrameShadow(QtWidgets.QFrame.Sunken) + self.h_line3.setObjectName("h_line3") + self.verticalLayout.addWidget(self.h_line3) + self.h_layout_avatars1 = QtWidgets.QHBoxLayout() + self.h_layout_avatars1.setObjectName("h_layout_avatars1") + self.label_image1 = QtWidgets.QLabel(self.centralwidget) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.label_image1.sizePolicy().hasHeightForWidth()) + self.label_image1.setSizePolicy(sizePolicy) + self.label_image1.setMinimumSize(QtCore.QSize(100, 100)) + self.label_image1.setMaximumSize(QtCore.QSize(100, 100)) + self.label_image1.setSizeIncrement(QtCore.QSize(1, 1)) + self.label_image1.setBaseSize(QtCore.QSize(100, 100)) + self.label_image1.setFrameShape(QtWidgets.QFrame.Box) + self.label_image1.setFrameShadow(QtWidgets.QFrame.Plain) + self.label_image1.setText("") + self.label_image1.setScaledContents(True) + self.label_image1.setAlignment(QtCore.Qt.AlignCenter) + self.label_image1.setProperty("KeepAspectRatio", True) + self.label_image1.setObjectName("label_image1") + self.h_layout_avatars1.addWidget(self.label_image1) + self.push_button_select_avatar1 = QtWidgets.QPushButton(self.centralwidget) + self.push_button_select_avatar1.setMinimumSize(QtCore.QSize(0, 0)) + self.push_button_select_avatar1.setObjectName("push_button_select_avatar1") + self.h_layout_avatars1.addWidget(self.push_button_select_avatar1) + self.verticalLayout.addLayout(self.h_layout_avatars1) + self.h_layout_avatars2 = QtWidgets.QHBoxLayout() + self.h_layout_avatars2.setObjectName("h_layout_avatars2") + self.label_image2 = QtWidgets.QLabel(self.centralwidget) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.label_image2.sizePolicy().hasHeightForWidth()) + self.label_image2.setSizePolicy(sizePolicy) + self.label_image2.setMinimumSize(QtCore.QSize(100, 100)) + self.label_image2.setMaximumSize(QtCore.QSize(100, 100)) + self.label_image2.setSizeIncrement(QtCore.QSize(1, 1)) + self.label_image2.setBaseSize(QtCore.QSize(100, 100)) + self.label_image2.setFrameShape(QtWidgets.QFrame.Box) + self.label_image2.setFrameShadow(QtWidgets.QFrame.Plain) + self.label_image2.setText("") + self.label_image2.setScaledContents(True) + self.label_image2.setAlignment(QtCore.Qt.AlignCenter) + self.label_image2.setProperty("KeepAspectRatio", True) + self.label_image2.setObjectName("label_image2") + self.h_layout_avatars2.addWidget(self.label_image2) + self.push_button_select_avatar2 = QtWidgets.QPushButton(self.centralwidget) + self.push_button_select_avatar2.setObjectName("push_button_select_avatar2") + self.h_layout_avatars2.addWidget(self.push_button_select_avatar2) + self.verticalLayout.addLayout(self.h_layout_avatars2) + self.h_line2 = QtWidgets.QFrame(self.centralwidget) + self.h_line2.setFrameShape(QtWidgets.QFrame.HLine) + self.h_line2.setFrameShadow(QtWidgets.QFrame.Sunken) + self.h_line2.setObjectName("h_line2") + self.verticalLayout.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.centralwidget) + self.label_threshold_description.setObjectName("label_threshold_description") + self.h_layout_threshold.addWidget(self.label_threshold_description) + self.line_edit_threshold_value = QtWidgets.QLineEdit(self.centralwidget) + self.line_edit_threshold_value.setObjectName("line_edit_threshold_value") + self.h_layout_threshold.addWidget(self.line_edit_threshold_value) + self.verticalLayout.addLayout(self.h_layout_threshold) + self.h_slider = QtWidgets.QSlider(self.centralwidget) + self.h_slider.setOrientation(QtCore.Qt.Horizontal) + self.h_slider.setObjectName("h_slider") + self.verticalLayout.addWidget(self.h_slider) + self.h_line = QtWidgets.QFrame(self.centralwidget) + self.h_line.setFrameShape(QtWidgets.QFrame.HLine) + self.h_line.setFrameShadow(QtWidgets.QFrame.Sunken) + self.h_line.setObjectName("h_line") + self.verticalLayout.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.centralwidget) + self.push_button_preview.setObjectName("push_button_preview") + self.h_layout_preview_or_generate.addWidget(self.push_button_preview) + self.push_button_generate = QtWidgets.QPushButton(self.centralwidget) + self.push_button_generate.setObjectName("push_button_generate") + self.h_layout_preview_or_generate.addWidget(self.push_button_generate) + self.verticalLayout.addLayout(self.h_layout_preview_or_generate) + self.h_line2.raise_() + self.h_line.raise_() + self.h_line3.raise_() + self.h_slider.raise_() + MainWindow.setCentralWidget(self.centralwidget) + self.menubar = QtWidgets.QMenuBar(MainWindow) + self.menubar.setGeometry(QtCore.QRect(0, 0, 870, 32)) + self.menubar.setObjectName("menubar") + self.menuProject = QtWidgets.QMenu(self.menubar) + self.menuProject.setObjectName("menuProject") + MainWindow.setMenuBar(self.menubar) + self.statusbar = QtWidgets.QStatusBar(MainWindow) + self.statusbar.setObjectName("statusbar") + MainWindow.setStatusBar(self.statusbar) + self.actionNowy = QtWidgets.QAction(MainWindow) + self.actionNowy.setObjectName("actionNowy") + self.actionOtw_rz = QtWidgets.QAction(MainWindow) + self.actionOtw_rz.setObjectName("actionOtw_rz") + self.actionZapisz = QtWidgets.QAction(MainWindow) + self.actionZapisz.setObjectName("actionZapisz") + self.actionZapisz_jako = QtWidgets.QAction(MainWindow) + self.actionZapisz_jako.setObjectName("actionZapisz_jako") + self.actionZako_cz = QtWidgets.QAction(MainWindow) + self.actionZako_cz.setObjectName("actionZako_cz") + self.actionUstawienia = QtWidgets.QAction(MainWindow) + self.actionUstawienia.setObjectName("actionUstawienia") + self.actionO_programie = QtWidgets.QAction(MainWindow) + self.actionO_programie.setObjectName("actionO_programie") + self.menuProject.addAction(self.actionNowy) + self.menuProject.addAction(self.actionOtw_rz) + self.menuProject.addAction(self.actionZapisz) + self.menuProject.addAction(self.actionZapisz_jako) + self.menuProject.addSeparator() + self.menuProject.addAction(self.actionO_programie) + self.menuProject.addAction(self.actionUstawienia) + self.menuProject.addSeparator() + self.menuProject.addAction(self.actionZako_cz) + self.menubar.addAction(self.menuProject.menuAction()) + + self.retranslateUi(MainWindow) + QtCore.QMetaObject.connectSlotsByName(MainWindow) + + def retranslateUi(self, MainWindow): + _translate = QtCore.QCoreApplication.translate + MainWindow.setWindowTitle(_translate("MainWindow", "MagicPodcast")) + self.line_edit_video.setPlaceholderText(_translate("MainWindow", "Plik wideo")) + self.push_button_wideo.setText(_translate("MainWindow", "Dodaj wideo")) + self.line_edit_audio1.setPlaceholderText(_translate("MainWindow", "Plik audio pierwszego rozmówcy")) + self.line_edit_name1.setPlaceholderText(_translate("MainWindow", "Imię pierwszego rozmówcy")) + self.push_button_audio1.setText(_translate("MainWindow", "Dodaj audio 1")) + self.line_edit_audio2.setPlaceholderText(_translate("MainWindow", "Plik audio drugiego rozmówcy")) + self.line_edit_name2.setPlaceholderText(_translate("MainWindow", "Imię drugieo rozmówcy")) + self.push_button_audio2.setText(_translate("MainWindow", "Dodaj audio 2")) + self.push_button_select_avatar1.setText(_translate("MainWindow", "Wybierz awatar pierwszego rozmówcy")) + self.push_button_select_avatar2.setText(_translate("MainWindow", "Wybierz awatar drugiego rozmówcy")) + self.label_threshold_description.setText(_translate("MainWindow", "Poziom wykrywania głosu:")) + self.push_button_preview.setText(_translate("MainWindow", "Podgląd")) + self.push_button_generate.setText(_translate("MainWindow", "Wygeneruj podcast")) + self.menuProject.setTitle(_translate("MainWindow", "Projekt")) + self.actionNowy.setText(_translate("MainWindow", "Nowy")) + self.actionOtw_rz.setText(_translate("MainWindow", "Otwórz")) + self.actionZapisz.setText(_translate("MainWindow", "Zapisz")) + self.actionZapisz_jako.setText(_translate("MainWindow", "Zapisz jako")) + self.actionZako_cz.setText(_translate("MainWindow", "Zakończ")) + self.actionUstawienia.setText(_translate("MainWindow", "Ustawienia")) + self.actionO_programie.setText(_translate("MainWindow", "O programie")) + + +if __name__ == "__main__": + import sys + app = QtWidgets.QApplication(sys.argv) + MainWindow = QtWidgets.QMainWindow() + ui = Ui_MainWindow() + ui.setupUi(MainWindow) + MainWindow.show() + sys.exit(app.exec_()) diff --git a/generate_class_files_from_ui_files.sh b/generate_class_files_from_ui_files.sh new file mode 100755 index 0000000..a4ccf9f --- /dev/null +++ b/generate_class_files_from_ui_files.sh @@ -0,0 +1,9 @@ +#!/bin/bash + + +for file in $(ls ./ui_files) +do +output_file=$(echo $file | sed -e 's/\..*$//') +pipenv run python -m PyQt5.uic.pyuic -x ./ui_files/$file -o ./class_files/$output_file'_ui.py' + +done; diff --git a/main.py b/main.py new file mode 100644 index 0000000..e69de29 diff --git a/ui_files/mainwindow.ui b/ui_files/mainwindow.ui index 4173ac5..6006aaa 100644 --- a/ui_files/mainwindow.ui +++ b/ui_files/mainwindow.ui @@ -7,7 +7,7 @@ 0 0 870 - 563 + 566 @@ -154,6 +154,9 @@ Qt::AlignCenter + + true + @@ -220,6 +223,9 @@ Qt::AlignCenter + + true + @@ -285,12 +291,9 @@ - verticalLayoutWidget - verticalLayoutWidget + h_line2 + h_line h_line3 - horizontalLayoutWidget_5 - horizontalLayoutWidget_6 - horizontalLayoutWidget_7 h_slider