-
Notifications
You must be signed in to change notification settings - Fork 1
/
f.py
307 lines (248 loc) · 12.9 KB
/
f.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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'untitled.ui'
#
# Created by: PyQt5 UI code generator 5.13.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import QSize, Qt
from PyQt5.QtWidgets import QLabel, QInputDialog, QDialog, QGridLayout, QLineEdit, QPushButton, QMessageBox, QWidget
from wallet import Wallet
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.setFixedSize(1020, 580)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.listwidget = QtWidgets.QTableWidget(self.centralwidget)
self.listwidget.setGeometry(QtCore.QRect(0, 0, 511, 541))
self.listwidget.setObjectName("listwidget")
self.listwidget.setColumnCount(4)
self.listwidget.setHorizontalHeaderLabels(["Price", "Category", "Date", "Comments"])
self.listwidget.horizontalHeaderItem(0).setTextAlignment(Qt.AlignLeft)
self.listwidget.horizontalHeaderItem(1).setTextAlignment(Qt.AlignHCenter)
self.listwidget.horizontalHeaderItem(2).setTextAlignment(Qt.AlignRight)
self.listwidget.horizontalHeaderItem(3).setTextAlignment(Qt.AlignRight)
self.Tabel_view = QtWidgets.QTableWidget(self.centralwidget)
self.Tabel_view.setGeometry(QtCore.QRect(511, 180, 509, 365))
self.Tabel_view.setColumnCount(2)
self.Tabel_view.setHorizontalHeaderLabels(["Name", "Value"])
self.Tabel_view.horizontalHeaderItem(0).setTextAlignment(Qt.AlignHCenter)
self.Tabel_view.horizontalHeaderItem(1).setTextAlignment(Qt.AlignHCenter)
self.pushButton = QtWidgets.QPushButton(self.centralwidget)
self.pushButton.setGeometry(QtCore.QRect(920, 0, 93, 28))
self.pushButton.setObjectName("pushButton")
self.label = QtWidgets.QLabel(self.centralwidget)
self.label.setGeometry(QtCore.QRect(530, 30, 77, 16))
self.label.setObjectName("label")
self.lineEdit = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit.setGeometry(QtCore.QRect(510, 0, 113, 22))
self.lineEdit.setObjectName("lineEdit")
self.label_commments = QtWidgets.QLabel(self.centralwidget)
self.label_commments.setGeometry(QtCore.QRect(730, 30, 113, 22))
self.label_commments.setText('Comments')
# data
self.lineEdit_comments = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit_comments.setGeometry(QtCore.QRect(710, 0, 110, 22))
self.lineEdit_comments.setObjectName("lineEdit_comments")
self.lineEdit_2 = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit_2.setGeometry(QtCore.QRect(630, 0, 71, 22))
self.lineEdit_2.setObjectName("lineEdit_2")
self.label_2 = QtWidgets.QLabel(self.centralwidget)
self.label_2.setGeometry(QtCore.QRect(640, 30, 55, 16))
self.label_2.setObjectName("label_2")
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 924, 26))
self.menubar.setObjectName("menubar")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
# wallet name
self.pushButton_AddWallet = QtWidgets.QPushButton(self.centralwidget)
self.pushButton_AddWallet.setGeometry(QtCore.QRect(700, 60, 71, 22))
self.pushButton_AddWallet.setObjectName("pushButton_AddWallet")
self.pushButton_AddWallet.setText('add')
self.lineEdit_Value = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit_Value.setGeometry(QtCore.QRect(520, 60, 71, 22))
self.lineEdit_Value.setObjectName("lineEdit_Value")
self.lineEdit_name = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit_name.setGeometry(QtCore.QRect(600, 60, 71, 22))
self.lineEdit_name.setObjectName("lineEdit_name")
self.label_Value = QtWidgets.QLabel(self.centralwidget)
self.label_Value.setGeometry(QtCore.QRect(520, 85, 71, 22))
self.label_Value.setObjectName("label_Value")
self.label_Value.setText('Сумма')
self.label_NameWallet = QtWidgets.QLabel(self.centralwidget)
self.label_NameWallet.setGeometry(QtCore.QRect(600, 85, 93, 22))
self.label_NameWallet.setObjectName("label_NameWallet")
self.label_NameWallet.setText('Имя кошелька')
# Пополение кошелька
self.label_Status = QtWidgets.QLabel(self.centralwidget)
self.label_Status.setGeometry(QtCore.QRect(520, 150, 90, 22))
self.label_Status.setObjectName('label_Status')
self.label_Status.setText('сумма')
self.lineEdit_Sum = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit_Sum.setGeometry(QtCore.QRect(520, 120, 71, 22))
self.lineEdit_Sum.setObjectName("lineEdit_Sum")
self.QComboBox_lst = QtWidgets.QComboBox(self.centralwidget)
self.QComboBox_lst.setGeometry(QtCore.QRect(600, 120, 100, 22))
self.QComboBox_lst.setObjectName("QComboBox_lst")
self.pushButton_refill = QtWidgets.QPushButton(self.centralwidget)
self.pushButton_refill.setGeometry(QtCore.QRect(710, 120, 71, 22))
self.pushButton_refill.setObjectName("pushButton_refill")
self.pushButton_refill.setText('Пополнить')
# combo = QComboBox(self)
self.Wallet_list = QtWidgets.QComboBox(self.centralwidget)
self.Wallet_list.setGeometry(QtCore.QRect(820, 0, 100, 22))
self.Wallet_list.setObjectName("Wallet_list")
self.pushButton_1 = QtWidgets.QPushButton(self.centralwidget)
self.pushButton_1.setGeometry(QtCore.QRect(820, 520, 100, 22))
self.pushButton_1.setObjectName("pushButton_1")
self.pushButton_1.setText('statistic')
self.login = UI_LoginWindow()
self.login.show()
# exit
self.pushButton_Exit = QtWidgets.QPushButton(self.centralwidget)
self.pushButton_Exit.setGeometry(920, 520, 71, 22)
self.pushButton_Exit.setText('Exit')
self.stat = Statistic()
QtCore.QMetaObject.connectSlotsByName(MainWindow)
singal = QtCore.pyqtSignal(list)
def send_signal(self):
self.signal.emit([self.lineEdit_password.text(), self.lineEdit_login.text()])
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.pushButton.setText(_translate("MainWindow", "+"))
self.label.setText(_translate("MainWindow", "категория"))
self.label_2.setText(_translate("MainWindow", "сумма"))
def HandleQuestion(self):
pass
def show_it(self, the_password):
print(the_password)
def Statistic(self):
pass
class Ui_RegWindow(QWidget):
def __init__(self):
super().__init__()
self.initUI()
sign_up = QtCore.pyqtSignal(bool)
def initUI(self):
self.setObjectName("Login")
self.setFixedSize(400, 75)
self.label_login = QtWidgets.QLabel(self)
self.label_login.setGeometry(QtCore.QRect(0, 0, 71, 22))
self.label_login.setObjectName("lineEdit_login")
self.label_login.setText('Login')
self.lineEdit_login = QtWidgets.QLineEdit(self)
self.lineEdit_login.setGeometry(QtCore.QRect(0, 30, 71, 22))
self.lineEdit_login.setObjectName("lineEdit_login")
# password
self.label_password = QtWidgets.QLabel(self)
self.label_password.setGeometry(QtCore.QRect(80, 0, 71, 22))
self.label_password.setObjectName("lineEdit_password")
self.label_password.setText('Password')
self.lineEdit_password = QtWidgets.QLineEdit(self)
self.lineEdit_password.setGeometry(QtCore.QRect(80, 30, 71, 22))
self.lineEdit_password.setObjectName("lineEdit_password")
self.lineEdit_password.setEchoMode(QtWidgets.QLineEdit.Password)
# name
self.label_Name = QtWidgets.QLabel(self)
self.label_Name.setGeometry(QtCore.QRect(161, 0, 71, 22))
self.label_Name.setObjectName("label_Name")
self.label_Name.setText('Name')
self.lineEdit_Name = QtWidgets.QLineEdit(self)
self.lineEdit_Name.setGeometry(QtCore.QRect(161, 30, 71, 22))
self.lineEdit_Name.setObjectName("lineEdit_Name")
# button
self.pushButton_Sign_up = QtWidgets.QPushButton(self)
self.pushButton_Sign_up.setGeometry(QtCore.QRect(250, 30, 71, 22))
self.pushButton_Sign_up.setObjectName("pushButton_Sign_up")
self.pushButton_Sign_up.setText('Sign up')
self.pushButton_Sign_up.clicked.connect(self.send_password)
self.label_passed = QtWidgets.QLabel(self)
self.label_passed.setGeometry(QtCore.QRect(0, 55, 300, 20))
self.label_passed.setObjectName("label_passed")
def send_password(self):
user = Wallet()
if not user.init_user(login=str(self.lineEdit_login.text()), password=str(self.lineEdit_password.text()),
name=str(self.lineEdit_Name.text())):
self.label_passed.setText('A user with the same name already exists')
return None
self.sign_up.emit(True)
self.close()
self.lineEdit_password.clear()
self.lineEdit_login.clear()
class UI_LoginWindow(QWidget):
def __init__(self):
super().__init__()
self.initUI()
got = QtCore.pyqtSignal(list)
def initUI(self):
self.setObjectName("Login")
self.setFixedSize(400, 75)
# login
self.label_login = QtWidgets.QLabel(self)
self.label_login.setGeometry(QtCore.QRect(0, 0, 71, 22))
self.label_login.setObjectName("lineEdit_login")
self.label_login.setText('Login')
self.lineEdit_login = QtWidgets.QLineEdit(self)
self.lineEdit_login.setGeometry(QtCore.QRect(0, 30, 71, 22))
self.lineEdit_login.setObjectName("lineEdit_login")
# password
self.label_password = QtWidgets.QLabel(self)
self.label_password.setGeometry(QtCore.QRect(80, 0, 71, 22))
self.label_password.setObjectName("lineEdit_password")
self.label_password.setText('Password')
self.lineEdit_password = QtWidgets.QLineEdit(self)
self.lineEdit_password.setGeometry(QtCore.QRect(80, 30, 71, 22))
self.lineEdit_password.setObjectName("lineEdit_password")
self.lineEdit_password.setEchoMode(QtWidgets.QLineEdit.Password)
# log in
self.pushButton_Login = QtWidgets.QPushButton(self)
self.pushButton_Login.setGeometry(QtCore.QRect(160, 30, 71, 22))
self.pushButton_Login.setObjectName("pushButton_Login")
self.pushButton_Login.setText('Login')
self.pushButton_Login.clicked.connect(self.send_password)
# sign up
self.pushButton_Sign_up = QtWidgets.QPushButton(self)
self.pushButton_Sign_up.setGeometry(QtCore.QRect(250, 30, 71, 22))
self.pushButton_Sign_up.setObjectName("pushButton_Sign_up")
self.pushButton_Sign_up.setText('Sign Up')
self.pushButton_Sign_up.clicked.connect(self.SignUp)
# label passed
self.label_passed = QtWidgets.QLabel(self)
self.label_passed.setGeometry(QtCore.QRect(0, 55, 300, 20))
self.label_passed.setObjectName("label_passed")
self.registration = Ui_RegWindow()
self.registration.sign_up.connect(self.Exit)
def SignUp(self):
self.close()
self.registration.show()
def Exit(self):
self.show()
def send_password(self):
user = Wallet()
if not user.sign_in(login=str(self.lineEdit_login.text()), password=str(self.lineEdit_password.text())):
self.label_passed.setText('Error check password or login')
self.got.emit([self.lineEdit_password.text(), self.lineEdit_login.text()])
self.lineEdit_password.clear()
self.lineEdit_login.clear()
class Statistic(QWidget):
def __init__(self):
super().__init__()
def initUI(self, lst):
self.setObjectName("Login")
self.setFixedSize(700, 700)
self.photo = QtWidgets.QLabel(self)
self.photo.setGeometry(QtCore.QRect(0, 0, 700, 700))
self.photo.setScaledContents(True)
self.photo.setObjectName('photo')
self.user = Wallet()
self.user.sign_in(lst[0], lst[1])
self.user.pie()
self.photo.setPixmap(QtGui.QPixmap("diagram.png"))
self.show()