diff --git a/src/gresource/greeter-resources.gresource.xml b/src/gresource/greeter-resources.gresource.xml deleted file mode 100644 index fa2c5bc..0000000 --- a/src/gresource/greeter-resources.gresource.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - css/style.css - js/bundle.js - - - - - - diff --git a/web-greeter/bridge/Config.py b/web-greeter/bridge/Config.py index ed1d3ed..2b1ff48 100644 --- a/web-greeter/bridge/Config.py +++ b/web-greeter/bridge/Config.py @@ -26,4 +26,27 @@ # You should have received a copy of the GNU General Public License # along with Web Greeter; If not, see . -# Standard Lib +# 3rd-Party Libs +from PyQt5.QtCore import QVariant + +# This Application +from whither.bridge import ( + BridgeObject, + bridge, +) + + +class Config(BridgeObject): + + def __init__(self, config, *args, **kwargs): + super().__init__(name='Config', *args, **kwargs) + + self._branding, self._greeter = config.branding, config.greeter + + @bridge.prop(QVariant) + def branding(self): + return self._branding + + @bridge.prop(QVariant) + def greeter(self): + return self._greeter diff --git a/web-greeter/greeter.py b/web-greeter/greeter.py index a5eddd1..854c379 100644 --- a/web-greeter/greeter.py +++ b/web-greeter/greeter.py @@ -36,6 +36,7 @@ from whither.base.data import AttributeDict # This Application from bridge.Greeter import Greeter +from bridge.Config import Config BASE_DIR = os.path.dirname(os.path.realpath(__file__)) @@ -51,7 +52,7 @@ class WebGreeter(App): self.get_and_save_user_config() self._greeter = Greeter() - self._web_container.bridge_objects = (self._greeter,) + self._web_container.bridge_objects = (self._greeter, Config(self._user_config)) self._web_container.initialize_bridge_objects() self.load_theme() diff --git a/src/gresource/css/style.css b/web-greeter/resources/css/style.css similarity index 100% rename from src/gresource/css/style.css rename to web-greeter/resources/css/style.css diff --git a/src/gresource/js/ThemeUtils.js b/web-greeter/resources/js/ThemeUtils.js similarity index 100% rename from src/gresource/js/ThemeUtils.js rename to web-greeter/resources/js/ThemeUtils.js diff --git a/src/gresource/js/_vendor/moment-with-locales.min.js b/web-greeter/resources/js/_vendor/moment-with-locales.min.js similarity index 100% rename from src/gresource/js/_vendor/moment-with-locales.min.js rename to web-greeter/resources/js/_vendor/moment-with-locales.min.js diff --git a/web-greeter/resources/js/bootstrap.js b/web-greeter/resources/js/bootstrap.js new file mode 100644 index 0000000..cce358f --- /dev/null +++ b/web-greeter/resources/js/bootstrap.js @@ -0,0 +1,40 @@ +/* + * bootstrap.js + * + * Copyright © 2017 Antergos Developers + * + * This file is part of lightdm-webkit2-greeter. + * + * lightdm-webkit2-greeter is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * lightdm-webkit2-greeter is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * The following additional terms are in effect as per Section 7 of the license: + * + * The preservation of all legal notices and author attributions in + * the material or in the Appropriate Legal Notices displayed + * by works containing it is required. + * + * You should have received a copy of the GNU General Public License + * along with lightdm-webkit2-greeter; If not, see . + */ + +let _channel; + + +function initialize() { + new QWebChannel( qt.webChannelTransport, channel => { + _channel = channel; + window.lightdm = _channel.objects.LightDMGreeter; + window.greeter_config = _channel.objects.Config; + }); +} + + +$(window).on('load', initialize); diff --git a/src/gresource/js/Greeter.js b/web-greeter/resources/js/docs/Greeter.js similarity index 100% rename from src/gresource/js/Greeter.js rename to web-greeter/resources/js/docs/Greeter.js diff --git a/src/gresource/js/GreeterConfig.js b/web-greeter/resources/js/docs/GreeterConfig.js similarity index 100% rename from src/gresource/js/GreeterConfig.js rename to web-greeter/resources/js/docs/GreeterConfig.js diff --git a/src/gresource/js/LightDMObjects.js b/web-greeter/resources/js/docs/LightDMObjects.js similarity index 100% rename from src/gresource/js/LightDMObjects.js rename to web-greeter/resources/js/docs/LightDMObjects.js diff --git a/web-greeter/resources/resources.qrc b/web-greeter/resources/resources.qrc new file mode 100644 index 0000000..f90a478 --- /dev/null +++ b/web-greeter/resources/resources.qrc @@ -0,0 +1,9 @@ + + + + css/style.css + js/bundle.js + + + +