-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
34 lines (27 loc) · 1.29 KB
/
main.py
File metadata and controls
34 lines (27 loc) · 1.29 KB
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
import sys
from selector.sel_alg import pc_selection, db_pc_list
from interface import *
class Interface(QtWidgets.QMainWindow): # Класс для открытия интерфейса/GUI
def __init__(self):
super().__init__()
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.ui.pushButton.clicked.connect(self.search)
self.base_line_edit = self.ui.lineEdit
def search(self): # Сбор и обработка данных от пользователя
price_pc = self.ui.lineEdit.text() # Сбор входных данных
pc_list = pc_selection(int(price_pc)) # Запуск поиска комплектующих
pc_str = []
for pc_j in pc_list: # Цикл по обработке выходных данных
if hasattr(pc_j, '__iter__'):
pc_str.append(" | ".join(map(str, pc_j)))
else:
pc_str.append(str(pc_j))
pc_str.append(f"Цена сборки: {db_pc_list(pc_list)}")
self.ui.listWidget.clear()
self.ui.listWidget.addItems(pc_str) # Вывод данных в интерфейс
if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
window = Interface()
window.show()
sys.exit(app.exec())