Skip to content

Commit 69257be

Browse files
authored
Merge pull request #21 from Ali-Amir-Mohamed/main
Update Mainpage.py with a comment by Mohamed Amir Ali
2 parents 60f6c83 + ed7b681 commit 69257be

1 file changed

Lines changed: 24 additions & 1 deletion

File tree

Mainpage.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,30 @@ def UpdateProfile(self):
113113
#####################################################################################################
114114

115115
def viewSuggestions(self):
116-
pass
116+
try:
117+
conn=sqlite3.connect("usersInfo.db")
118+
cur=conn.cursor()
119+
sql_query="SELECT Image,Username,Age,Location,Gender FROM Users WHEREUsername !=? LIMIT 10"
120+
rows=cur.execute(sql_query, (self.username)).fetchall()
121+
self.tablewidget.setRowCount(len(rows))
122+
for i, row in enumerate(rows):
123+
image_data=row[0]
124+
pixmap=QPixmap()
125+
pixmap.loadFromData(image_data)
126+
label=QtWidgets.Qlabel()
127+
label.setPixmap(pixmap.scaled(100,100))
128+
label.setAlignment(QtCore.Qt.AlignCenter)
129+
self.tableWidget.setRowHeight(i, 120)
130+
self.tableWidget.setCellWidget(i, 0, label)
131+
for j in range(1, len(row)):
132+
item=Qtwidgets.QTableWidgetItem(str(row[j]))
133+
item.setTextAlignment(QtCore.Qt.AlignCenter)
134+
self.table Widget.setItem(i, j, item)
135+
conn.close()
136+
137+
except Exception as e:
138+
QMessageBox.critical(self, "Error", f"Failed to view suggestions: {str(e)}")
139+
117140
#############################################################################################################
118141
## FUNCTION THAT ALLOWS YOU TO LOAD A USERS PROFILE ON THE OTHER PROFILES PAGE FROM THE DATA BASE ##
119142
#####################################################################################################

0 commit comments

Comments
 (0)