Skip to content

Commit db9a40a

Browse files
committed
Merge branch 'develop' into visualization_table_error
# Conflicts: # src/petab_gui/controllers/table_controllers.py
2 parents afd9d62 + 56bf65c commit db9a40a

11 files changed

Lines changed: 146 additions & 28 deletions

File tree

.github/workflows/ci.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,46 @@ jobs:
2222

2323
- name: Run pre-commit hooks
2424
run: pre-commit run --all-files
25+
26+
launch:
27+
runs-on: ubuntu-latest
28+
strategy:
29+
matrix:
30+
python-version: ['3.11', '3.13']
31+
steps:
32+
- name: Check out repository
33+
uses: actions/checkout@v5
34+
35+
- name: Prepare Python
36+
uses: actions/setup-python@v6
37+
with:
38+
python-version: ${{ matrix.python-version }}
39+
40+
- name: Install dependencies
41+
run: |
42+
sudo apt-get update
43+
sudo apt-get install -y xvfb libegl1 libqt6gui6 libxcb-cursor0
44+
45+
- name: Install PEtabGUI
46+
run: |
47+
python -m pip install --upgrade pip
48+
pip install .
49+
50+
- name: Launch GUI
51+
# Ensure that we can launch the GUI
52+
run: |
53+
echo "Launching Xvfb"
54+
Xvfb :99 -screen 0 1920x1200x24 &
55+
export DISPLAY=:99
56+
echo "Running petab_gui --version"
57+
petab_gui --version
58+
echo "Running petab_gui without arguments"
59+
petab_gui &
60+
echo $! > petabgui_pid.txt
61+
sleep 10
62+
kill $(cat petabgui_pid.txt)
63+
echo "Running petab_gui with example problem"
64+
petab_gui example/problem.yaml &
65+
echo $! > petabgui_pid.txt
66+
sleep 10
67+
kill $(cat petabgui_pid.txt)

.github/workflows/python-publish.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ jobs:
2121

2222
steps:
2323
- uses: actions/checkout@v4
24+
with:
25+
# Fetch full history for setuptools-scm
26+
fetch-depth: 0
2427

2528
- uses: actions/setup-python@v5
2629
with:
@@ -56,7 +59,8 @@ jobs:
5659
# ALTERNATIVE: if your GitHub Release name is the PyPI project version string
5760
# ALTERNATIVE: exactly, uncomment the following line instead:
5861
# url: https://pypi.org/project/YOURPROJECT/${{ github.event.release.name }}
59-
62+
env:
63+
SETUPTOOLS_SCM_OVERRIDES_FOR_PETAB_GUI: '{"local_scheme": "no-local-version"}'
6064
steps:
6165
- name: Retrieve release distributions
6266
uses: actions/download-artifact@v4

.readthedocs.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,10 @@ build:
2222
os: "ubuntu-24.04"
2323
tools:
2424
python: "3.11"
25+
jobs:
26+
post_checkout:
27+
# Avoid setuptools-scm dirty Git index issues
28+
- git reset --hard HEAD
29+
- git clean -fdx
30+
# Enforce fail_on_shallow for setuptools-scm
31+
- export SETUPTOOLS_SCM_OVERRIDES_FOR_${READTHEDOCS_PROJECT//-/_}='{scm.git.pre_parse="fail_on_shallow"}'

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pip install petab_gui
2121
To install the latest development version from GitHub, run:
2222

2323
```bash
24-
pip3 install git+https://github.com/PaulJonasJost/PEtab_GUI/
24+
pip install git+https://github.com/PaulJonasJost/PEtab_GUI/
2525
```
2626

2727
### From a local copy
@@ -52,7 +52,7 @@ The PEtabGUI provides a Python-based graphical user interface that simplifies
5252
the creation, editing, and validation of PEtab parameter estimation problems.
5353

5454
- **Unified Environment**
55-
- Integrates all PEtab components (SBML/PySB models, conditions, observables,
55+
- Integrates all PEtab components (SBML models, conditions, observables,
5656
measurements, parameters, and visualization files).
5757
- Supports drag-and-drop import of YAML or individual component files.
5858
- Automatically resolves mismatches and converts matrix-format experimental data

docs/source/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#
33
# For the full list of built-in configuration values, see the documentation:
44
# https://www.sphinx-doc.org/en/master/usage/configuration.html
5+
from importlib.metadata import version as get_version
56

67
rst_prolog = """
78
.. |petab_doc_url| replace:: https://petab.readthedocs.io/en/latest/index.html
@@ -13,7 +14,7 @@
1314
project = "PEtab GUI"
1415
copyright = "2025, Paul Jonas Jost, Frank T. Bergmann"
1516
author = "Paul Jonas Jost, Frank T. Bergmann"
16-
release = "0.1.3"
17+
release: str = get_version("petab-gui")
1718

1819
# -- General configuration ---------------------------------------------------
1920
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

docs/source/contributing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Filing an Issue
4242
----------------
4343

4444
If you encounter any bugs or have feature requests, please file an issue on GitHub.
45-
[Open a new issue](https://github.com/PaulJonasJost/PEtab_GUI/issues/new/choose).
45+
`Open a new issue <https://github.com/PaulJonasJost/PEtab_GUI/issues/new/choose>`__.
4646

4747
When filing an issue, provide as much detail as possible,
4848
including steps to reproduce the issue, expected behavior, and any relevant logs or screenshots.

docs/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,4 @@ To get started with PEtab GUI, check out the :doc:`installation instructions <re
5555
:caption: Development
5656

5757
GitHub Repository <https://github.com/PaulJonasJost/PEtab_GUI>
58+
contributing

src/petab_gui/controllers/mother_controller.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -858,11 +858,15 @@ def check_model(self):
858858

859859
# Log the consistency check result
860860
if not failed:
861-
self.logger.log_message("Model is consistent.", color="green")
861+
self.logger.log_message(
862+
"PEtab problem has no errors.", color="green"
863+
)
862864
for model in self.model.pandas_models.values():
863865
model.reset_invalid_cells()
864866
else:
865-
self.logger.log_message("Model is inconsistent.", color="red")
867+
self.logger.log_message(
868+
"PEtab problem has errors.", color="red"
869+
)
866870
except Exception as e:
867871
msg = f"PEtab linter failed at some point: {filtered_error(e)}"
868872
self.logger.log_message(msg, color="red")

src/petab_gui/controllers/table_controllers.py

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def __init__(
7777
self.undo_stack = undo_stack
7878
self.model.undo_stack = undo_stack
7979
self.check_petab_lint_mode = True
80-
if model.table_type in ["simulation"]:
80+
if model.table_type in ["simulation", "visualization"]:
8181
self.check_petab_lint_mode = False
8282
self.mother_controller = mother_controller
8383
self.view.table_view.setModel(self.proxy_model)
@@ -1341,3 +1341,61 @@ def check_petab_lint(
13411341
capture_handler.get_formatted_messages()
13421342
)
13431343
raise ValueError(captured_output)
1344+
1345+
def setup_completers(self):
1346+
"""Set completers for the visualization table."""
1347+
table_view = self.view.table_view
1348+
# plotTypeSimulation
1349+
index = self.model.return_column_index("plotTypeSimulation")
1350+
if index and index > -1:
1351+
self.completers["plotTypeSimulation"] = ComboBoxDelegate(
1352+
["LinePlot", "BarPlot", "ScatterPlot"]
1353+
)
1354+
table_view.setItemDelegateForColumn(
1355+
index, self.completers["plotTypeSimulation"]
1356+
)
1357+
# plotTypeData
1358+
index = self.model.return_column_index("plotTypeData")
1359+
if index and index > -1:
1360+
self.completers["plotTypeData"] = ComboBoxDelegate(
1361+
["MeanAndSD", "MeanAndSEM", "replicate", "provided"]
1362+
)
1363+
table_view.setItemDelegateForColumn(
1364+
index, self.completers["plotTypeData"]
1365+
)
1366+
# datasetId
1367+
index = self.model.return_column_index("datasetId")
1368+
if index and index > -1:
1369+
self.completers["datasetId"] = ColumnSuggestionDelegate(
1370+
self.mother_controller.model.measurement, "datasetId"
1371+
)
1372+
table_view.setItemDelegateForColumn(
1373+
index, self.completers["datasetId"]
1374+
)
1375+
# yValues
1376+
index = self.model.return_column_index("yValues")
1377+
if index and index > -1:
1378+
self.completers["yValues"] = ColumnSuggestionDelegate(
1379+
self.mother_controller.model.observable, "observableId"
1380+
)
1381+
table_view.setItemDelegateForColumn(
1382+
index, self.completers["yValues"]
1383+
)
1384+
# xScale
1385+
index = self.model.return_column_index("xScale")
1386+
if index and index > -1:
1387+
self.completers["xScale"] = ComboBoxDelegate(
1388+
["lin", "log", "log10", "order"]
1389+
)
1390+
table_view.setItemDelegateForColumn(
1391+
index, self.completers["xScale"]
1392+
)
1393+
# yScale
1394+
index = self.model.return_column_index("yScale")
1395+
if index and index > -1:
1396+
self.completers["yScale"] = ComboBoxDelegate(
1397+
["lin", "log", "log10", "order"]
1398+
)
1399+
table_view.setItemDelegateForColumn(
1400+
index, self.completers["yScale"]
1401+
)

src/petab_gui/models/pandas_table_model.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ def _set_data_single(self, index, value):
377377
if error:
378378
self.new_log_message.emit(
379379
f"Column '{column_name}' expects a value of type "
380-
f"{expected_type}, but got '{value}'",
380+
f"{expected_type.__name__}, but got '{value}'",
381381
"red",
382382
)
383383
return False
@@ -670,7 +670,9 @@ def return_column_index(self, column_name):
670670
Returns:
671671
int: The view column index for the given column name, or -1
672672
"""
673-
pass
673+
if column_name in self._data_frame.columns:
674+
return self._data_frame.columns.get_loc(column_name)
675+
return -1
674676

675677
def unique_values(self, column_name):
676678
"""Return a list of unique values in a specified column.
@@ -1115,12 +1117,6 @@ def get_default_values(self, index, changed: dict | None = None):
11151117
else:
11161118
command.redo()
11171119

1118-
def return_column_index(self, column_name):
1119-
"""Return the index of a column."""
1120-
if column_name in self._data_frame.columns:
1121-
return self._data_frame.columns.get_loc(column_name)
1122-
return -1
1123-
11241120

11251121
class ObservableModel(IndexedPandasTableModel):
11261122
"""Table model for the observable data."""

0 commit comments

Comments
 (0)