Skip to content

Commit

Permalink
Merge pull request #42 from cibr-jyu/add-tooltips
Browse files Browse the repository at this point in the history
Add tooltips
  • Loading branch information
teekuningas authored Mar 15, 2024
2 parents 3e21704 + c1add84 commit ff48df5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions meggie/configuration.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"id": "meggie",
"tabs": [
{"id": "preprocessing",
"name": "Preprocessing",
Expand Down
13 changes: 11 additions & 2 deletions meggie/mainwindow/dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,16 @@ def find_all_package_specs():
continue
with open(config_path, "r") as f:
config = json.load(f)
if config:
if config and config.get("id"):
package_specs[source] = config

# add possibly missing fields
for package_spec in package_specs.values():
if "name" not in package_spec:
package_spec["name"] = ""
package_spec["name"] = package_spec["id"]

if "description" not in package_spec:
package_spec["description"] = package_spec.get("name", "")

if "author" not in package_spec:
package_spec["author"] = ""
Expand Down Expand Up @@ -282,11 +285,13 @@ def __init__(self, parent):

action_spec = self.action_specs[action_name][2]
title = action_spec["name"]
description = action_spec.get("description", "")

pushButtonInputActionElement = QtWidgets.QPushButton(
self.groupBoxInputActions
)
pushButtonInputActionElement.setText(title)
pushButtonInputActionElement.setToolTip(description)
self.gridLayoutInputActions.addWidget(
pushButtonInputActionElement, idx, 0, 1, 1
)
Expand All @@ -310,11 +315,13 @@ def __init__(self, parent):

action_spec = self.action_specs[action_name][2]
title = action_spec["name"]
description = action_spec.get("description", "")

pushButtonOutputActionElement = QtWidgets.QPushButton(
self.groupBoxOutputActions
)
pushButtonOutputActionElement.setText(title)
pushButtonOutputActionElement.setToolTip(description)
self.gridLayoutOutputActions.addWidget(
pushButtonOutputActionElement, idx, 0, 1, 1
)
Expand Down Expand Up @@ -458,10 +465,12 @@ def connect_to_handler(button, name):
def handler_wrapper(checked):
experiment = self.parent.experiment
if not experiment:
messagebox(self, "You need to open an experiment first.")
return

subject = experiment.active_subject
if not subject:
messagebox(self, "You need to activate a subject first.")
return

data = self._get_data()
Expand Down

0 comments on commit ff48df5

Please sign in to comment.