-
Notifications
You must be signed in to change notification settings - Fork 1
/
secretary_password.py
84 lines (70 loc) · 3.77 KB
/
secretary_password.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'C:/Users/Ecrin/Desktop/Yeni klasör/sekreter_password.ui'
#
# Created by: PyQt5 UI code generator 5.15.7
#
# 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
import Main_Window
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(250, 200)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.pushButton = QtWidgets.QPushButton(self.centralwidget)
self.pushButton.setGeometry(QtCore.QRect(50, 150, 150, 40))
self.pushButton.setObjectName("pushButton")
self.formLayoutWidget = QtWidgets.QWidget(self.centralwidget)
self.formLayoutWidget.setGeometry(QtCore.QRect(20, 10, 210, 130))
self.formLayoutWidget.setObjectName("formLayoutWidget")
self.formLayout = QtWidgets.QFormLayout(self.formLayoutWidget)
self.formLayout.setContentsMargins(0, 0, 0, 0)
self.formLayout.setObjectName("formLayout")
self.label_new_pass = QtWidgets.QLabel(self.formLayoutWidget)
self.label_new_pass.setObjectName("label_new_pass")
self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.label_new_pass)
self.new_pass = QtWidgets.QLineEdit(self.formLayoutWidget)
self.new_pass.setEchoMode(QtWidgets.QLineEdit.Password)
self.new_pass.setObjectName("new_pass")
self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.new_pass)
self.label_approve = QtWidgets.QLabel(self.formLayoutWidget)
self.label_approve.setObjectName("label_approve")
self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label_approve)
self.approve = QtWidgets.QLineEdit(self.formLayoutWidget)
self.approve.setEchoMode(QtWidgets.QLineEdit.Password)
self.approve.setObjectName("approve")
self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.approve)
MainWindow.setCentralWidget(self.centralwidget)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
# Connect the button to the update_password method
self.pushButton.clicked.connect(self.update_password)
# Create an instance of Main_Window.Ui_MainWindow to access its methods
self.passwords = Main_Window.Ui_MainWindow.rtn_pass()
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "Update Password"))
self.pushButton.setText(_translate("MainWindow", "Update Password"))
self.label_new_pass.setText(_translate("MainWindow", "New password:"))
self.label_approve.setText(_translate("MainWindow", "Approve new password:"))
def update_password(self):
new_pass = self.new_pass.text()
approve = self.approve.text()
if new_pass == approve:
self.passwords[0] = new_pass
print("Password updated successfully.")
else:
print("New passwords do not match.")
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_())