-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add script for test_2_loading_saved_files
- Loading branch information
Showing
4 changed files
with
45 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import sys | ||
import os | ||
from pathlib import Path | ||
|
||
from PySide6.QtWidgets import QApplication | ||
from PySide6.QtGui import QIcon | ||
|
||
from app.main import Main | ||
|
||
def ex_loading_saved_files(run_app=True): | ||
"""Example of reading different supported .CSV and .txt data formats""" | ||
|
||
DATA_DIR = Path(__file__).parent | ||
file_paths = [str(file) for ext in ['*.maps', '*.spectra'] for file in DATA_DIR.glob(ext)] | ||
|
||
app = QApplication.instance() or QApplication([]) | ||
window = Main() | ||
app.setStyle("Fusion") | ||
|
||
if file_paths is None or len(file_paths) == 0: | ||
raise ValueError("No valid file paths provided.") | ||
try: | ||
window.open(file_paths=file_paths) | ||
except Exception as e: | ||
raise RuntimeError(f"Failed to open files: {e}") | ||
|
||
window.ui.show() | ||
|
||
if run_app: | ||
sys.exit(app.exec()) | ||
|
||
if __name__ == "__main__": | ||
ex_loading_saved_files() |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Test_1 | ||
import sys | ||
from pathlib import Path | ||
|
||
sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) | ||
|
||
import pytest | ||
from examples.ex_loading_saved_files import ex_loading_saved_files | ||
|
||
def test_loading_saved_files(qtbot): | ||
ex_loading_saved_files(run_app=False) |