Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
clive
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
clive
Commits
a4047b2e
Commit
a4047b2e
authored
3 weeks ago
by
Mateusz Żebrak
Browse files
Options
Downloads
Patches
Plain Diff
Create ComposeFormResult typealias
parent
bffce618
No related branches found
No related tags found
2 merge requests
!600
v1.27.5.21 Release
,
!558
Remove welcome profile from TUIWorld, set TUIWorld profile during CreateProfile wizard instead
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
clive/__private/ui/forms/create_profile/create_profile_form.py
+2
-9
2 additions, 9 deletions
.../__private/ui/forms/create_profile/create_profile_form.py
clive/__private/ui/forms/form.py
+6
-6
6 additions, 6 deletions
clive/__private/ui/forms/form.py
with
8 additions
and
15 deletions
clive/__private/ui/forms/create_profile/create_profile_form.py
+
2
−
9
View file @
a4047b2e
from
__future__
import
annotations
from
typing
import
TYPE_CHECKING
from
clive.__private.core.profile
import
Profile
from
clive.__private.ui.forms.create_profile.create_profile_form_screen
import
CreateProfileFormScreen
from
clive.__private.ui.forms.create_profile.new_key_alias_form_screen
import
NewKeyAliasFormScreen
from
clive.__private.ui.forms.create_profile.set_account_form_screen
import
SetAccountFormScreen
from
clive.__private.ui.forms.create_profile.welcome_form_screen
import
CreateProfileWelcomeFormScreen
from
clive.__private.ui.forms.form
import
Form
if
TYPE_CHECKING
:
from
collections.abc
import
Iterator
from
clive.__private.ui.forms.form_screen
import
FormScreen
from
clive.__private.ui.forms.form
import
ComposeFormResult
,
Form
class
CreateProfileForm
(
Form
):
...
...
@@ -23,7 +16,7 @@ class CreateProfileForm(Form):
async
def
cleanup
(
self
)
->
None
:
await
self
.
world
.
switch_profile
(
None
)
def
compose_form
(
self
)
->
Iterator
[
type
[
FormScreen
]]
:
def
compose_form
(
self
)
->
ComposeFormResult
:
if
not
Profile
.
is_any_profile_saved
():
yield
CreateProfileWelcomeFormScreen
yield
CreateProfileFormScreen
...
...
This diff is collapsed.
Click to expand it.
clive/__private/ui/forms/form.py
+
6
−
6
View file @
a4047b2e
...
...
@@ -2,20 +2,20 @@ from __future__ import annotations
import
inspect
from
abc
import
abstractmethod
from
collections.abc
import
Callable
,
Iterator
from
collections.abc
import
Callable
from
queue
import
Queue
from
typing
import
TYPE_CHECKING
,
Any
,
cast
from
typing
import
Any
,
Iterable
,
cast
from
clive.__private.core.commands.abc.command
import
Command
from
clive.__private.core.contextual
import
ContextualHolder
from
clive.__private.ui.clive_screen
import
CliveScreen
from
clive.__private.ui.forms.form_context
import
FormContextT
,
NoContext
if
TYPE_CHECKING
:
from
clive.__private.ui.forms.form_screen
import
FormScreen
from
clive.__private.ui.forms.form_screen
import
FormScreen
PostAction
=
Command
|
Callable
[[],
Any
]
ComposeFormResult
=
Iterable
[
type
[
FormScreen
[
FormContextT
]]]
class
Form
(
ContextualHolder
[
FormContextT
],
CliveScreen
[
None
]):
MINIMUM_SCREEN_COUNT
=
2
# Rationale: it makes no sense to have only one screen in the form
...
...
@@ -29,7 +29,7 @@ class Form(ContextualHolder[FormContextT], CliveScreen[None]):
super
().
__init__
(
self
.
_build_context
())
@abstractmethod
def
compose_form
(
self
)
->
Iterator
[
type
[
FormScreen
[
FormContextT
]
]]
:
def
compose_form
(
self
)
->
ComposeFormResult
[
FormContextT
]:
"""
Yield screens types in the order they should be displayed.
"""
@property
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment