Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![PyPI - Version](https://badge.fury.io/py/PEtab-GUI.svg)](pypi.org/project/PEtab-GUI/)
[![PyPI - Version](https://badge.fury.io/py/PEtab-GUI.svg)](https://pypi.org/project/PEtab-GUI/)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.15355753.svg)](https://doi.org/10.5281/zenodo.15355753)

# PEtabGUI
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ dependencies = [
"petab[combine]>=0.6.0",
"qtawesome",
"copasi-basico",
"copasi-petab-importer"
"copasi-petab-importer",
"pyobjc; sys_platform == 'darwin'"
]
license-files = ["LICENSE"]

Expand Down
5 changes: 5 additions & 0 deletions src/petab_gui/C.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

import numpy as np

#: Application name
APP_NAME = "PEtabGUI"
#: Base URL of the repository
REPO_URL = "https://github.com/PaulJonasJost/PEtab_GUI"

COLUMNS = {
"measurement": {
"observableId": {"type": np.object_, "optional": False},
Expand Down
11 changes: 10 additions & 1 deletion src/petab_gui/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from PySide6.QtGui import QFileOpenEvent, QIcon
from PySide6.QtWidgets import QApplication

from .C import APP_NAME
from .controllers import MainController
from .models import PEtabModel
from .views import MainWindow
Expand Down Expand Up @@ -59,6 +60,7 @@ def __init__(self, file: str | Path = None):
"""
super().__init__(sys.argv)

self.setApplicationName(APP_NAME)
self.setWindowIcon(get_icon())
self.model = PEtabModel()
self.view = MainWindow()
Expand Down Expand Up @@ -120,7 +122,7 @@ def main():
except PackageNotFoundError:
pkg_version = "unknown"

parser = argparse.ArgumentParser(description="PEtabGUI: A PEtab editor")
parser = argparse.ArgumentParser(description=f"{APP_NAME}: A PEtab editor")
parser.add_argument(
"--version",
action="version",
Expand All @@ -132,6 +134,13 @@ def main():
)
args = parser.parse_args()

if sys.platform == "darwin":
from Foundation import NSBundle # type: type: ignore[import]

bundle = NSBundle.mainBundle()
info = bundle.localizedInfoDictionary() or bundle.infoDictionary()
info["CFBundleName"] = APP_NAME

app = PEtabGuiApp(args.petab_yaml)
sys.exit(app.exec())

Expand Down
28 changes: 27 additions & 1 deletion src/petab_gui/controllers/mother_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import tempfile
import zipfile
from functools import partial
from importlib.metadata import version
from io import BytesIO
from pathlib import Path

Expand Down Expand Up @@ -32,6 +33,7 @@
QWidget,
)

from ..C import APP_NAME, REPO_URL
from ..models import PEtabModel, SbmlViewerModel
from ..settings_manager import SettingsDialog, settings_manager
from ..utils import (
Expand Down Expand Up @@ -164,7 +166,7 @@ def window_title(self):
"""Return the window title based on the model."""
if isinstance(self.model.sbml, SbmlViewerModel):
return self.model.sbml.model_id
return "PEtab Editor"
return APP_NAME

def setup_context_menu(self):
"""Sets up context menus for the tables."""
Expand Down Expand Up @@ -438,6 +440,12 @@ def setup_actions(self):
self._whats_this_filter = _WhatsThisClickHelp(actions["whats_this"])
actions["whats_this"].toggled.connect(self._toggle_whats_this_mode)

# About action
actions["about"] = QAction(
qta.icon("mdi6.information"), "&About", self.view
)
actions["about"].triggered.connect(self.about)

# connect actions
actions["reset_view"] = QAction(
qta.icon("mdi6.view-grid-plus"), "Reset View", self.view
Expand Down Expand Up @@ -1158,6 +1166,24 @@ def _show_help_welcome(self):
if dont.isChecked():
settings.setValue("help_mode/welcome_disabled", True)

def about(self):
"""Show an about dialog."""
config_file = settings_manager.settings.fileName()
QMessageBox.about(
self.view,
f"About {APP_NAME}",
f"<b>{APP_NAME}</b><br>"
f"Version: {version('petab-gui')}<br>"
f"PEtab version: {version('petab')}<br><br>"
f"{APP_NAME} is a tool for editing and visualizing PEtab "
f"problems.<br><br>"
f"Visit the GitHub repository at "
f"<a href='{REPO_URL}'>{REPO_URL}</a> "
"for more information.<br><br>"
f"<small>Settings are stored in "
f"<a href='file://{config_file}'>{config_file}</a></small>",
)

def get_current_problem(self):
"""Get the current PEtab problem from the model."""
return self.model.current_petab_problem
3 changes: 2 additions & 1 deletion src/petab_gui/views/main_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
QWidget,
)

from ..C import APP_NAME
from ..models.tooltips import (
COND_TABLE_TOOLTIP,
DATA_PLOT_TOOLTIP,
Expand Down Expand Up @@ -39,7 +40,7 @@ def __init__(self):

self.allow_close = False

self.setWindowTitle("PEtabGUI")
self.setWindowTitle(APP_NAME)
self.setGeometry(100, 100, 1200, 800)

# Logger: used in both tabs
Expand Down
1 change: 1 addition & 0 deletions src/petab_gui/views/task_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ def __init__(self, parent, actions):
# Add actions to the menu for re-adding tables
self.menu.addAction(actions["open_documentation"])
self.menu.addAction(actions["whats_this"])
self.menu.addAction(actions["about"])


class TaskBar:
Expand Down