-
Notifications
You must be signed in to change notification settings - Fork 0
/
browsePrivate.py
99 lines (83 loc) · 4.03 KB
/
browsePrivate.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
from PyQt5 import QtCore, QtGui, QtWidgets
import recipeFuncs as rf
from PyQt5.QtWidgets import *
class Ui_MainWindow(object):
def setupUiBrowsePrivate(self, MainWindow):
MainWindow.resize(793, 365)
MainWindow.setStyleSheet("background-color: #123456;")
MainWindow.setWindowIcon(QtGui.QIcon('chef.png'))
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.frame = QtWidgets.QFrame(self.centralwidget)
self.frame.setStyleSheet("background-color: white;")
self.frame.setGeometry(QtCore.QRect(20, 20, 751, 321))
self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
self.line = QtWidgets.QFrame(self.frame)
self.line.setGeometry(QtCore.QRect(30, 80, 691, 16))
self.line.setFrameShape(QtWidgets.QFrame.HLine)
self.line.setFrameShadow(QtWidgets.QFrame.Plain)
self.line.setLineWidth(5)
self.titleLabel = QtWidgets.QLabel(self.frame)
self.titleLabel.setGeometry(QtCore.QRect(30, 20, 691, 61))
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(18)
font.setBold(True)
self.titleLabel.setFont(font)
self.titleLabel.setAlignment(QtCore.Qt.AlignCenter)
self.tableWidget = QtWidgets.QTableWidget(self.frame)
self.tableWidget.setGeometry(QtCore.QRect(45, 105, 651, 201))
self.tableWidget.setColumnCount(5)
self.tableWidget.setRowCount(0)
item = QtWidgets.QTableWidgetItem()
font.setPointSize(8)
item.setFont(font)
self.tableWidget.setHorizontalHeaderItem(0, item)
item = QtWidgets.QTableWidgetItem()
item.setFont(font)
self.tableWidget.setHorizontalHeaderItem(1, item)
item = QtWidgets.QTableWidgetItem()
item.setFont(font)
self.tableWidget.setHorizontalHeaderItem(2, item)
item = QtWidgets.QTableWidgetItem()
item.setFont(font)
self.tableWidget.setHorizontalHeaderItem(3, item)
item = QtWidgets.QTableWidgetItem()
item.setFont(font)
self.tableWidget.setHorizontalHeaderItem(4, item)
self.tableWidget.setRowCount(len(rf.privateRecipes.index)-1)
rowPosition = self.tableWidget.rowCount()
self.tableWidget.insertRow(rowPosition)
print(len(rf.privateRecipes.index))
for i in range(len(rf.privateRecipes.index)):
x = rf.privateRecipes.iloc[i].tolist()
self.tableWidget.setItem(i, 0, QTableWidgetItem(x[0]))
self.tableWidget.setItem(i, 1, QTableWidgetItem(x[1]))
self.tableWidget.setItem(i, 2, QTableWidgetItem(str(x[2])))
self.tableWidget.setItem(i, 3, QTableWidgetItem(x[3]))
self.tableWidget.setItem(i, 4, QTableWidgetItem(str(x[4])))
MainWindow.setCentralWidget(self.centralwidget)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "Personal Cookbook/Recipe Library/ Browse Private Library"))
self.titleLabel.setText(_translate("MainWindow", "Browse Your Recipes"))
item = self.tableWidget.horizontalHeaderItem(0)
item.setText(_translate("MainWindow", "Recipe Name"))
item = self.tableWidget.horizontalHeaderItem(1)
item.setText(_translate("MainWindow", "Instructions"))
item = self.tableWidget.horizontalHeaderItem(2)
item.setText(_translate("MainWindow", "Servings"))
item = self.tableWidget.horizontalHeaderItem(3)
item.setText(_translate("MainWindow", "Description"))
item = self.tableWidget.horizontalHeaderItem(4)
item.setText(_translate("MainWindow", "Is Public"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUiBrowsePrivate(MainWindow)
MainWindow.show()
sys.exit(app.exec_())