welcome: move setup to constructor
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import gettext
|
||||
import locale
|
||||
from pathlib import Path
|
||||
|
||||
from gi.repository import Gtk
|
||||
@@ -20,22 +22,11 @@ class WelcomePage(Gtk.Box, Page):
|
||||
def __init__(self, **kwargs):
|
||||
Gtk.Box.__init__(self, **kwargs)
|
||||
config = global_state.get_config('welcome_page')
|
||||
language_code = global_state.get_config('language_code')
|
||||
|
||||
if config['logo']:
|
||||
self.image = Path(config['logo'])
|
||||
|
||||
### callbacks ###
|
||||
|
||||
@Gtk.Template.Callback('continue')
|
||||
def _continue(self, button):
|
||||
global_state.advance(self)
|
||||
|
||||
### public methods ###
|
||||
|
||||
def load_once(self):
|
||||
config = global_state.get_config('welcome_page')
|
||||
language_code = global_state.get_config('language_code')
|
||||
|
||||
if (text_key := f'text_{language_code}') in config:
|
||||
text = config[text_key]
|
||||
elif config['text']:
|
||||
@@ -44,3 +35,9 @@ class WelcomePage(Gtk.Box, Page):
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user