-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Return cli widgets as default if no others are resolved
- Loading branch information
Showing
2 changed files
with
6 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
from typing import List | ||
from daipecore.widgets.Widgets import Widgets | ||
from daipecore.widgets.CommandLineWidgets import CommandLineWidgets | ||
|
||
|
||
class WidgetsFactory: | ||
def __init__(self, widgets: List[Widgets]): | ||
def __init__(self, widgets: List[Widgets], cli_widgets: CommandLineWidgets): | ||
self.__widgets = widgets | ||
self.__cli_widgets = cli_widgets | ||
|
||
def create(self) -> Widgets: | ||
for widget in self.__widgets: | ||
if widget.should_be_resolved(): | ||
return widget | ||
raise Exception("No widgets resolved") | ||
|
||
return self.__cli_widgets |