excel2moodle 0.3.5__py3-none-any.whl → 0.3.6__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/__init__.py +3 -8
- excel2moodle/__main__.py +9 -1
- excel2moodle/core/dataStructure.py +1 -1
- excel2moodle/logger.py +0 -1
- excel2moodle/ui/appUi.py +37 -27
- excel2moodle/ui/settings.py +2 -1
- {excel2moodle-0.3.5.dist-info → excel2moodle-0.3.6.dist-info}/METADATA +1 -1
- {excel2moodle-0.3.5.dist-info → excel2moodle-0.3.6.dist-info}/RECORD +12 -12
- {excel2moodle-0.3.5.dist-info → excel2moodle-0.3.6.dist-info}/WHEEL +0 -0
- {excel2moodle-0.3.5.dist-info → excel2moodle-0.3.6.dist-info}/entry_points.txt +0 -0
- {excel2moodle-0.3.5.dist-info → excel2moodle-0.3.6.dist-info}/licenses/LICENSE +0 -0
- {excel2moodle-0.3.5.dist-info → excel2moodle-0.3.6.dist-info}/top_level.txt +0 -0
excel2moodle/__init__.py
CHANGED
@@ -56,14 +56,9 @@ if __package__ is not None:
|
|
56
56
|
settings = Settings()
|
57
57
|
logfile = Path(settings.get(SettingsKey.LOGFILE)).resolve()
|
58
58
|
e2mMetadata["logfile"] = logfile
|
59
|
-
logfile.
|
59
|
+
if logfile.exists():
|
60
|
+
logfile.replace(f"{logfile}.old")
|
60
61
|
|
61
|
-
|
62
|
+
mainLogger = logging.getLogger(__name__)
|
62
63
|
logConfig.dictConfig(config=loggerConfig)
|
63
64
|
qSignalLogger = LogWindowHandler()
|
64
|
-
logger.addHandler(qSignalLogger)
|
65
|
-
|
66
|
-
|
67
|
-
for k, v in e2mMetadata.items():
|
68
|
-
msg = f"{k:^14s}: {v}"
|
69
|
-
logger.info(msg)
|
excel2moodle/__main__.py
CHANGED
@@ -1,19 +1,27 @@
|
|
1
|
-
"""Main Function to make the Package executable"""
|
1
|
+
"""Main Function to make the Package executable."""
|
2
|
+
|
3
|
+
import signal
|
2
4
|
|
3
5
|
from PySide6 import QtWidgets, sys
|
4
6
|
|
7
|
+
from excel2moodle import e2mMetadata, mainLogger, qSignalLogger
|
5
8
|
from excel2moodle.core import dataStructure
|
6
9
|
from excel2moodle.ui import appUi as ui
|
7
10
|
from excel2moodle.ui.settings import Settings
|
8
11
|
|
9
12
|
|
10
13
|
def main() -> None:
|
14
|
+
mainLogger.addHandler(qSignalLogger)
|
15
|
+
signal.signal(signal.SIGINT, signal.SIG_DFL)
|
11
16
|
app = QtWidgets.QApplication(sys.argv)
|
12
17
|
settings = Settings()
|
13
18
|
database: dataStructure.QuestionDB = dataStructure.QuestionDB(settings)
|
14
19
|
window = ui.MainWindow(settings, database)
|
15
20
|
database.window = window
|
16
21
|
window.show()
|
22
|
+
for k, v in e2mMetadata.items():
|
23
|
+
msg = f"{k:^14s}: {v}"
|
24
|
+
mainLogger.info(msg)
|
17
25
|
sys.exit(app.exec())
|
18
26
|
|
19
27
|
|
excel2moodle/logger.py
CHANGED
@@ -90,7 +90,6 @@ class LogWindowHandler(logging.Handler):
|
|
90
90
|
log_message = self.format(record)
|
91
91
|
color = self.logLevelColors.get(record.levelname, "black")
|
92
92
|
prettyMessage = f'<span style="color:{color};">{log_message}</span>'
|
93
|
-
print("emitting new log signal") # noqa:T201
|
94
93
|
self.emitter.signal.emit(prettyMessage)
|
95
94
|
|
96
95
|
|
excel2moodle/ui/appUi.py
CHANGED
@@ -8,11 +8,9 @@ import logging
|
|
8
8
|
from pathlib import Path
|
9
9
|
|
10
10
|
from PySide6 import QtCore, QtWidgets
|
11
|
-
from PySide6.QtCore import Qt
|
11
|
+
from PySide6.QtCore import QRunnable, Qt, QThreadPool
|
12
12
|
|
13
13
|
from excel2moodle import qSignalLogger
|
14
|
-
|
15
|
-
# from excel2moodle.logger import LogWindowHandler
|
16
14
|
from excel2moodle.core.dataStructure import QuestionDB
|
17
15
|
from excel2moodle.extra import equationVerification as eqVerif
|
18
16
|
from excel2moodle.ui import dialogs
|
@@ -35,7 +33,8 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
35
33
|
self.testDB = testDB
|
36
34
|
self.ui = Ui_MoodleTestGenerator()
|
37
35
|
self.ui.setupUi(self)
|
38
|
-
|
36
|
+
self.connectEvents()
|
37
|
+
logger.info("Settings are stored under: %s", self.settings.fileName())
|
39
38
|
self.ui.treeWidget.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection)
|
40
39
|
self.ui.treeWidget.header().setSectionResizeMode(
|
41
40
|
QtWidgets.QHeaderView.ResizeToContents,
|
@@ -43,20 +42,20 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
43
42
|
self.ui.checkBoxIncludeCategories.setChecked(
|
44
43
|
self.settings.get(SettingsKey.INCLUDEINCATS),
|
45
44
|
)
|
46
|
-
|
47
|
-
|
48
|
-
|
45
|
+
self.ui.spinBoxDefaultQVariant.setValue(
|
46
|
+
self.settings.get(SettingsKey.QUESTIONVARIANT)
|
47
|
+
)
|
49
48
|
self.ui.pointCounter.setReadOnly(True)
|
50
49
|
self.ui.questionCounter.setReadOnly(True)
|
51
50
|
self.setStatus(
|
52
|
-
"Wählen Sie
|
51
|
+
"Wählen Sie eine Excel Tabelle mit den Fragen aus",
|
53
52
|
)
|
54
53
|
try:
|
55
54
|
self.resize(self.settings.value("windowSize"))
|
56
55
|
self.move(self.settings.value("windowPosition"))
|
57
56
|
except Exception:
|
58
57
|
pass
|
59
|
-
self.
|
58
|
+
self.threadPool = QThreadPool()
|
60
59
|
|
61
60
|
def connectEvents(self) -> None:
|
62
61
|
self.ui.treeWidget.itemClicked.connect(self.onSelectionChanged)
|
@@ -69,7 +68,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
69
68
|
self.setIncludeCategoriesSetting,
|
70
69
|
)
|
71
70
|
self.ui.actionParseAll.triggered.connect(self.onParseAll)
|
72
|
-
self.testDB.dataChanged.signal.connect(self.refreshList)
|
71
|
+
# self.testDB.dataChanged.signal.connect(self.refreshList)
|
73
72
|
self.ui.buttonSpreadSheet.clicked.connect(self.onButSpreadsheet)
|
74
73
|
self.ui.buttonTestGen.clicked.connect(self.onButGenTest)
|
75
74
|
self.ui.actionPreviewQ.triggered.connect(self.openPreviewQuestionDlg)
|
@@ -81,6 +80,18 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
81
80
|
def setQVariantDefault(self, value: int) -> None:
|
82
81
|
self.settings.set(SettingsKey.QUESTIONVARIANT, value)
|
83
82
|
|
83
|
+
@QtCore.Slot()
|
84
|
+
def onParseAll(self) -> None:
|
85
|
+
"""Event triggered by the *Tools/Parse all Questions* Event.
|
86
|
+
|
87
|
+
It parses all the Questions found in the spreadsheet
|
88
|
+
and then refreshes the list of questions.
|
89
|
+
If successful it prints out a list of all exported Questions
|
90
|
+
"""
|
91
|
+
self.ui.treeWidget.clear()
|
92
|
+
process = ParseSpreadsheetThread(self.testDB, self)
|
93
|
+
self.threadPool.start(process)
|
94
|
+
|
84
95
|
@QtCore.Slot(Path)
|
85
96
|
def onSheetPathChanged(self, sheet: Path) -> None:
|
86
97
|
logger.debug("Slot, new Spreadsheet triggered")
|
@@ -90,9 +101,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
90
101
|
svgFolder.resolve()
|
91
102
|
self.settings.set(SettingsKey.PICTUREFOLDER, svgFolder)
|
92
103
|
self.ui.buttonSpreadSheet.setText(str(sheet.name))
|
93
|
-
self.
|
94
|
-
self.testDB.parseAll()
|
95
|
-
self.refreshList()
|
104
|
+
self.onParseAll()
|
96
105
|
|
97
106
|
def updateLog(self, log) -> None:
|
98
107
|
self.ui.loggerWindow.append(log)
|
@@ -156,22 +165,8 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
156
165
|
)
|
157
166
|
self.excelPath = Path(file[0]).resolve()
|
158
167
|
self.settings.setSpreadsheet(self.excelPath)
|
159
|
-
logger.debug(f"Saved Spreadsheet Path: {self.excelPath}\n")
|
160
168
|
self.setStatus("[OK] Excel Tabelle wurde eingelesen")
|
161
169
|
|
162
|
-
@QtCore.Slot()
|
163
|
-
def onParseAll(self) -> None:
|
164
|
-
"""Event triggered by the *Tools/Parse all Questions* Event.
|
165
|
-
|
166
|
-
It parses all the Questions found in the spreadsheet
|
167
|
-
and then refreshes the list of questions.
|
168
|
-
If successful it prints out a list of all exported Questions
|
169
|
-
"""
|
170
|
-
self.testDB.readSpreadsheetData(self.spreadSheetPath)
|
171
|
-
self.testDB.parseAll()
|
172
|
-
self.setStatus("[OK] Alle Fragen wurden erfolgreich in XML-Dateien umgewandelt")
|
173
|
-
self.refreshList()
|
174
|
-
|
175
170
|
def refreshList(self) -> None:
|
176
171
|
"""Refresh the question overview in the main window.
|
177
172
|
|
@@ -214,6 +209,21 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
214
209
|
about.exec()
|
215
210
|
|
216
211
|
|
212
|
+
class ParseSpreadsheetThread(QRunnable):
|
213
|
+
def __init__(self, questionDB: QuestionDB, mainApp: MainWindow) -> None:
|
214
|
+
super().__init__()
|
215
|
+
self.testDB = questionDB
|
216
|
+
self.mainApp = mainApp
|
217
|
+
|
218
|
+
@QtCore.Slot()
|
219
|
+
def run(self) -> None:
|
220
|
+
self.testDB.readSpreadsheetData(self.mainApp.spreadSheetPath)
|
221
|
+
self.mainApp.setStatus("[OK] Tabellen wurde eingelesen")
|
222
|
+
self.testDB.parseAll()
|
223
|
+
self.mainApp.setStatus("[OK] Alle Fragen wurden erfolgreich geparsed")
|
224
|
+
self.mainApp.refreshList()
|
225
|
+
|
226
|
+
|
217
227
|
class EqCheckerWindow(QtWidgets.QWidget):
|
218
228
|
def __init__(self) -> None:
|
219
229
|
super().__init__()
|
excel2moodle/ui/settings.py
CHANGED
@@ -51,10 +51,11 @@ class Settings(QSettings):
|
|
51
51
|
def __init__(self) -> None:
|
52
52
|
"""Instantiate the settings."""
|
53
53
|
super().__init__("jbosse3", "excel2moodle")
|
54
|
+
logger.info("Settings are stored under: %s", self.fileName())
|
54
55
|
if self.contains(SettingsKey.SPREADSHEETFOLDER):
|
55
56
|
self.sheet = self.get(SettingsKey.SPREADSHEETFOLDER)
|
56
57
|
if self.sheet.is_file():
|
57
|
-
QTimer.singleShot(
|
58
|
+
QTimer.singleShot(300, self._emitSpreadsheetChanged)
|
58
59
|
|
59
60
|
def _emitSpreadsheetChanged(self) -> None:
|
60
61
|
self.shPathChanged.emit(self.sheet)
|
@@ -1,9 +1,9 @@
|
|
1
|
-
excel2moodle/__init__.py,sha256=
|
2
|
-
excel2moodle/__main__.py,sha256=
|
3
|
-
excel2moodle/logger.py,sha256=
|
1
|
+
excel2moodle/__init__.py,sha256=tJopLP1Oks1wtiFPiW25qKwgJWa-X_C0UNQijM-pRnw,2236
|
2
|
+
excel2moodle/__main__.py,sha256=gPhAh5GmRw-atxu-3JCdElFBKFw5ZB-G_G3xoPPJQVM,812
|
3
|
+
excel2moodle/logger.py,sha256=WomQ_EAiqZ2oVHNReG4KdfGRMrJl3jC3LIr8cbvOlbY,3084
|
4
4
|
excel2moodle/core/__init__.py,sha256=H4Bt6u076RKb6BH5F58nHLQvYPDUoayosM_Onyr9yT0,398
|
5
5
|
excel2moodle/core/category.py,sha256=VunNsfRUv7O8L3XMe1BB2EFxtfCAJFaRafRYRKF15kE,3006
|
6
|
-
excel2moodle/core/dataStructure.py,sha256=
|
6
|
+
excel2moodle/core/dataStructure.py,sha256=G-XpkcmP4ZpySvpi9ykvETrP-U69BNtjTR762ZekuBk,6217
|
7
7
|
excel2moodle/core/etHelpers.py,sha256=i8DAx7YBxrQqzbXFsU-pIvYMPHSRhYci-JvuzY1MzeI,2299
|
8
8
|
excel2moodle/core/exceptions.py,sha256=VgbxrnoR9RRnmDYK2rbB_Bv00r7NLWET6FgddPwo3uw,748
|
9
9
|
excel2moodle/core/globals.py,sha256=OGBxkgD19etaMP6sTtsTZ_u8NXbnHYdCQYAu9E3pcgE,3692
|
@@ -16,18 +16,18 @@ excel2moodle/core/stringHelpers.py,sha256=XZAyXKZcQT_bAQSb9tBQs5tMC5soJf_ZhYFHrD
|
|
16
16
|
excel2moodle/extra/__init__.py,sha256=PM-id60HD21A3IcGC_fCYFihS8osBGZMIJCcN-ZRsIM,293
|
17
17
|
excel2moodle/extra/equationVerification.py,sha256=GLJl1r90d8AAiNy0H2hooZrg3D6aEwNfifYKAe3aGxM,3921
|
18
18
|
excel2moodle/ui/__init__.py,sha256=4EdGtpzwH3rgw4xW9E5x9kdPQYwKbo9rehHRZTNxCrQ,44
|
19
|
-
excel2moodle/ui/appUi.py,sha256=
|
19
|
+
excel2moodle/ui/appUi.py,sha256=wbvAPrPFAZaXP7sPQmGt9P4KoKgzhAAwnxdh6gN1Gak,10355
|
20
20
|
excel2moodle/ui/dialogs.py,sha256=EgAKcydF4clyEweocjmtyCdsQJdQmvY-LVzOlu_cl_8,5320
|
21
21
|
excel2moodle/ui/questionPreviewDialog.py,sha256=_rJvz1GM90aNnj3P6SugEezK7JW6m74ZALgkChohWLM,4980
|
22
|
-
excel2moodle/ui/settings.py,sha256=
|
22
|
+
excel2moodle/ui/settings.py,sha256=eN5h1YeSYJ84-hDe13ief31Am5y46CxahoRx5Cn8usQ,4360
|
23
23
|
excel2moodle/ui/treewidget.py,sha256=mTRqmZHMZT3QTTvt5Gw9L-yl4KdhhulkF7O1KBwW-_E,2449
|
24
24
|
excel2moodle/ui/variantDialog.py,sha256=snVaF3_YAc7NWjMRg7NzbjL_PzNbOpt4eiqElkE46io,5414
|
25
25
|
excel2moodle/ui/windowDoc.py,sha256=IciZpwrLnGzIQV1aCdKQBg6km3oufHGs8havTFzNJyU,1055
|
26
26
|
excel2moodle/ui/windowEquationChecker.py,sha256=fLyal3sbJwpthWCAxLB5vbSFOX23JoivoYksNp3mZVY,7925
|
27
27
|
excel2moodle/ui/windowMain.py,sha256=FsaApCyWgngnWPb46R8_01z8q4XeWxRFVqewSIt742c,19027
|
28
|
-
excel2moodle-0.3.
|
29
|
-
excel2moodle-0.3.
|
30
|
-
excel2moodle-0.3.
|
31
|
-
excel2moodle-0.3.
|
32
|
-
excel2moodle-0.3.
|
33
|
-
excel2moodle-0.3.
|
28
|
+
excel2moodle-0.3.6.dist-info/licenses/LICENSE,sha256=ywQqe6Sitymkf2lV2NRcx_aGsaC-KbSl_EfEsRXmNRw,35135
|
29
|
+
excel2moodle-0.3.6.dist-info/METADATA,sha256=O1NBWfHhc6EMKGMaBJRHW9DmPWotmbJKUzN16gv3wsA,2945
|
30
|
+
excel2moodle-0.3.6.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
|
31
|
+
excel2moodle-0.3.6.dist-info/entry_points.txt,sha256=myfMLDThuGgWHMJDPPfILiZqo_7D3fhmDdJGqWOAjPw,60
|
32
|
+
excel2moodle-0.3.6.dist-info/top_level.txt,sha256=5V1xRUQ9o7UmOCmNoWCZPAuy5nXp3Qbzyqch8fUGT_c,13
|
33
|
+
excel2moodle-0.3.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|