Bread_Editor/utils.py

22 lines
580 B
Python
Raw Normal View History

#!/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():
self.app.open_files += dialog.selectedFiles()