21 lines
580 B
Python
21 lines
580 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():
|
|
self.app.open_files += dialog.selectedFiles()
|