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. 75
      web-greeter/bridge/Greeter.py
  4. 3
      web-greeter/greeter.py
  5. 28
      web-greeter/whither.yml

1
themes/antergos/css/style.css

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

14
themes/antergos/js/greeter.js

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

75
web-greeter/bridge/Greeter.py

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

3
web-greeter/greeter.py

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

28
web-greeter/whither.yml

@ -13,26 +13,26 @@ WebGreeter:
width:
height:
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.
title: Web Greeter for LightDM
icon:
no_desktop_env: False
toolbar:
enabled: False
# App's Config
app:
background_images_dir: @background_images_dir@
config_dir: @config_dir@
greeters_dir: @greeters_dir@
has_lightdm_1_19_2: @has_lightdm_1_19_2@
locale_dir: @locale_dir@
logo_image: @logo_image@
themes_dir: @themes_dir@
user_image: @user_image@
background_images_dir: '@background_images_dir@'
config_dir: '@config_dir@'
greeters_dir: '@greeters_dir@'
has_lightdm_1_19_2: '@has_lightdm_1_19_2@'
locale_dir: '@locale_dir@'
logo_image: '@logo_image@'
themes_dir: /home/dustin/github/antergos/lightdm-webkit2-greeter/themes
user_image: '@user_image@'
version:
full: @full_version@
major: @major_version@
minor: @minor_version@
micro: @micro_version@
full: '@full_version@'
major: '@major_version@'
minor: '@minor_version@'
micro: '@micro_version@'

Loading…
Cancel
Save