-
Notifications
You must be signed in to change notification settings - Fork 0
/
dialog_qt5.py
252 lines (243 loc) · 13.9 KB
/
dialog_qt5.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
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'dialog.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, QtGui, QtWidgets
class Ui_dialog(object):
def setupUi(self, dialog):
dialog.setObjectName("dialog")
dialog.resize(402, 291)
dialog.setAutoFillBackground(True)
dialog.setStyleSheet("")
dialog.setModal(True)
self.import_btn = QtWidgets.QPushButton(dialog)
self.import_btn.setEnabled(False)
self.import_btn.setGeometry(QtCore.QRect(220, 260, 75, 23))
self.import_btn.setStyleSheet(":focus {border: 1px solid #99D1FF;}")
self.import_btn.setAutoDefault(False)
self.import_btn.setObjectName("import_btn")
self.cancel_btn = QtWidgets.QPushButton(dialog)
self.cancel_btn.setGeometry(QtCore.QRect(310, 260, 75, 23))
self.cancel_btn.setStyleSheet(":focus {border: 1px solid #99D1FF;}")
self.cancel_btn.setAutoDefault(False)
self.cancel_btn.setObjectName("cancel_btn")
self.verticalLayoutWidget = QtWidgets.QWidget(dialog)
self.verticalLayoutWidget.setGeometry(QtCore.QRect(10, 10, 381, 241))
self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.verticalLayout.setObjectName("verticalLayout")
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.file_label = QtWidgets.QLabel(self.verticalLayoutWidget)
self.file_label.setMaximumSize(QtCore.QSize(50, 16777215))
self.file_label.setObjectName("file_label")
self.horizontalLayout.addWidget(self.file_label)
self.file = QtWidgets.QPushButton(self.verticalLayoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.file.sizePolicy().hasHeightForWidth())
self.file.setSizePolicy(sizePolicy)
self.file.setLayoutDirection(QtCore.Qt.LeftToRight)
self.file.setStyleSheet("")
self.file.setAutoDefault(False)
self.file.setFlat(False)
self.file.setObjectName("file")
self.horizontalLayout.addWidget(self.file)
self.verticalLayout.addLayout(self.horizontalLayout)
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.deck_label = QtWidgets.QLabel(self.verticalLayoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.deck_label.sizePolicy().hasHeightForWidth())
self.deck_label.setSizePolicy(sizePolicy)
self.deck_label.setMaximumSize(QtCore.QSize(50, 16777215))
self.deck_label.setObjectName("deck_label")
self.horizontalLayout_2.addWidget(self.deck_label)
self.deck = QtWidgets.QComboBox(self.verticalLayoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.deck.sizePolicy().hasHeightForWidth())
self.deck.setSizePolicy(sizePolicy)
self.deck.setFocusPolicy(QtCore.Qt.WheelFocus)
self.deck.setStyleSheet("")
self.deck.setObjectName("deck")
self.horizontalLayout_2.addWidget(self.deck)
self.verticalLayout.addLayout(self.horizontalLayout_2)
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
self.note_label = QtWidgets.QLabel(self.verticalLayoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(1)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.note_label.sizePolicy().hasHeightForWidth())
self.note_label.setSizePolicy(sizePolicy)
self.note_label.setMaximumSize(QtCore.QSize(50, 16777215))
self.note_label.setObjectName("note_label")
self.horizontalLayout_3.addWidget(self.note_label)
self.note = QtWidgets.QComboBox(self.verticalLayoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(1)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.note.sizePolicy().hasHeightForWidth())
self.note.setSizePolicy(sizePolicy)
self.note.setFocusPolicy(QtCore.Qt.WheelFocus)
self.note.setStyleSheet("")
self.note.setObjectName("note")
self.horizontalLayout_3.addWidget(self.note)
self.subdeck = QtWidgets.QCheckBox(self.verticalLayoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.subdeck.sizePolicy().hasHeightForWidth())
self.subdeck.setSizePolicy(sizePolicy)
self.subdeck.setObjectName("subdeck")
self.horizontalLayout_3.addWidget(self.subdeck)
self.verticalLayout.addLayout(self.horizontalLayout_3)
self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
self.front_label = QtWidgets.QLabel(self.verticalLayoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.front_label.sizePolicy().hasHeightForWidth())
self.front_label.setSizePolicy(sizePolicy)
self.front_label.setMaximumSize(QtCore.QSize(50, 16777215))
self.front_label.setObjectName("front_label")
self.horizontalLayout_4.addWidget(self.front_label)
self.front = QtWidgets.QComboBox(self.verticalLayoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.front.sizePolicy().hasHeightForWidth())
self.front.setSizePolicy(sizePolicy)
self.front.setFocusPolicy(QtCore.Qt.WheelFocus)
self.front.setObjectName("front")
self.horizontalLayout_4.addWidget(self.front)
self.verticalLayout.addLayout(self.horizontalLayout_4)
self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
self.horizontalLayout_5.setObjectName("horizontalLayout_5")
self.back_label = QtWidgets.QLabel(self.verticalLayoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.back_label.sizePolicy().hasHeightForWidth())
self.back_label.setSizePolicy(sizePolicy)
self.back_label.setMaximumSize(QtCore.QSize(50, 16777215))
self.back_label.setObjectName("back_label")
self.horizontalLayout_5.addWidget(self.back_label)
self.back = QtWidgets.QComboBox(self.verticalLayoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.back.sizePolicy().hasHeightForWidth())
self.back.setSizePolicy(sizePolicy)
self.back.setFocusPolicy(QtCore.Qt.WheelFocus)
self.back.setObjectName("back")
self.horizontalLayout_5.addWidget(self.back)
self.verticalLayout.addLayout(self.horizontalLayout_5)
self.horizontalLayout_6 = QtWidgets.QHBoxLayout()
self.horizontalLayout_6.setObjectName("horizontalLayout_6")
self.format_label = QtWidgets.QLabel(self.verticalLayoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.format_label.sizePolicy().hasHeightForWidth())
self.format_label.setSizePolicy(sizePolicy)
self.format_label.setMaximumSize(QtCore.QSize(50, 16777215))
self.format_label.setObjectName("format_label")
self.horizontalLayout_6.addWidget(self.format_label)
self.format = QtWidgets.QComboBox(self.verticalLayoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.format.sizePolicy().hasHeightForWidth())
self.format.setSizePolicy(sizePolicy)
self.format.setFocusPolicy(QtCore.Qt.WheelFocus)
self.format.setObjectName("format")
self.horizontalLayout_6.addWidget(self.format)
self.verticalLayout.addLayout(self.horizontalLayout_6)
self.horizontalLayout_7 = QtWidgets.QHBoxLayout()
self.horizontalLayout_7.setObjectName("horizontalLayout_7")
self.label = QtWidgets.QLabel(self.verticalLayoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth())
self.label.setSizePolicy(sizePolicy)
self.label.setMaximumSize(QtCore.QSize(50, 16777215))
self.label.setObjectName("label")
self.horizontalLayout_7.addWidget(self.label)
self.width = QtWidgets.QSpinBox(self.verticalLayoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.width.sizePolicy().hasHeightForWidth())
self.width.setSizePolicy(sizePolicy)
self.width.setMaximum(10000)
self.width.setObjectName("width")
self.horizontalLayout_7.addWidget(self.width)
self.scale_lbl = QtWidgets.QLabel(self.verticalLayoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.scale_lbl.sizePolicy().hasHeightForWidth())
self.scale_lbl.setSizePolicy(sizePolicy)
self.scale_lbl.setMaximumSize(QtCore.QSize(50, 16777215))
self.scale_lbl.setObjectName("scale_lbl")
self.horizontalLayout_7.addWidget(self.scale_lbl)
self.height = QtWidgets.QSpinBox(self.verticalLayoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.height.sizePolicy().hasHeightForWidth())
self.height.setSizePolicy(sizePolicy)
self.height.setMaximum(10000)
self.height.setObjectName("height")
self.horizontalLayout_7.addWidget(self.height)
self.verticalLayout.addLayout(self.horizontalLayout_7)
self.retranslateUi(dialog)
self.import_btn.clicked.connect(dialog.accept)
self.cancel_btn.clicked.connect(dialog.reject)
QtCore.QMetaObject.connectSlotsByName(dialog)
dialog.setTabOrder(self.file, self.deck)
dialog.setTabOrder(self.deck, self.note)
dialog.setTabOrder(self.note, self.front)
dialog.setTabOrder(self.front, self.back)
dialog.setTabOrder(self.back, self.format)
dialog.setTabOrder(self.format, self.width)
dialog.setTabOrder(self.width, self.height)
dialog.setTabOrder(self.height, self.import_btn)
dialog.setTabOrder(self.import_btn, self.cancel_btn)
def retranslateUi(self, dialog):
_translate = QtCore.QCoreApplication.translate
dialog.setWindowTitle(_translate("dialog", "PDF to notes"))
self.import_btn.setText(_translate("dialog", "Import"))
self.cancel_btn.setText(_translate("dialog", "Cancel"))
self.file_label.setText(_translate("dialog", "PDF file"))
self.file.setText(_translate("dialog", "Click to select PDF"))
self.deck_label.setText(_translate("dialog", "Deck"))
self.note_label.setText(_translate("dialog", "Note type"))
self.subdeck.setText(_translate("dialog", "Subdecks"))
self.front_label.setText(_translate("dialog", "Front/cloze"))
self.back_label.setText(_translate("dialog", "Back"))
self.format_label.setText(_translate("dialog", "Format"))
self.label.setText(_translate("dialog", "Fit width"))
self.width.setSuffix(_translate("dialog", " px"))
self.scale_lbl.setText(_translate("dialog", "Fit height"))
self.height.setSuffix(_translate("dialog", " px"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
dialog = QtWidgets.QDialog()
ui = Ui_dialog()
ui.setupUi(dialog)
dialog.show()
sys.exit(app.exec_())