diff --git a/ui_clear_dialog.py b/ui_clear_dialog.py deleted file mode 100644 index 97a627e..0000000 --- a/ui_clear_dialog.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'ui_clear_dialog.ui' -# -# Created by: PyQt5 UI code generator 5.15.0 -# -# 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_ClearDialog(object): - def setupUi(self, ClearDialog): - ClearDialog.setObjectName("ClearDialog") - ClearDialog.setWindowModality(QtCore.Qt.ApplicationModal) - ClearDialog.resize(265, 75) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(ClearDialog.sizePolicy().hasHeightForWidth()) - ClearDialog.setSizePolicy(sizePolicy) - self.verticalLayout = QtWidgets.QVBoxLayout(ClearDialog) - self.verticalLayout.setObjectName("verticalLayout") - self.t_clear = QtWidgets.QLabel(ClearDialog) - self.t_clear.setObjectName("t_clear") - self.verticalLayout.addWidget(self.t_clear) - self.l_buttons = QtWidgets.QHBoxLayout() - self.l_buttons.setObjectName("l_buttons") - self.b_yes = QtWidgets.QPushButton(ClearDialog) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.b_yes.sizePolicy().hasHeightForWidth()) - self.b_yes.setSizePolicy(sizePolicy) - self.b_yes.setObjectName("b_yes") - self.l_buttons.addWidget(self.b_yes) - self.b_no = QtWidgets.QPushButton(ClearDialog) - self.b_no.setObjectName("b_no") - self.l_buttons.addWidget(self.b_no) - self.verticalLayout.addLayout(self.l_buttons) - - self.retranslateUi(ClearDialog) - QtCore.QMetaObject.connectSlotsByName(ClearDialog) - - def retranslateUi(self, ClearDialog): - _translate = QtCore.QCoreApplication.translate - ClearDialog.setWindowTitle(_translate("ClearDialog", "Eingabefelder leeren")) - self.t_clear.setText(_translate("ClearDialog", "Sollen die Eingabefelder geleert werden?")) - self.b_yes.setText(_translate("ClearDialog", "Ja")) - self.b_no.setText(_translate("ClearDialog", "Nein")) diff --git a/ui_clear_dialog.ui b/ui_clear_dialog.ui deleted file mode 100644 index 45ef83e..0000000 --- a/ui_clear_dialog.ui +++ /dev/null @@ -1,61 +0,0 @@ - - - ClearDialog - - - Qt::ApplicationModal - - - - 0 - 0 - 265 - 75 - - - - - 0 - 0 - - - - Eingabefelder leeren - - - - - - Sollen die Eingabefelder geleert werden? - - - - - - - - - - 0 - 0 - - - - Ja - - - - - - - Nein - - - - - - - - - - diff --git a/ui_mainwindow.py b/ui_mainwindow.py index 6041ef5..e6717ec 100644 --- a/ui_mainwindow.py +++ b/ui_mainwindow.py @@ -2,10 +2,9 @@ # Form implementation generated from reading ui file 'ui_mainwindow.ui' # -# Created by: PyQt5 UI code generator 5.15.0 +# Created by: PyQt5 UI code generator 5.14.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. +# WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets @@ -50,6 +49,10 @@ class Ui_MainWindow(object): self.e_servings.setText("") self.e_servings.setObjectName("e_servings") self.y_basics.addWidget(self.e_servings, 1, 1, 1, 1) + self.e_url = QtWidgets.QLineEdit(self.t_basics) + self.e_url.setText("") + self.e_url.setObjectName("e_url") + self.y_basics.addWidget(self.e_url, 2, 3, 1, 1) self.l_recipe_name = QtWidgets.QLabel(self.t_basics) self.l_recipe_name.setObjectName("l_recipe_name") self.y_basics.addWidget(self.l_recipe_name, 0, 0, 1, 1) @@ -72,10 +75,6 @@ class Ui_MainWindow(object): self.e_rating_overall.setProperty("value", 3) self.e_rating_overall.setObjectName("e_rating_overall") self.y_basics.addWidget(self.e_rating_overall, 2, 1, 1, 1) - self.e_url = QtWidgets.QLineEdit(self.t_basics) - self.e_url.setText("") - self.e_url.setObjectName("e_url") - self.y_basics.addWidget(self.e_url, 2, 3, 1, 1) self.verticalLayout_9.addLayout(self.y_basics) self.horizontalLayout_16 = QtWidgets.QHBoxLayout() self.horizontalLayout_16.setObjectName("horizontalLayout_16") @@ -362,19 +361,15 @@ class Ui_MainWindow(object): self.gridLayout.addWidget(self.tabWidget, 0, 0, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.menuBar = QtWidgets.QMenuBar(MainWindow) - self.menuBar.setGeometry(QtCore.QRect(0, 0, 800, 28)) + self.menuBar.setGeometry(QtCore.QRect(0, 0, 800, 30)) self.menuBar.setObjectName("menuBar") self.menuMen = QtWidgets.QMenu(self.menuBar) self.menuMen.setObjectName("menuMen") MainWindow.setMenuBar(self.menuBar) - self.ma_clear_fields = QtWidgets.QAction(MainWindow) - self.ma_clear_fields.setObjectName("ma_clear_fields") self.ma_close = QtWidgets.QAction(MainWindow) self.ma_close.setObjectName("ma_close") self.ma_information = QtWidgets.QAction(MainWindow) self.ma_information.setObjectName("ma_information") - self.menuMen.addAction(self.ma_clear_fields) - self.menuMen.addSeparator() self.menuMen.addAction(self.ma_information) self.menuMen.addSeparator() self.menuMen.addAction(self.ma_close) @@ -459,6 +454,5 @@ class Ui_MainWindow(object): self.b_rating_remove.setText(_translate("MainWindow", "Entfernen")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.t_rating), _translate("MainWindow", "Bewertung")) self.menuMen.setTitle(_translate("MainWindow", "Me&nü")) - self.ma_clear_fields.setText(_translate("MainWindow", "Eingaben löschen")) self.ma_close.setText(_translate("MainWindow", "&Schließen")) self.ma_information.setText(_translate("MainWindow", "Informationen")) diff --git a/ui_mainwindow.ui b/ui_mainwindow.ui index 755b70f..caf6143 100644 --- a/ui_mainwindow.ui +++ b/ui_mainwindow.ui @@ -98,6 +98,13 @@ + + + + + + + @@ -143,13 +150,6 @@ - - - - - - - @@ -792,26 +792,19 @@ 0 0 800 - 28 + 30 Me&nü - - - - - Eingaben löschen - - &Schließen diff --git a/wikicookbook.py b/wikicookbook.py index 4e545cb..d8b8835 100644 --- a/wikicookbook.py +++ b/wikicookbook.py @@ -28,7 +28,6 @@ from PyQt5.QtWidgets import QApplication, QMainWindow, QMessageBox, QTableWidget from ui_mainwindow import Ui_MainWindow from ui_code_dialog import Ui_WikiCode from ui_about_dialog import Ui_About -from ui_clear_dialog import Ui_ClearDialog class AboutDialog(QDialog, Ui_About): def __init__(self, *args, **kwargs): @@ -39,25 +38,14 @@ class AboutDialog(QDialog, Ui_About): self.show() -class ClearDialog(QDialog, Ui_ClearDialog): - def __init__(self, *args, **kwargs): - super(ClearDialog, self).__init__(*args, **kwargs) - self.setupUi(self) - - self.b_yes.clicked.connect(self.accept) - self.b_no.clicked.connect(self.reject) - - self.show() - class WikiCodeDialog(QDialog, Ui_WikiCode): def __init__(self, code, *args, **kwargs): super(WikiCodeDialog, self).__init__(*args, **kwargs) self.setupUi(self) - self.copied = False self.e_code.setPlainText(code) - self.b_close.clicked.connect(self.clear_fields) + self.b_close.clicked.connect(self.close) self.b_copy.clicked.connect(self.copy) self.show() @@ -65,20 +53,6 @@ class WikiCodeDialog(QDialog, Ui_WikiCode): def copy(self): self.e_code.selectAll() self.e_code.copy() - self.copied = True - - def clear_fields(self): - """ - Show the clear fields dialog if the code was at least copied once. - """ - if self.copied: - dialog = ClearDialog() - dialog.rejected.connect(self.reject) - dialog.accepted.connect(self.accept) - dialog.exec_() - else: - self.close() - class MainWindow(QMainWindow, Ui_MainWindow): def __init__(self, *args, **kwargs): @@ -89,9 +63,8 @@ class MainWindow(QMainWindow, Ui_MainWindow): self.b_cancel.clicked.connect(self.close) self.ma_close.triggered.connect(self.close) - # Connect other menu actions + # Connect about action self.ma_information.triggered.connect(self.about) - self.ma_clear_fields.triggered.connect(self.clear_fields) # Conncect recipe name typing self.e_recipe_name.textChanged.connect(self.updateTitle) @@ -304,59 +277,6 @@ class MainWindow(QMainWindow, Ui_MainWindow): code = current_recipe.wikicode(writer) dialog = WikiCodeDialog(code) - dialog.accepted.connect(self.clear) - dialog.exec_() - - def clear(self): - """ - Clear all fields - """ - - # Tab: Basics - self.e_recipe_name.setText("") - self.e_servings.setText("") - self.e_time.setText("") - self.e_rating_overall.setValue(3) - self.e_url.setText("") - self.e_category.setText("") - self.v_categories.clear() - - # Tab: Ingredients - self.e_ingredient.setText("") - self.e_amount.setText("") - self.c_heading.setChecked(False) - self.v_ingredients.clear() - - # Tab: Utensils - self.e_utensil.setText("") - self.v_utensils.clear() - - # Tab: Steps - self.e_step.setText("") - self.v_steps.clear() - - # Tab: Notes - self.e_note.setText("") - self.v_notes.clear() - - # Tab: Tips - self.e_tip.setText("") - self.v_tips.clear() - - # Tab: Variations - self.e_variation.setText("") - self.v_variations.clear() - - # Tab: Ratings - self.e_rating.setText("") - self.v_ratings.clear() - - def clear_fields(self): - """ - Show the clear fields dialog. - """ - dialog = ClearDialog() - dialog.accepted.connect(self.clear) dialog.exec_() def about(self): @@ -376,7 +296,6 @@ class MainWindow(QMainWindow, Ui_MainWindow): if reply == QMessageBox.Yes: super.close() - if __name__ == "__main__": app = QApplication([]) app.setApplicationName("WikiCookBook")