-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathHistory.py
54 lines (50 loc) · 1.96 KB
/
History.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
from PyQt5.QtWidgets import QWidget, QLabel, QHBoxLayout, QVBoxLayout, QGroupBox, QScrollArea, QPushButton, QProgressBar, QMessageBox
from PyQt5.Qt import Qt
from PyQt5.QtGui import QPixmap, QImage
from ImageViewer import *
import os
import glob
class myHistory(QWidget):
def __init__(self):
super(QWidget, self).__init__()
self.initUI()
def initUI(self):
self.imageList = []
self.imageList = glob.glob("result/*.jpg")
self.imageList.sort(key = os.path.getmtime)
self.imageList.reverse()
num = len(self.imageList)
self.labelList = []
self.hboxgroupList = []
self.hboxList = []
self.vboxgroup = QGroupBox()
self.vbox = QVBoxLayout()
self.vboxLayout = QVBoxLayout()
for i in range(num):
self.labelList.append(myImageResult(self.imageList[i], 320, 240))
if num % 2 == 1:
self.labelList.append(myImageBlank("pics/null.png", 320, 240))
num += 1
for i in range(int((num+1)/2)):
self.hboxgroupList.append(QGroupBox())
self.hboxList.append(QHBoxLayout())
self.hboxList[i].addStretch(1)
self.hboxList[i].addWidget(self.labelList[i*2])
self.hboxList[i].addStretch(1)
self.hboxList[i].addWidget(self.labelList[i*2+1])
self.hboxList[i].addStretch(1)
self.hboxgroupList[i].setLayout(self.hboxList[i])
for i in range(int((num+1)/2)):
self.vbox.addWidget(self.hboxgroupList[i])
self.vbox.addStretch(1)
self.vboxgroup.setLayout(self.vbox)
self.scroll = QScrollArea()
self.scroll.setWidget(self.vboxgroup)
self.scroll.setAutoFillBackground(True)
self.scroll.setWidgetResizable(True)
self.vboxLayout.addWidget(self.scroll)
self.setLayout(self.vboxLayout)
def renew(self):
self.setUpdatesEnabled(False)
self.initUI()
self.setUpdatesEnabled(True)