-
Notifications
You must be signed in to change notification settings - Fork 23
/
learningUI.py
220 lines (212 loc) · 13 KB
/
learningUI.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
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'learningUI.ui'
#
# Created: Thu May 07 11:27:22 2015
# by: PyQt4 UI code generator 4.11.2
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_Wizard(object):
def setupUi(self, Wizard):
Wizard.setObjectName(_fromUtf8("Wizard"))
Wizard.resize(788, 483)
Wizard.setWizardStyle(QtGui.QWizard.ModernStyle)
self.wizardPage1 = QtGui.QWizardPage()
self.wizardPage1.setObjectName(_fromUtf8("wizardPage1"))
self.verticalLayout_4 = QtGui.QVBoxLayout(self.wizardPage1)
self.verticalLayout_4.setObjectName(_fromUtf8("verticalLayout_4"))
self.label_2 = QtGui.QLabel(self.wizardPage1)
self.label_2.setWordWrap(True)
self.label_2.setObjectName(_fromUtf8("label_2"))
self.verticalLayout_4.addWidget(self.label_2)
spacerItem = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
self.verticalLayout_4.addItem(spacerItem)
self.horizontalLayout_5 = QtGui.QHBoxLayout()
self.horizontalLayout_5.setObjectName(_fromUtf8("horizontalLayout_5"))
self.label_3 = QtGui.QLabel(self.wizardPage1)
self.label_3.setObjectName(_fromUtf8("label_3"))
self.horizontalLayout_5.addWidget(self.label_3)
self.base_data_label = QtGui.QLabel(self.wizardPage1)
self.base_data_label.setWordWrap(True)
self.base_data_label.setObjectName(_fromUtf8("base_data_label"))
self.horizontalLayout_5.addWidget(self.base_data_label)
self.horizontalLayout_5.setStretch(0, 1)
self.horizontalLayout_5.setStretch(1, 100)
self.verticalLayout_4.addLayout(self.horizontalLayout_5)
spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.verticalLayout_4.addItem(spacerItem1)
self.horizontalLayout_6 = QtGui.QHBoxLayout()
self.horizontalLayout_6.setObjectName(_fromUtf8("horizontalLayout_6"))
self.label_4 = QtGui.QLabel(self.wizardPage1)
self.label_4.setObjectName(_fromUtf8("label_4"))
self.horizontalLayout_6.addWidget(self.label_4)
self.user_data_label = QtGui.QLabel(self.wizardPage1)
self.user_data_label.setWordWrap(True)
self.user_data_label.setObjectName(_fromUtf8("user_data_label"))
self.horizontalLayout_6.addWidget(self.user_data_label)
self.horizontalLayout_6.setStretch(0, 1)
self.horizontalLayout_6.setStretch(1, 100)
self.verticalLayout_4.addLayout(self.horizontalLayout_6)
self.delete_images_button = QtGui.QPushButton(self.wizardPage1)
self.delete_images_button.setEnabled(False)
self.delete_images_button.setObjectName(_fromUtf8("delete_images_button"))
self.verticalLayout_4.addWidget(self.delete_images_button)
spacerItem2 = QtGui.QSpacerItem(20, 281, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.verticalLayout_4.addItem(spacerItem2)
self.verticalLayout_4.setStretch(0, 1)
self.verticalLayout_4.setStretch(2, 1)
self.verticalLayout_4.setStretch(3, 1)
self.verticalLayout_4.setStretch(4, 1)
self.verticalLayout_4.setStretch(6, 10)
Wizard.addPage(self.wizardPage1)
self.wizardPage2 = CustomQWizardPage()
self.wizardPage2.setObjectName(_fromUtf8("wizardPage2"))
self.verticalLayout_2 = QtGui.QVBoxLayout(self.wizardPage2)
self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
self.label = QtGui.QLabel(self.wizardPage2)
self.label.setWordWrap(True)
self.label.setObjectName(_fromUtf8("label"))
self.verticalLayout_2.addWidget(self.label)
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.file_list = QtGui.QListWidget(self.wizardPage2)
self.file_list.setMaximumSize(QtCore.QSize(16777215, 100))
self.file_list.setObjectName(_fromUtf8("file_list"))
self.horizontalLayout.addWidget(self.file_list)
self.verticalLayout = QtGui.QVBoxLayout()
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.add_files_button = QtGui.QPushButton(self.wizardPage2)
self.add_files_button.setObjectName(_fromUtf8("add_files_button"))
self.verticalLayout.addWidget(self.add_files_button)
self.remove_file_button = QtGui.QPushButton(self.wizardPage2)
self.remove_file_button.setObjectName(_fromUtf8("remove_file_button"))
self.verticalLayout.addWidget(self.remove_file_button)
self.ocr_button = QtGui.QPushButton(self.wizardPage2)
self.ocr_button.setObjectName(_fromUtf8("ocr_button"))
self.verticalLayout.addWidget(self.ocr_button)
self.horizontalLayout.addLayout(self.verticalLayout)
self.verticalLayout_2.addLayout(self.horizontalLayout)
self.label_5 = QtGui.QLabel(self.wizardPage2)
self.label_5.setWordWrap(True)
self.label_5.setObjectName(_fromUtf8("label_5"))
self.verticalLayout_2.addWidget(self.label_5)
self.snippet_preview = QtGui.QGraphicsView(self.wizardPage2)
self.snippet_preview.setMaximumSize(QtCore.QSize(16777215, 45))
self.snippet_preview.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.snippet_preview.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.snippet_preview.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
self.snippet_preview.setObjectName(_fromUtf8("snippet_preview"))
self.verticalLayout_2.addWidget(self.snippet_preview)
self.field_holder = QtGui.QHBoxLayout()
self.field_holder.setObjectName(_fromUtf8("field_holder"))
self.grid = QtGui.QGridLayout()
self.grid.setSizeConstraint(QtGui.QLayout.SetMinimumSize)
self.grid.setObjectName(_fromUtf8("grid"))
self.field_holder.addLayout(self.grid)
spacerItem3 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.field_holder.addItem(spacerItem3)
self.field_holder.setStretch(1, 100)
self.verticalLayout_2.addLayout(self.field_holder)
self.horizontalLayout_4 = QtGui.QHBoxLayout()
self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4"))
self.prev_button = QtGui.QPushButton(self.wizardPage2)
self.prev_button.setEnabled(False)
self.prev_button.setObjectName(_fromUtf8("prev_button"))
self.horizontalLayout_4.addWidget(self.prev_button)
self.next_button = QtGui.QPushButton(self.wizardPage2)
self.next_button.setEnabled(False)
self.next_button.setObjectName(_fromUtf8("next_button"))
self.horizontalLayout_4.addWidget(self.next_button)
self.verticalLayout_2.addLayout(self.horizontalLayout_4)
spacerItem4 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.verticalLayout_2.addItem(spacerItem4)
self.notifier = QtGui.QLabel(self.wizardPage2)
self.notifier.setAlignment(QtCore.Qt.AlignCenter)
self.notifier.setObjectName(_fromUtf8("notifier"))
self.verticalLayout_2.addWidget(self.notifier)
self.verticalLayout_2.setStretch(6, 100)
Wizard.addPage(self.wizardPage2)
self.wizardPage3 = CustomQWizardPage()
self.wizardPage3.setObjectName(_fromUtf8("wizardPage3"))
self.verticalLayout_5 = QtGui.QVBoxLayout(self.wizardPage3)
self.verticalLayout_5.setObjectName(_fromUtf8("verticalLayout_5"))
self.label_6 = QtGui.QLabel(self.wizardPage3)
self.label_6.setObjectName(_fromUtf8("label_6"))
self.verticalLayout_5.addWidget(self.label_6)
self.summary_label = QtGui.QLabel(self.wizardPage3)
self.summary_label.setWordWrap(True)
self.summary_label.setObjectName(_fromUtf8("summary_label"))
self.verticalLayout_5.addWidget(self.summary_label)
self.save_button = QtGui.QPushButton(self.wizardPage3)
self.save_button.setObjectName(_fromUtf8("save_button"))
self.verticalLayout_5.addWidget(self.save_button)
spacerItem5 = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
self.verticalLayout_5.addItem(spacerItem5)
self.label_7 = QtGui.QLabel(self.wizardPage3)
self.label_7.setWordWrap(True)
self.label_7.setObjectName(_fromUtf8("label_7"))
self.verticalLayout_5.addWidget(self.label_7)
self.train_button = QtGui.QPushButton(self.wizardPage3)
self.train_button.setEnabled(False)
self.train_button.setObjectName(_fromUtf8("train_button"))
self.verticalLayout_5.addWidget(self.train_button)
self.loader = QtGui.QLabel(self.wizardPage3)
self.loader.setText(_fromUtf8(""))
self.loader.setAlignment(QtCore.Qt.AlignCenter)
self.loader.setObjectName(_fromUtf8("loader"))
self.verticalLayout_5.addWidget(self.loader)
self.training_summary = QtGui.QLabel(self.wizardPage3)
self.training_summary.setText(_fromUtf8(""))
self.training_summary.setWordWrap(True)
self.training_summary.setObjectName(_fromUtf8("training_summary"))
self.verticalLayout_5.addWidget(self.training_summary)
self.details = QtGui.QTextEdit(self.wizardPage3)
self.details.setObjectName(_fromUtf8("details"))
self.verticalLayout_5.addWidget(self.details)
spacerItem6 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.verticalLayout_5.addItem(spacerItem6)
self.verticalLayout_5.setStretch(0, 1)
self.verticalLayout_5.setStretch(1, 1)
self.verticalLayout_5.setStretch(2, 1)
self.verticalLayout_5.setStretch(3, 1)
self.verticalLayout_5.setStretch(4, 1)
self.verticalLayout_5.setStretch(5, 1)
self.verticalLayout_5.setStretch(9, 100)
Wizard.addPage(self.wizardPage3)
self.retranslateUi(Wizard)
QtCore.QMetaObject.connectSlotsByName(Wizard)
def retranslateUi(self, Wizard):
Wizard.setWindowTitle(_translate("Wizard", "Wizard", None))
self.label_2.setText(_translate("Wizard", "This is the learning module. You can improve your OCR accuracy by training OCR with your images. Following learning images are available. You can add more by processing your screenshots in the next step. If you want to restart learning from scratch you can always delete user\'s training images. Base images will not be deleted as they are necessary for proper training.", None))
self.label_3.setText(_translate("Wizard", "Base learning images:", None))
self.base_data_label.setText(_translate("Wizard", "-", None))
self.label_4.setText(_translate("Wizard", "User\'s learning images:", None))
self.user_data_label.setText(_translate("Wizard", "-", None))
self.delete_images_button.setText(_translate("Wizard", "Delete user\'s training images", None))
self.label.setText(_translate("Wizard", "Select Files to use for learning and click OCR. The images will be cut in single characters for training. Check every single one if it is recognized properly and correct if needed.", None))
self.add_files_button.setText(_translate("Wizard", "Add Files", None))
self.remove_file_button.setText(_translate("Wizard", "Remove File", None))
self.ocr_button.setText(_translate("Wizard", "OCR", None))
self.label_5.setText(_translate("Wizard", "Dot and comma are the same for learning.\n"
"If two letters are recognized as one use empty text field so it will be ignored while learning.", None))
self.prev_button.setText(_translate("Wizard", "Previous", None))
self.next_button.setText(_translate("Wizard", "Next", None))
self.notifier.setText(_translate("Wizard", "You did not add and OCR any images yet.", None))
self.label_6.setText(_translate("Wizard", "You collected following new images:", None))
self.summary_label.setText(_translate("Wizard", "-", None))
self.save_button.setText(_translate("Wizard", "Add those images to user\'s training images", None))
self.label_7.setText(_translate("Wizard", "Base training data and user\'s training data will be used for OCR training. Click the button above to add just analyzed data to user\'s images. Please note: Learning process can take several minutes to finish! Summary will be shown when the training is completed.", None))
self.train_button.setText(_translate("Wizard", "Perform training", None))
from customqwizardpage import CustomQWizardPage