excel2moodle 0.5.2__py3-none-any.whl → 0.6.1__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 +3 -2
- excel2moodle/core/bullets.py +98 -0
- excel2moodle/core/dataStructure.py +3 -4
- excel2moodle/core/globals.py +3 -8
- excel2moodle/core/parser.py +37 -65
- excel2moodle/core/question.py +144 -76
- excel2moodle/extra/variableGenerator.py +250 -0
- excel2moodle/question_types/cloze.py +156 -125
- excel2moodle/question_types/nfm.py +38 -100
- excel2moodle/ui/UI_mainWindow.py +63 -36
- excel2moodle/ui/UI_variableGenerator.py +197 -0
- excel2moodle/ui/appUi.py +90 -23
- excel2moodle/ui/dialogs.py +44 -77
- excel2moodle/ui/equationChecker.py +2 -2
- excel2moodle/ui/treewidget.py +9 -24
- {excel2moodle-0.5.2.dist-info → excel2moodle-0.6.1.dist-info}/METADATA +34 -2
- {excel2moodle-0.5.2.dist-info → excel2moodle-0.6.1.dist-info}/RECORD +21 -20
- excel2moodle/core/numericMultiQ.py +0 -80
- excel2moodle/ui/windowDoc.py +0 -27
- {excel2moodle-0.5.2.dist-info → excel2moodle-0.6.1.dist-info}/WHEEL +0 -0
- {excel2moodle-0.5.2.dist-info → excel2moodle-0.6.1.dist-info}/entry_points.txt +0 -0
- {excel2moodle-0.5.2.dist-info → excel2moodle-0.6.1.dist-info}/licenses/LICENSE +0 -0
- {excel2moodle-0.5.2.dist-info → excel2moodle-0.6.1.dist-info}/top_level.txt +0 -0
@@ -1,23 +1,16 @@
|
|
1
1
|
"""Numerical question multi implementation."""
|
2
2
|
|
3
|
-
import math
|
4
|
-
import re
|
5
3
|
from types import UnionType
|
6
|
-
from typing import
|
4
|
+
from typing import ClassVar
|
7
5
|
|
8
|
-
|
6
|
+
import lxml.etree as ET
|
9
7
|
|
10
|
-
from excel2moodle.core import stringHelpers
|
11
|
-
from excel2moodle.core.exceptions import QNotParsedException
|
12
8
|
from excel2moodle.core.globals import (
|
13
9
|
Tags,
|
14
10
|
XMLTags,
|
15
11
|
)
|
16
12
|
from excel2moodle.core.parser import QuestionParser
|
17
|
-
from excel2moodle.core.question import ParametricQuestion
|
18
|
-
|
19
|
-
if TYPE_CHECKING:
|
20
|
-
import lxml.etree as ET
|
13
|
+
from excel2moodle.core.question import ParametricQuestion, Parametrics
|
21
14
|
|
22
15
|
|
23
16
|
class NFMQuestion(ParametricQuestion):
|
@@ -28,19 +21,23 @@ class NFMQuestion(ParametricQuestion):
|
|
28
21
|
|
29
22
|
def __init__(self, *args, **kwargs) -> None:
|
30
23
|
super().__init__(*args, **kwargs)
|
31
|
-
self.
|
24
|
+
self.answerElement: ET.Element
|
25
|
+
|
26
|
+
def getUpdatedElement(self, variant: int = 1) -> ET.Element:
|
27
|
+
"""Update and get the Question Elements to reflect the version.
|
32
28
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
self.
|
29
|
+
`NFMQuestion` updates the answer Elements.
|
30
|
+
`ParametricQuestion` updates the bullet points.
|
31
|
+
`Question` returns the Element.
|
32
|
+
"""
|
33
|
+
result = self.parametrics.getResult(variant)
|
34
|
+
tolerance = round(self.rawData.get(Tags.TOLERANCE) * result, 3)
|
35
|
+
self.answerElement.find(XMLTags.TEXT).text = str(result)
|
36
|
+
self.answerElement.find(XMLTags.TOLERANCE).text = str(tolerance)
|
37
|
+
return super().getUpdatedElement(variant)
|
39
38
|
|
40
39
|
|
41
40
|
class NFMQuestionParser(QuestionParser):
|
42
|
-
astEval = Interpreter(with_import=True)
|
43
|
-
|
44
41
|
def __init__(self) -> None:
|
45
42
|
super().__init__()
|
46
43
|
self.genFeedbacks = [XMLTags.GENFEEDB]
|
@@ -50,86 +47,27 @@ class NFMQuestionParser(QuestionParser):
|
|
50
47
|
self.question: NFMQuestion = question
|
51
48
|
super().setup(question)
|
52
49
|
module = self.settings.get(Tags.IMPORTMODULE)
|
53
|
-
if module and
|
54
|
-
|
55
|
-
imported =
|
50
|
+
if module and Parametrics.astEval.symtable.get(module, None) is None:
|
51
|
+
Parametrics.astEval(f"import {module}")
|
52
|
+
imported = Parametrics.astEval.symtable.get(module)
|
56
53
|
self.logger.warning("Imported '%s' to Asteval symtable.", module)
|
57
54
|
|
58
|
-
def _parseAnswers(self) ->
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
)
|
78
|
-
else:
|
79
|
-
msg = f"The expression {equation} could not be evaluated."
|
80
|
-
raise QNotParsedException(msg, self.question.id)
|
81
|
-
self.question.answerVariants = ansElementsList
|
82
|
-
self._setVariants(len(ansElementsList))
|
83
|
-
|
84
|
-
def _setVariants(self, number: int) -> None:
|
85
|
-
self.question.variants = number
|
86
|
-
mvar = self.question.category.maxVariants
|
87
|
-
if mvar is None:
|
88
|
-
self.question.category.maxVariants = number
|
89
|
-
else:
|
90
|
-
self.question.category.maxVariants = min(number, mvar)
|
91
|
-
|
92
|
-
@classmethod
|
93
|
-
def setupAstIntprt(cls, var: dict[str, list[float | int]], index: int) -> None:
|
94
|
-
"""Setup the asteval Interpreter with the variables."""
|
95
|
-
for name, value in var.items():
|
96
|
-
cls.astEval.symtable[name] = value[index]
|
97
|
-
|
98
|
-
def _getVariablesDict(self, keyList: list) -> tuple[dict[str, list[float]], int]:
|
99
|
-
"""Read variabel values for vars in `keyList` from `question.rawData`.
|
100
|
-
|
101
|
-
Returns
|
102
|
-
-------
|
103
|
-
A dictionary containing a list of values for each variable
|
104
|
-
The number of values for each variable
|
105
|
-
|
106
|
-
"""
|
107
|
-
dic: dict = {}
|
108
|
-
num: int = 0
|
109
|
-
for k in keyList:
|
110
|
-
val = self.rawInput[k.lower()]
|
111
|
-
if isinstance(val, str):
|
112
|
-
li = stringHelpers.getListFromStr(val)
|
113
|
-
num = len(li)
|
114
|
-
variables: list[float] = [float(i.replace(",", ".")) for i in li]
|
115
|
-
dic[str(k)] = variables
|
116
|
-
else:
|
117
|
-
dic[str(k)] = [str(val)]
|
118
|
-
num = 1
|
119
|
-
self.logger.debug("The following variables were provided: %s", dic)
|
120
|
-
return dic, num
|
121
|
-
|
122
|
-
@staticmethod
|
123
|
-
def _getVarsList(bps: str | list[str]) -> list:
|
124
|
-
"""Durchsucht den bulletPoints String nach den Variablen ``{var}``.
|
125
|
-
|
126
|
-
It only finds variables after the ``=`` sign, to not catch LaTex.
|
127
|
-
"""
|
128
|
-
varNames = []
|
129
|
-
regexFinder = re.compile(r"=\s*\{(\w+)\}")
|
130
|
-
if isinstance(bps, list):
|
131
|
-
for _p in bps:
|
132
|
-
varNames.extend(regexFinder.findall(str(_p)))
|
133
|
-
else:
|
134
|
-
varNames = regexFinder.findall(str(bps))
|
135
|
-
return varNames
|
55
|
+
def _parseAnswers(self) -> list[ET.Element]:
|
56
|
+
variables = self.question.bulletList.getVariablesDict(self.question)
|
57
|
+
self.question.parametrics = Parametrics(
|
58
|
+
self.rawInput.get(Tags.EQUATION),
|
59
|
+
self.rawInput.get(Tags.FIRSTRESULT),
|
60
|
+
self.question.id,
|
61
|
+
)
|
62
|
+
self.question.parametrics.variables = variables
|
63
|
+
self.question.answerElement = self.getNumericAnsElement()
|
64
|
+
return [self.question.answerElement]
|
65
|
+
|
66
|
+
# TODO: @jbosse3: Implement a new _setVariants() method, to show in treewidget
|
67
|
+
# def _setVariants(self, number: int) -> None:
|
68
|
+
# self.question.variants = number
|
69
|
+
# mvar = self.question.category.maxVariants
|
70
|
+
# if mvar is None:
|
71
|
+
# self.question.category.maxVariants = number
|
72
|
+
# else:
|
73
|
+
# self.question.category.maxVariants = min(number, mvar)
|
excel2moodle/ui/UI_mainWindow.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
|
3
3
|
################################################################################
|
4
|
-
## Form generated from reading UI file '
|
4
|
+
## Form generated from reading UI file 'UI_mainWindow.ui'
|
5
5
|
##
|
6
6
|
## Created by: Qt User Interface Compiler version 6.9.1
|
7
7
|
##
|
@@ -16,13 +16,14 @@ from PySide6.QtGui import (QAction, QBrush, QColor, QConicalGradient,
|
|
16
16
|
QIcon, QImage, QKeySequence, QLinearGradient,
|
17
17
|
QPainter, QPalette, QPixmap, QRadialGradient,
|
18
18
|
QTransform)
|
19
|
-
from PySide6.QtWidgets import (QAbstractItemView, QAbstractSpinBox, QApplication,
|
20
|
-
QDoubleSpinBox, QFormLayout, QFrame,
|
19
|
+
from PySide6.QtWidgets import (QAbstractItemView, QAbstractScrollArea, QAbstractSpinBox, QApplication,
|
20
|
+
QCheckBox, QDoubleSpinBox, QFormLayout, QFrame,
|
21
21
|
QGridLayout, QHeaderView, QLabel, QLayout,
|
22
22
|
QLineEdit, QMainWindow, QMenu, QMenuBar,
|
23
23
|
QPushButton, QSizePolicy, QSpinBox, QSplitter,
|
24
|
-
QStatusBar,
|
25
|
-
QTreeWidgetItem, QVBoxLayout,
|
24
|
+
QStatusBar, QTableWidget, QTableWidgetItem, QTextEdit,
|
25
|
+
QToolBar, QTreeWidget, QTreeWidgetItem, QVBoxLayout,
|
26
|
+
QWidget)
|
26
27
|
|
27
28
|
class Ui_MoodleTestGenerator(object):
|
28
29
|
def setupUi(self, MoodleTestGenerator):
|
@@ -49,7 +50,7 @@ class Ui_MoodleTestGenerator(object):
|
|
49
50
|
self.actionSetting.setIcon(icon4)
|
50
51
|
self.actionExport = QAction(MoodleTestGenerator)
|
51
52
|
self.actionExport.setObjectName(u"actionExport")
|
52
|
-
icon5 = QIcon(QIcon.fromTheme(QIcon.ThemeIcon.
|
53
|
+
icon5 = QIcon(QIcon.fromTheme(QIcon.ThemeIcon.DocumentSave))
|
53
54
|
self.actionExport.setIcon(icon5)
|
54
55
|
self.actionAbout = QAction(MoodleTestGenerator)
|
55
56
|
self.actionAbout.setObjectName(u"actionAbout")
|
@@ -58,6 +59,18 @@ class Ui_MoodleTestGenerator(object):
|
|
58
59
|
self.actionDocumentation = QAction(MoodleTestGenerator)
|
59
60
|
self.actionDocumentation.setObjectName(u"actionDocumentation")
|
60
61
|
self.actionDocumentation.setIcon(icon6)
|
62
|
+
self.actionGenerateVariables = QAction(MoodleTestGenerator)
|
63
|
+
self.actionGenerateVariables.setObjectName(u"actionGenerateVariables")
|
64
|
+
icon7 = QIcon(QIcon.fromTheme(u"applications-development"))
|
65
|
+
self.actionGenerateVariables.setIcon(icon7)
|
66
|
+
self.actionCopyVariables = QAction(MoodleTestGenerator)
|
67
|
+
self.actionCopyVariables.setObjectName(u"actionCopyVariables")
|
68
|
+
icon8 = QIcon(QIcon.fromTheme(u"edit-copy"))
|
69
|
+
self.actionCopyVariables.setIcon(icon8)
|
70
|
+
self.actionOpenSpreadsheetExternal = QAction(MoodleTestGenerator)
|
71
|
+
self.actionOpenSpreadsheetExternal.setObjectName(u"actionOpenSpreadsheetExternal")
|
72
|
+
icon9 = QIcon(QIcon.fromTheme(u"mail-forward"))
|
73
|
+
self.actionOpenSpreadsheetExternal.setIcon(icon9)
|
61
74
|
self.mainWidget = QWidget(MoodleTestGenerator)
|
62
75
|
self.mainWidget.setObjectName(u"mainWidget")
|
63
76
|
self.verticalLayout_3 = QVBoxLayout(self.mainWidget)
|
@@ -190,13 +203,6 @@ class Ui_MoodleTestGenerator(object):
|
|
190
203
|
|
191
204
|
self.verticalLayout_2.addLayout(self.formLayout_3)
|
192
205
|
|
193
|
-
self.questionText = QLabel(self.layoutWidget1)
|
194
|
-
self.questionText.setObjectName(u"questionText")
|
195
|
-
self.questionText.setWordWrap(True)
|
196
|
-
self.questionText.setMargin(10)
|
197
|
-
|
198
|
-
self.verticalLayout_2.addWidget(self.questionText)
|
199
|
-
|
200
206
|
self.line_6 = QFrame(self.layoutWidget1)
|
201
207
|
self.line_6.setObjectName(u"line_6")
|
202
208
|
self.line_6.setFrameShape(QFrame.Shape.HLine)
|
@@ -204,19 +210,25 @@ class Ui_MoodleTestGenerator(object):
|
|
204
210
|
|
205
211
|
self.verticalLayout_2.addWidget(self.line_6)
|
206
212
|
|
207
|
-
self.
|
208
|
-
self.
|
209
|
-
self.answersLabel.setMargin(10)
|
213
|
+
self.previewTextEdit = QTextEdit(self.layoutWidget1)
|
214
|
+
self.previewTextEdit.setObjectName(u"previewTextEdit")
|
210
215
|
|
211
|
-
self.verticalLayout_2.addWidget(self.
|
216
|
+
self.verticalLayout_2.addWidget(self.previewTextEdit)
|
212
217
|
|
213
|
-
self.
|
214
|
-
self.
|
215
|
-
|
216
|
-
|
217
|
-
self.
|
218
|
+
self.tableVariables = QTableWidget(self.layoutWidget1)
|
219
|
+
if (self.tableVariables.columnCount() < 1):
|
220
|
+
self.tableVariables.setColumnCount(1)
|
221
|
+
__qtablewidgetitem = QTableWidgetItem()
|
222
|
+
self.tableVariables.setHorizontalHeaderItem(0, __qtablewidgetitem)
|
223
|
+
self.tableVariables.setObjectName(u"tableVariables")
|
224
|
+
sizePolicy1 = QSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum)
|
225
|
+
sizePolicy1.setHorizontalStretch(0)
|
226
|
+
sizePolicy1.setVerticalStretch(0)
|
227
|
+
sizePolicy1.setHeightForWidth(self.tableVariables.sizePolicy().hasHeightForWidth())
|
228
|
+
self.tableVariables.setSizePolicy(sizePolicy1)
|
229
|
+
self.tableVariables.setSizeAdjustPolicy(QAbstractScrollArea.SizeAdjustPolicy.AdjustToContents)
|
218
230
|
|
219
|
-
self.verticalLayout_2.addWidget(self.
|
231
|
+
self.verticalLayout_2.addWidget(self.tableVariables)
|
220
232
|
|
221
233
|
self.splitter.addWidget(self.layoutWidget1)
|
222
234
|
self.splitter_2.addWidget(self.splitter)
|
@@ -228,11 +240,11 @@ class Ui_MoodleTestGenerator(object):
|
|
228
240
|
self.verticalLayout.setContentsMargins(0, 3, 0, 0)
|
229
241
|
self.label_4 = QLabel(self.layoutWidget2)
|
230
242
|
self.label_4.setObjectName(u"label_4")
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
self.label_4.setSizePolicy(
|
243
|
+
sizePolicy2 = QSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Minimum)
|
244
|
+
sizePolicy2.setHorizontalStretch(0)
|
245
|
+
sizePolicy2.setVerticalStretch(0)
|
246
|
+
sizePolicy2.setHeightForWidth(self.label_4.sizePolicy().hasHeightForWidth())
|
247
|
+
self.label_4.setSizePolicy(sizePolicy2)
|
236
248
|
self.label_4.setMinimumSize(QSize(0, 20))
|
237
249
|
self.label_4.setMaximumSize(QSize(16777215, 20))
|
238
250
|
self.label_4.setBaseSize(QSize(0, 20))
|
@@ -243,11 +255,11 @@ class Ui_MoodleTestGenerator(object):
|
|
243
255
|
self.loggerWindow = QTextEdit(self.layoutWidget2)
|
244
256
|
self.loggerWindow.setObjectName(u"loggerWindow")
|
245
257
|
self.loggerWindow.setEnabled(True)
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
self.loggerWindow.setSizePolicy(
|
258
|
+
sizePolicy3 = QSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
|
259
|
+
sizePolicy3.setHorizontalStretch(0)
|
260
|
+
sizePolicy3.setVerticalStretch(0)
|
261
|
+
sizePolicy3.setHeightForWidth(self.loggerWindow.sizePolicy().hasHeightForWidth())
|
262
|
+
self.loggerWindow.setSizePolicy(sizePolicy3)
|
251
263
|
self.loggerWindow.setMinimumSize(QSize(0, 0))
|
252
264
|
self.loggerWindow.setMaximumSize(QSize(16777215, 800))
|
253
265
|
self.loggerWindow.setBaseSize(QSize(0, 29))
|
@@ -285,9 +297,12 @@ class Ui_MoodleTestGenerator(object):
|
|
285
297
|
self.menubar.addAction(self.menuHelp.menuAction())
|
286
298
|
self.menuFile.addAction(self.actionExport)
|
287
299
|
self.menuFile.addAction(self.actionSpreadsheet)
|
300
|
+
self.menuFile.addAction(self.actionOpenSpreadsheetExternal)
|
288
301
|
self.menuTools.addAction(self.actionParseAll)
|
289
302
|
self.menuTools.addAction(self.actionEquationChecker)
|
290
303
|
self.menuTools.addAction(self.actionSetting)
|
304
|
+
self.menuTools.addAction(self.actionGenerateVariables)
|
305
|
+
self.menuTools.addAction(self.actionCopyVariables)
|
291
306
|
self.menuHelp.addAction(self.actionAbout)
|
292
307
|
self.menuHelp.addAction(self.actionDocumentation)
|
293
308
|
self.toolBar_3.addAction(self.actionEquationChecker)
|
@@ -304,7 +319,7 @@ class Ui_MoodleTestGenerator(object):
|
|
304
319
|
|
305
320
|
def retranslateUi(self, MoodleTestGenerator):
|
306
321
|
MoodleTestGenerator.setWindowTitle(QCoreApplication.translate("MoodleTestGenerator", u"excel 2 moodle", None))
|
307
|
-
self.actionSpreadsheet.setText(QCoreApplication.translate("MoodleTestGenerator", u"&
|
322
|
+
self.actionSpreadsheet.setText(QCoreApplication.translate("MoodleTestGenerator", u"&Import spreadsheet", None))
|
308
323
|
#if QT_CONFIG(tooltip)
|
309
324
|
self.actionSpreadsheet.setToolTip(QCoreApplication.translate("MoodleTestGenerator", u"Open the question spreadsheet", None))
|
310
325
|
#endif // QT_CONFIG(tooltip)
|
@@ -332,6 +347,18 @@ class Ui_MoodleTestGenerator(object):
|
|
332
347
|
#if QT_CONFIG(shortcut)
|
333
348
|
self.actionDocumentation.setShortcut(QCoreApplication.translate("MoodleTestGenerator", u"F1", None))
|
334
349
|
#endif // QT_CONFIG(shortcut)
|
350
|
+
self.actionGenerateVariables.setText(QCoreApplication.translate("MoodleTestGenerator", u"Variable Generator", None))
|
351
|
+
#if QT_CONFIG(tooltip)
|
352
|
+
self.actionGenerateVariables.setToolTip(QCoreApplication.translate("MoodleTestGenerator", u"Generate new variables for the question.", None))
|
353
|
+
#endif // QT_CONFIG(tooltip)
|
354
|
+
self.actionCopyVariables.setText(QCoreApplication.translate("MoodleTestGenerator", u"Copy Variables", None))
|
355
|
+
#if QT_CONFIG(tooltip)
|
356
|
+
self.actionCopyVariables.setToolTip(QCoreApplication.translate("MoodleTestGenerator", u"Copy the variables of the question to the clipboard", None))
|
357
|
+
#endif // QT_CONFIG(tooltip)
|
358
|
+
self.actionOpenSpreadsheetExternal.setText(QCoreApplication.translate("MoodleTestGenerator", u"Open spreadsheet in external app", None))
|
359
|
+
#if QT_CONFIG(tooltip)
|
360
|
+
self.actionOpenSpreadsheetExternal.setToolTip(QCoreApplication.translate("MoodleTestGenerator", u"Open the imported spreadsheet in external application such as LibreOffice Calc", None))
|
361
|
+
#endif // QT_CONFIG(tooltip)
|
335
362
|
#if QT_CONFIG(tooltip)
|
336
363
|
self.buttonExport.setToolTip(QCoreApplication.translate("MoodleTestGenerator", u"Export the selected questions to a xml file", None))
|
337
364
|
#endif // QT_CONFIG(tooltip)
|
@@ -351,8 +378,8 @@ class Ui_MoodleTestGenerator(object):
|
|
351
378
|
___qtreewidgetitem.setText(0, QCoreApplication.translate("MoodleTestGenerator", u"Question ID", None));
|
352
379
|
self.label.setText(QCoreApplication.translate("MoodleTestGenerator", u"Question Preview", None))
|
353
380
|
self.questionNameLabel.setText(QCoreApplication.translate("MoodleTestGenerator", u"Question:", None))
|
354
|
-
self.
|
355
|
-
|
381
|
+
___qtablewidgetitem = self.tableVariables.horizontalHeaderItem(0)
|
382
|
+
___qtablewidgetitem.setText(QCoreApplication.translate("MoodleTestGenerator", u"Variable", None));
|
356
383
|
self.label_4.setText(QCoreApplication.translate("MoodleTestGenerator", u"Logging Messages", None))
|
357
384
|
self.menuFile.setTitle(QCoreApplication.translate("MoodleTestGenerator", u"File", None))
|
358
385
|
self.menuTools.setTitle(QCoreApplication.translate("MoodleTestGenerator", u"Tools", None))
|
@@ -0,0 +1,197 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
################################################################################
|
4
|
+
## Form generated from reading UI file 'UI_variableGenerator.ui'
|
5
|
+
##
|
6
|
+
## Created by: Qt User Interface Compiler version 6.9.1
|
7
|
+
##
|
8
|
+
## WARNING! All changes made in this file will be lost when recompiling UI file!
|
9
|
+
################################################################################
|
10
|
+
|
11
|
+
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
|
12
|
+
QMetaObject, QObject, QPoint, QRect,
|
13
|
+
QSize, QTime, QUrl, Qt)
|
14
|
+
from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
|
15
|
+
QFont, QFontDatabase, QGradient, QIcon,
|
16
|
+
QImage, QKeySequence, QLinearGradient, QPainter,
|
17
|
+
QPalette, QPixmap, QRadialGradient, QTransform)
|
18
|
+
from PySide6.QtWidgets import (QAbstractItemView, QAbstractScrollArea, QApplication, QDialog,
|
19
|
+
QGroupBox, QHBoxLayout, QHeaderView, QLabel,
|
20
|
+
QLineEdit, QListWidget, QListWidgetItem, QPushButton,
|
21
|
+
QSizePolicy, QSpacerItem, QSpinBox, QTableWidget,
|
22
|
+
QTableWidgetItem, QVBoxLayout, QWidget)
|
23
|
+
|
24
|
+
class Ui_VariableGeneratorDialog(object):
|
25
|
+
def setupUi(self, VariableGeneratorDialog):
|
26
|
+
if not VariableGeneratorDialog.objectName():
|
27
|
+
VariableGeneratorDialog.setObjectName(u"VariableGeneratorDialog")
|
28
|
+
VariableGeneratorDialog.resize(604, 634)
|
29
|
+
self.verticalLayout = QVBoxLayout(VariableGeneratorDialog)
|
30
|
+
self.verticalLayout.setObjectName(u"verticalLayout")
|
31
|
+
self.groupBox_existing_variables = QGroupBox(VariableGeneratorDialog)
|
32
|
+
self.groupBox_existing_variables.setObjectName(u"groupBox_existing_variables")
|
33
|
+
self.groupBox_existing_variables.setCheckable(True)
|
34
|
+
self.groupBox_existing_variables.setChecked(False)
|
35
|
+
self.verticalLayout_4 = QVBoxLayout(self.groupBox_existing_variables)
|
36
|
+
self.verticalLayout_4.setObjectName(u"verticalLayout_4")
|
37
|
+
self.tableWidget_existing_variables = QTableWidget(self.groupBox_existing_variables)
|
38
|
+
if (self.tableWidget_existing_variables.columnCount() < 1):
|
39
|
+
self.tableWidget_existing_variables.setColumnCount(1)
|
40
|
+
__qtablewidgetitem = QTableWidgetItem()
|
41
|
+
self.tableWidget_existing_variables.setHorizontalHeaderItem(0, __qtablewidgetitem)
|
42
|
+
self.tableWidget_existing_variables.setObjectName(u"tableWidget_existing_variables")
|
43
|
+
sizePolicy = QSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum)
|
44
|
+
sizePolicy.setHorizontalStretch(0)
|
45
|
+
sizePolicy.setVerticalStretch(0)
|
46
|
+
sizePolicy.setHeightForWidth(self.tableWidget_existing_variables.sizePolicy().hasHeightForWidth())
|
47
|
+
self.tableWidget_existing_variables.setSizePolicy(sizePolicy)
|
48
|
+
self.tableWidget_existing_variables.setSizeAdjustPolicy(QAbstractScrollArea.SizeAdjustPolicy.AdjustToContents)
|
49
|
+
self.tableWidget_existing_variables.setEditTriggers(QAbstractItemView.EditTrigger.NoEditTriggers)
|
50
|
+
|
51
|
+
self.verticalLayout_4.addWidget(self.tableWidget_existing_variables)
|
52
|
+
|
53
|
+
|
54
|
+
self.verticalLayout.addWidget(self.groupBox_existing_variables)
|
55
|
+
|
56
|
+
self.groupBox_variables = QGroupBox(VariableGeneratorDialog)
|
57
|
+
self.groupBox_variables.setObjectName(u"groupBox_variables")
|
58
|
+
self.verticalLayout_2 = QVBoxLayout(self.groupBox_variables)
|
59
|
+
self.verticalLayout_2.setObjectName(u"verticalLayout_2")
|
60
|
+
self.tableWidget_variables = QTableWidget(self.groupBox_variables)
|
61
|
+
if (self.tableWidget_variables.columnCount() < 4):
|
62
|
+
self.tableWidget_variables.setColumnCount(4)
|
63
|
+
__qtablewidgetitem1 = QTableWidgetItem()
|
64
|
+
self.tableWidget_variables.setHorizontalHeaderItem(0, __qtablewidgetitem1)
|
65
|
+
__qtablewidgetitem2 = QTableWidgetItem()
|
66
|
+
self.tableWidget_variables.setHorizontalHeaderItem(1, __qtablewidgetitem2)
|
67
|
+
__qtablewidgetitem3 = QTableWidgetItem()
|
68
|
+
self.tableWidget_variables.setHorizontalHeaderItem(2, __qtablewidgetitem3)
|
69
|
+
__qtablewidgetitem4 = QTableWidgetItem()
|
70
|
+
self.tableWidget_variables.setHorizontalHeaderItem(3, __qtablewidgetitem4)
|
71
|
+
self.tableWidget_variables.setObjectName(u"tableWidget_variables")
|
72
|
+
sizePolicy.setHeightForWidth(self.tableWidget_variables.sizePolicy().hasHeightForWidth())
|
73
|
+
self.tableWidget_variables.setSizePolicy(sizePolicy)
|
74
|
+
self.tableWidget_variables.setSizeAdjustPolicy(QAbstractScrollArea.SizeAdjustPolicy.AdjustToContents)
|
75
|
+
|
76
|
+
self.verticalLayout_2.addWidget(self.tableWidget_variables)
|
77
|
+
|
78
|
+
|
79
|
+
self.verticalLayout.addWidget(self.groupBox_variables)
|
80
|
+
|
81
|
+
self.groupBox_rules = QGroupBox(VariableGeneratorDialog)
|
82
|
+
self.groupBox_rules.setObjectName(u"groupBox_rules")
|
83
|
+
self.verticalLayout_3 = QVBoxLayout(self.groupBox_rules)
|
84
|
+
self.verticalLayout_3.setObjectName(u"verticalLayout_3")
|
85
|
+
self.listWidget_rules = QListWidget(self.groupBox_rules)
|
86
|
+
self.listWidget_rules.setObjectName(u"listWidget_rules")
|
87
|
+
self.listWidget_rules.setSizeAdjustPolicy(QAbstractScrollArea.SizeAdjustPolicy.AdjustToContents)
|
88
|
+
|
89
|
+
self.verticalLayout_3.addWidget(self.listWidget_rules)
|
90
|
+
|
91
|
+
self.horizontalLayout = QHBoxLayout()
|
92
|
+
self.horizontalLayout.setObjectName(u"horizontalLayout")
|
93
|
+
self.lineEdit_newRule = QLineEdit(self.groupBox_rules)
|
94
|
+
self.lineEdit_newRule.setObjectName(u"lineEdit_newRule")
|
95
|
+
|
96
|
+
self.horizontalLayout.addWidget(self.lineEdit_newRule)
|
97
|
+
|
98
|
+
self.pushButton_addRule = QPushButton(self.groupBox_rules)
|
99
|
+
self.pushButton_addRule.setObjectName(u"pushButton_addRule")
|
100
|
+
|
101
|
+
self.horizontalLayout.addWidget(self.pushButton_addRule)
|
102
|
+
|
103
|
+
self.pushButton_removeRule = QPushButton(self.groupBox_rules)
|
104
|
+
self.pushButton_removeRule.setObjectName(u"pushButton_removeRule")
|
105
|
+
|
106
|
+
self.horizontalLayout.addWidget(self.pushButton_removeRule)
|
107
|
+
|
108
|
+
|
109
|
+
self.verticalLayout_3.addLayout(self.horizontalLayout)
|
110
|
+
|
111
|
+
|
112
|
+
self.verticalLayout.addWidget(self.groupBox_rules)
|
113
|
+
|
114
|
+
self.groupBox_generated_variables = QGroupBox(VariableGeneratorDialog)
|
115
|
+
self.groupBox_generated_variables.setObjectName(u"groupBox_generated_variables")
|
116
|
+
self.verticalLayout_5 = QVBoxLayout(self.groupBox_generated_variables)
|
117
|
+
self.verticalLayout_5.setObjectName(u"verticalLayout_5")
|
118
|
+
self.tableWidget_generated_variables = QTableWidget(self.groupBox_generated_variables)
|
119
|
+
self.tableWidget_generated_variables.setObjectName(u"tableWidget_generated_variables")
|
120
|
+
sizePolicy.setHeightForWidth(self.tableWidget_generated_variables.sizePolicy().hasHeightForWidth())
|
121
|
+
self.tableWidget_generated_variables.setSizePolicy(sizePolicy)
|
122
|
+
self.tableWidget_generated_variables.setSizeAdjustPolicy(QAbstractScrollArea.SizeAdjustPolicy.AdjustToContents)
|
123
|
+
self.tableWidget_generated_variables.setEditTriggers(QAbstractItemView.EditTrigger.NoEditTriggers)
|
124
|
+
|
125
|
+
self.verticalLayout_5.addWidget(self.tableWidget_generated_variables)
|
126
|
+
|
127
|
+
|
128
|
+
self.verticalLayout.addWidget(self.groupBox_generated_variables)
|
129
|
+
|
130
|
+
self.horizontalLayout_2 = QHBoxLayout()
|
131
|
+
self.horizontalLayout_2.setObjectName(u"horizontalLayout_2")
|
132
|
+
self.label_numSets = QLabel(VariableGeneratorDialog)
|
133
|
+
self.label_numSets.setObjectName(u"label_numSets")
|
134
|
+
|
135
|
+
self.horizontalLayout_2.addWidget(self.label_numSets)
|
136
|
+
|
137
|
+
self.spinBox_numSets = QSpinBox(VariableGeneratorDialog)
|
138
|
+
self.spinBox_numSets.setObjectName(u"spinBox_numSets")
|
139
|
+
self.spinBox_numSets.setMinimum(1)
|
140
|
+
self.spinBox_numSets.setMaximum(1000)
|
141
|
+
self.spinBox_numSets.setValue(10)
|
142
|
+
|
143
|
+
self.horizontalLayout_2.addWidget(self.spinBox_numSets)
|
144
|
+
|
145
|
+
self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum)
|
146
|
+
|
147
|
+
self.horizontalLayout_2.addItem(self.horizontalSpacer)
|
148
|
+
|
149
|
+
self.pushButton_generate = QPushButton(VariableGeneratorDialog)
|
150
|
+
self.pushButton_generate.setObjectName(u"pushButton_generate")
|
151
|
+
|
152
|
+
self.horizontalLayout_2.addWidget(self.pushButton_generate)
|
153
|
+
|
154
|
+
self.pushButton_save = QPushButton(VariableGeneratorDialog)
|
155
|
+
self.pushButton_save.setObjectName(u"pushButton_save")
|
156
|
+
|
157
|
+
self.horizontalLayout_2.addWidget(self.pushButton_save)
|
158
|
+
|
159
|
+
self.pushButton_cancel = QPushButton(VariableGeneratorDialog)
|
160
|
+
self.pushButton_cancel.setObjectName(u"pushButton_cancel")
|
161
|
+
|
162
|
+
self.horizontalLayout_2.addWidget(self.pushButton_cancel)
|
163
|
+
|
164
|
+
|
165
|
+
self.verticalLayout.addLayout(self.horizontalLayout_2)
|
166
|
+
|
167
|
+
|
168
|
+
self.retranslateUi(VariableGeneratorDialog)
|
169
|
+
|
170
|
+
QMetaObject.connectSlotsByName(VariableGeneratorDialog)
|
171
|
+
# setupUi
|
172
|
+
|
173
|
+
def retranslateUi(self, VariableGeneratorDialog):
|
174
|
+
VariableGeneratorDialog.setWindowTitle(QCoreApplication.translate("VariableGeneratorDialog", u"Variable Set Generator", None))
|
175
|
+
self.groupBox_existing_variables.setTitle(QCoreApplication.translate("VariableGeneratorDialog", u"Existing Variable Sets", None))
|
176
|
+
___qtablewidgetitem = self.tableWidget_existing_variables.horizontalHeaderItem(0)
|
177
|
+
___qtablewidgetitem.setText(QCoreApplication.translate("VariableGeneratorDialog", u"Variable", None));
|
178
|
+
self.groupBox_variables.setTitle(QCoreApplication.translate("VariableGeneratorDialog", u"Variable Constraints (Min/Max)", None))
|
179
|
+
___qtablewidgetitem1 = self.tableWidget_variables.horizontalHeaderItem(0)
|
180
|
+
___qtablewidgetitem1.setText(QCoreApplication.translate("VariableGeneratorDialog", u"Variable", None));
|
181
|
+
___qtablewidgetitem2 = self.tableWidget_variables.horizontalHeaderItem(1)
|
182
|
+
___qtablewidgetitem2.setText(QCoreApplication.translate("VariableGeneratorDialog", u"Min", None));
|
183
|
+
___qtablewidgetitem3 = self.tableWidget_variables.horizontalHeaderItem(2)
|
184
|
+
___qtablewidgetitem3.setText(QCoreApplication.translate("VariableGeneratorDialog", u"Max", None));
|
185
|
+
___qtablewidgetitem4 = self.tableWidget_variables.horizontalHeaderItem(3)
|
186
|
+
___qtablewidgetitem4.setText(QCoreApplication.translate("VariableGeneratorDialog", u"Decimal Places", None));
|
187
|
+
self.groupBox_rules.setTitle(QCoreApplication.translate("VariableGeneratorDialog", u"Inter-Variable Rules", None))
|
188
|
+
self.lineEdit_newRule.setPlaceholderText(QCoreApplication.translate("VariableGeneratorDialog", u"e.g., a < b * 2 or c >= a + b", None))
|
189
|
+
self.pushButton_addRule.setText(QCoreApplication.translate("VariableGeneratorDialog", u"Add Rule", None))
|
190
|
+
self.pushButton_removeRule.setText(QCoreApplication.translate("VariableGeneratorDialog", u"Remove Selected", None))
|
191
|
+
self.groupBox_generated_variables.setTitle(QCoreApplication.translate("VariableGeneratorDialog", u"Generated Variable Sets (Preview)", None))
|
192
|
+
self.label_numSets.setText(QCoreApplication.translate("VariableGeneratorDialog", u"Number of Sets to Generate:", None))
|
193
|
+
self.pushButton_generate.setText(QCoreApplication.translate("VariableGeneratorDialog", u"Preview", None))
|
194
|
+
self.pushButton_save.setText(QCoreApplication.translate("VariableGeneratorDialog", u"Save Variables", None))
|
195
|
+
self.pushButton_cancel.setText(QCoreApplication.translate("VariableGeneratorDialog", u"Cancel", None))
|
196
|
+
# retranslateUi
|
197
|
+
|