excel2moodle 0.4.0__py3-none-any.whl → 0.4.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- excel2moodle/__main__.py +8 -9
- excel2moodle/core/__init__.py +0 -10
- excel2moodle/core/category.py +4 -3
- excel2moodle/core/dataStructure.py +85 -57
- excel2moodle/core/etHelpers.py +2 -2
- excel2moodle/core/exceptions.py +2 -2
- excel2moodle/core/globals.py +10 -27
- excel2moodle/core/parser.py +24 -30
- excel2moodle/core/question.py +147 -63
- excel2moodle/core/settings.py +73 -45
- excel2moodle/core/validator.py +36 -55
- excel2moodle/logger.py +3 -3
- excel2moodle/question_types/__init__.py +2 -0
- excel2moodle/question_types/cloze.py +207 -0
- excel2moodle/question_types/mc.py +26 -16
- excel2moodle/question_types/nf.py +17 -3
- excel2moodle/question_types/nfm.py +60 -17
- excel2moodle/ui/{windowEquationChecker.py → UI_equationChecker.py} +98 -78
- excel2moodle/ui/{exportSettingsDialog.py → UI_exportSettingsDialog.py} +55 -4
- excel2moodle/ui/{windowMain.py → UI_mainWindow.py} +32 -39
- excel2moodle/ui/appUi.py +35 -66
- excel2moodle/ui/dialogs.py +40 -2
- excel2moodle/ui/equationChecker.py +70 -0
- excel2moodle/ui/treewidget.py +4 -4
- {excel2moodle-0.4.0.dist-info → excel2moodle-0.4.2.dist-info}/METADATA +2 -3
- excel2moodle-0.4.2.dist-info/RECORD +38 -0
- {excel2moodle-0.4.0.dist-info → excel2moodle-0.4.2.dist-info}/entry_points.txt +0 -3
- excel2moodle/ui/questionPreviewDialog.py +0 -115
- excel2moodle-0.4.0.dist-info/RECORD +0 -37
- /excel2moodle/ui/{variantDialog.py → UI_variantDialog.py} +0 -0
- {excel2moodle-0.4.0.dist-info → excel2moodle-0.4.2.dist-info}/WHEEL +0 -0
- {excel2moodle-0.4.0.dist-info → excel2moodle-0.4.2.dist-info}/licenses/LICENSE +0 -0
- {excel2moodle-0.4.0.dist-info → excel2moodle-0.4.2.dist-info}/top_level.txt +0 -0
@@ -1,9 +1,9 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
|
3
3
|
################################################################################
|
4
|
-
## Form generated from reading UI file '
|
4
|
+
## Form generated from reading UI file 'UI_equationChecker.ui'
|
5
5
|
##
|
6
|
-
## Created by: Qt User Interface Compiler version 6.
|
6
|
+
## Created by: Qt User Interface Compiler version 6.9.1
|
7
7
|
##
|
8
8
|
## WARNING! All changes made in this file will be lost when recompiling UI file!
|
9
9
|
################################################################################
|
@@ -16,13 +16,15 @@ from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
|
|
16
16
|
QImage, QKeySequence, QLinearGradient, QPainter,
|
17
17
|
QPalette, QPixmap, QRadialGradient, QTransform)
|
18
18
|
from PySide6.QtWidgets import (QApplication, QFrame, QGridLayout, QLabel,
|
19
|
-
QLineEdit, QPushButton, QSizePolicy,
|
20
|
-
QSpinBox, QTextEdit, QVBoxLayout,
|
19
|
+
QLineEdit, QPlainTextEdit, QPushButton, QSizePolicy,
|
20
|
+
QSpacerItem, QSpinBox, QTextEdit, QVBoxLayout,
|
21
|
+
QWidget)
|
21
22
|
|
22
23
|
class Ui_EquationChecker(object):
|
23
24
|
def setupUi(self, EquationChecker):
|
24
25
|
if not EquationChecker.objectName():
|
25
26
|
EquationChecker.setObjectName(u"EquationChecker")
|
27
|
+
EquationChecker.setWindowModality(Qt.WindowModality.WindowModal)
|
26
28
|
EquationChecker.resize(1213, 898)
|
27
29
|
icon = QIcon(QIcon.fromTheme(QIcon.ThemeIcon.ListRemove))
|
28
30
|
EquationChecker.setWindowIcon(icon)
|
@@ -31,56 +33,52 @@ class Ui_EquationChecker(object):
|
|
31
33
|
self.verticalLayout.setObjectName(u"verticalLayout")
|
32
34
|
self.gridLayout = QGridLayout()
|
33
35
|
self.gridLayout.setObjectName(u"gridLayout")
|
34
|
-
self.label_6 = QLabel(EquationChecker)
|
35
|
-
self.label_6.setObjectName(u"label_6")
|
36
|
-
font = QFont()
|
37
|
-
font.setPointSize(15)
|
38
|
-
self.label_6.setFont(font)
|
39
|
-
|
40
|
-
self.gridLayout.addWidget(self.label_6, 0, 3, 1, 1)
|
41
|
-
|
42
|
-
self.qNumber = QSpinBox(EquationChecker)
|
43
|
-
self.qNumber.setObjectName(u"qNumber")
|
44
|
-
self.qNumber.setMinimumSize(QSize(150, 0))
|
45
|
-
|
46
|
-
self.gridLayout.addWidget(self.qNumber, 2, 1, 1, 1)
|
47
|
-
|
48
|
-
self.lineFirstResult = QLineEdit(EquationChecker)
|
49
|
-
self.lineFirstResult.setObjectName(u"lineFirstResult")
|
50
|
-
self.lineFirstResult.setEnabled(True)
|
51
|
-
font1 = QFont()
|
52
|
-
font1.setBold(True)
|
53
|
-
self.lineFirstResult.setFont(font1)
|
54
|
-
self.lineFirstResult.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
55
|
-
self.lineFirstResult.setReadOnly(True)
|
56
|
-
|
57
|
-
self.gridLayout.addWidget(self.lineFirstResult, 1, 4, 1, 1)
|
58
|
-
|
59
36
|
self.label_2 = QLabel(EquationChecker)
|
60
37
|
self.label_2.setObjectName(u"label_2")
|
61
38
|
self.label_2.setMinimumSize(QSize(200, 0))
|
39
|
+
self.label_2.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
62
40
|
|
63
|
-
self.gridLayout.addWidget(self.label_2,
|
41
|
+
self.gridLayout.addWidget(self.label_2, 3, 0, 1, 1)
|
64
42
|
|
65
|
-
self.
|
66
|
-
self.
|
43
|
+
self.equationText = QPlainTextEdit(EquationChecker)
|
44
|
+
self.equationText.setObjectName(u"equationText")
|
45
|
+
sizePolicy = QSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum)
|
46
|
+
sizePolicy.setHorizontalStretch(0)
|
47
|
+
sizePolicy.setVerticalStretch(0)
|
48
|
+
sizePolicy.setHeightForWidth(self.equationText.sizePolicy().hasHeightForWidth())
|
49
|
+
self.equationText.setSizePolicy(sizePolicy)
|
50
|
+
self.equationText.setMinimumSize(QSize(0, 20))
|
51
|
+
self.equationText.setBaseSize(QSize(0, 20))
|
67
52
|
|
68
|
-
self.gridLayout.addWidget(self.
|
53
|
+
self.gridLayout.addWidget(self.equationText, 3, 1, 1, 1)
|
69
54
|
|
70
|
-
self.
|
71
|
-
self.
|
55
|
+
self.label_4 = QLabel(EquationChecker)
|
56
|
+
self.label_4.setObjectName(u"label_4")
|
72
57
|
|
73
|
-
self.gridLayout.addWidget(self.
|
58
|
+
self.gridLayout.addWidget(self.label_4, 4, 3, 1, 1)
|
74
59
|
|
75
|
-
self.
|
76
|
-
self.
|
77
|
-
|
60
|
+
self.lineCalculatedRes = QLineEdit(EquationChecker)
|
61
|
+
self.lineCalculatedRes.setObjectName(u"lineCalculatedRes")
|
62
|
+
font = QFont()
|
63
|
+
font.setBold(True)
|
64
|
+
self.lineCalculatedRes.setFont(font)
|
65
|
+
self.lineCalculatedRes.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
66
|
+
self.lineCalculatedRes.setReadOnly(True)
|
67
|
+
self.lineCalculatedRes.setClearButtonEnabled(False)
|
78
68
|
|
79
|
-
self.gridLayout.addWidget(self.
|
69
|
+
self.gridLayout.addWidget(self.lineCalculatedRes, 4, 4, 1, 1)
|
80
70
|
|
81
|
-
self.
|
71
|
+
self.lineCheckResult = QLineEdit(EquationChecker)
|
72
|
+
self.lineCheckResult.setObjectName(u"lineCheckResult")
|
73
|
+
font1 = QFont()
|
74
|
+
font1.setBold(True)
|
75
|
+
font1.setItalic(True)
|
76
|
+
self.lineCheckResult.setFont(font1)
|
77
|
+
self.lineCheckResult.setLayoutDirection(Qt.LayoutDirection.LeftToRight)
|
78
|
+
self.lineCheckResult.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
79
|
+
self.lineCheckResult.setReadOnly(True)
|
82
80
|
|
83
|
-
self.gridLayout.
|
81
|
+
self.gridLayout.addWidget(self.lineCheckResult, 5, 4, 1, 1)
|
84
82
|
|
85
83
|
self.buttonRunCheck = QPushButton(EquationChecker)
|
86
84
|
self.buttonRunCheck.setObjectName(u"buttonRunCheck")
|
@@ -89,7 +87,7 @@ class Ui_EquationChecker(object):
|
|
89
87
|
font2.setBold(True)
|
90
88
|
self.buttonRunCheck.setFont(font2)
|
91
89
|
|
92
|
-
self.gridLayout.addWidget(self.buttonRunCheck,
|
90
|
+
self.gridLayout.addWidget(self.buttonRunCheck, 5, 1, 1, 1)
|
93
91
|
|
94
92
|
self.label_8 = QLabel(EquationChecker)
|
95
93
|
self.label_8.setObjectName(u"label_8")
|
@@ -97,39 +95,60 @@ class Ui_EquationChecker(object):
|
|
97
95
|
font3.setPointSize(12)
|
98
96
|
self.label_8.setFont(font3)
|
99
97
|
|
100
|
-
self.gridLayout.addWidget(self.label_8,
|
98
|
+
self.gridLayout.addWidget(self.label_8, 5, 3, 1, 1)
|
101
99
|
|
102
|
-
self.
|
103
|
-
self.
|
104
|
-
font4 = QFont()
|
105
|
-
font4.setBold(True)
|
106
|
-
font4.setItalic(True)
|
107
|
-
self.lineCheckResult.setFont(font4)
|
108
|
-
self.lineCheckResult.setLayoutDirection(Qt.LayoutDirection.LeftToRight)
|
109
|
-
self.lineCheckResult.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
110
|
-
self.lineCheckResult.setReadOnly(True)
|
100
|
+
self.variableText = QTextEdit(EquationChecker)
|
101
|
+
self.variableText.setObjectName(u"variableText")
|
111
102
|
|
112
|
-
self.gridLayout.addWidget(self.
|
103
|
+
self.gridLayout.addWidget(self.variableText, 3, 3, 1, 1)
|
113
104
|
|
114
|
-
self.
|
115
|
-
self.
|
116
|
-
self.
|
117
|
-
self.lineCalculatedRes.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
118
|
-
self.lineCalculatedRes.setReadOnly(True)
|
119
|
-
self.lineCalculatedRes.setClearButtonEnabled(False)
|
105
|
+
self.label_9 = QLabel(EquationChecker)
|
106
|
+
self.label_9.setObjectName(u"label_9")
|
107
|
+
self.label_9.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
120
108
|
|
121
|
-
self.gridLayout.addWidget(self.
|
109
|
+
self.gridLayout.addWidget(self.label_9, 3, 2, 1, 1)
|
122
110
|
|
123
|
-
self.
|
124
|
-
self.
|
111
|
+
self.label_10 = QLabel(EquationChecker)
|
112
|
+
self.label_10.setObjectName(u"label_10")
|
113
|
+
|
114
|
+
self.gridLayout.addWidget(self.label_10, 2, 0, 1, 1)
|
115
|
+
|
116
|
+
self.answerPart = QSpinBox(EquationChecker)
|
117
|
+
self.answerPart.setObjectName(u"answerPart")
|
118
|
+
|
119
|
+
self.gridLayout.addWidget(self.answerPart, 2, 1, 1, 1)
|
120
|
+
|
121
|
+
self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum)
|
122
|
+
|
123
|
+
self.gridLayout.addItem(self.horizontalSpacer, 2, 2, 1, 1)
|
124
|
+
|
125
|
+
self.label_3 = QLabel(EquationChecker)
|
126
|
+
self.label_3.setObjectName(u"label_3")
|
127
|
+
|
128
|
+
self.gridLayout.addWidget(self.label_3, 2, 3, 1, 1)
|
129
|
+
|
130
|
+
self.lineFirstResult = QLineEdit(EquationChecker)
|
131
|
+
self.lineFirstResult.setObjectName(u"lineFirstResult")
|
132
|
+
self.lineFirstResult.setEnabled(True)
|
133
|
+
self.lineFirstResult.setFont(font)
|
134
|
+
self.lineFirstResult.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
135
|
+
self.lineFirstResult.setReadOnly(True)
|
136
|
+
|
137
|
+
self.gridLayout.addWidget(self.lineFirstResult, 2, 4, 1, 1)
|
125
138
|
|
126
|
-
self.
|
139
|
+
self.label_6 = QLabel(EquationChecker)
|
140
|
+
self.label_6.setObjectName(u"label_6")
|
141
|
+
font4 = QFont()
|
142
|
+
font4.setPointSize(15)
|
143
|
+
self.label_6.setFont(font4)
|
127
144
|
|
128
|
-
self.
|
129
|
-
|
130
|
-
self.
|
145
|
+
self.gridLayout.addWidget(self.label_6, 1, 3, 1, 1)
|
146
|
+
|
147
|
+
self.label_5 = QLabel(EquationChecker)
|
148
|
+
self.label_5.setObjectName(u"label_5")
|
149
|
+
self.label_5.setFont(font4)
|
131
150
|
|
132
|
-
self.gridLayout.addWidget(self.
|
151
|
+
self.gridLayout.addWidget(self.label_5, 1, 1, 1, 1)
|
133
152
|
|
134
153
|
|
135
154
|
self.verticalLayout.addLayout(self.gridLayout)
|
@@ -169,19 +188,20 @@ class Ui_EquationChecker(object):
|
|
169
188
|
|
170
189
|
def retranslateUi(self, EquationChecker):
|
171
190
|
EquationChecker.setWindowTitle(QCoreApplication.translate("EquationChecker", u"Equation Checker", None))
|
172
|
-
self.
|
191
|
+
self.label_2.setText(QCoreApplication.translate("EquationChecker", u"Equation:", None))
|
192
|
+
self.label_4.setText(QCoreApplication.translate("EquationChecker", u"calculated first Result", None))
|
193
|
+
self.lineCalculatedRes.setText(QCoreApplication.translate("EquationChecker", u"0.00", None))
|
194
|
+
self.lineCheckResult.setText("")
|
195
|
+
self.lineCheckResult.setPlaceholderText(QCoreApplication.translate("EquationChecker", u"waiting for check", None))
|
196
|
+
self.buttonRunCheck.setText(QCoreApplication.translate("EquationChecker", u"Run Check now", None))
|
197
|
+
self.label_8.setText(QCoreApplication.translate("EquationChecker", u"Check", None))
|
198
|
+
self.label_9.setText(QCoreApplication.translate("EquationChecker", u"Variables:", None))
|
199
|
+
self.label_10.setText(QCoreApplication.translate("EquationChecker", u"Answer Part (Cloze)", None))
|
200
|
+
self.label_3.setText(QCoreApplication.translate("EquationChecker", u"firstResult from spreadsheet", None))
|
173
201
|
self.lineFirstResult.setText(QCoreApplication.translate("EquationChecker", u"0.00", None))
|
174
202
|
self.lineFirstResult.setPlaceholderText(QCoreApplication.translate("EquationChecker", u"waiting", None))
|
175
|
-
self.
|
176
|
-
self.label_3.setText(QCoreApplication.translate("EquationChecker", u"firstResult from spreadsheet", None))
|
203
|
+
self.label_6.setText(QCoreApplication.translate("EquationChecker", u"Output", None))
|
177
204
|
self.label_5.setText(QCoreApplication.translate("EquationChecker", u"Input", None))
|
178
|
-
self.buttonRunCheck.setText(QCoreApplication.translate("EquationChecker", u"Run Check now", None))
|
179
|
-
self.label_8.setText(QCoreApplication.translate("EquationChecker", u"Check", None))
|
180
|
-
self.lineCheckResult.setText("")
|
181
|
-
self.lineCheckResult.setPlaceholderText(QCoreApplication.translate("EquationChecker", u"waiting for check", None))
|
182
|
-
self.lineCalculatedRes.setText(QCoreApplication.translate("EquationChecker", u"0.00", None))
|
183
|
-
self.label_4.setText(QCoreApplication.translate("EquationChecker", u"calculated first Result", None))
|
184
|
-
self.label.setText(QCoreApplication.translate("EquationChecker", u"Category Number", None))
|
185
205
|
self.label_7.setText(QCoreApplication.translate("EquationChecker", u"Calculated Values with corresponding properties", None))
|
186
206
|
# retranslateUi
|
187
207
|
|
@@ -3,7 +3,7 @@
|
|
3
3
|
################################################################################
|
4
4
|
## Form generated from reading UI file 'exportSettingsDialog.ui'
|
5
5
|
##
|
6
|
-
## Created by: Qt User Interface Compiler version 6.9.
|
6
|
+
## Created by: Qt User Interface Compiler version 6.9.1
|
7
7
|
##
|
8
8
|
## WARNING! All changes made in this file will be lost when recompiling UI file!
|
9
9
|
################################################################################
|
@@ -15,8 +15,9 @@ from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
|
|
15
15
|
QFont, QFontDatabase, QGradient, QIcon,
|
16
16
|
QImage, QKeySequence, QLinearGradient, QPainter,
|
17
17
|
QPalette, QPixmap, QRadialGradient, QTransform)
|
18
|
-
from PySide6.QtWidgets import (QAbstractButton, QApplication, QCheckBox,
|
19
|
-
|
18
|
+
from PySide6.QtWidgets import (QAbstractButton, QAbstractSpinBox, QApplication, QCheckBox,
|
19
|
+
QDialog, QDialogButtonBox, QDoubleSpinBox, QFormLayout,
|
20
|
+
QFrame, QHBoxLayout, QLabel, QPushButton,
|
20
21
|
QSizePolicy, QSpinBox, QWidget)
|
21
22
|
|
22
23
|
class Ui_ExportDialog(object):
|
@@ -49,6 +50,51 @@ class Ui_ExportDialog(object):
|
|
49
50
|
|
50
51
|
self.formLayout_2.setWidget(1, QFormLayout.ItemRole.FieldRole, self.checkBoxIncludeCategories)
|
51
52
|
|
53
|
+
self.label = QLabel(ExportDialog)
|
54
|
+
self.label.setObjectName(u"label")
|
55
|
+
|
56
|
+
self.formLayout_2.setWidget(2, QFormLayout.ItemRole.LabelRole, self.label)
|
57
|
+
|
58
|
+
self.btnExportFile = QPushButton(ExportDialog)
|
59
|
+
self.btnExportFile.setObjectName(u"btnExportFile")
|
60
|
+
self.btnExportFile.setMinimumSize(QSize(200, 0))
|
61
|
+
|
62
|
+
self.formLayout_2.setWidget(2, QFormLayout.ItemRole.FieldRole, self.btnExportFile)
|
63
|
+
|
64
|
+
self.line_2 = QFrame(ExportDialog)
|
65
|
+
self.line_2.setObjectName(u"line_2")
|
66
|
+
self.line_2.setFrameShape(QFrame.Shape.HLine)
|
67
|
+
self.line_2.setFrameShadow(QFrame.Shadow.Sunken)
|
68
|
+
|
69
|
+
self.formLayout_2.setWidget(3, QFormLayout.ItemRole.LabelRole, self.line_2)
|
70
|
+
|
71
|
+
self.label_2 = QLabel(ExportDialog)
|
72
|
+
self.label_2.setObjectName(u"label_2")
|
73
|
+
font = QFont()
|
74
|
+
font.setPointSize(12)
|
75
|
+
self.label_2.setFont(font)
|
76
|
+
|
77
|
+
self.formLayout_2.setWidget(4, QFormLayout.ItemRole.LabelRole, self.label_2)
|
78
|
+
|
79
|
+
self.questionCount = QSpinBox(ExportDialog)
|
80
|
+
self.questionCount.setObjectName(u"questionCount")
|
81
|
+
self.questionCount.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
82
|
+
self.questionCount.setButtonSymbols(QAbstractSpinBox.ButtonSymbols.NoButtons)
|
83
|
+
self.questionCount.setMaximum(999)
|
84
|
+
|
85
|
+
self.formLayout_2.setWidget(5, QFormLayout.ItemRole.LabelRole, self.questionCount)
|
86
|
+
|
87
|
+
self.pointCount = QDoubleSpinBox(ExportDialog)
|
88
|
+
self.pointCount.setObjectName(u"pointCount")
|
89
|
+
self.pointCount.setLayoutDirection(Qt.LayoutDirection.RightToLeft)
|
90
|
+
self.pointCount.setAutoFillBackground(True)
|
91
|
+
self.pointCount.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
92
|
+
self.pointCount.setButtonSymbols(QAbstractSpinBox.ButtonSymbols.NoButtons)
|
93
|
+
self.pointCount.setDecimals(1)
|
94
|
+
self.pointCount.setMaximum(1000.000000000000000)
|
95
|
+
|
96
|
+
self.formLayout_2.setWidget(5, QFormLayout.ItemRole.FieldRole, self.pointCount)
|
97
|
+
|
52
98
|
|
53
99
|
self.horizontalLayout.addLayout(self.formLayout_2)
|
54
100
|
|
@@ -73,7 +119,12 @@ class Ui_ExportDialog(object):
|
|
73
119
|
#if QT_CONFIG(tooltip)
|
74
120
|
self.label_9.setToolTip(QCoreApplication.translate("ExportDialog", u"If enabled, all questions will be categorized, when importing into moodle. Otherwise they will all be imported into one category", None))
|
75
121
|
#endif // QT_CONFIG(tooltip)
|
76
|
-
self.label_9.setText(QCoreApplication.translate("ExportDialog", u"Include
|
122
|
+
self.label_9.setText(QCoreApplication.translate("ExportDialog", u"Include Categories", None))
|
77
123
|
self.checkBoxIncludeCategories.setText("")
|
124
|
+
self.label.setText(QCoreApplication.translate("ExportDialog", u"Export File:", None))
|
125
|
+
self.btnExportFile.setText("")
|
126
|
+
self.label_2.setText(QCoreApplication.translate("ExportDialog", u"Export Information:", None))
|
127
|
+
self.questionCount.setSuffix(QCoreApplication.translate("ExportDialog", u" Qst.", None))
|
128
|
+
self.pointCount.setSuffix(QCoreApplication.translate("ExportDialog", u" Pts.", None))
|
78
129
|
# retranslateUi
|
79
130
|
|
@@ -3,7 +3,7 @@
|
|
3
3
|
################################################################################
|
4
4
|
## Form generated from reading UI file 'mainWindow.ui'
|
5
5
|
##
|
6
|
-
## Created by: Qt User Interface Compiler version 6.9.
|
6
|
+
## Created by: Qt User Interface Compiler version 6.9.1
|
7
7
|
##
|
8
8
|
## WARNING! All changes made in this file will be lost when recompiling UI file!
|
9
9
|
################################################################################
|
@@ -20,9 +20,9 @@ from PySide6.QtWidgets import (QAbstractItemView, QAbstractSpinBox, QApplication
|
|
20
20
|
QDoubleSpinBox, QFormLayout, QFrame, QGraphicsView,
|
21
21
|
QGridLayout, QHeaderView, QLabel, QLayout,
|
22
22
|
QLineEdit, QMainWindow, QMenu, QMenuBar,
|
23
|
-
QPushButton, QSizePolicy,
|
24
|
-
QTextEdit, QToolBar, QTreeWidget,
|
25
|
-
QVBoxLayout, QWidget)
|
23
|
+
QPushButton, QSizePolicy, QSpinBox, QSplitter,
|
24
|
+
QStatusBar, QTextEdit, QToolBar, QTreeWidget,
|
25
|
+
QTreeWidgetItem, QVBoxLayout, QWidget)
|
26
26
|
|
27
27
|
class Ui_MoodleTestGenerator(object):
|
28
28
|
def setupUi(self, MoodleTestGenerator):
|
@@ -78,30 +78,20 @@ class Ui_MoodleTestGenerator(object):
|
|
78
78
|
self.gridLayout = QGridLayout()
|
79
79
|
self.gridLayout.setObjectName(u"gridLayout")
|
80
80
|
self.gridLayout.setVerticalSpacing(6)
|
81
|
-
self.
|
82
|
-
self.
|
83
|
-
self.line_4.setFrameShape(QFrame.Shape.VLine)
|
84
|
-
self.line_4.setFrameShadow(QFrame.Shadow.Sunken)
|
81
|
+
self.buttonExport = QPushButton(self.layoutWidget)
|
82
|
+
self.buttonExport.setObjectName(u"buttonExport")
|
85
83
|
|
86
|
-
self.gridLayout.addWidget(self.
|
84
|
+
self.gridLayout.addWidget(self.buttonExport, 0, 2, 1, 1)
|
87
85
|
|
88
86
|
self.checkBoxQuestionListSelectAll = QCheckBox(self.layoutWidget)
|
89
87
|
self.checkBoxQuestionListSelectAll.setObjectName(u"checkBoxQuestionListSelectAll")
|
90
88
|
|
91
89
|
self.gridLayout.addWidget(self.checkBoxQuestionListSelectAll, 1, 0, 1, 1)
|
92
90
|
|
93
|
-
self.
|
94
|
-
self.
|
95
|
-
self.questionCounter.setMaximumSize(QSize(120, 16777215))
|
96
|
-
font = QFont()
|
97
|
-
font.setPointSize(13)
|
98
|
-
self.questionCounter.setFont(font)
|
99
|
-
self.questionCounter.setReadOnly(True)
|
100
|
-
self.questionCounter.setButtonSymbols(QAbstractSpinBox.ButtonSymbols.NoButtons)
|
101
|
-
self.questionCounter.setDecimals(0)
|
102
|
-
self.questionCounter.setMaximum(300.000000000000000)
|
91
|
+
self.buttonSpreadsheet = QPushButton(self.layoutWidget)
|
92
|
+
self.buttonSpreadsheet.setObjectName(u"buttonSpreadsheet")
|
103
93
|
|
104
|
-
self.gridLayout.addWidget(self.
|
94
|
+
self.gridLayout.addWidget(self.buttonSpreadsheet, 0, 0, 1, 1)
|
105
95
|
|
106
96
|
self.pointCounter = QDoubleSpinBox(self.layoutWidget)
|
107
97
|
self.pointCounter.setObjectName(u"pointCounter")
|
@@ -113,10 +103,10 @@ class Ui_MoodleTestGenerator(object):
|
|
113
103
|
self.pointCounter.setSizePolicy(sizePolicy)
|
114
104
|
self.pointCounter.setMaximumSize(QSize(120, 16777215))
|
115
105
|
self.pointCounter.setBaseSize(QSize(190, 0))
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
self.pointCounter.setFont(
|
106
|
+
font = QFont()
|
107
|
+
font.setPointSize(12)
|
108
|
+
font.setBold(False)
|
109
|
+
self.pointCounter.setFont(font)
|
120
110
|
self.pointCounter.setLayoutDirection(Qt.LayoutDirection.LeftToRight)
|
121
111
|
self.pointCounter.setAutoFillBackground(False)
|
122
112
|
self.pointCounter.setInputMethodHints(Qt.InputMethodHint.ImhNone)
|
@@ -129,15 +119,22 @@ class Ui_MoodleTestGenerator(object):
|
|
129
119
|
|
130
120
|
self.gridLayout.addWidget(self.pointCounter, 1, 2, 1, 1)
|
131
121
|
|
132
|
-
self.
|
133
|
-
self.
|
122
|
+
self.line_4 = QFrame(self.layoutWidget)
|
123
|
+
self.line_4.setObjectName(u"line_4")
|
124
|
+
self.line_4.setFrameShape(QFrame.Shape.VLine)
|
125
|
+
self.line_4.setFrameShadow(QFrame.Shadow.Sunken)
|
134
126
|
|
135
|
-
self.gridLayout.addWidget(self.
|
127
|
+
self.gridLayout.addWidget(self.line_4, 1, 3, 1, 1)
|
136
128
|
|
137
|
-
self.
|
138
|
-
self.
|
129
|
+
self.questionCounter = QSpinBox(self.layoutWidget)
|
130
|
+
self.questionCounter.setObjectName(u"questionCounter")
|
131
|
+
self.questionCounter.setMaximumSize(QSize(120, 16777215))
|
132
|
+
font1 = QFont()
|
133
|
+
font1.setPointSize(12)
|
134
|
+
self.questionCounter.setFont(font1)
|
135
|
+
self.questionCounter.setButtonSymbols(QAbstractSpinBox.ButtonSymbols.NoButtons)
|
139
136
|
|
140
|
-
self.gridLayout.addWidget(self.
|
137
|
+
self.gridLayout.addWidget(self.questionCounter, 1, 1, 1, 1)
|
141
138
|
|
142
139
|
|
143
140
|
self.verticalLayout_4.addLayout(self.gridLayout)
|
@@ -335,22 +332,18 @@ class Ui_MoodleTestGenerator(object):
|
|
335
332
|
#if QT_CONFIG(shortcut)
|
336
333
|
self.actionDocumentation.setShortcut(QCoreApplication.translate("MoodleTestGenerator", u"F1", None))
|
337
334
|
#endif // QT_CONFIG(shortcut)
|
338
|
-
self.checkBoxQuestionListSelectAll.setText(QCoreApplication.translate("MoodleTestGenerator", u"Select all", None))
|
339
335
|
#if QT_CONFIG(tooltip)
|
340
|
-
self.
|
336
|
+
self.buttonExport.setToolTip(QCoreApplication.translate("MoodleTestGenerator", u"Export the selected questions to a xml file", None))
|
341
337
|
#endif // QT_CONFIG(tooltip)
|
342
|
-
self.
|
343
|
-
self.
|
338
|
+
self.buttonExport.setText(QCoreApplication.translate("MoodleTestGenerator", u"Export", None))
|
339
|
+
self.checkBoxQuestionListSelectAll.setText(QCoreApplication.translate("MoodleTestGenerator", u"Select all", None))
|
340
|
+
self.buttonSpreadsheet.setText(QCoreApplication.translate("MoodleTestGenerator", u"Open Spreadsheet", None))
|
344
341
|
#if QT_CONFIG(tooltip)
|
345
342
|
self.pointCounter.setToolTip(QCoreApplication.translate("MoodleTestGenerator", u"The total number of points of all selected questions.", None))
|
346
343
|
#endif // QT_CONFIG(tooltip)
|
347
344
|
self.pointCounter.setPrefix("")
|
348
345
|
self.pointCounter.setSuffix(QCoreApplication.translate("MoodleTestGenerator", u" Pts.", None))
|
349
|
-
self.
|
350
|
-
#if QT_CONFIG(tooltip)
|
351
|
-
self.buttonExport.setToolTip(QCoreApplication.translate("MoodleTestGenerator", u"Export the selected questions to a xml file", None))
|
352
|
-
#endif // QT_CONFIG(tooltip)
|
353
|
-
self.buttonExport.setText(QCoreApplication.translate("MoodleTestGenerator", u"Export", None))
|
346
|
+
self.questionCounter.setSuffix(QCoreApplication.translate("MoodleTestGenerator", u" Qst.", None))
|
354
347
|
___qtreewidgetitem = self.treeWidget.headerItem()
|
355
348
|
___qtreewidgetitem.setText(3, QCoreApplication.translate("MoodleTestGenerator", u"Variants", None));
|
356
349
|
___qtreewidgetitem.setText(2, QCoreApplication.translate("MoodleTestGenerator", u"Points", None));
|
excel2moodle/ui/appUi.py
CHANGED
@@ -13,15 +13,15 @@ from PySide6.QtCore import QRunnable, Qt, QThreadPool
|
|
13
13
|
from excel2moodle import mainLogger
|
14
14
|
from excel2moodle.core.category import Category
|
15
15
|
from excel2moodle.core.dataStructure import QuestionDB
|
16
|
-
from excel2moodle.core.settings import Settings,
|
17
|
-
from excel2moodle.extra import equationVerification as eqVerif
|
16
|
+
from excel2moodle.core.settings import Settings, Tags
|
18
17
|
from excel2moodle.logger import LogWindowHandler
|
18
|
+
from excel2moodle.question_types.mc import MCQuestion
|
19
|
+
from excel2moodle.question_types.nf import NFQuestion
|
19
20
|
from excel2moodle.ui import dialogs
|
21
|
+
from excel2moodle.ui.equationChecker import EqCheckerWindow
|
20
22
|
from excel2moodle.ui.treewidget import CategoryItem, QuestionItem
|
23
|
+
from excel2moodle.ui.UI_mainWindow import Ui_MoodleTestGenerator
|
21
24
|
from excel2moodle.ui.windowDoc import DocumentationWindow
|
22
|
-
from excel2moodle.ui.windowMain import Ui_MoodleTestGenerator
|
23
|
-
|
24
|
-
from .windowEquationChecker import Ui_EquationChecker
|
25
25
|
|
26
26
|
logger = logging.getLogger(__name__)
|
27
27
|
|
@@ -41,6 +41,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
41
41
|
self.ui.setupUi(self)
|
42
42
|
self.exportDialog = dialogs.ExportDialog(self)
|
43
43
|
self.questionPreview = dialogs.QuestionPreview(self)
|
44
|
+
self.eqChecker = EqCheckerWindow()
|
44
45
|
self.connectEvents()
|
45
46
|
logger.info("Settings are stored under: %s", self.settings.fileName())
|
46
47
|
self.ui.treeWidget.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection)
|
@@ -48,10 +49,10 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
48
49
|
QtWidgets.QHeaderView.ResizeToContents,
|
49
50
|
)
|
50
51
|
self.exportDialog.ui.checkBoxIncludeCategories.setChecked(
|
51
|
-
self.settings.get(
|
52
|
+
self.settings.get(Tags.INCLUDEINCATS),
|
52
53
|
)
|
53
54
|
self.exportDialog.ui.spinBoxDefaultQVariant.setValue(
|
54
|
-
self.settings.get(
|
55
|
+
self.settings.get(Tags.QUESTIONVARIANT)
|
55
56
|
)
|
56
57
|
self.ui.pointCounter.setReadOnly(True)
|
57
58
|
self.ui.questionCounter.setReadOnly(True)
|
@@ -91,7 +92,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
91
92
|
|
92
93
|
@QtCore.Slot()
|
93
94
|
def setQVariantDefault(self, value: int) -> None:
|
94
|
-
self.settings.set(
|
95
|
+
self.settings.set(Tags.QUESTIONVARIANT, value)
|
95
96
|
|
96
97
|
@QtCore.Slot()
|
97
98
|
def parseSpreadsheetAll(self) -> None:
|
@@ -110,9 +111,9 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
110
111
|
logger.debug("Slot, new Spreadsheet triggered")
|
111
112
|
self.spreadSheetPath = sheet
|
112
113
|
self.mainPath = sheet.parent
|
113
|
-
svgFolder = self.mainPath / self.settings.get(
|
114
|
+
svgFolder = self.mainPath / self.settings.get(Tags.PICTURESUBFOLDER)
|
114
115
|
svgFolder.resolve()
|
115
|
-
self.settings.set(
|
116
|
+
self.settings.set(Tags.PICTUREFOLDER, svgFolder)
|
116
117
|
self.ui.buttonSpreadsheet.setText(f"../{sheet.name}")
|
117
118
|
self.parseSpreadsheetAll()
|
118
119
|
|
@@ -121,9 +122,9 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
121
122
|
|
122
123
|
def setIncludeCategoriesSetting(self) -> None:
|
123
124
|
if self.exportDialog.ui.checkBoxIncludeCategories.isChecked():
|
124
|
-
self.settings.set(
|
125
|
+
self.settings.set(Tags.INCLUDEINCATS, True)
|
125
126
|
else:
|
126
|
-
self.settings.set(
|
127
|
+
self.settings.set(Tags.INCLUDEINCATS, False)
|
127
128
|
|
128
129
|
def closeEvent(self, event) -> None:
|
129
130
|
self.settings.setValue("windowSize", self.size())
|
@@ -140,6 +141,8 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
140
141
|
count += q.getQuestion().points
|
141
142
|
self.ui.pointCounter.setValue(count)
|
142
143
|
self.ui.questionCounter.setValue(questions)
|
144
|
+
if self.eqChecker.isVisible():
|
145
|
+
self.openEqCheckerDlg()
|
143
146
|
|
144
147
|
@QtCore.Slot()
|
145
148
|
def toggleQuestionSelectionState(self, state) -> None:
|
@@ -154,17 +157,16 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
154
157
|
@QtCore.Slot()
|
155
158
|
def onButGenTest(self) -> None:
|
156
159
|
"""Open a file Dialog so the export file may be choosen."""
|
157
|
-
self.exportDialog.exec()
|
158
|
-
path = QtWidgets.QFileDialog.getSaveFileName(
|
159
|
-
self,
|
160
|
-
"Select Output File",
|
161
|
-
dir=f"{self.mainPath / 'Testfile.xml'}",
|
162
|
-
filter="xml Files (*.xml)",
|
163
|
-
)
|
164
|
-
self.exportFile = Path(path[0])
|
165
|
-
logger.info("New Export File is set %s", self.exportFile)
|
166
160
|
selection: list[QuestionItem] = self.ui.treeWidget.selectedItems()
|
167
|
-
self.
|
161
|
+
self.exportDialog.exportFile = Path(self.mainPath / "TestFile.xml")
|
162
|
+
self.exportDialog.ui.questionCount.setValue(self.ui.questionCounter.value())
|
163
|
+
self.exportDialog.ui.pointCount.setValue(self.ui.pointCounter.value())
|
164
|
+
if self.exportDialog.exec():
|
165
|
+
self.exportFile = self.exportDialog.exportFile
|
166
|
+
logger.info("New Export File is set %s", self.exportFile)
|
167
|
+
self.testDB.appendQuestions(selection, self.exportFile)
|
168
|
+
else:
|
169
|
+
logger.info("Aborting Export")
|
168
170
|
|
169
171
|
@QtCore.Slot()
|
170
172
|
def actionSpreadsheet(self) -> None:
|
@@ -206,10 +208,17 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
206
208
|
|
207
209
|
@QtCore.Slot()
|
208
210
|
def openEqCheckerDlg(self) -> None:
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
211
|
+
item = self.ui.treeWidget.currentItem()
|
212
|
+
if isinstance(item, QuestionItem):
|
213
|
+
question = item.getQuestion()
|
214
|
+
if isinstance(question, (NFQuestion, MCQuestion)):
|
215
|
+
logger.debug("Can't check an MC or NF Question")
|
216
|
+
else:
|
217
|
+
logger.debug("opening wEquationChecker \n")
|
218
|
+
self.eqChecker.setup(item.getQuestion())
|
219
|
+
self.eqChecker.show()
|
220
|
+
else:
|
221
|
+
logger.debug("No Question Item selected: %s", type(item))
|
213
222
|
|
214
223
|
@QtCore.Slot()
|
215
224
|
def openAboutDlg(self) -> None:
|
@@ -242,43 +251,3 @@ class ParseAllThread(QRunnable):
|
|
242
251
|
self.testDB.asyncInitAllCategories(self.mainApp.spreadSheetPath)
|
243
252
|
self.mainApp.setStatus("[OK] Tabellen wurde eingelesen")
|
244
253
|
self.testDB.parseAllQuestions()
|
245
|
-
|
246
|
-
|
247
|
-
class EqCheckerWindow(QtWidgets.QWidget):
|
248
|
-
def __init__(self) -> None:
|
249
|
-
super().__init__()
|
250
|
-
self.excelFile = Path()
|
251
|
-
self.ui = Ui_EquationChecker()
|
252
|
-
self.ui.setupUi(self)
|
253
|
-
self.ui.buttonRunCheck.clicked.connect(
|
254
|
-
lambda: self.onButRunCheck(
|
255
|
-
self.ui.catNumber.value(),
|
256
|
-
self.ui.qNumber.value(),
|
257
|
-
),
|
258
|
-
)
|
259
|
-
|
260
|
-
def onButRunCheck(self, catN: int, qN: int) -> None:
|
261
|
-
"""Is Triggered by the ``Run Check now`` Button and runs the Equation Check."""
|
262
|
-
self.ui.textResultsOutput.clear()
|
263
|
-
bullets, results, firstResult = eqVerif.equationChecker(
|
264
|
-
f"KAT_{catN}",
|
265
|
-
qN,
|
266
|
-
self.excelFile,
|
267
|
-
)
|
268
|
-
check = False
|
269
|
-
self.ui.lineFirstResult.setText(f"{firstResult}")
|
270
|
-
for i, calculation in enumerate(results):
|
271
|
-
if i == 0 and firstResult != 0:
|
272
|
-
check = eqVerif.checkResult(firstResult, calculation)
|
273
|
-
self.ui.lineCalculatedRes.setText(f"{calculation}")
|
274
|
-
self.ui.textResultsOutput.append(
|
275
|
-
f"Ergebnis {i + 1}: \t{calculation}\n\tMit den Werten: \n{bullets[i]}\n",
|
276
|
-
)
|
277
|
-
|
278
|
-
if check:
|
279
|
-
self.ui.lineCheckResult.setText("[OK]")
|
280
|
-
logger.info(
|
281
|
-
"Das erste berechnete Ergebnis stimmt mit dem Wert in 'firstResult' überein\n",
|
282
|
-
)
|
283
|
-
else:
|
284
|
-
self.ui.lineCheckResult.setText("[ERROR]")
|