-
Notifications
You must be signed in to change notification settings - Fork 1
/
gui_ui.py
694 lines (538 loc) · 30.5 KB
/
gui_ui.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
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'gui.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtWidgets, QtGui
from PyQt5.QtWidgets import QFileDialog
import os
import cv2
import datetime
import shutil
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
# Root Dir
self.ROOT_DIR = os.path.dirname(__file__)
# self.first_run = True
# main window
MainWindow.setObjectName("MainWindow")
MainWindow.resize(927, 672)
# font settings
font = QtGui.QFont()
font.setFamily("Times New Roman")
font.setPointSize(10)
font.setBold(True)
font.setWeight(75)
# central widget
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setFont(font)
self.centralwidget.setObjectName("centralwidget")
# --------------------header widget start--------------------
# header widget
self.header = QtWidgets.QWidget(self.centralwidget)
self.header.setObjectName("header")
# menu button
self.menu_btn = QtWidgets.QPushButton(self.header)
self.menu_btn.setText("")
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap("icon/icons8-circled-menu-50.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.menu_btn.setIcon(icon)
self.menu_btn.setIconSize(QtCore.QSize(20, 20))
self.menu_btn.setCheckable(True)
self.menu_btn.setChecked(False)
# self.menu_btn.setChecked(True)
self.menu_btn.setAutoExclusive(True)
self.menu_btn.setObjectName("menu_btn")
# vertical spacer between menu button and face recognition label
spacerItem = QtWidgets.QSpacerItem(369, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
# face recognition label
self.fr_label = QtWidgets.QLabel(self.header)
self.fr_label.setScaledContents(True)
self.fr_label.setAlignment(QtCore.Qt.AlignCenter)
self.fr_label.setObjectName("fr_label")
# vertical spacer between face recognition label and end of screen
spacerItem1 = QtWidgets.QSpacerItem(369, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
# header widget in horizontal layout
self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.header)
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.horizontalLayout_2.addWidget(self.menu_btn)
self.horizontalLayout_2.addItem(spacerItem)
self.horizontalLayout_2.addWidget(self.fr_label)
self.horizontalLayout_2.addItem(spacerItem1)
# --------------------header widget end--------------------
# --------------------sidebar widget start--------------------
# sidebar widget
self.sidebar = QtWidgets.QWidget(self.centralwidget)
self.sidebar.setObjectName("sidebar")
# shadow for every button
# self.sideBar_btns_shadow = QtWidgets.QGraphicsDropShadowEffect()
# self.sideBar_btns_shadow.setBlurRadius(15)
# home button
self.home_btn = QtWidgets.QPushButton(self.sidebar)
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap("icon/home.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.home_btn.setIcon(icon1)
self.home_btn.setIconSize(QtCore.QSize(20, 20))
self.home_btn.setCheckable(True)
self.home_btn.setAutoExclusive(True)
self.home_btn.setObjectName("home_btn")
self.home_btn_shadow = QtWidgets.QGraphicsDropShadowEffect()
self.home_btn_shadow.setBlurRadius(15)
self.home_btn.setGraphicsEffect(self.home_btn_shadow)
self.home_btn_shadow.setEnabled(False)
# upload images button
self.upload_images_btn = QtWidgets.QPushButton(self.sidebar)
icon6 = QtGui.QIcon()
icon6.addPixmap(QtGui.QPixmap("icon/add-contact.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.upload_images_btn.setIcon(icon6)
self.upload_images_btn.setIconSize(QtCore.QSize(20, 20))
self.upload_images_btn.setCheckable(True)
self.upload_images_btn.setAutoExclusive(True)
self.upload_images_btn.setObjectName("upload_images_btn")
self.upload_images_btn_shadow = QtWidgets.QGraphicsDropShadowEffect()
self.upload_images_btn_shadow.setBlurRadius(15)
self.upload_images_btn.setGraphicsEffect(self.upload_images_btn_shadow)
self.upload_images_btn_shadow.setEnabled(False)
# upload videos button
self.upload_videos_btn = QtWidgets.QPushButton(self.sidebar)
icon6 = QtGui.QIcon()
icon6.addPixmap(QtGui.QPixmap("icon/add-file-path2.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.upload_videos_btn.setIcon(icon6)
self.upload_videos_btn.setIconSize(QtCore.QSize(20, 20))
self.upload_videos_btn.setCheckable(True)
self.upload_videos_btn.setAutoExclusive(True)
self.upload_videos_btn.setObjectName("upload_videos_btn")
self.upload_videos_btn_shadow = QtWidgets.QGraphicsDropShadowEffect()
self.upload_videos_btn_shadow.setBlurRadius(15)
self.upload_videos_btn.setGraphicsEffect(self.upload_videos_btn_shadow)
self.upload_videos_btn_shadow.setEnabled(False)
# show data button
self.show_data_btn = QtWidgets.QPushButton(self.sidebar)
icon2 = QtGui.QIcon()
icon2.addPixmap(QtGui.QPixmap("icon/add-database-32.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.show_data_btn.setIcon(icon2)
self.show_data_btn.setIconSize(QtCore.QSize(20, 20))
self.show_data_btn.setCheckable(True)
self.show_data_btn.setAutoExclusive(True)
self.show_data_btn.setObjectName("show_data_btn")
self.show_data_btn_shadow = QtWidgets.QGraphicsDropShadowEffect()
self.show_data_btn_shadow.setBlurRadius(15)
self.show_data_btn.setGraphicsEffect(self.show_data_btn_shadow)
self.show_data_btn_shadow.setEnabled(False)
# add camera button
self.add_camera_btn = QtWidgets.QPushButton(self.sidebar)
icon5 = QtGui.QIcon()
icon5.addPixmap(QtGui.QPixmap("icon/add-photo-camera1.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.add_camera_btn.setIcon(icon5)
self.add_camera_btn.setIconSize(QtCore.QSize(20, 20))
self.add_camera_btn.setCheckable(True)
self.add_camera_btn.setAutoExclusive(True)
self.add_camera_btn.setObjectName("add_camera_btn")
self.add_camera_btn_shadow = QtWidgets.QGraphicsDropShadowEffect()
self.add_camera_btn_shadow.setBlurRadius(15)
self.add_camera_btn.setGraphicsEffect(self.add_camera_btn_shadow)
self.add_camera_btn_shadow.setEnabled(False)
# settings panel button
self.sett_panel_btn = QtWidgets.QPushButton(self.sidebar)
icon4 = QtGui.QIcon()
icon4.addPixmap(QtGui.QPixmap("icon/settings-17-32.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.sett_panel_btn.setIcon(icon4)
self.sett_panel_btn.setIconSize(QtCore.QSize(20, 20))
self.sett_panel_btn.setCheckable(True)
self.sett_panel_btn.setAutoExclusive(True)
self.sett_panel_btn.setObjectName("sett_panel_btn")
self.sett_panel_btn_shadow = QtWidgets.QGraphicsDropShadowEffect()
self.sett_panel_btn_shadow.setBlurRadius(15)
self.sett_panel_btn.setGraphicsEffect(self.sett_panel_btn_shadow)
self.sett_panel_btn_shadow.setEnabled(False)
# recognize face button
self.recg_face_btn = QtWidgets.QPushButton(self.sidebar)
icon3 = QtGui.QIcon()
icon3.addPixmap(QtGui.QPixmap("icon/Face_Recognize13.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.recg_face_btn.setIcon(icon3)
self.recg_face_btn.setIconSize(QtCore.QSize(20, 20))
self.recg_face_btn.setCheckable(True)
self.recg_face_btn.setAutoExclusive(True)
self.recg_face_btn.setObjectName("recg_face_btn")
self.recg_face_btn_shadow = QtWidgets.QGraphicsDropShadowEffect()
self.recg_face_btn_shadow.setBlurRadius(15)
self.recg_face_btn.setGraphicsEffect(self.recg_face_btn_shadow)
self.recg_face_btn_shadow.setEnabled(False)
# above buttons in vertical layout
self.verticalLayout = QtWidgets.QVBoxLayout()
self.verticalLayout.setSpacing(0)
self.verticalLayout.setObjectName("verticalLayout")
self.verticalLayout.addWidget(self.home_btn)
self.verticalLayout.addWidget(self.upload_images_btn)
self.verticalLayout.addWidget(self.upload_videos_btn)
self.verticalLayout.addWidget(self.show_data_btn)
self.verticalLayout.addWidget(self.add_camera_btn)
self.verticalLayout.addWidget(self.sett_panel_btn)
self.verticalLayout.addWidget(self.recg_face_btn)
# vertical spacer between vertical layout of buttons and close button
spacerItem2 = QtWidgets.QSpacerItem(20, 399, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
# close button
self.close_btn = QtWidgets.QPushButton(self.sidebar)
icon7 = QtGui.QIcon()
icon7.addPixmap(QtGui.QPixmap("icon/icons8-cancel-50.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.close_btn.setIcon(icon7)
self.close_btn.setIconSize(QtCore.QSize(20, 20))
self.close_btn.setCheckable(True)
self.close_btn.setAutoExclusive(True)
self.close_btn.setObjectName("close_btn")
# set of buttons, vertical spacer and close button in vertical layout
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.sidebar)
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.verticalLayout_2.addLayout(self.verticalLayout)
self.verticalLayout_2.addItem(spacerItem2)
self.verticalLayout_2.addWidget(self.close_btn)
# --------------------sidebar widget end--------------------
# --------------------content page widget start--------------------
# content page
self.content_page = QtWidgets.QWidget(self.centralwidget)
self.content_page.setObjectName("content_page")
# stacked widget
self.stackedWidget = QtWidgets.QStackedWidget(self.content_page)
self.stackedWidget.setObjectName("stackedWidget")
# --------------------home page start--------------------
# home page
self.home_page = QtWidgets.QWidget()
self.home_page.setObjectName("home_page")
self.gridLayout_2 = QtWidgets.QGridLayout(self.home_page)
self.gridLayout_2.setObjectName("gridLayout_2")
# 4 spacers
# HP = home panel, T = top, L = left, R = right, B = bottom, S = spacer
HPLS = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
HPTS = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
HPRS = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
HPBS = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
# home page in label
self.home_page_label = QtWidgets.QLabel(self.home_page)
self.home_page_label.setAlignment(QtCore.Qt.AlignCenter)
self.home_page_label.setObjectName("home_page_label")
self.gridLayout_2.addItem(HPTS, 0, 1, 1, 1)
self.gridLayout_2.addItem(HPLS, 1, 0, 1, 1)
self.gridLayout_2.addWidget(self.home_page_label, 1, 1, 1, 2)
self.gridLayout_2.addItem(HPRS, 1, 3, 1, 1)
self.gridLayout_2.addItem(HPBS, 2, 2, 1, 1)
# self.gridLayout_2.addWidget(self.home_page_label, 0, 0, 1, 1)
self.stackedWidget.addWidget(self.home_page)
# --------------------home page page end--------------------
# --------------------upload images page start--------------------
# upload images page
self.upload_images_page = QtWidgets.QWidget()
self.upload_images_page.setObjectName("upload_images_page")
# upload images form
self.upload_images_FL = QtWidgets.QFormLayout()
self.upload_images_lbl = QtWidgets.QLabel("ADD FOLDER NAME:")
self.upload_images_lbl.setObjectName('upload_images_lbl')
self.upload_images_text = QtWidgets.QLineEdit()
# adding rows to form layout
self.upload_images_FL.addRow(self.upload_images_lbl, self.upload_images_text)
#
self.images_list_widget = QtWidgets.QListWidget()
# upload images page layout
self.upload_images_vbl = QtWidgets.QVBoxLayout()
self.upload_images_vbl.addLayout(self.upload_images_FL)
self.upload_images_vbl.addWidget(self.images_list_widget)
self.upload_images_page.setLayout(self.upload_images_vbl)
# upload images page in stacked widget
self.stackedWidget.addWidget(self.upload_images_page)
# --------------------upload images page end--------------------
# --------------------upload videos page start--------------------
# upload videos page
self.upload_videos_page = QtWidgets.QWidget()
self.upload_videos_page.setObjectName("upload_videos_page")
# upload videos form
self.upload_videos_FL = QtWidgets.QFormLayout()
self.upload_videos_lbl = QtWidgets.QLabel("ADD FOLDER NAME:")
self.upload_videos_lbl.setObjectName('upload_videos_lbl')
self.upload_videos_text = QtWidgets.QLineEdit()
# adding rows to form layout
self.upload_videos_FL.addRow(self.upload_videos_lbl, self.upload_videos_text)
#
self.videos_list_widget = QtWidgets.QListWidget()
# upload videos page layout
self.upload_videos_vbl = QtWidgets.QVBoxLayout()
self.upload_videos_vbl.addLayout(self.upload_videos_FL)
self.upload_videos_vbl.addWidget(self.videos_list_widget)
self.upload_videos_page.setLayout(self.upload_videos_vbl)
# upload videos page in stacked widget
self.stackedWidget.addWidget(self.upload_videos_page)
# --------------------upload videos page end--------------------
# --------------------show data page start--------------------
# add data page
self.show_data_page = QtWidgets.QWidget()
self.show_data_page.setObjectName("show_data_page")
#
self.show_data_page_GL = QtWidgets.QGridLayout(self.show_data_page)
self.show_data_page_GL.setObjectName("show_data_page_GL")
# add data label
# self.label_3 = QtWidgets.QLabel(self.show_data_page)
# self.label_3.setAlignment(QtCore.Qt.AlignCenter)
# self.label_3.setObjectName("label_3")
#
self.images_LW = QtWidgets.QListWidget()
self.videos_LW = QtWidgets.QListWidget()
# profile section
self.profile_sec = QtWidgets.QWidget()
# self.profile_sec.setFixedSize(500, 500)
# 4 spacers
# PS = profile section, T = top, L = left, R = right, B = bottom, S = spacer
PSTS = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
PSLS = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
PSRS = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
PSBS = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
#
self.image_lbl = QtWidgets.QLabel(self.profile_sec)
self.image_lbl.setObjectName('image_lbl')
self.image_lbl.setScaledContents(True)
self.image_lbl.setFixedSize(200, 300)
self.name = QtWidgets.QLabel('')
self.name.setObjectName('name')
# self.enc_time = QtWidgets.QLabel(self.profile_sec)
# self.del_btn = QtWidgets.QPushButton('DELETE ENCODINGS')
#
self.profWid = QtWidgets.QWidget()
self.profWid.setObjectName("profWid")
#
self.profGL = QtWidgets.QGridLayout()
self.profGL.setObjectName("profGL")
self.profGL.addWidget(self.image_lbl, 0, 0, 3, 1)
self.profGL.addWidget(self.name, 1, 1, 1, 1)
# self.profGL.addWidget(self.enc_time, 1, 1, 1, 1)
# self.profGL.addWidget(self.del_btn, 1, 1, 1, 1)
self.profWid.setLayout(self.profGL)
# profile section gridlayout
self.profileSecGL = QtWidgets.QGridLayout(self.profile_sec)
self.profileSecGL.setObjectName("profileSecGL")
# self.profileSecGL.addWidget(self.sett_panel_label, 0, 1, 1, 2)
self.profileSecGL.addItem(PSTS, 0, 1, 1, 1)
self.profileSecGL.addItem(PSLS, 1, 0, 1, 1)
self.profileSecGL.addWidget(self.profWid, 1, 1, 1, 1)
self.profileSecGL.addItem(PSRS, 1, 2, 1, 1)
self.profileSecGL.addItem(PSBS, 2, 1, 1, 1)
#
self.images_LW_lbl = QtWidgets.QLabel('IMAGES')
self.images_LW_lbl.setObjectName('images_LW_lbl')
self.videos_LW_lbl = QtWidgets.QLabel('VIDEOS')
self.videos_LW_lbl.setObjectName('videos_LW_lbl')
self.profile_sec_lbl = QtWidgets.QLabel('PROFILE')
self.profile_sec_lbl.setObjectName('profile_sec_lbl')
#
self.show_data_page_GL.addWidget(self.images_LW_lbl, 0, 0, 1, 1)
self.show_data_page_GL.addWidget(self.images_LW, 1, 0, 1, 1)
self.show_data_page_GL.addWidget(self.videos_LW_lbl, 0, 1, 1, 1)
self.show_data_page_GL.addWidget(self.videos_LW, 1, 1, 1, 1)
self.show_data_page_GL.addWidget(self.profile_sec_lbl, 2, 0, 1, 2)
self.show_data_page_GL.addWidget(self.profile_sec, 3, 0, 1, 2)
# self.profile_sec_lbl.hide()
# self.profile_sec.hide()
#
self.stackedWidget.addWidget(self.show_data_page)
# --------------------show data page end--------------------
# --------------------add camera page start--------------------
# add camera page
self.add_camera_page = QtWidgets.QWidget()
self.add_camera_page.setObjectName("add_camera_page")
# add camera form
self.add_camera_FL = QtWidgets.QFormLayout()
self.add_camera_lbl = QtWidgets.QLabel("ADD CAMERA LINK:")
self.add_camera_lbl.setObjectName('add_camera_lbl')
self.add_camera_text = QtWidgets.QLineEdit()
self.add_camera_text.setPlaceholderText('ADD IP OF CAMERA')
self.add_camera_FL.addRow(self.add_camera_lbl, self.add_camera_text)
self.add_camera_page.setLayout(self.add_camera_FL)
self.stackedWidget.addWidget(self.add_camera_page)
# --------------------add camera page end--------------------
# --------------------settings panel page start--------------------
# settings panel page
self.sett_panel_page = QtWidgets.QWidget()
self.sett_panel_page.setObjectName("sett_panel_page")
# settings panel label
self.sett_panel_label = QtWidgets.QLabel(self.sett_panel_page)
self.sett_panel_label.setScaledContents(True)
self.sett_panel_label.setAlignment(QtCore.Qt.AlignCenter)
self.sett_panel_label.setObjectName("sett_panel_label")
# 4 spacers
# SP = settings panel, T = top, L = left, R = right, B = bottom, S = spacer
SPTS = QtWidgets.QSpacerItem(20, 133, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
SPLS = QtWidgets.QSpacerItem(71, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
SPRS = QtWidgets.QSpacerItem(70, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
SPBS = QtWidgets.QSpacerItem(20, 133, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
# detection model label
self.detection_model_label = QtWidgets.QLabel(self.sett_panel_page)
self.detection_model_label.setMinimumSize(QtCore.QSize(250, 25))
self.detection_model_label.setScaledContents(True)
self.detection_model_label.setAlignment(QtCore.Qt.AlignCenter)
self.detection_model_label.setObjectName("detection_model_label")
# detection model combobox
self.detection_model_CB = QtWidgets.QComboBox(self.sett_panel_page)
self.detection_model_CB.setMinimumSize(QtCore.QSize(200, 20))
self.detection_model_CB.setObjectName("detection_model_CB")
detection_item = ['MTCNN', 'mediapipe']
self.detection_model_index = {i:x for i,x in enumerate(detection_item)}
self.detection_model_to_index = {x:i for i,x in enumerate(detection_item)}
self.detection_model_CB.addItems(detection_item)
self.detection_model_CB.setCurrentIndex(1)
# horizontal spacer between detection model label and detection model combobox
spacerItem5 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
# detection model cell in horizontal layout
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.horizontalLayout.addWidget(self.detection_model_label)
self.horizontalLayout.addItem(spacerItem5)
self.horizontalLayout.addWidget(self.detection_model_CB)
# vertical spacer between detection model cell and recognition model cell
spacerItem6 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
# recognition model label
self.recognition_model_label = QtWidgets.QLabel(self.sett_panel_page)
self.recognition_model_label.setMinimumSize(QtCore.QSize(250, 25))
self.recognition_model_label.setScaledContents(True)
self.recognition_model_label.setAlignment(QtCore.Qt.AlignCenter)
self.recognition_model_label.setObjectName("recognition_model_label")
# recognition model combobox
self.recognition_model_CB = QtWidgets.QComboBox(self.sett_panel_page)
self.recognition_model_CB.setMinimumSize(QtCore.QSize(200, 20))
self.recognition_model_CB.setObjectName("recognition_model_CB")
recog_items = ['Facenet','Facenet512', 'ArcFace']
self.recognition_model_index = {i:x for i,x in enumerate(recog_items)}
self.recognition_model_to_index = {x:i for i,x in enumerate(recog_items)}
self.recognition_model_CB.addItems(recog_items)
self.recognition_model_CB.setCurrentIndex(0)
# horizontal spacer between recognition model label and recognition model combobox
spacerItem7 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
# recognition model cell in horizontal layout
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
self.horizontalLayout_3.addWidget(self.recognition_model_label)
self.horizontalLayout_3.addItem(spacerItem7)
self.horizontalLayout_3.addWidget(self.recognition_model_CB)
# vertical spacer between recognition model cell and processors cell
spacerItem8 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
# processor label
self.processors_label = QtWidgets.QLabel(self.sett_panel_page)
self.processors_label.setMinimumSize(QtCore.QSize(250, 25))
self.processors_label.setScaledContents(True)
self.processors_label.setAlignment(QtCore.Qt.AlignCenter)
self.processors_label.setObjectName("processors_label")
# processor combobox
self.processors_CB = QtWidgets.QComboBox(self.sett_panel_page)
self.processors_CB.setMinimumSize(QtCore.QSize(200, 20))
self.processors_CB.setObjectName("processors_CB")
# add number of processors
cpu_count = os.cpu_count()
processors = []
for i in range(2, cpu_count+1):
processors.append(str(i))
self.processors_CB.addItems(processors)
# horizontal spacer between processor label and processor combobox
spacerItem9 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
# processors cell in horizontal layout
self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
self.horizontalLayout_4.addWidget(self.processors_label)
self.horizontalLayout_4.addItem(spacerItem9)
self.horizontalLayout_4.addWidget(self.processors_CB)
# vertical spacer between processors cell and save settings button
processorsCellSaveBtnCellSpacer = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
# save settings button
self.save_sett_btn = QtWidgets.QPushButton(self.sett_panel_page)
self.save_sett_btn.setObjectName("save_sett_btn")
# detection model cell, recognition model cell, processors cell,
# save settings button and vertical spacers in vertical layout
self.verticalLayout_3 = QtWidgets.QVBoxLayout()
self.verticalLayout_3.setContentsMargins(50, 50, 50, 50)
self.verticalLayout_3.setObjectName("verticalLayout_3")
self.verticalLayout_3.addLayout(self.horizontalLayout)
self.verticalLayout_3.addItem(spacerItem6)
self.verticalLayout_3.addLayout(self.horizontalLayout_3)
self.verticalLayout_3.addItem(spacerItem8)
self.verticalLayout_3.addLayout(self.horizontalLayout_4)
self.verticalLayout_3.addItem(processorsCellSaveBtnCellSpacer)
self.verticalLayout_3.addWidget(self.save_sett_btn)
# all elements of settings panel in grid layout
self.settPanelGL = QtWidgets.QGridLayout(self.sett_panel_page)
self.settPanelGL.setObjectName("settPanelGL")
self.settPanelGL.addWidget(self.sett_panel_label, 0, 1, 1, 2)
self.settPanelGL.addItem(SPTS, 1, 1, 1, 1)
self.settPanelGL.addItem(SPLS, 2, 0, 1, 1)
self.settPanelGL.addLayout(self.verticalLayout_3, 2, 1, 1, 2)
self.settPanelGL.addItem(SPRS, 2, 3, 1, 1)
self.settPanelGL.addItem(SPBS, 3, 2, 1, 1)
self.stackedWidget.addWidget(self.sett_panel_page)
# --------------------settings panel page end--------------------
# --------------------recognized faces page start--------------------
# recognize face page
self.recg_face_page = QtWidgets.QWidget()
self.recg_face_page.setObjectName("recg_face_page")
self.gridLayout_4 = QtWidgets.QGridLayout(self.recg_face_page)
self.gridLayout_4.setObjectName("gridLayout_4")
# recognize face label
# self.label_4 = QtWidgets.QLabel(self.recg_face_page)
# self.label_4.setAlignment(QtCore.Qt.AlignCenter)
# self.label_4.setObjectName("label_4")
self.table_wid = QtWidgets.QTableWidget()
# self.table_wid.setItem(0, 0)
self.table_wid.horizontalHeader().setStretchLastSection(True)
self.table_wid.horizontalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Stretch)
self.table_wid.horizontalHeader().setVisible(False)
self.table_wid.verticalHeader().setVisible(False)
self.gridLayout_4.addWidget(self.table_wid, 0, 0, 1, 1)
self.stackedWidget.addWidget(self.recg_face_page)
# --------------------recognized faces page end--------------------
# grid layout of content page
self.gridLayout_7 = QtWidgets.QGridLayout(self.content_page)
self.gridLayout_7.setObjectName("gridLayout_7")
self.gridLayout_7.addWidget(self.stackedWidget, 0, 0, 1, 1)
# --------------------content page widget end--------------------
# grid layout of central widget
self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
self.gridLayout.setContentsMargins(0, 0, 0, 0)
self.gridLayout.setSpacing(0)
self.gridLayout.setObjectName("gridLayout")
# header widget in grid layout of central widget
self.gridLayout.addWidget(self.header, 0, 0, 1, 2)
# sidebar widget in grid layout of central widget
self.gridLayout.addWidget(self.sidebar, 1, 0, 1, 1)
# content page widget in grid layour of central widget
self.gridLayout.addWidget(self.content_page, 1, 1, 1, 1)
# central widget in mainwindow
MainWindow.setCentralWidget(self.centralwidget)
self.retranslateUi(MainWindow)
self.close_btn.clicked.connect(MainWindow.close)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
# mainwindow
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
# header labels
self.fr_label.setText(_translate("MainWindow", "FACE RECOGNIZER"))
# sidebar buttons
self.home_btn.setText(_translate("MainWindow", "HOME"))
self.show_data_btn.setText(_translate("MainWindow", "SHOW DATA"))
self.recg_face_btn.setText(_translate("MainWindow", "RECOGNIZED FACES"))
self.sett_panel_btn.setText(_translate("MainWindow", "SETTINGS PANEL"))
self.add_camera_btn.setText(_translate("MainWindow", "ADD CAMERA"))
self.upload_videos_btn.setText(_translate("MainWindow", "UPLOAD VIDEOS"))
self.upload_images_btn.setText(_translate("MainWindow", "UPLOAD IMAGES"))
self.close_btn.setText(_translate("MainWindow", "CLOSE"))
# content page label
self.home_page_label.setText(_translate("MainWindow", "STREAM"))
# self.label_3.setText(_translate("MainWindow", "ADD DATA"))
# self.label_4.setText(_translate("MainWindow", "SHOW RECOGNIZED FACES"))
#
# self.images_LW_lbl.setText(_translate("MainWindow", "IMAGES"))
# self.videos_LW_lbl.setText(_translate("MainWindow", "VIDEOS"))
# self.profile_sec_lbl.setText(_translate("MainWindow", "PROFILE"))
# self.name.setText(_translate("MainWindow", ""))
# self.enc_time.setText(_translate("MainWindow", ""))
# self.del_btn.setText(_translate("MainWindow", "DELETE ENCODINGS"))
# settings panel page labels and buttons
self.sett_panel_label.setText(_translate("MainWindow", "SETTINGS PANEL"))
self.detection_model_label.setText(_translate("MainWindow", "CHOOSE DETECTION MODEL"))
self.recognition_model_label.setText(_translate("MainWindow", "CHOOSE RECOGNITION MODEL"))
self.processors_label.setText(_translate("MainWindow", "CHOOSE PROCESSORS"))
self.save_sett_btn.setText(_translate("MainWindow", "SAVE"))