Skip to content

Commit 883466a

Browse files
committed
Update login.py
1 parent 97cdaf3 commit 883466a

File tree

1 file changed

+68
-13
lines changed

1 file changed

+68
-13
lines changed

TestDemo-2/login.py

+68-13
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,19 @@
1212
class Ui_Form(object):
1313
def setupUi(self, Form):
1414
Form.setObjectName("Form")
15-
Form.resize(457, 361)
15+
Form.resize(510, 450)
16+
Form.setMinimumSize(QtCore.QSize(510, 450))
1617
Form.setStyleSheet("#Form{\n"
1718
"background-color:#0a676c\n"
1819
"}\n"
1920
"\n"
2021
"#loginwidget{\n"
2122
"background-color: #fff;\n"
22-
"border-radius: 10px\n"
23+
"border-radius: 10px;\n"
24+
"box-shadow: 5px 5px 10px black;\n"
2325
"}\n"
2426
"\n"
27+
"\n"
2528
"#logo_frame QPushButton{\n"
2629
"background-color: transparent;\n"
2730
"}\n"
@@ -31,6 +34,32 @@ def setupUi(self, Form):
3134
"border: none;\n"
3235
"color: #0a676c;\n"
3336
"}\n"
37+
"\n"
38+
"#username_frame QLineEdit, #password_frame QLineEdit {\n"
39+
"border: none;\n"
40+
"padding: 3px;\n"
41+
"border-bottom: 1px solid #74afad;\n"
42+
"}\n"
43+
"\n"
44+
"#login_btn_frame QPushButton {\n"
45+
"border: none;\n"
46+
"color: #fff;\n"
47+
"\n"
48+
"}\n"
49+
"\n"
50+
"#login_btn_frame {\n"
51+
"background-color: #0a676c;\n"
52+
"border-radius: 5px;\n"
53+
"}\n"
54+
"#login_btn_frame:hover {\n"
55+
"background-color:#22767a;\n"
56+
"}\n"
57+
"\n"
58+
"#message_frame QLabel {\n"
59+
"color: red;\n"
60+
"padding-left: 5px\n"
61+
"}\n"
62+
"\n"
3463
"")
3564
self.horizontalLayout = QtWidgets.QHBoxLayout(Form)
3665
self.horizontalLayout.setContentsMargins(7, -1, -1, -1)
@@ -42,8 +71,10 @@ def setupUi(self, Form):
4271
sizePolicy.setHeightForWidth(self.loginwidget.sizePolicy().hasHeightForWidth())
4372
self.loginwidget.setSizePolicy(sizePolicy)
4473
self.loginwidget.setMaximumSize(QtCore.QSize(441, 343))
74+
self.loginwidget.setStyleSheet("")
4575
self.loginwidget.setObjectName("loginwidget")
4676
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.loginwidget)
77+
self.verticalLayout_2.setSpacing(0)
4778
self.verticalLayout_2.setObjectName("verticalLayout_2")
4879
self.logo_frame = QtWidgets.QFrame(parent=self.loginwidget)
4980
self.logo_frame.setFrameShape(QtWidgets.QFrame.Shape.StyledPanel)
@@ -64,7 +95,7 @@ def setupUi(self, Form):
6495
icon = QtGui.QIcon()
6596
icon.addPixmap(QtGui.QPixmap("icons/logo.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
6697
self.logo.setIcon(icon)
67-
self.logo.setIconSize(QtCore.QSize(70, 35))
98+
self.logo.setIconSize(QtCore.QSize(70, 30))
6899
self.logo.setObjectName("logo")
69100
self.horizontalLayout_7.addWidget(self.logo)
70101
self.verticalLayout_2.addWidget(self.logo_frame)
@@ -73,7 +104,8 @@ def setupUi(self, Form):
73104
self.title_frame.setFrameShadow(QtWidgets.QFrame.Shadow.Raised)
74105
self.title_frame.setObjectName("title_frame")
75106
self.horizontalLayout_6 = QtWidgets.QHBoxLayout(self.title_frame)
76-
self.horizontalLayout_6.setContentsMargins(-1, 0, -1, -1)
107+
self.horizontalLayout_6.setContentsMargins(0, 0, 0, 0)
108+
self.horizontalLayout_6.setSpacing(0)
77109
self.horizontalLayout_6.setObjectName("horizontalLayout_6")
78110
self.pushButton = QtWidgets.QPushButton(parent=self.title_frame)
79111
self.pushButton.setEnabled(False)
@@ -91,8 +123,6 @@ def setupUi(self, Form):
91123
self.loginframe_user.setObjectName("loginframe_user")
92124
self.verticalLayout = QtWidgets.QVBoxLayout(self.loginframe_user)
93125
self.verticalLayout.setObjectName("verticalLayout")
94-
spacerItem = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Preferred)
95-
self.verticalLayout.addItem(spacerItem)
96126
self.username_frame = QtWidgets.QFrame(parent=self.loginframe_user)
97127
font = QtGui.QFont()
98128
font.setPointSize(10)
@@ -104,39 +134,64 @@ def setupUi(self, Form):
104134
self.horizontalLayout_2.setContentsMargins(5, 5, 5, 5)
105135
self.horizontalLayout_2.setSpacing(6)
106136
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
137+
self.label = QtWidgets.QLabel(parent=self.username_frame)
138+
self.label.setMaximumSize(QtCore.QSize(20, 20))
139+
self.label.setText("")
140+
self.label.setPixmap(QtGui.QPixmap("icons/user.svg"))
141+
self.label.setScaledContents(True)
142+
self.label.setObjectName("label")
143+
self.horizontalLayout_2.addWidget(self.label)
107144
self.lineEdit_username = QtWidgets.QLineEdit(parent=self.username_frame)
145+
font = QtGui.QFont()
146+
font.setPointSize(10)
147+
self.lineEdit_username.setFont(font)
108148
self.lineEdit_username.setObjectName("lineEdit_username")
109149
self.horizontalLayout_2.addWidget(self.lineEdit_username)
110150
self.verticalLayout.addWidget(self.username_frame)
111-
spacerItem1 = QtWidgets.QSpacerItem(20, 10, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Preferred)
112-
self.verticalLayout.addItem(spacerItem1)
151+
spacerItem = QtWidgets.QSpacerItem(20, 5, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Preferred)
152+
self.verticalLayout.addItem(spacerItem)
113153
self.password_frame = QtWidgets.QFrame(parent=self.loginframe_user)
114154
self.password_frame.setFrameShape(QtWidgets.QFrame.Shape.StyledPanel)
115155
self.password_frame.setFrameShadow(QtWidgets.QFrame.Shadow.Raised)
116156
self.password_frame.setObjectName("password_frame")
117157
self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.password_frame)
118158
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
159+
self.label_2 = QtWidgets.QLabel(parent=self.password_frame)
160+
self.label_2.setMinimumSize(QtCore.QSize(0, 0))
161+
self.label_2.setMaximumSize(QtCore.QSize(20, 20))
162+
self.label_2.setText("")
163+
self.label_2.setPixmap(QtGui.QPixmap("icons/lock.svg"))
164+
self.label_2.setScaledContents(True)
165+
self.label_2.setObjectName("label_2")
166+
self.horizontalLayout_3.addWidget(self.label_2)
119167
self.lineEdit_password = QtWidgets.QLineEdit(parent=self.password_frame)
168+
font = QtGui.QFont()
169+
font.setPointSize(10)
170+
self.lineEdit_password.setFont(font)
171+
self.lineEdit_password.setEchoMode(QtWidgets.QLineEdit.EchoMode.Password)
120172
self.lineEdit_password.setObjectName("lineEdit_password")
121173
self.horizontalLayout_3.addWidget(self.lineEdit_password)
122174
self.verticalLayout.addWidget(self.password_frame)
123-
spacerItem2 = QtWidgets.QSpacerItem(20, 10, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Preferred)
124-
self.verticalLayout.addItem(spacerItem2)
175+
spacerItem1 = QtWidgets.QSpacerItem(20, 10, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Preferred)
176+
self.verticalLayout.addItem(spacerItem1)
125177
self.login_btn_frame = QtWidgets.QFrame(parent=self.loginframe_user)
126178
self.login_btn_frame.setFrameShape(QtWidgets.QFrame.Shape.StyledPanel)
127179
self.login_btn_frame.setFrameShadow(QtWidgets.QFrame.Shadow.Raised)
128180
self.login_btn_frame.setObjectName("login_btn_frame")
129181
self.horizontalLayout_4 = QtWidgets.QHBoxLayout(self.login_btn_frame)
130182
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
131183
self.login_btn = QtWidgets.QPushButton(parent=self.login_btn_frame)
184+
font = QtGui.QFont()
185+
font.setPointSize(10)
186+
font.setBold(True)
187+
self.login_btn.setFont(font)
188+
self.login_btn.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape.PointingHandCursor))
132189
icon1 = QtGui.QIcon()
133190
icon1.addPixmap(QtGui.QPixmap("icons/log-in (1).svg"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
134191
self.login_btn.setIcon(icon1)
135192
self.login_btn.setObjectName("login_btn")
136193
self.horizontalLayout_4.addWidget(self.login_btn)
137194
self.verticalLayout.addWidget(self.login_btn_frame)
138-
spacerItem3 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Preferred)
139-
self.verticalLayout.addItem(spacerItem3)
140195
self.verticalLayout_2.addWidget(self.loginframe_user)
141196
self.message_frame = QtWidgets.QFrame(parent=self.loginwidget)
142197
self.message_frame.setFrameShape(QtWidgets.QFrame.Shape.StyledPanel)
@@ -145,6 +200,7 @@ def setupUi(self, Form):
145200
self.horizontalLayout_5 = QtWidgets.QHBoxLayout(self.message_frame)
146201
self.horizontalLayout_5.setObjectName("horizontalLayout_5")
147202
self.label_message = QtWidgets.QLabel(parent=self.message_frame)
203+
self.label_message.setText("")
148204
self.label_message.setObjectName("label_message")
149205
self.horizontalLayout_5.addWidget(self.label_message)
150206
self.verticalLayout_2.addWidget(self.message_frame)
@@ -160,7 +216,6 @@ def retranslateUi(self, Form):
160216
self.lineEdit_username.setPlaceholderText(_translate("Form", "Enter Username"))
161217
self.lineEdit_password.setPlaceholderText(_translate("Form", "Enter Password"))
162218
self.login_btn.setText(_translate("Form", "LOG IN"))
163-
self.label_message.setText(_translate("Form", "TextLabel"))
164219

165220

166221
if __name__ == "__main__":

0 commit comments

Comments
 (0)