Skip to content

Commit

Permalink
feat: add option to enable and set_current
Browse files Browse the repository at this point in the history
  • Loading branch information
kraanzu committed Sep 27, 2024
1 parent 70346b5 commit ccc8d6a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions dooit/ui/api/api_components/formatters/formatter_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@ def disable(self, id: str) -> bool:
formatter.disabled = True
return True

@trigger_refresh
def enable(self, id: str, set_current: bool = False) -> bool:
formatter = self.formatters.get(id)
if not formatter:
return False
formatter.disabled = False

if set_current:
formatter = self.formatters.pop(id)
self.formatters.update({id: formatter})

return True

@property
def formatter_functions(self) -> List[Callable]:
return [formatter.func for formatter in self.formatters.values()]
Expand Down

0 comments on commit ccc8d6a

Please sign in to comment.