Browse Source

Finish Theme class. Also some work on build config.

sisyphus
Dustin Falgout 8 years ago
parent
commit
d0e7b401b4
  1. 101
      meson.build
  2. 2
      meson_options.txt
  3. 19
      web-greeter/utils/theme.py
  4. 35
      web-greeter/whither.yml

101
meson.build

@ -1,84 +1,95 @@
project('lightdm-webkit2-greeter', 'python', version: '3.0.0', license: 'GPL-3')
project('web-greeter', 'python', version: '3.0.0alpha1', license: 'GPL-3')
# ================================== #
# ------->>> Version Vars <<<------- #
# ================================== #
as_version = meson.project_version()
version = meson.project_version()
version_parts = as_version.split('.')
as_major_version = version_parts[0]
as_minor_version = version_parts[1]
as_micro_version = version_parts[2]
major_version = version_parts[0]
minor_version = version_parts[1]
micro_version = version_parts[2]
# ======================================= #
# ------->>> Dependency Checks <<<------- #
# ======================================= #
python_dep = join(meson.build_root(), 'python_dep.py')
dbus_glib = dependency('dbus-glib-1')
lightdm_gobject = dependency('liblightdm-gobject-1')
x11 = dependency('x11')
web_engine = dependency('qt5', modules: ['WebEngine', 'WebEngineWidgets', 'WebChannel'])
gtk3 = dependency('gtk+-3.0', version: '>=3.18')
webkit2 = dependency('webkit2gtk-4.0', version: '>=2.12')
webkit2_webext = dependency('webkit2gtk-web-extension-4.0', version: '>=2.12')
greeter_deps = [dbus_glib, gtk3, webkit2, x11]
webext_deps = [webkit2_webext, lightdm_gobject]
pyqt5_check = run_command(python_dep, 'PyQt5')
has_webkitgtk_2_14 = webkit2.version().version_compare('>=2.14')
has_lightdm_1_19_2 = lightdm_gobject.version().version_compare('>=1.19.2')
has_gtk_3_22 = gtk3.version().version_compare('>=3.22')
if pyqt5_check.return_code() == 0:
pyqt5 = declare_dependency(version: pyqt5_check.stdout().strip())
else
pyqt5 = declare_dependency(version: '0.0.1')
endif
# =================================== #
# ------->>> Configuration <<<------- #
# =================================== #
conf = configuration_data()
config_file = 'webkit2-greeter.conf'
config_file_legacy = 'lightdm-webkit2-greeter.conf'
yaml_check = run_command(python_dep, 'ruamel.yaml')
if yaml_check.return_code() == 0:
yaml = declare_dependency(version: yaml_check.stdout().strip())
else
yaml = declare_dependency(version: '0.0.1')
endif
conf.set('VERSION', as_version)
conf.set('PACKAGE_VERSION', as_version)
conf.set('AS_MAJOR_VERSION', as_major_version)
conf.set('AS_MINOR_VERSION', as_minor_version)
conf.set('AS_MICRO_VERSION', as_micro_version)
python_dependencies = [
['pyqt5', pyqt5],
['ruamel.yaml', yaml]
]
conf.set('GETTEXT_PACKAGE', '"lightdm-webkit2-greeter"')
foreach dep: python_dependencies
if not dep.get(1).version().version_compare(>0.0.1):
error('Missing Dependency: @0@'.format(dep.get(0)))
endif
endforeach
conf.set('LOCALE_DIR', '"@0@"'.format(get_option('with-locale-dir')))
conf.set('THEME_DIR', '"@0@"'.format(get_option('with-theme-dir')))
greeter_deps = [dbus_glib, lightdm_gobject, web_engine, x11]
has_lightdm_1_19_2 = lightdm_gobject.version().version_compare('>=1.19.2')
conf.set('CONFIG_DIR', '"@0@"'.format(get_option('with-config-dir')))
conf.set('CONFIG_FILE', '"@0@"'.format(join_paths(get_option('with-config-dir'), config_file)))
# =================================== #
# ------->>> Configuration <<<------- #
# =================================== #
conf.set('CONFIG_FILE_LEGACY', '"@0@"'.format(join_paths(get_option('with-config-dir'), config_file_legacy)))
conf = configuration_data()
config_file = 'whither.yaml'
logo_image = get_option('with-logo-image', join_paths(get_option('with-themes-dir'), 'antergos/img/antergos.png'))
user_image = get_option('with-user-image', join_paths(get_option('with-themes-dir'), 'antergos/img/antergos-logo-user.png'))
conf.set('DESKTOP_DIR', '"@0@"'.format(get_option('with-desktop-dir')))
conf.set('full_version', version)
conf.set('major_version', major_version)
conf.set('minor_version', minor_version)
conf.set('micro_version', micro_version)
conf.set('WEBEXT_DIR', '"@0@"'.format(get_option('with-webext-dir')))
conf.set('locale_dir', get_option('with-locale-dir'))
conf.set('GRESOURCE_PATH', '"/com/antergos/webkit2-greeter"')
conf.set('themes_dir', get_option('with-themes-dir'))
conf.set('BACKGROUND_IMAGES_DIR', '"/usr/share/backgrounds"')
conf.set('config_dir', get_option('with-config-dir'))
conf.set('LOGO_IMAGE', '"@0@"'.format(join_paths(get_option('with-theme-dir'), 'antergos/img/antergos.png')))
conf.set('greeters_dir', get_option('with-greeters-dir'))
conf.set('USER_IMAGE', '"@0@"'.format(join_paths(get_option('with-theme-dir'), 'antergos/img/antergos-logo-user.png')))
conf.set('background_images_dir', get_option('with-background-images-dir'))
if has_webkitgtk_2_14
conf.set('HAS_WEBKITGTK_2_14', has_webkitgtk_2_14)
endif
conf.set('logo_image', logo_image)
if has_lightdm_1_19_2
conf.set('HAS_LIGHTDM_1_19_2', has_lightdm_1_19_2)
endif
conf.set('user_image', user_image)
if has_gtk_3_22
conf.set('HAS_GTK_3_22', has_gtk_3_22)
if has_lightdm_1_19_2
conf.set('has_lightdm_1_19_2', 'True')
else
conf.set('has_lightdm_1_19_2', 'False')
endif
@ -86,7 +97,7 @@ endif
# ------->>> Sub Directories <<<------- #
# ===================================== #
subdirs = ['src', 'man', 'themes', 'data', 'po']
subdirs = ['web-greeter', 'man', 'themes', 'dist', 'po']
foreach s : subdirs
subdir(s)

2
meson_options.txt

@ -1,4 +1,4 @@
option('with-theme-dir',
option('with-themes-dir',
type: 'string',
value: '/usr/share/lightdm-webkit/themes',
description: 'Directory to use for greeter themes')

19
web-greeter/utils/theme.py

@ -29,7 +29,6 @@
""" Utility class used to find and manage greeter themes. """
# Standard Lib
import json
import os
# This Application
@ -37,20 +36,24 @@ from .pkg_json import PackageJSON
class Theme:
"""
Represents a greeter theme installed on the local system.
Args:
path (str): The absolute path to the theme's directory.
Attributes:
data (PackageJSON): The theme's data sourced from its `package.json` file.
"""
def __init__(self, path: str) -> None:
self.path = path
self._initialize()
def _initialize(self):
def _initialize(self) -> None:
package_json = os.path.join(self.path, 'package.json')
try:
self.data = PackageJSON(package_json)
self.compatible = '3' in self.data.supports
data = json.loads(package_json)
except Exception:
self.data = None

35
web-greeter/whither.yml

@ -1,31 +1,38 @@
# Whither (Universal Linux Apps) Configuration
# The top-level keys in this file should be application names. This makes it possible to
# install multiple Whither-based apps on a single system, each with their own configuration.
# App Name
WebGreeter:
# Whither's Config
whither:
# Unique identifier string (dbus-style)
app_id: com.antergos.web-greeter
app_id: com.antergos.web-greeter # Unique identifier string (dbus style)
toolkit: auto # auto|qt|gtk
# A valid URI for an HTML page that will be loaded when the app starts.
entry_point:
autoload: False
url: ''
url: '' # Valid URI for an HTML page to be loaded when the app starts (autoload only).
window:
width: 1120
height: 720
width:
height:
initial_state: maximized # normal|maximized|minimized|fullscreen
# Whether or not the window should show standard titlebar and action buttons.
decorated: False
# Whether or not the window should stay on top of all other windows.
stays_on_top: False
decorated: False # 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: /usr/share/cnchi/data/icons/48x48/cnchi.png
icon:
toolbar:
enabled: False
# App's Config
app:
themes_dir: /home/dustin/github/antergos/lightdm-webkit2-greeter/themes
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@
version:
full: @full_version@
major: @major_version@
minor: @minor_version@
micro: @micro_version@

Loading…
Cancel
Save