Browse Source

almost ready for testing

sisyphus
Dustin Falgout 8 years ago
parent
commit
d682a4636a
  1. 1
      themes/antergos/css/style.css
  2. 14
      themes/antergos/js/greeter.js
  3. 77
      web-greeter/bridge/Greeter.py
  4. 3
      web-greeter/greeter.py
  5. 30
      web-greeter/whither.yml

1
themes/antergos/css/style.css

@ -44,6 +44,7 @@
body { body {
-webkit-font-smoothing: antialiased !important; -webkit-font-smoothing: antialiased !important;
text-rendering: optimizeLegibility !important; text-rendering: optimizeLegibility !important;
background-color: #000000;
} }
*:focus { *:focus {

14
themes/antergos/js/greeter.js

@ -425,14 +425,14 @@ class Theme {
$( '.submit_passwd' ).on( 'click', event => this.submit_password(event) ); $( '.submit_passwd' ).on( 'click', event => this.submit_password(event) );
$( '[data-i18n="debug_log"]' ).on( 'click', event => this.show_log_handler(event) ); $( '[data-i18n="debug_log"]' ).on( 'click', event => this.show_log_handler(event) );
window.show_prompt = (prompt, type) => this.show_prompt(prompt, type); lightdm.show_prompt.connect( (prompt, type) => this.show_prompt(prompt, type) );
window.show_message = (msg, type) => this.show_message(msg, type); lightdm.show_message.connect( (msg, type) => this.show_message(msg, type) );
window.start_authentication = event => this.start_authentication(event); window.start_authentication = event => this.start_authentication(event);
window.cancel_authentication = event => this.cancel_authentication(event); window.cancel_authentication = event => this.cancel_authentication(event);
window.authentication_complete = () => this.authentication_complete(); lightdm.authentication_complete.connect( () => this.authentication_complete() );
window.autologin_timer_expired = event => this.cancel_authentication(event); lightdm.autologin_timer_expired.connect( event => this.cancel_authentication(event) );
} }
/** /**
@ -619,7 +619,7 @@ class Theme {
* @param {object} event - jQuery.Event object from 'click' event. * @param {object} event - jQuery.Event object from 'click' event.
*/ */
start_authentication( event ) { start_authentication( event ) {
let user_id = $( this ).attr( 'id' ), let user_id = $( event.target ).attr( 'id' ),
selector = `.${user_id}`, selector = `.${user_id}`,
user_session_cached = _config._get( 'user', user_id, 'session' ), user_session_cached = _config._get( 'user', user_id, 'session' ),
user_session = is_empty( user_session_cached ) ? lightdm.default_session : user_session_cached; user_session = is_empty( user_session_cached ) ? lightdm.default_session : user_session_cached;
@ -711,7 +711,7 @@ class Theme {
if ( lightdm.is_authenticated ) { if ( lightdm.is_authenticated ) {
// The user entered the correct password. Let's start the session. // The user entered the correct password. Let's start the session.
$( 'body' ).fadeOut( 1000, () => lightdm.login( lightdm.authentication_user, selected_session ) ); $( 'body' ).fadeOut( 1000, () => lightdm.start_session( selected_session ) );
} else { } else {
// The user did not enter the correct password. Show error message. // The user did not enter the correct password. Show error message.
@ -722,6 +722,7 @@ class Theme {
submit_password( event ) { submit_password( event ) {
let passwd = $( '#passwordField' ).val(); let passwd = $( '#passwordField' ).val();
console.log(lightdm.authentication_user);
$( '#passwordArea' ).hide(); $( '#passwordArea' ).hide();
$( '#timerArea' ).show(); $( '#timerArea' ).show();
@ -745,7 +746,6 @@ class Theme {
key_press_handler( event ) { key_press_handler( event ) {
let action; let action;
console.log(event);
switch ( event.which ) { switch ( event.which ) {
case 13: case 13:

77
web-greeter/bridge/Greeter.py

@ -27,6 +27,7 @@
# along with Web Greeter; If not, see <http://www.gnu.org/licenses/>. # along with Web Greeter; If not, see <http://www.gnu.org/licenses/>.
# Standard Lib # Standard Lib
import time
# 3rd-Party Libs # 3rd-Party Libs
import gi import gi
@ -37,6 +38,7 @@ from whither.bridge import (
bridge, bridge,
Variant, Variant,
) )
from PyQt5.QtCore import QTimer
# This Application # This Application
from . import ( from . import (
@ -53,22 +55,19 @@ LightDMUsers = LightDM.UserList()
class Greeter(BridgeObject): class Greeter(BridgeObject):
authentication_complete = bridge.signal(LightDM.Greeter, name='authentication_complete') # LightDM.Greeter Signals
autologin_timer_expired = bridge.signal(LightDM.Greeter, name='autologin_timer_expired') authentication_complete = bridge.signal()
autologin_timer_expired = bridge.signal()
idle = bridge.signal()
reset = bridge.signal()
show_message = bridge.signal(str, LightDM.MessageType, arguments=('text', 'type'))
show_prompt = bridge.signal(str, LightDM.PromptType, arguments=('text', 'type'))
idle = bridge.signal(LightDM.Greeter, name='idle') # Property values are cached on the JavaScript side and will only update when
reset = bridge.signal(LightDM.Greeter, name='reset') # a notify signal is emitted. We use the same signal for all properties which means
# all properties get updated when any property is changed. That's not a problem with
show_message = bridge.signal( # the small number of properties we have.
(LightDM.Greeter, str, LightDM.MessageType), property_changed = bridge.signal()
name='show_message',
arguments=('text', 'type')
)
show_prompt = bridge.signal(
(LightDM.Greeter, str, LightDM.PromptType),
name='show_prompt',
arguments=('text', 'type')
)
def __init__(self, themes_dir, *args, **kwargs): def __init__(self, themes_dir, *args, **kwargs):
super().__init__(name='LightDMGreeter', *args, **kwargs) super().__init__(name='LightDMGreeter', *args, **kwargs)
@ -87,14 +86,32 @@ class Greeter(BridgeObject):
self._shared_data_directory = user_data_dir.rpartition('/')[0] self._shared_data_directory = user_data_dir.rpartition('/')[0]
def _connect_signals(self): def _connect_signals(self):
LightDMGreeter.connect('authentication-complete', self.authentication_complete.emit) LightDMGreeter.connect(
LightDMGreeter.connect('autologin-timer-expired', self.authentication_complete.emit) 'authentication-complete',
LightDMGreeter.connect('idle', self.idle.emit) lambda greeter: self._emit_signal(self.authentication_complete)
LightDMGreeter.connect('reset', self.reset.emit) )
LightDMGreeter.connect('show-message', self.show_message.emit) LightDMGreeter.connect(
LightDMGreeter.connect('show-prompt', self.show_prompt.emit) 'autologin-timer-expired',
lambda greeter: self._emit_signal(self.autologin_timer_expired)
@bridge.prop(str) )
LightDMGreeter.connect('idle', lambda greeter: self._emit_signal(self.idle))
LightDMGreeter.connect('reset', lambda greeter: self._emit_signal(self.reset))
LightDMGreeter.connect(
'show-message',
lambda greeter, msg, mtype: self._emit_signal(self.show_message, msg, mtype)
)
LightDMGreeter.connect(
'show-prompt',
lambda greeter, msg, mtype: self._emit_signal(self.show_prompt, msg, mtype)
)
def _emit_signal(self, _signal, *args):
self.property_changed.emit()
QTimer().singleShot(300, lambda: _signal.emit(*args))
@bridge.prop(str, notify=property_changed)
def authentication_user(self): def authentication_user(self):
return LightDMGreeter.get_authentication_user() or '' return LightDMGreeter.get_authentication_user() or ''
@ -142,15 +159,15 @@ class Greeter(BridgeObject):
def hostname(self): def hostname(self):
return LightDM.get_hostname() return LightDM.get_hostname()
@bridge.prop(bool) @bridge.prop(bool, notify=property_changed)
def in_authentication(self): def in_authentication(self):
return LightDMGreeter.get_in_authentication() return LightDMGreeter.get_in_authentication()
@bridge.prop(bool) @bridge.prop(bool, notify=property_changed)
def is_authenticated(self): def is_authenticated(self):
return LightDMGreeter.get_is_authenticated() return LightDMGreeter.get_is_authenticated()
@bridge.prop(Variant) @bridge.prop(Variant, notify=property_changed)
def language(self): def language(self):
return language_to_dict(LightDM.get_language()) return language_to_dict(LightDM.get_language())
@ -170,7 +187,7 @@ class Greeter(BridgeObject):
def lock_hint(self): def lock_hint(self):
return LightDMGreeter.get_lock_hint() return LightDMGreeter.get_lock_hint()
@bridge.prop(Variant) @bridge.prop(Variant, notify=property_changed)
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()]
@ -209,18 +226,22 @@ class Greeter(BridgeObject):
@bridge.method(str) @bridge.method(str)
def authenticate(self, username): def authenticate(self, username):
LightDMGreeter.authenticate(username) LightDMGreeter.authenticate(username)
self.property_changed.emit()
@bridge.method() @bridge.method()
def authenticate_as_guest(self): def authenticate_as_guest(self):
LightDMGreeter.authenticate_as_guest() LightDMGreeter.authenticate_as_guest()
self.property_changed.emit()
@bridge.method() @bridge.method()
def cancel_authentication(self): def cancel_authentication(self):
LightDMGreeter.cancel_authentication() LightDMGreeter.cancel_authentication()
self.property_changed.emit()
@bridge.method() @bridge.method()
def cancel_autologin(self): def cancel_autologin(self):
LightDMGreeter.cancel_autologin() LightDMGreeter.cancel_autologin()
self.property_changed.emit()
@bridge.method(result=bool) @bridge.method(result=bool)
def hibernate(self): def hibernate(self):
@ -229,6 +250,7 @@ class Greeter(BridgeObject):
@bridge.method(str) @bridge.method(str)
def respond(self, response): def respond(self, response):
LightDMGreeter.respond(response) LightDMGreeter.respond(response)
self.property_changed.emit()
@bridge.method(result=bool) @bridge.method(result=bool)
def restart(self): def restart(self):
@ -238,6 +260,7 @@ class Greeter(BridgeObject):
def set_language(self, lang): def set_language(self, lang):
if self.is_authenticated: if self.is_authenticated:
LightDMGreeter.set_language(lang) LightDMGreeter.set_language(lang)
self.property_changed.emit()
@bridge.method(result=bool) @bridge.method(result=bool)
def shutdown(self): def shutdown(self):

3
web-greeter/greeter.py

@ -80,7 +80,8 @@ class WebGreeter(App):
def load_theme(self): def load_theme(self):
theme_url = 'file://{0}/{1}/index.html'.format( theme_url = 'file://{0}/{1}/index.html'.format(
self.config.themes_dir, self.config.themes_dir,
self.user_config.greeter.webkit_theme 'antergos'
#self.user_config.greeter.webkit_theme
) )
self._web_container.load(theme_url) self._web_container.load(theme_url)

30
web-greeter/whither.yml

@ -13,26 +13,26 @@ WebGreeter:
width: width:
height: height:
initial_state: maximized # normal|maximized|minimized|fullscreen initial_state: maximized # normal|maximized|minimized|fullscreen
decorated: False # Should the window show standard titlebar and action buttons. decorated: True # Should the window show standard titlebar and action buttons.
stays_on_top: False # Should the window stay on top of all other windows. stays_on_top: False # Should the window stay on top of all other windows.
title: Web Greeter for LightDM title: Web Greeter for LightDM
icon: icon:
no_desktop_env: False
toolbar: toolbar:
enabled: False enabled: False
# App's Config # App's Config
app: app:
background_images_dir: @background_images_dir@ background_images_dir: '@background_images_dir@'
config_dir: @config_dir@ config_dir: '@config_dir@'
greeters_dir: @greeters_dir@ greeters_dir: '@greeters_dir@'
has_lightdm_1_19_2: @has_lightdm_1_19_2@ has_lightdm_1_19_2: '@has_lightdm_1_19_2@'
locale_dir: @locale_dir@ locale_dir: '@locale_dir@'
logo_image: @logo_image@ logo_image: '@logo_image@'
themes_dir: @themes_dir@ themes_dir: /home/dustin/github/antergos/lightdm-webkit2-greeter/themes
user_image: @user_image@ user_image: '@user_image@'
version: version:
full: @full_version@ full: '@full_version@'
major: @major_version@ major: '@major_version@'
minor: @minor_version@ minor: '@minor_version@'
micro: @micro_version@ micro: '@micro_version@'

Loading…
Cancel
Save