Skip to content

Commit

Permalink
Show rule requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
zeptofine committed Oct 10, 2023
1 parent ff3523f commit 58902b8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
3 changes: 1 addition & 2 deletions imdataset_creator/gui/frames.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ def __init__(self, parent=None):
self.setContextMenuPolicy(Qt.ContextMenuPolicy.ActionsContextMenu)
(collapse_action := QAction("collapse", self)).triggered.connect(self.toggle_group)
(duplicate_action := QAction("duplicate", self)).triggered.connect(self.duplicate.emit)
revert_action = QAction("revert to defaults", self)
revert_action.triggered.connect(self.reset_settings_group)
(revert_action := QAction("revert to defaults", self)).triggered.connect(self.reset_settings_group)
self.addActions([collapse_action, duplicate_action, revert_action])

self._minimumsize = self.size()
Expand Down
13 changes: 13 additions & 0 deletions imdataset_creator/gui/rule_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@

class RuleView(FlowItem):
title = "Rule"
bound_item: type[base_rules.Rule]

def setup_widget(self, *args, **kwargs):
super().setup_widget(*args, **kwargs)
if requires := self.bound_item().requires:
if self.desc:
self.desc += "\n"
self.desc += "requires: "
self.desc += str(
requires.name if isinstance(requires, base_rules.Column) else set(col.name for col in requires)
)

self.descriptionwidget.setText(self.desc)

@abstractmethod
def get(self):
Expand Down

0 comments on commit 58902b8

Please sign in to comment.