fixes
This commit is contained in:
parent
b2358d323e
commit
33da827626
24
main.py
24
main.py
@ -1,17 +1,13 @@
|
||||
import os
|
||||
import struct
|
||||
import subprocess
|
||||
import sys
|
||||
import traceback
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import zlib
|
||||
import requests
|
||||
import threading
|
||||
|
||||
from PySide6.QtCore import QProcess
|
||||
from PySide6.QtWidgets import QApplication, QMainWindow, QFileDialog, QMessageBox, QTreeWidgetItem, QLayout, QLabel, \
|
||||
QLineEdit, QPushButton
|
||||
from PySide6.QtWidgets import QApplication, QMainWindow, QFileDialog, QMessageBox, QPushButton
|
||||
from mainwindow import Ui_MainWindow
|
||||
|
||||
|
||||
@ -21,11 +17,10 @@ class MainWindow(QMainWindow):
|
||||
self.ui = Ui_MainWindow()
|
||||
self.ui.setupUi(self)
|
||||
self.giants_path = locate_giants_folder()
|
||||
if not self.giants_path:
|
||||
raise Exception()
|
||||
self.wdefs_path = self.giants_path / "Bin" / "wdefs.bin"
|
||||
self.giantsmain_path = self.giants_path / "GiantsMain.exe"
|
||||
|
||||
if not self.giants_path:
|
||||
self.close()
|
||||
self.ui.lineEdit.textEdited.connect(self.on_textedit_changed)
|
||||
self.ui.pushButton.clicked.connect(self.on_button_clicked)
|
||||
|
||||
@ -142,7 +137,9 @@ def ask_giants_directory() -> Path:
|
||||
QMessageBox.information(None, "Wdefs",
|
||||
"Could not locate your Giants installation automatically.\nPlease browse to your Giants folder and select GiantsMain.exe")
|
||||
giantsmain_path, _filename = QFileDialog.getOpenFileName(None, caption="Wdefs", filter="GiantsMain.exe")
|
||||
return Path(giantsmain_path).parent
|
||||
if giantsmain_path:
|
||||
return Path(giantsmain_path).parent
|
||||
return None
|
||||
|
||||
|
||||
def crc(inp_bytes: bytes) -> int:
|
||||
@ -169,6 +166,9 @@ def new_exe_bytes(wdefs_bytes: bytes, giantsmain_path: Path) -> bytes:
|
||||
if __name__ == "__main__":
|
||||
app = QApplication(sys.argv)
|
||||
app.setQuitOnLastWindowClosed(True)
|
||||
window = MainWindow()
|
||||
window.show()
|
||||
sys.exit(app.exec())
|
||||
try:
|
||||
window = MainWindow()
|
||||
window.show()
|
||||
sys.exit(app.exec())
|
||||
except:
|
||||
sys.exit(1)
|
||||
|
Loading…
Reference in New Issue
Block a user