Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provide support for ShowMode in SwitchTo and Cancel widgets #350 #354

Merged
merged 10 commits into from
Feb 2, 2024

Conversation

lubaskinc0de
Copy link
Contributor

Close issue #350, now users can pass show_mode argument to Cancel and SwitchTo widgets

third_window = Window(
    "Third Window",
    Cancel(Const("Back"), show_mode=ShowMode.DELETE_AND_SEND),
    state=SecondSG.main,
)

second_dialog = Dialog(third_window)

second_window = Window(
    "Second",
    SwitchTo(Const("To first"), state=MySG.first, id="to_first"),
    state=MySG.second,
)

first_window = Window(
    "First",
    SwitchTo(Const("To second"), state=MySG.second, id="to_second", show_mode=ShowMode.SEND),
    Start(Const("To next dialog"), state=SecondSG.main, id="to_next_dialog"),
    state=MySG.first,
)
first_dialog = Dialog(first_window, second_window)

@lubaskinc0de
Copy link
Contributor Author

should we use ShowMode.AUTO for default or make it Optional?

@@ -117,6 +121,7 @@ def __init__(
result: Any = None,
on_click: Optional[OnClick] = None,
when: WhenCondition = None,
show_mode: ShowMode = ShowMode.AUTO,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's do it in the same way as in manager methods:

show_mode: Optional[ShowMode] = None,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -8,6 +8,8 @@
from aiogram_dialog.widgets.common import WhenCondition
from aiogram_dialog.widgets.text import Const, Text
from aiogram_dialog.widgets.widget_event import WidgetEventProcessor
from aiogram_dialog import ShowMode
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's have full imports from api package like above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@Tishka17 Tishka17 merged commit 9c855ad into Tishka17:develop Feb 2, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants