|
|
@ -1,7 +1,7 @@ |
|
|
|
#!/usr/bin/env python |
|
|
|
#!/usr/bin/env python |
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
# |
|
|
|
# |
|
|
|
# LightDMGreeter.py |
|
|
|
# Greeter.py |
|
|
|
# |
|
|
|
# |
|
|
|
# Copyright © 2017 Antergos |
|
|
|
# Copyright © 2017 Antergos |
|
|
|
# |
|
|
|
# |
|
|
@ -33,7 +33,10 @@ import gi |
|
|
|
gi.require_version('LightDM', '1') |
|
|
|
gi.require_version('LightDM', '1') |
|
|
|
from gi.repository import LightDM |
|
|
|
from gi.repository import LightDM |
|
|
|
from PyQt5.QtCore import QVariant |
|
|
|
from PyQt5.QtCore import QVariant |
|
|
|
from whither.bridge import BridgeObject, prop |
|
|
|
from whither.bridge import ( |
|
|
|
|
|
|
|
BridgeObject, |
|
|
|
|
|
|
|
bridge, |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
# This Application |
|
|
|
# This Application |
|
|
|
from . import ( |
|
|
|
from . import ( |
|
|
@ -50,110 +53,178 @@ LightDMUserList = LightDM.UserList() |
|
|
|
|
|
|
|
|
|
|
|
class Greeter(BridgeObject): |
|
|
|
class Greeter(BridgeObject): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
authentication_complete = bridge.signal() |
|
|
|
|
|
|
|
autologin_timer_expired = bridge.signal() |
|
|
|
|
|
|
|
idle = bridge.signal() |
|
|
|
|
|
|
|
reset = bridge.signal() |
|
|
|
|
|
|
|
show_message = bridge.signal(str, str, arguments=('text', 'type')) |
|
|
|
|
|
|
|
show_prompt = bridge.signal(str, str, arguments=('text', 'type')) |
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, *args, **kwargs): |
|
|
|
def __init__(self, *args, **kwargs): |
|
|
|
super().__init__(name='LightDMGreeter', *args, **kwargs) |
|
|
|
super().__init__(name='LightDMGreeter', *args, **kwargs) |
|
|
|
|
|
|
|
|
|
|
|
@prop(str) |
|
|
|
LightDMGreeter.connect_to_daemon_sync() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self._connect_signals() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _connect_signals(self): |
|
|
|
|
|
|
|
LightDMGreeter.connect('authentication-complete', self.authentication_complete.emit) |
|
|
|
|
|
|
|
LightDMGreeter.connect('autologin-timer-expired', self.authentication_complete.emit) |
|
|
|
|
|
|
|
LightDMGreeter.connect('idle', self.idle.emit) |
|
|
|
|
|
|
|
LightDMGreeter.connect('reset', self.reset.emit) |
|
|
|
|
|
|
|
LightDMGreeter.connect('show-message', self.reset.emit) |
|
|
|
|
|
|
|
LightDMGreeter.connect('show-prompt', self.reset.emit) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bridge.prop(str) |
|
|
|
def authentication_user(self): |
|
|
|
def authentication_user(self): |
|
|
|
return LightDMGreeter.get_authentication_user() or '' |
|
|
|
return LightDMGreeter.get_authentication_user() or '' |
|
|
|
|
|
|
|
|
|
|
|
@prop(bool) |
|
|
|
@bridge.prop(bool) |
|
|
|
def autologin_guest(self): |
|
|
|
def autologin_guest(self): |
|
|
|
return LightDMGreeter.get_autologin_guest_hint() |
|
|
|
return LightDMGreeter.get_autologin_guest_hint() |
|
|
|
|
|
|
|
|
|
|
|
@prop(int) |
|
|
|
@bridge.prop(int) |
|
|
|
def autologin_timeout(self): |
|
|
|
def autologin_timeout(self): |
|
|
|
return LightDMGreeter.get_autologin_timeout_hint() |
|
|
|
return LightDMGreeter.get_autologin_timeout_hint() |
|
|
|
|
|
|
|
|
|
|
|
@prop(str) |
|
|
|
@bridge.prop(str) |
|
|
|
def autologin_user(self): |
|
|
|
def autologin_user(self): |
|
|
|
return LightDMGreeter.get_autologin_user_hint() |
|
|
|
return LightDMGreeter.get_autologin_user_hint() |
|
|
|
|
|
|
|
|
|
|
|
@prop(bool) |
|
|
|
@bridge.prop(bool) |
|
|
|
def can_hibernate(self): |
|
|
|
def can_hibernate(self): |
|
|
|
return LightDM.get_can_hibernate() |
|
|
|
return LightDM.get_can_hibernate() |
|
|
|
|
|
|
|
|
|
|
|
@prop(bool) |
|
|
|
@bridge.prop(bool) |
|
|
|
def can_restart(self): |
|
|
|
def can_restart(self): |
|
|
|
return LightDM.get_can_restart() |
|
|
|
return LightDM.get_can_restart() |
|
|
|
|
|
|
|
|
|
|
|
@prop(bool) |
|
|
|
@bridge.prop(bool) |
|
|
|
def can_shutdown(self): |
|
|
|
def can_shutdown(self): |
|
|
|
return LightDM.get_can_shutdown() |
|
|
|
return LightDM.get_can_shutdown() |
|
|
|
|
|
|
|
|
|
|
|
@prop(bool) |
|
|
|
@bridge.prop(bool) |
|
|
|
def can_suspend(self): |
|
|
|
def can_suspend(self): |
|
|
|
return LightDM.get_can_suspend() |
|
|
|
return LightDM.get_can_suspend() |
|
|
|
|
|
|
|
|
|
|
|
@prop(str) |
|
|
|
@bridge.prop(str) |
|
|
|
def default_session(self): |
|
|
|
def default_session(self): |
|
|
|
return LightDMGreeter.get_default_session_hint() |
|
|
|
return LightDMGreeter.get_default_session_hint() |
|
|
|
|
|
|
|
|
|
|
|
@prop(bool) |
|
|
|
@bridge.prop(bool) |
|
|
|
def has_guest_account(self): |
|
|
|
def has_guest_account(self): |
|
|
|
return LightDMGreeter.get_has_guest_account_hint() |
|
|
|
return LightDMGreeter.get_has_guest_account_hint() |
|
|
|
|
|
|
|
|
|
|
|
@prop(bool) |
|
|
|
@bridge.prop(bool) |
|
|
|
def hide_users(self): |
|
|
|
def hide_users(self): |
|
|
|
return LightDMGreeter.get_hide_users_hint() |
|
|
|
return LightDMGreeter.get_hide_users_hint() |
|
|
|
|
|
|
|
|
|
|
|
@prop(str) |
|
|
|
@bridge.prop(str) |
|
|
|
def hostname(self): |
|
|
|
def hostname(self): |
|
|
|
return LightDM.get_hostname() |
|
|
|
return LightDM.get_hostname() |
|
|
|
|
|
|
|
|
|
|
|
@prop(bool) |
|
|
|
@bridge.prop(bool) |
|
|
|
def in_authentication(self): |
|
|
|
def in_authentication(self): |
|
|
|
return LightDMGreeter.get_in_authentication() |
|
|
|
return LightDMGreeter.get_in_authentication() |
|
|
|
|
|
|
|
|
|
|
|
@prop(bool) |
|
|
|
@bridge.prop(bool) |
|
|
|
def is_authenticated(self): |
|
|
|
def is_authenticated(self): |
|
|
|
return LightDMGreeter.get_is_authenticated() |
|
|
|
return LightDMGreeter.get_is_authenticated() |
|
|
|
|
|
|
|
|
|
|
|
@prop(QVariant) |
|
|
|
@bridge.prop(QVariant) |
|
|
|
def language(self): |
|
|
|
def language(self): |
|
|
|
return language_to_dict(LightDM.get_language()) |
|
|
|
return language_to_dict(LightDM.get_language()) |
|
|
|
|
|
|
|
|
|
|
|
@prop(list) |
|
|
|
@bridge.prop(list) |
|
|
|
def languages(self): |
|
|
|
def languages(self): |
|
|
|
return [language_to_dict(lang) for lang in LightDM.get_languages()] |
|
|
|
return [language_to_dict(lang) for lang in LightDM.get_languages()] |
|
|
|
|
|
|
|
|
|
|
|
@prop(QVariant) |
|
|
|
@bridge.prop(QVariant) |
|
|
|
def layout(self): |
|
|
|
def layout(self): |
|
|
|
return layout_to_dict(LightDM.get_layout()) |
|
|
|
return layout_to_dict(LightDM.get_layout()) |
|
|
|
|
|
|
|
|
|
|
|
@prop(list) |
|
|
|
@bridge.prop(list) |
|
|
|
def layouts(self): |
|
|
|
def layouts(self): |
|
|
|
return [layout_to_dict(layout) for layout in LightDM.get_layouts()] |
|
|
|
return [layout_to_dict(layout) for layout in LightDM.get_layouts()] |
|
|
|
|
|
|
|
|
|
|
|
@prop(bool) |
|
|
|
@bridge.prop(bool) |
|
|
|
def lock_hint(self): |
|
|
|
def lock_hint(self): |
|
|
|
return LightDMGreeter.get_lock_hint() |
|
|
|
return LightDMGreeter.get_lock_hint() |
|
|
|
|
|
|
|
|
|
|
|
@prop(list) |
|
|
|
@bridge.prop(list) |
|
|
|
def remote_sessions(self): |
|
|
|
def remote_sessions(self): |
|
|
|
return [session_to_dict(session) for session in LightDM.get_remote_sessions()] |
|
|
|
return [session_to_dict(session) for session in LightDM.get_remote_sessions()] |
|
|
|
|
|
|
|
|
|
|
|
@prop(bool) |
|
|
|
@bridge.prop(bool) |
|
|
|
def select_guest_hint(self): |
|
|
|
def select_guest_hint(self): |
|
|
|
return LightDMGreeter.get_select_guest_hint() |
|
|
|
return LightDMGreeter.get_select_guest_hint() |
|
|
|
|
|
|
|
|
|
|
|
@prop(str) |
|
|
|
@bridge.prop(str) |
|
|
|
def select_user_hint(self): |
|
|
|
def select_user_hint(self): |
|
|
|
return LightDMGreeter.get_select_user_hint() or '' |
|
|
|
return LightDMGreeter.get_select_user_hint() or '' |
|
|
|
|
|
|
|
|
|
|
|
@prop(list) |
|
|
|
@bridge.prop(QVariant) |
|
|
|
def sessions(self): |
|
|
|
def sessions(self): |
|
|
|
return [session_to_dict(session) for session in LightDM.get_sessions()] |
|
|
|
return [session_to_dict(session) for session in LightDM.get_sessions()] |
|
|
|
|
|
|
|
|
|
|
|
@prop(bool) |
|
|
|
@bridge.prop(bool) |
|
|
|
def show_manual_login_hint(self): |
|
|
|
def show_manual_login_hint(self): |
|
|
|
return LightDMGreeter.get_show_manual_login_hint() |
|
|
|
return LightDMGreeter.get_show_manual_login_hint() |
|
|
|
|
|
|
|
|
|
|
|
@prop(bool) |
|
|
|
@bridge.prop(bool) |
|
|
|
def show_remote_login_hint(self): |
|
|
|
def show_remote_login_hint(self): |
|
|
|
return LightDMGreeter.get_show_remote_login_hint() |
|
|
|
return LightDMGreeter.get_show_remote_login_hint() |
|
|
|
|
|
|
|
|
|
|
|
@prop(list) |
|
|
|
@bridge.prop(QVariant) |
|
|
|
def users(self): |
|
|
|
def users(self): |
|
|
|
return [user_to_dict(user) for user in LightDMUserList.get_users()] |
|
|
|
return [user_to_dict(user) for user in LightDMUserList.get_users()] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bridge.method(str) |
|
|
|
|
|
|
|
def authenticate(self, username): |
|
|
|
|
|
|
|
LightDMGreeter.authenticate(username) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bridge.method() |
|
|
|
|
|
|
|
def authenticate_as_guest(self): |
|
|
|
|
|
|
|
LightDMGreeter.authenticate_as_guest() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bridge.method() |
|
|
|
|
|
|
|
def cancel_authentication(self): |
|
|
|
|
|
|
|
LightDMGreeter.cancel_authentication() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bridge.method() |
|
|
|
|
|
|
|
def cancel_autologin(self): |
|
|
|
|
|
|
|
LightDMGreeter.cancel_autologin() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bridge.method(result=bool) |
|
|
|
|
|
|
|
def hibernate(self): |
|
|
|
|
|
|
|
return LightDMGreeter.hibernate() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bridge.method(str) |
|
|
|
|
|
|
|
def respond(self, response): |
|
|
|
|
|
|
|
LightDMGreeter.respond(response) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bridge.method(result=bool) |
|
|
|
|
|
|
|
def restart(self): |
|
|
|
|
|
|
|
return LightDMGreeter.restart() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bridge.method(str) |
|
|
|
|
|
|
|
def set_language(self, lang): |
|
|
|
|
|
|
|
if self.is_authenticated: |
|
|
|
|
|
|
|
LightDMGreeter.set_language(lang) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bridge.method(result=bool) |
|
|
|
|
|
|
|
def shutdown(self): |
|
|
|
|
|
|
|
return LightDMGreeter.shutdown() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bridge.method(str, result=bool) |
|
|
|
|
|
|
|
def start_session(self, session): |
|
|
|
|
|
|
|
return LightDMGreeter.start_session_sync(session) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bridge.method(result=bool) |
|
|
|
|
|
|
|
def suspend(self): |
|
|
|
|
|
|
|
return LightDMGreeter.suspend() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|