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
Merge requests
!320
Make info about known account more visible
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Make info about known account more visible
mzebrak/known-account
into
develop
Overview
0
Commits
2
Pipelines
11
Changes
3
Merged
Mateusz Żebrak
requested to merge
mzebrak/known-account
into
develop
1 year ago
Overview
0
Commits
2
Pipelines
11
Changes
1
Expand
Requires:
!301 (merged)
Closes:
#157 (closed)
Edited
1 year ago
by
Mateusz Żebrak
0
0
Merge request reports
Compare
version 7
version 9
55daee34
1 year ago
version 8
df364d22
1 year ago
version 7
4b2d157c
1 year ago
version 6
bd80f77b
1 year ago
version 5
d7b8ec59
1 year ago
version 4
f3fda0ca
1 year ago
version 3
be16ae65
1 year ago
version 2
be16ae65
1 year ago
version 1
be16ae65
1 year ago
develop (base)
and
version 8
latest version
3f872973
2 commits,
1 year ago
version 9
55daee34
2 commits,
1 year ago
version 8
df364d22
2 commits,
1 year ago
version 7
4b2d157c
2 commits,
1 year ago
version 6
bd80f77b
3 commits,
1 year ago
version 5
d7b8ec59
2 commits,
1 year ago
version 4
f3fda0ca
16 commits,
1 year ago
version 3
be16ae65
16 commits,
1 year ago
version 2
be16ae65
16 commits,
1 year ago
version 1
be16ae65
2 commits,
1 year ago
Show latest version
1 file
+
1
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
clive/__private/ui/widgets/inputs/account_name_input.py
+
33
−
1
Options
from
__future__
import
annotations
from
typing
import
TYPE_CHECKING
from
typing
import
TYPE_CHECKING
,
Final
from
textual
import
on
from
textual.containers
import
Horizontal
,
Vertical
from
clive.__private.ui.widgets.inputs.text_input
import
TextInput
@@ -20,6 +21,9 @@ if TYPE_CHECKING:
class
AccountNameInput
(
TextInput
):
"""
An input for a Hive account name.
"""
_KNOWN_ACCOUNT_CLASS
:
Final
[
str
]
=
"
-known-account
"
_UNKNOWN_ACCOUNT_CLASS
:
Final
[
str
]
=
"
-unknown-account
"
DEFAULT_CSS
=
"""
AccountNameInput {
height: auto;
@@ -32,6 +36,16 @@ class AccountNameInput(TextInput):
CliveInput {
width: 1fr;
&.-known-account {
border-subtitle-background: $success-darken-3;
}
&.-unknown-account {
border-subtitle-background: $warning-lighten-1;
border-subtitle-color: black;
}
}
KnownAccount {
@@ -92,3 +106,21 @@ class AccountNameInput(TextInput):
if
self
.
_ask_known_account
:
yield
self
.
_known_account
yield
self
.
pretty
@on
(
KnownAccount
.
Status
)
def
_update_known_account_status
(
self
,
event
:
KnownAccount
.
Status
)
->
None
:
known_account_text
=
"
known account
"
unknown_account_text
=
"
unknown account
"
is_account_known
=
event
.
is_account_known
self
.
input
.
border_subtitle
=
known_account_text
if
is_account_known
else
unknown_account_text
self
.
input
.
add_class
(
self
.
_KNOWN_ACCOUNT_CLASS
if
is_account_known
else
self
.
_UNKNOWN_ACCOUNT_CLASS
)
self
.
input
.
remove_class
(
self
.
_UNKNOWN_ACCOUNT_CLASS
if
is_account_known
else
self
.
_KNOWN_ACCOUNT_CLASS
)
self
.
input
.
refresh
()
# sometimes it's not refreshed automatically without this..
@on
(
KnownAccount
.
Disabled
)
def
_remove_known_account_status
(
self
)
->
None
:
self
.
input
.
border_subtitle
=
""
self
.
input
.
remove_class
(
self
.
_KNOWN_ACCOUNT_CLASS
)
self
.
input
.
remove_class
(
self
.
_UNKNOWN_ACCOUNT_CLASS
)
Loading