Browse Source

Some fixes

sisyphus
JezerM 4 years ago
parent
commit
3c9dff1dc0
  1. 59
      themes/_vendor/js/mock.js
  2. 2
      web-greeter/resources/js/ThemeUtils.js
  3. 4
      web-greeter/resources/js/docs/Greeter.js
  4. 8
      web-greeter/utils/config.py

59
themes/_vendor/js/mock.js vendored

@ -38,21 +38,21 @@ String.prototype.capitalize = function() {
/** /**
* @memberOf window * @memberOf window
* @type {LightDM.LightDMGreeter} * @type {LightDM.Greeter}
*/ */
let lightdm = null; let lightdm = null;
/** /**
* @memberOf window * @memberOf window
* @type {LightDM.GreeterUtil} * @type {LightDM.ThemeUtils}
*/ */
let greeter_util = null; let theme_utils = null;
/** /**
* @memberOf window * @memberOf window
* @type {LightDM.ConfigFile} * @type {LightDM.GreeterConfig}
*/ */
let config = null; let greeter_config = null;
/** /**
@ -61,7 +61,7 @@ let config = null;
/** /**
* Interface for object that holds info about a session. Session objects are not * Interface for object that holds info about a session. Session objects are not
* created by the theme's code, but rather by the {@link LightDMGreeter} class. * created by the theme's code, but rather by the {@link Greeter} class.
* @memberOf LightDM * @memberOf LightDM
*/ */
class LightDMSession { class LightDMSession {
@ -92,7 +92,7 @@ class LightDMSession {
/** /**
* Interface for object that holds info about a language on this system. Language objects are not * Interface for object that holds info about a language on this system. Language objects are not
* created by the theme's code, but rather by the {@link LightDMGreeter} class. * created by the theme's code, but rather by the {@link Greeter} class.
* @memberOf LightDM * @memberOf LightDM
*/ */
class LightDMLanguage { class LightDMLanguage {
@ -123,7 +123,7 @@ class LightDMLanguage {
/** /**
* Interface for object that holds info about a keyboard layout on this system. Language * Interface for object that holds info about a keyboard layout on this system. Language
* objects are not created by the theme's code, but rather by the {@link LightDMGreeter} class. * objects are not created by the theme's code, but rather by the {@link Greeter} class.
* @memberOf LightDM * @memberOf LightDM
*/ */
class LightDMLayout { class LightDMLayout {
@ -154,7 +154,7 @@ class LightDMLayout {
/** /**
* Interface for object that holds info about a user account on this system. User * Interface for object that holds info about a user account on this system. User
* objects are not created by the theme's code, but rather by the {@link LightDMGreeter} class. * objects are not created by the theme's code, but rather by the {@link Greeter} class.
* @memberOf LightDM * @memberOf LightDM
*/ */
class LightDMUser { class LightDMUser {
@ -214,22 +214,6 @@ class LightDMUser {
* @readonly * @readonly
*/ */
this.session = user_info.session; this.session = user_info.session;
/**
* DEPRECATED!
* @deprecated See {@link LightDMUser.username}.
* @type {String}
* @readonly
*/
this.name = user_info.name;
/**
* DEPRECATED!
* @deprecated See {@link LightDMUser.display_name}.
* @type {String}
* @readonly
*/
this.real_name = user_info.real_name;
} }
} }
@ -240,7 +224,7 @@ class LightDMUser {
* with the global variable: `greeter_util`. * with the global variable: `greeter_util`.
* @memberOf LightDM * @memberOf LightDM
*/ */
class GreeterUtil { class ThemeUtils {
constructor() { constructor() {
if ( null !== greeter_util ) { if ( null !== greeter_util ) {
@ -287,7 +271,7 @@ class GreeterUtil {
* with the global variable: `config`. * with the global variable: `config`.
* @memberOf LightDM * @memberOf LightDM
*/ */
class ConfigFile { class GreeterConfig {
constructor() { constructor() {
if ( null !== config ) { if ( null !== config ) {
@ -342,13 +326,13 @@ let MockObjects = {
/** /**
* Singleton class which implements the LightDMGreeter Interface. Greeter themes will * Singleton class which implements the Greeter Interface. Greeter themes will
* interact directly with this class to facilitate the user log in processes. * interact directly with this class to facilitate the user log in processes.
* The greeter will automatically create an instance of this class when it starts. * The greeter will automatically create an instance of this class when it starts.
* The instance can be accessed with the global variable: `lightdm`. * The instance can be accessed with the global variable: `lightdm`.
* @memberOf LightDM * @memberOf LightDM
*/ */
class LightDMGreeter { class Greeter {
constructor() { constructor() {
if ( null !== lightdm ) { if ( null !== lightdm ) {
@ -816,9 +800,6 @@ let MockData = () => ({
username: 'superman', username: 'superman',
logged_in: false, logged_in: false,
session: 'gnome', session: 'gnome',
name: 'superman',
real_name: 'Clark Kent'
}, },
{ {
display_name: 'Bruce Wayne', display_name: 'Bruce Wayne',
@ -829,30 +810,24 @@ let MockData = () => ({
username: 'batman', username: 'batman',
logged_in: false, logged_in: false,
session: 'cinnamon', session: 'cinnamon',
name: 'batman',
real_name: 'Bruce Wayne'
}, },
{ {
display_name: 'Peter Parker', display_name: 'Peter Parker',
language: null, language: null,
layout: null, layout: null,
image: '/usr/share/lightdm-webkit/themes/antergos/img/antergos-logo-user', image: '/usr/share/web-greeter/themes/antergos/img/antergos-logo-user',
home_directory: '/home/spiderman', home_directory: '/home/spiderman',
username: 'spiderman', username: 'spiderman',
logged_in: false, logged_in: false,
session: 'MATE', session: 'MATE',
name: 'spiderman',
real_name: 'Peter Parker'
} }
] ]
}); });
new ConfigFile(); new GreeterConfig();
new GreeterUtil(); new ThemeUtils();
new LightDMGreeter(); new Greeter();
// mock lighdm for testing // mock lighdm for testing

2
web-greeter/resources/js/ThemeUtils.js

@ -1,5 +1,5 @@
/* /*
* GreeterUtils.js * ThemeUtils.js
* *
* Copyright © 2017 Antergos Developers <dev@antergos.com> * Copyright © 2017 Antergos Developers <dev@antergos.com>
* *

4
web-greeter/resources/js/docs/Greeter.js vendored

@ -266,9 +266,7 @@ class Greeter {
* Triggers the system to hibernate. * Triggers the system to hibernate.
* @returns {boolean} {@link true} if hibernation initiated, otherwise {@link false} * @returns {boolean} {@link true} if hibernation initiated, otherwise {@link false}
*/ */
hibernate() { hibernate() {}
return this._do_mocked_system_action('hibernate');
}
/** /**
* Provide a response to a prompt. * Provide a response to a prompt.

8
web-greeter/utils/config.py

@ -45,12 +45,13 @@ def javaScriptConsoleMessage(self, level: WebPage.JavaScriptConsoleMessageLevel,
elif level == WebPage.JavaScriptConsoleMessageLevel.WarningMessageLevel: elif level == WebPage.JavaScriptConsoleMessageLevel.WarningMessageLevel:
typeLog = "[WARNING]" typeLog = "[WARNING]"
elif level == WebPage.JavaScriptConsoleMessageLevel.InfoMessageLevel: elif level == WebPage.JavaScriptConsoleMessageLevel.InfoMessageLevel:
typeLog = "[LOG]" return
else: else:
return return
logMessage = "{typ} {source} {line}: {msg}".format(typ = typeLog, msg = message, source = sourceID, line = lineNumber) logMessage = "{typ} {source} {line}: {msg}".format(typ = typeLog, msg = message, source = sourceID, line = lineNumber)
print(logMessage) print(logMessage)
if error: if error:
errorMessage = "{source} {line}: {msg}".format(source = sourceID, line = lineNumber, msg = message) errorMessage = "{source} {line}: {msg}".format(source = sourceID, line = lineNumber, msg = message)
errorPrompt(errorMessage) errorPrompt(errorMessage)
@ -87,7 +88,10 @@ class ErrorDialog(QDialog):
self.done(2) self.done(2)
def errorPrompt(err): def errorPrompt(err):
print("ERROR PROMPT")
if not globals.greeter.config.greeter.detect_theme_errors:
return
dia = ErrorDialog(globals.greeter._main_window.widget.centralWidget(), err) dia = ErrorDialog(globals.greeter._main_window.widget.centralWidget(), err)
dia.exec() dia.exec()

Loading…
Cancel
Save