-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
55 lines (45 loc) · 1.39 KB
/
app.py
File metadata and controls
55 lines (45 loc) · 1.39 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import sys
from PyQt5.QtWidgets import *
from PyQt5.QtCore import Qt
from start import StartUI
from classify import ClassifyUI
class MyApp(QMainWindow):
def __init__(self):
super().__init__()
self.useSubDir = True
self.dir = ""
self.save = ""
self.exts = ['png', 'jpg', 'jpeg']
self.toolBar = None
self.progressBar = None
self.thread = None
self.images = []
self.labels = []
self.classButtons = []
self.tabs = []
self.data = [[] for _ in range(20)]
self.undoRecord = []
self.redoRecord = []
self.initUI()
def initUI(self):
self.setWindowTitle('image-classifier')
self.changeScene(StartUI)
self.setFixedSize(1280, 720)
self.statusBar().setSizeGripEnabled(False)
self.center()
self.show()
def center(self):
frame = self.frameGeometry()
center = QDesktopWidget().availableGeometry().center()
frame.moveCenter(center)
self.move(frame.topLeft())
def changeScene(self, scene):
if self.toolBar:
self.removeToolBar(self.toolBar)
self.statusBar().clearMessage()
self.statusBar().removeWidget(self.progressBar)
self.setCentralWidget(scene(self))
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = MyApp()
sys.exit(app.exec_())