add welcome page
This commit is contained in:
@@ -15,6 +15,7 @@ blueprints = custom_target('blueprints',
|
||||
'ui/pages/restart.blp',
|
||||
'ui/pages/software.blp',
|
||||
'ui/pages/user.blp',
|
||||
'ui/pages/welcome.blp',
|
||||
'ui/widgets/device_row.blp',
|
||||
'ui/widgets/language_row.blp',
|
||||
'ui/widgets/page_wrapper.blp',
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
<file preprocess="xml-stripblanks">ui/pages/restart.ui</file>
|
||||
<file preprocess="xml-stripblanks">ui/pages/software.ui</file>
|
||||
<file preprocess="xml-stripblanks">ui/pages/user.ui</file>
|
||||
<file preprocess="xml-stripblanks">ui/pages/welcome.ui</file>
|
||||
|
||||
<file preprocess="xml-stripblanks">ui/widgets/device_row.ui</file>
|
||||
<file preprocess="xml-stripblanks">ui/widgets/language_row.ui</file>
|
||||
|
||||
34
data/resources/ui/pages/welcome.blp
Normal file
34
data/resources/ui/pages/welcome.blp
Normal file
@@ -0,0 +1,34 @@
|
||||
using Gtk 4.0;
|
||||
using Adw 1;
|
||||
|
||||
template WelcomePage : Box {
|
||||
name: _("Welcome");
|
||||
orientation: vertical;
|
||||
spacing: 30;
|
||||
|
||||
Adw.Clamp {
|
||||
margin-top: 18;
|
||||
maximum-size: 280;
|
||||
|
||||
Label description {
|
||||
/* Translators: TODO */
|
||||
label: _("This installer will guide you through the installation of {} onto your system.");
|
||||
wrap: true;
|
||||
justify: center;
|
||||
styles ["heading"]
|
||||
}
|
||||
}
|
||||
|
||||
CenterBox {
|
||||
[center]
|
||||
Button {
|
||||
/* Translators: On button. */
|
||||
label: _("_Continue");
|
||||
focusable: true;
|
||||
receives-default: true;
|
||||
use-underline: true;
|
||||
clicked => continue();
|
||||
styles ["suggested-action", "pill"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,11 @@ suggested_languages:
|
||||
- 'ru'
|
||||
- 'zh'
|
||||
|
||||
# Show a welcome page after language selection.
|
||||
# Default: usage: yes
|
||||
welcome_page:
|
||||
usage: yes
|
||||
|
||||
# Minimum disk size needed for the installation (in Gigabyte)
|
||||
# Default: 5
|
||||
minimum_disk_size: 5
|
||||
|
||||
@@ -39,6 +39,7 @@ def _configure_variables_set(config):
|
||||
|
||||
def _load_default_config():
|
||||
return {
|
||||
'welcome_page': {'usage': True},
|
||||
'internet_connection_required': True,
|
||||
'internet_checker_url': 'http://nmcheck.gnome.org/check_network_status.txt',
|
||||
'suggested_languages': ['en', 'ar', 'de', 'es', 'fr', 'ja', 'ru', 'zh'],
|
||||
@@ -72,6 +73,9 @@ def _set_testing_defaults(config):
|
||||
def _valid(config):
|
||||
assert not config['fixed_language'] == True, 'Need to specify or disable fixed language.'
|
||||
return (
|
||||
_match(config, 'welcome_page', dict) and
|
||||
'usage' in config['welcome_page'] and
|
||||
_match(config['welcome_page'], 'usage', bool) and
|
||||
_match(config, 'internet_connection_required', bool) and
|
||||
_match(config, 'internet_checker_url', str) and
|
||||
_match(config, 'suggested_languages', list) and
|
||||
|
||||
@@ -37,6 +37,7 @@ os_installer_sources = [
|
||||
'ui/pages/restart.py',
|
||||
'ui/pages/software.py',
|
||||
'ui/pages/user.py',
|
||||
'ui/pages/welcome.py',
|
||||
'ui/widgets.py',
|
||||
'ui/window.py',
|
||||
'util/installation_scripting.py',
|
||||
|
||||
28
src/ui/pages/welcome.py
Normal file
28
src/ui/pages/welcome.py
Normal file
@@ -0,0 +1,28 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from gi.repository import Gtk
|
||||
|
||||
from .global_state import global_state
|
||||
from .installation_scripting import installation_scripting, Step
|
||||
from .page import Page
|
||||
from .widgets import reset_model, DeviceRow
|
||||
|
||||
|
||||
@Gtk.Template(resource_path='/com/github/p3732/os-installer/ui/pages/welcome.ui')
|
||||
class WelcomePage(Gtk.Box, Page):
|
||||
__gtype_name__ = __qualname__
|
||||
image_name = 'weather-clear-symbolic'
|
||||
|
||||
description = Gtk.Template.Child()
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
Gtk.Box.__init__(self, **kwargs)
|
||||
text = self.description.get_label()
|
||||
text = text.format(global_state.get_config('distribution_name'))
|
||||
self.description.set_label(text)
|
||||
|
||||
### callbacks ###
|
||||
|
||||
@Gtk.Template.Callback('continue')
|
||||
def _continue(self, button):
|
||||
global_state.advance(self)
|
||||
@@ -19,6 +19,7 @@ from .locale import LocalePage
|
||||
from .restart import RestartPage
|
||||
from .software import SoftwarePage
|
||||
from .user import UserPage
|
||||
from .welcome import WelcomePage
|
||||
from .widgets import PageWrapper
|
||||
|
||||
from .confirm_quit_popup import ConfirmQuitPopup
|
||||
@@ -82,6 +83,7 @@ class OsInstallerWindow(Adw.ApplicationWindow):
|
||||
pages = [
|
||||
# pre-installation section
|
||||
(LanguagePage, self._offer_language_selection()),
|
||||
(WelcomePage, global_state.get_config('welcome_page')['usage']),
|
||||
(KeyboardLayoutPage, True),
|
||||
(InternetPage, global_state.get_config(
|
||||
'internet_connection_required')),
|
||||
|
||||
Reference in New Issue
Block a user