Fix seat-access selection (#2885)
* Fix seat-access selection * Format import
This commit is contained in:
parent
69b443c1ad
commit
20cc124a6d
|
|
@ -0,0 +1,6 @@
|
||||||
|
from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
|
class SeatAccess(Enum):
|
||||||
|
seatd = 'seatd'
|
||||||
|
polkit = 'polkit'
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
from enum import Enum
|
|
||||||
from typing import TYPE_CHECKING, Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
|
from archinstall.default_profiles.desktops import SeatAccess
|
||||||
from archinstall.default_profiles.profile import GreeterType, ProfileType, SelectResult
|
from archinstall.default_profiles.profile import GreeterType, ProfileType, SelectResult
|
||||||
from archinstall.default_profiles.xorg import XorgProfile
|
from archinstall.default_profiles.xorg import XorgProfile
|
||||||
from archinstall.tui import Alignment, FrameProperties, MenuItem, MenuItemGroup, ResultType, SelectMenu
|
from archinstall.tui import Alignment, FrameProperties, MenuItem, MenuItemGroup, ResultType, SelectMenu
|
||||||
|
|
@ -10,11 +10,6 @@ if TYPE_CHECKING:
|
||||||
_: Any
|
_: Any
|
||||||
|
|
||||||
|
|
||||||
class SeatAccess(Enum):
|
|
||||||
seatd = 'seatd'
|
|
||||||
polkit = 'polkit'
|
|
||||||
|
|
||||||
|
|
||||||
class HyprlandProfile(XorgProfile):
|
class HyprlandProfile(XorgProfile):
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
super().__init__('Hyprland', ProfileType.DesktopEnv, description='')
|
super().__init__('Hyprland', ProfileType.DesktopEnv, description='')
|
||||||
|
|
@ -44,7 +39,7 @@ class HyprlandProfile(XorgProfile):
|
||||||
@property
|
@property
|
||||||
def services(self) -> list[str]:
|
def services(self) -> list[str]:
|
||||||
if pref := self.custom_settings.get('seat_access', None):
|
if pref := self.custom_settings.get('seat_access', None):
|
||||||
return [pref.value]
|
return [pref]
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def _ask_seat_access(self) -> None:
|
def _ask_seat_access(self) -> None:
|
||||||
|
|
@ -68,7 +63,7 @@ class HyprlandProfile(XorgProfile):
|
||||||
|
|
||||||
if result.type_ == ResultType.Selection:
|
if result.type_ == ResultType.Selection:
|
||||||
if result.item() is not None:
|
if result.item() is not None:
|
||||||
self.custom_settings['seat_access'] = result.get_value()
|
self.custom_settings['seat_access'] = result.get_value().value
|
||||||
|
|
||||||
def do_on_select(self) -> SelectResult | None:
|
def do_on_select(self) -> SelectResult | None:
|
||||||
self._ask_seat_access()
|
self._ask_seat_access()
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
from enum import Enum
|
|
||||||
from typing import TYPE_CHECKING, Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
|
from archinstall.default_profiles.desktops import SeatAccess
|
||||||
from archinstall.default_profiles.profile import GreeterType, ProfileType, SelectResult
|
from archinstall.default_profiles.profile import GreeterType, ProfileType, SelectResult
|
||||||
from archinstall.default_profiles.xorg import XorgProfile
|
from archinstall.default_profiles.xorg import XorgProfile
|
||||||
from archinstall.tui import Alignment, FrameProperties, MenuItem, MenuItemGroup, ResultType, SelectMenu
|
from archinstall.tui import Alignment, FrameProperties, MenuItem, MenuItemGroup, ResultType, SelectMenu
|
||||||
|
|
@ -10,11 +10,6 @@ if TYPE_CHECKING:
|
||||||
_: Any
|
_: Any
|
||||||
|
|
||||||
|
|
||||||
class SeatAccess(Enum):
|
|
||||||
seatd = 'seatd'
|
|
||||||
polkit = 'polkit'
|
|
||||||
|
|
||||||
|
|
||||||
class SwayProfile(XorgProfile):
|
class SwayProfile(XorgProfile):
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
super().__init__(
|
super().__init__(
|
||||||
|
|
@ -77,7 +72,7 @@ class SwayProfile(XorgProfile):
|
||||||
|
|
||||||
if result.type_ == ResultType.Selection:
|
if result.type_ == ResultType.Selection:
|
||||||
if result.item() is not None:
|
if result.item() is not None:
|
||||||
self.custom_settings['seat_access'] = result.get_value()
|
self.custom_settings['seat_access'] = result.get_value().value
|
||||||
|
|
||||||
def do_on_select(self) -> SelectResult | None:
|
def do_on_select(self) -> SelectResult | None:
|
||||||
self._ask_seat_access()
|
self._ask_seat_access()
|
||||||
|
|
|
||||||
|
|
@ -120,9 +120,13 @@ class ProfileHandler:
|
||||||
info('No profile definition found: {}'.format(', '.join(invalid_sub_profiles)))
|
info('No profile definition found: {}'.format(', '.join(invalid_sub_profiles)))
|
||||||
|
|
||||||
custom_settings = profile_config.get('custom_settings', {})
|
custom_settings = profile_config.get('custom_settings', {})
|
||||||
profile.set_custom_settings(custom_settings)
|
|
||||||
profile.current_selection = valid_sub_profiles
|
profile.current_selection = valid_sub_profiles
|
||||||
|
|
||||||
|
for sub_profile in valid_sub_profiles:
|
||||||
|
sub_profile_settings = custom_settings.get(sub_profile.name, {})
|
||||||
|
if sub_profile_settings:
|
||||||
|
sub_profile.custom_settings = sub_profile_settings
|
||||||
|
|
||||||
return profile
|
return profile
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue