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
9b6fd322
Commit
9b6fd322
authored
1 month ago
by
Mateusz Żebrak
Browse files
Options
Downloads
Patches
Plain Diff
Get rid of unused ScreenBuilder type alias
parent
f59f142d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
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
+4
-2
4 additions, 2 deletions
.../__private/ui/forms/create_profile/create_profile_form.py
clive/__private/ui/forms/form.py
+8
-7
8 additions, 7 deletions
clive/__private/ui/forms/form.py
with
12 additions
and
9 deletions
clive/__private/ui/forms/create_profile/create_profile_form.py
+
4
−
2
View file @
9b6fd322
...
...
@@ -10,18 +10,20 @@ from clive.__private.ui.forms.create_profile.create_profile_form_screen import C
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
,
ScreenBuilder
from
clive.__private.ui.forms.form
import
Form
if
TYPE_CHECKING
:
from
collections.abc
import
Iterator
from
clive.__private.ui.forms.form_screen
import
FormScreenBase
class
CreateProfileForm
(
Form
[
CreateProfileContext
]):
@property
def
context
(
self
)
->
CreateProfileContext
:
return
self
.
__context
def
register_screen_builders
(
self
)
->
Iterator
[
ScreenB
uilder
[
CreateProfileContext
]]:
def
register_screen_builders
(
self
)
->
Iterator
[
type
[
Form
ScreenB
ase
[
CreateProfileContext
]]
]
:
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
+
8
−
7
View file @
9b6fd322
...
...
@@ -4,14 +4,15 @@ import inspect
from
abc
import
abstractmethod
from
collections.abc
import
Callable
,
Iterator
from
queue
import
Queue
from
typing
import
Any
from
typing
import
TYPE_CHECKING
,
Any
from
clive.__private.core.commands.abc.command
import
Command
from
clive.__private.core.contextual
import
ContextT
,
Contextual
from
clive.__private.ui.clive_screen
import
CliveScreen
from
clive.__private.ui.forms.form_screen
import
FormScreenBase
ScreenBuilder
=
Callable
[[
"
Form[ContextT]
"
],
FormScreenBase
[
ContextT
]
|
FormScreenBase
[
None
]]
if
TYPE_CHECKING
:
from
clive.__private.ui.forms.form_screen
import
FormScreenBase
PostAction
=
Command
|
Callable
[[],
Any
]
...
...
@@ -20,7 +21,7 @@ class Form(Contextual[ContextT], CliveScreen[None]):
def
__init__
(
self
)
->
None
:
self
.
_current_screen_index
=
0
self
.
_screens
:
list
[
ScreenB
uilder
[
ContextT
]]
=
[
*
list
(
self
.
register_screen_builders
())]
self
.
_screens
:
list
[
type
[
Form
ScreenB
ase
[
ContextT
]]
]
=
[
*
list
(
self
.
register_screen_builders
())]
assert
len
(
self
.
_screens
)
>=
self
.
MINIMUM_SCREEN_COUNT
,
"
Form must have at least 2 screens
"
self
.
_rebuild_context
()
self
.
_post_actions
=
Queue
[
PostAction
]()
...
...
@@ -28,11 +29,11 @@ class Form(Contextual[ContextT], CliveScreen[None]):
super
().
__init__
()
@property
def
screens
(
self
)
->
list
[
ScreenB
uilder
[
ContextT
]]:
def
screens
(
self
)
->
list
[
type
[
Form
ScreenB
ase
[
ContextT
]]
]
:
return
self
.
_screens
@property
def
current_screen
(
self
)
->
ScreenB
uilder
[
ContextT
]:
def
current_screen
(
self
)
->
type
[
Form
ScreenB
ase
[
ContextT
]
]
:
return
self
.
_screens
[
self
.
_current_screen_index
]
def
on_mount
(
self
)
->
None
:
...
...
@@ -67,7 +68,7 @@ class Form(Contextual[ContextT], CliveScreen[None]):
"""
Create brand new fresh context.
"""
@abstractmethod
def
register_screen_builders
(
self
)
->
Iterator
[
ScreenB
uilder
[
ContextT
]]:
def
register_screen_builders
(
self
)
->
Iterator
[
type
[
Form
ScreenB
ase
[
ContextT
]]
]
:
"""
Return screens to display.
"""
def
add_post_action
(
self
,
*
actions
:
PostAction
)
->
None
:
...
...
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