-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainWindow.py
121 lines (102 loc) · 5.45 KB
/
mainWindow.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'untitled.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
from PWGenerator import action
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(693, 286)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth())
MainWindow.setSizePolicy(sizePolicy)
MainWindow.setLayoutDirection(QtCore.Qt.LeftToRight)
MainWindow.setAutoFillBackground(True)
MainWindow.setUnifiedTitleAndToolBarOnMac(False)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.genButton = QtWidgets.QPushButton(self.centralwidget)
self.genButton.setGeometry(QtCore.QRect(50, 210, 181, 31))
self.genButton.setObjectName("genButton")
self.genButton.clicked.connect(self.buttonClicked)
self.lcBox = QtWidgets.QCheckBox(self.centralwidget)
self.lcBox.setGeometry(QtCore.QRect(70, 90, 141, 20))
self.lcBox.setChecked(True)
self.lcBox.setObjectName("lcBox")
self.ucBox = QtWidgets.QCheckBox(self.centralwidget)
self.ucBox.setGeometry(QtCore.QRect(70, 120, 141, 20))
self.ucBox.setChecked(True)
self.ucBox.setObjectName("ucBox")
self.numBox = QtWidgets.QCheckBox(self.centralwidget)
self.numBox.setGeometry(QtCore.QRect(70, 150, 141, 20))
self.numBox.setChecked(True)
self.numBox.setObjectName("numBox")
self.scBox = QtWidgets.QCheckBox(self.centralwidget)
self.scBox.setGeometry(QtCore.QRect(70, 180, 141, 20))
self.scBox.setChecked(True)
self.scBox.setObjectName("checkBox_4")
self.horizontalSlider = QtWidgets.QSlider(self.centralwidget)
self.horizontalSlider.setGeometry(QtCore.QRect(60, 50, 161, 22))
self.horizontalSlider.setMinimum(12)
self.horizontalSlider.setMaximum(50)
self.horizontalSlider.setValue(16)
self.horizontalSlider.setSingleStep(2)
self.horizontalSlider.setOrientation(QtCore.Qt.Horizontal)
self.horizontalSlider.setObjectName("horizontalSlider")
self.horizontalSlider.valueChanged.connect(self.update)
self.sizeCountLabel = QtWidgets.QLabel(self.centralwidget)
self.sizeCountLabel.setGeometry(QtCore.QRect(100, 20, 21, 16))
self.sizeCountLabel.setAlignment(QtCore.Qt.AlignCenter)
self.sizeCountLabel.setObjectName("sizeCountLabel")
self.label_2 = QtWidgets.QLabel(self.centralwidget)
self.label_2.setGeometry(QtCore.QRect(130, 20, 41, 16))
self.label_2.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
self.label_2.setObjectName("label_2")
MainWindow.setCentralWidget(self.centralwidget)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.plainTextEdit = QtWidgets.QPlainTextEdit(self.centralwidget)
self.plainTextEdit.setGeometry(QtCore.QRect(280, 40, 401, 211))
self.plainTextEdit.setReadOnly(True)
self.plainTextEdit.setObjectName("plainTextEdit")
font = QtGui.QFont("Monaco", 12)
self.plainTextEdit.setFont(font)
self.label_3 = QtWidgets.QLabel(self.centralwidget)
self.label_3.setGeometry(QtCore.QRect(280, 20, 51, 16))
self.label_3.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
self.label_3.setObjectName("label_3")
MainWindow.setCentralWidget(self.centralwidget)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def update(self, value):
self.sizeCountLabel.setText(f'{value}')
def buttonClicked(self):
size = self.horizontalSlider.value()
lc = self.lcBox.isChecked()
uc = self.ucBox.isChecked()
num = self.numBox.isChecked()
sc = self.scBox.isChecked()
self.plainTextEdit.setPlainText(action(size, lc, uc, num, sc))
for i in range(1, 12):
self.plainTextEdit.appendPlainText(action(size, lc, uc, num, sc))
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "Password Generator"))
self.genButton.setText(_translate("MainWindow", "Genarate Passwords"))
self.lcBox.setText(_translate("MainWindow", "Lower case letters"))
self.ucBox.setText(_translate("MainWindow", "Upper case letters"))
self.numBox.setText(_translate("MainWindow", "Numbers"))
self.scBox.setText(_translate("MainWindow", "Special characters"))
self.sizeCountLabel.setText(_translate("MainWindow", "14"))
self.label_2.setText(_translate("MainWindow", "Digits"))
self.label_3.setText(_translate("MainWindow", "Output:"))