excel2moodle 0.3.5__tar.gz → 0.3.6__tar.gz

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.
Files changed (51) hide show
  1. {excel2moodle-0.3.5/excel2moodle.egg-info → excel2moodle-0.3.6}/PKG-INFO +1 -1
  2. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/excel2moodle/__init__.py +3 -8
  3. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/excel2moodle/__main__.py +9 -1
  4. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/excel2moodle/core/dataStructure.py +1 -1
  5. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/excel2moodle/logger.py +0 -1
  6. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/excel2moodle/ui/appUi.py +37 -27
  7. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/excel2moodle/ui/settings.py +2 -1
  8. {excel2moodle-0.3.5 → excel2moodle-0.3.6/excel2moodle.egg-info}/PKG-INFO +1 -1
  9. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/pyproject.toml +1 -1
  10. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/LICENSE +0 -0
  11. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/MANIFEST.in +0 -0
  12. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/README.md +0 -0
  13. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/docs/_build/html/excel2moodle.core.html +0 -0
  14. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/docs/_build/html/excel2moodle.extra.html +0 -0
  15. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/docs/_build/html/excel2moodle.html +0 -0
  16. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/docs/_build/html/excel2moodle.ui.html +0 -0
  17. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/docs/_build/html/excel2moodle.usage.html +0 -0
  18. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/docs/_build/html/genindex.html +0 -0
  19. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/docs/_build/html/howto.html +0 -0
  20. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/docs/_build/html/index.html +0 -0
  21. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/docs/_build/html/modules.html +0 -0
  22. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/docs/_build/html/py-modindex.html +0 -0
  23. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/docs/_build/html/search.html +0 -0
  24. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/docs/_build/html/usage.html +0 -0
  25. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/excel2moodle/core/__init__.py +0 -0
  26. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/excel2moodle/core/category.py +0 -0
  27. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/excel2moodle/core/etHelpers.py +0 -0
  28. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/excel2moodle/core/exceptions.py +0 -0
  29. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/excel2moodle/core/globals.py +0 -0
  30. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/excel2moodle/core/numericMultiQ.py +0 -0
  31. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/excel2moodle/core/parser.py +0 -0
  32. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/excel2moodle/core/question.py +0 -0
  33. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/excel2moodle/core/questionValidator.py +0 -0
  34. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/excel2moodle/core/questionWriter.py +0 -0
  35. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/excel2moodle/core/stringHelpers.py +0 -0
  36. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/excel2moodle/extra/__init__.py +0 -0
  37. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/excel2moodle/extra/equationVerification.py +0 -0
  38. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/excel2moodle/ui/__init__.py +0 -0
  39. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/excel2moodle/ui/dialogs.py +0 -0
  40. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/excel2moodle/ui/questionPreviewDialog.py +0 -0
  41. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/excel2moodle/ui/treewidget.py +0 -0
  42. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/excel2moodle/ui/variantDialog.py +0 -0
  43. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/excel2moodle/ui/windowDoc.py +0 -0
  44. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/excel2moodle/ui/windowEquationChecker.py +0 -0
  45. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/excel2moodle/ui/windowMain.py +0 -0
  46. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/excel2moodle.egg-info/SOURCES.txt +0 -0
  47. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/excel2moodle.egg-info/dependency_links.txt +0 -0
  48. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/excel2moodle.egg-info/entry_points.txt +0 -0
  49. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/excel2moodle.egg-info/requires.txt +0 -0
  50. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/excel2moodle.egg-info/top_level.txt +0 -0
  51. {excel2moodle-0.3.5 → excel2moodle-0.3.6}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: excel2moodle
3
- Version: 0.3.5
3
+ Version: 0.3.6
4
4
  Summary: A package for converting questions from a spreadsheet, to valid moodle-xml
5
5
  Author: Jakob Bosse
6
6
  License-Expression: GPL-3.0-or-later
@@ -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.replace(f"{logfile}.old")
59
+ if logfile.exists():
60
+ logfile.replace(f"{logfile}.old")
60
61
 
61
- logger = logging.getLogger(__name__)
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)
@@ -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
 
@@ -79,7 +79,7 @@ class QuestionDB:
79
79
  points=points,
80
80
  version=version,
81
81
  )
82
- self.dataChanged.signal.emit("whoo")
82
+ # self.dataChanged.signal.emit("whoo")
83
83
 
84
84
  def parseAll(self) -> None:
85
85
  self.mainTree = ET.Element("quiz")
@@ -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
 
@@ -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
- self.ui.retranslateUi(self)
48
- logger.info("Settings are stored under: %s", self.settings.fileName())
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 bitte eine Excel Tabelle und einen Export Ordner für die Fragen aus",
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.connectEvents()
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.testDB.readSpreadsheetData(self.spreadSheetPath)
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__()
@@ -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(0, self._emitSpreadsheetChanged)
58
+ QTimer.singleShot(300, self._emitSpreadsheetChanged)
58
59
 
59
60
  def _emitSpreadsheetChanged(self) -> None:
60
61
  self.shPathChanged.emit(self.sheet)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: excel2moodle
3
- Version: 0.3.5
3
+ Version: 0.3.6
4
4
  Summary: A package for converting questions from a spreadsheet, to valid moodle-xml
5
5
  Author: Jakob Bosse
6
6
  License-Expression: GPL-3.0-or-later
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "excel2moodle"
7
- version = "0.3.5"
7
+ version = "0.3.6"
8
8
  authors = [
9
9
  { name="Jakob Bosse" },
10
10
  ]
File without changes
File without changes
File without changes
File without changes