Fixed toml write error and updated pyinstaller spec to include new settings.

dev 3.3
= 3 years ago
parent 1bb12c722a
commit 5b03a6c7a9
Signed by untrusted user who does not match committer: gprog
GPG Key ID: 5BE9BB58D37713F8
  1. 2
      IL Extract.spec
  2. 9
      src/il_extract.py

@ -8,7 +8,7 @@ a = Analysis(
['src/il_extract.py'], ['src/il_extract.py'],
pathex=['src'], pathex=['src'],
binaries=[], binaries=[],
datas=[('src/assets/*', 'assets'), ('settings.json', '.')], datas=[('src/assets/*', 'assets'), ('settings.toml', '.')],
hiddenimports=[], hiddenimports=[],
hookspath=[], hookspath=[],
hooksconfig={}, hooksconfig={},

@ -6,7 +6,7 @@ import json
from PyQt5 import QtWidgets from PyQt5 import QtWidgets
from datetime import datetime as dt from datetime import datetime as dt
import il_reports as ilx #TODO redo aliasing import il_reports as ilx #TODO redo aliasing
from logging import debug, DEBUG, basicConfig from logging import debug, DEBUG, basicConfig, exception
from tomllib import load from tomllib import load
from tomli_w import dump from tomli_w import dump
@ -35,7 +35,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
# The location that the outputfile will be saved at # The location that the outputfile will be saved at
self.outputFile = "" self.outputFile = ""
# Load the settings.toml # Load the settings.toml
with open("settings.toml") as s: with open("settings.toml", mode="rb") as s:
self.settings = load(s) self.settings = load(s)
# Set the current report type to ACH as default # Set the current report type to ACH as default
@ -221,7 +221,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
if self.settings["defaultLocations"][self.curReportType] == '': if self.settings["defaultLocations"][self.curReportType] == '':
self.settings["defaultLocations"][self.curReportType] = ('/').join(self.inputFile.split('/')[:-1]) self.settings["defaultLocations"][self.curReportType] = ('/').join(self.inputFile.split('/')[:-1])
debug(f"checked_for_saved: saved new deafult location | {self.curReportType} | {self.settings['defaultLocations'][self.curReportType]}") debug(f"checked_for_saved: saved new deafult location | {self.curReportType} | {self.settings['defaultLocations'][self.curReportType]}")
with open('settings.toml', 'w') as s: with open('settings.toml', 'wb') as s:
# Save changes to the setting # Save changes to the setting
dump(self.settings, s) dump(self.settings, s)
@ -294,6 +294,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
if __name__ == "__main__": if __name__ == "__main__":
try:
# Defines the app # Defines the app
app = QtWidgets.QApplication(sys.argv) app = QtWidgets.QApplication(sys.argv)
# Sets the style # Sets the style
@ -304,3 +305,5 @@ if __name__ == "__main__":
window.show() window.show()
# Starts the app # Starts the app
app.exec() app.exec()
except Exception as e:
exception(f"HIGH LEVEL EXECPTION: {e}")

Loading…
Cancel
Save