-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
44 lines (32 loc) · 1.21 KB
/
Copy pathmain.py
File metadata and controls
44 lines (32 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import sys
import os
from PySide6.QtWidgets import QApplication, QWidget
from PySide6.QtGui import QIcon
from ui_ModrinthExtractor import Ui_ModrinthExtractor
def resource_path(path):
if hasattr(sys, '_MEIPASS'):
return os.path.join(sys._MEIPASS, path)
return path
class MainWindow(QWidget):
def __init__(self):
super().__init__()
self.ui = Ui_ModrinthExtractor()
self.ui.setupUi(self)
self.current_file = None
self.ui.DropArea.fileDropped.connect(self.file_dropped)
self.ui.ChooseExtractFolder.extractFolderChosen.connect(self.on_extract_folder_chosen)
def file_dropped(self, path, name, modpack_version, minecraft_version):
self.ui.MainLabel.setText(
f"# Selected file\n\n{path}"
)
self.ui.Name.setText(name)
self.ui.ModpackVersion.setText(modpack_version)
self.ui.MinecraftVersion.setText(f'Minecraft {minecraft_version}')
def on_extract_folder_chosen(self, folder_path):
self.ui.Path.setText(folder_path)
if __name__=="__main__":
app = QApplication(sys.argv)
window = MainWindow()
window.setWindowIcon(QIcon(resource_path("icon.ico")))
window.show()
sys.exit(app.exec())