Bread_Editor/utils.py
EKNr1 8f8c11772e File opening is now really working.
(Shows a tab menu with the opened files.)
2024-11-18 17:20:49 +01:00

22 lines
621 B
Python

#!/usr/bin/python3
from pathlib import Path
from PyQt6.QtWidgets import QFileDialog
class Utils:
def __init__(self, app):
self.app = app
self.home_path = str(Path.home())
def open_file(self):
dialog = QFileDialog(self.app.QTMainWindow)
dialog.setDirectory(self.home_path)
dialog.setFileMode(QFileDialog.FileMode.ExistingFiles)
dialog.setNameFilters(["Binary (*.bin)", "Any (*)"])
dialog.setViewMode(QFileDialog.ViewMode.List)
if dialog.exec():
for file_path in dialog.selectedFiles():
self.app.open_file(file_path)