Compare commits
3 commits
02f912928f
...
960258eba3
Author | SHA1 | Date | |
---|---|---|---|
960258eba3 | |||
7b7b92b6a3 | |||
97b16d1856 |
3 changed files with 127 additions and 5 deletions
52
ui_close_dialog.py
Normal file
52
ui_close_dialog.py
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'ui_close_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_CloseDialog(object):
|
||||||
|
def setupUi(self, CloseDialog):
|
||||||
|
CloseDialog.setObjectName("CloseDialog")
|
||||||
|
CloseDialog.setWindowModality(QtCore.Qt.ApplicationModal)
|
||||||
|
CloseDialog.resize(313, 75)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(CloseDialog.sizePolicy().hasHeightForWidth())
|
||||||
|
CloseDialog.setSizePolicy(sizePolicy)
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout(CloseDialog)
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.t_close = QtWidgets.QLabel(CloseDialog)
|
||||||
|
self.t_close.setObjectName("t_close")
|
||||||
|
self.verticalLayout.addWidget(self.t_close)
|
||||||
|
self.l_buttons = QtWidgets.QHBoxLayout()
|
||||||
|
self.l_buttons.setObjectName("l_buttons")
|
||||||
|
self.b_yes = QtWidgets.QPushButton(CloseDialog)
|
||||||
|
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(CloseDialog)
|
||||||
|
self.b_no.setObjectName("b_no")
|
||||||
|
self.l_buttons.addWidget(self.b_no)
|
||||||
|
self.verticalLayout.addLayout(self.l_buttons)
|
||||||
|
|
||||||
|
self.retranslateUi(CloseDialog)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(CloseDialog)
|
||||||
|
|
||||||
|
def retranslateUi(self, CloseDialog):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
CloseDialog.setWindowTitle(_translate("CloseDialog", "Programm schließen"))
|
||||||
|
self.t_close.setText(_translate("CloseDialog", "Soll das Programm wirklich geschlossen werden?"))
|
||||||
|
self.b_yes.setText(_translate("CloseDialog", "Ja"))
|
||||||
|
self.b_no.setText(_translate("CloseDialog", "Nein"))
|
61
ui_close_dialog.ui
Normal file
61
ui_close_dialog.ui
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CloseDialog</class>
|
||||||
|
<widget class="QDialog" name="CloseDialog">
|
||||||
|
<property name="windowModality">
|
||||||
|
<enum>Qt::ApplicationModal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>313</width>
|
||||||
|
<height>75</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Maximum" vsizetype="Minimum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Programm schließen</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="t_close">
|
||||||
|
<property name="text">
|
||||||
|
<string>Soll das Programm wirklich geschlossen werden?</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="l_buttons">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="b_yes">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Ja</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="b_no">
|
||||||
|
<property name="text">
|
||||||
|
<string>Nein</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
|
@ -29,6 +29,7 @@ from ui_mainwindow import Ui_MainWindow
|
||||||
from ui_code_dialog import Ui_WikiCode
|
from ui_code_dialog import Ui_WikiCode
|
||||||
from ui_about_dialog import Ui_About
|
from ui_about_dialog import Ui_About
|
||||||
from ui_clear_dialog import Ui_ClearDialog
|
from ui_clear_dialog import Ui_ClearDialog
|
||||||
|
from ui_close_dialog import Ui_CloseDialog
|
||||||
|
|
||||||
class AboutDialog(QDialog, Ui_About):
|
class AboutDialog(QDialog, Ui_About):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
@ -39,6 +40,16 @@ class AboutDialog(QDialog, Ui_About):
|
||||||
|
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
|
class CloseDialog(QDialog, Ui_CloseDialog):
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super(CloseDialog, self).__init__(*args, **kwargs)
|
||||||
|
self.setupUi(self)
|
||||||
|
|
||||||
|
self.b_yes.clicked.connect(self.accept)
|
||||||
|
self.b_no.clicked.connect(self.reject)
|
||||||
|
|
||||||
|
self.show()
|
||||||
|
|
||||||
class ClearDialog(QDialog, Ui_ClearDialog):
|
class ClearDialog(QDialog, Ui_ClearDialog):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(ClearDialog, self).__init__(*args, **kwargs)
|
super(ClearDialog, self).__init__(*args, **kwargs)
|
||||||
|
@ -386,11 +397,9 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||||
"""
|
"""
|
||||||
Close the application. A warning is shown before.
|
Close the application. A warning is shown before.
|
||||||
"""
|
"""
|
||||||
reply = QMessageBox.question(self, "Sicher?",
|
dialog = CloseDialog()
|
||||||
"Möchten Sie wirklich schließen?",
|
dialog.accepted.connect(self.close)
|
||||||
QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
|
dialog.exec_()
|
||||||
if reply == QMessageBox.Yes:
|
|
||||||
self.close()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Reference in a new issue