- support for appimage
- use dedicated pages for subsystem and extra settings
- update presets
main
mirkobrombin 2 years ago
parent d812ac6b75
commit 41609360df

@ -1 +1 @@
0.0.6 0.0.7

2
debian/changelog vendored

@ -1,4 +1,4 @@
vanilla-first-setup (0.0.6) jammy; urgency=low vanilla-first-setup (0.0.7) jammy; urgency=low
* First release * First release

@ -1,5 +1,5 @@
project('io.github.vanilla-os.FirstSetup', project('io.github.vanilla-os.FirstSetup',
version: '0.0.6', version: '0.0.7',
meson_version: '>= 0.59.0', meson_version: '>= 0.59.0',
default_options: [ 'warning_level=2', default_options: [ 'warning_level=2',
'werror=false', 'werror=false',

@ -0,0 +1,9 @@
pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())
dialogsdir = join_paths(pkgdatadir, 'vanilla_first_setup/dialogs')
sources = [
'__init__.py',
'subsystem.py',
]
install_data(sources, install_dir: dialogsdir)

@ -0,0 +1,26 @@
# subsystem.py
#
# Copyright 2022 mirkobrombin
#
# This program 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 Foundationat version 3 of the License.
#
# This program 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.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from gi.repository import Gtk, Adw
@Gtk.Template(resource_path='/pm/mirko/FirstSetup/gtk/dialog-subsystem.ui')
class SubSystemDialog(Adw.Window):
__gtype_name__ = 'SubSystemDialog'
def __init__(self, window, **kwargs):
super().__init__(**kwargs)
self.set_transient_for(window)

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="4.0"/>
<requires lib="libadwaita" version="1.0"/>
<template class="SubSystemDialog" parent="AdwWindow">
<property name="title" translatable="yes">Info About Sub System</property>
<property name="default-width">500</property>
<property name="modal">True</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="AdwHeaderBar">
<style>
<class name="flat"/>
</style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="margin-top">10</property>
<property name="margin-start">10</property>
<property name="margin-end">10</property>
<property name="margin-bottom">20</property>
<property name="wrap">True</property>
<property name="label">The Sub-System is a container that allows you to install deb packages without altering the system. It is useful for installing software without having to enter in read-write mode.
You don't need to enter in the container to install packages, just use the apx command (wrapper around the apt inside the container) to install new programs and automatically make them available in your Vanilla OS installation.
This features uses distrobox as backend.</property>
</object>
</child>
</object>
</child>
</template>
</interface>

@ -3,8 +3,8 @@
<requires lib="gtk" version="4.0"/> <requires lib="gtk" version="4.0"/>
<requires lib="libadwaita" version="1.0" /> <requires lib="libadwaita" version="1.0" />
<template class="FirstSetupWindow" parent="AdwApplicationWindow"> <template class="FirstSetupWindow" parent="AdwApplicationWindow">
<property name="default-width">800</property> <property name="default-width">750</property>
<property name="default-height">600</property> <property name="default-height">630</property>
<property name="title">Vanilla OS First Setup</property> <property name="title">Vanilla OS First Setup</property>
<child> <child>
<object class="GtkBox"> <object class="GtkBox">
@ -54,36 +54,57 @@
<!-- Configuration --> <!-- Configuration -->
<child> <child>
<object class="GtkBox"> <object class="AdwStatusPage">
<property name="orientation">vertical</property> <property name="icon-name">package-x-generic-symbolic</property>
<property name="vexpand">True</property> <property name="title">Choose the Package Manager</property>
<property name="hexpand">True</property> <property name="description">Choose one or more package managers from the following options.</property>
<property name="valign">center</property> <property name="halign">fill</property>
<property name="valign">fill</property>
<property name="hexpand">true</property>
<child> <child>
<object class="AdwPreferencesPage"> <object class="GtkBox">
<property name="orientation">vertical</property>
<property name="vexpand">True</property>
<property name="hexpand">True</property>
<property name="valign">center</property>
<child> <child>
<object class="AdwPreferencesGroup"> <object class="AdwPreferencesPage">
<property name="title">How Will you Install the Software?</property>
<child> <child>
<object class="AdwActionRow"> <object class="AdwPreferencesGroup">
<property name="title">Snap</property>
<property name="subtitle">Will replace GNOME Software with Snap store if the only package manager.</property>
<property name="activatable-widget">switch_snap</property>
<child> <child>
<object class="GtkSwitch" id="switch_snap"> <object class="AdwActionRow">
<property name="valign">center</property> <property name="title">Flatpak</property>
<property name="subtitle">Will also configure the Flathub repository.</property>
<property name="activatable-widget">switch_flatpak</property>
<child>
<object class="GtkSwitch" id="switch_flatpak">
<property name="valign">center</property>
</object>
</child>
</object> </object>
</child> </child>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="title">Flatpak</property>
<property name="subtitle">Will also configure the Flathub repository.</property>
<property name="activatable-widget">switch_flatpak</property>
<child> <child>
<object class="GtkSwitch" id="switch_flatpak"> <object class="AdwActionRow">
<property name="valign">center</property> <property name="title">Snap</property>
<property name="subtitle">Uses the Snapcraft repository. Default in Ubuntu.</property>
<property name="activatable-widget">switch_snap</property>
<child>
<object class="GtkSwitch" id="switch_snap">
<property name="valign">center</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="title">Appimage</property>
<property name="subtitle">Will install the necessary dependencies to run Appimages.</property>
<property name="activatable-widget">switch_appimage</property>
<child>
<object class="GtkSwitch" id="switch_appimage">
<property name="valign">center</property>
</object>
</child>
</object> </object>
</child> </child>
</object> </object>
@ -91,44 +112,121 @@
</object> </object>
</child> </child>
<child> <child>
<object class="AdwPreferencesGroup"> <object class="GtkButton" id="btn_next">
<property name="title">Extra</property> <property name="label">Next</property>
<property name="halign">center</property>
<style>
<class name="pill" />
<class name="suggested-action" />
</style>
</object>
</child>
</object>
</child>
</object>
</child>
<!-- Sub-System -->
<child>
<object class="AdwStatusPage">
<property name="icon-name">utilities-terminal-symbolic</property>
<property name="title">Sub-System</property>
<property name="description">Access a minimal mutable Ubuntu installation integrated with Vanilla OS.</property>
<property name="halign">fill</property>
<property name="valign">fill</property>
<property name="hexpand">true</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="vexpand">True</property>
<property name="hexpand">True</property>
<property name="halign">fill</property>
<property name="valign">center</property>
<property name="spacing">10</property>
<child>
<object class="GtkBox">
<property name="valign">center</property>
<property name="spacing">10</property>
<property name="halign">center</property>
<child> <child>
<object class="AdwActionRow"> <object class="GtkButton" id="btn_no_subsystem">
<property name="title">Apport</property> <property name="label">No</property>
<property name="subtitle">Do you want to keep the Bug Reporter utility?</property> <property name="halign">center</property>
<property name="activatable-widget">switch_apport</property> <style>
<child> <class name="pill" />
<object class="GtkSwitch" id="switch_apport"> </style>
<property name="valign">center</property>
</object>
</child>
</object> </object>
</child> </child>
<child> <child>
<object class="AdwActionRow"> <object class="GtkButton" id="btn_use_subsystem">
<property name="title">Distrobox</property> <property name="label">Yes, enable it</property>
<property name="subtitle">Allows you to create containers with different distributions.</property> <property name="halign">center</property>
<property name="activatable-widget">switch_distrobox</property> <style>
<child> <class name="pill" />
<object class="GtkSwitch" id="switch_distrobox"> <class name="suggested-action" />
<property name="valign">center</property> </style>
</object> </object>
</child> </child>
<child>
<object class="GtkButton" id="btn_info_subsystem">
<property name="icon-name">dialog-information-symbolic</property>
<style>
<class name="flat" />
</style>
</object> </object>
</child> </child>
</object> </object>
</child> </child>
</object> </object>
</child> </child>
</object>
</child>
<!-- Extra -->
<child>
<object class="AdwStatusPage">
<property name="icon-name">applications-utilities-symbolic</property>
<property name="title">Extra Settings</property>
<property name="description">The following are optional settings, leave them as they are if you don't know what they do.</property>
<property name="halign">fill</property>
<property name="valign">fill</property>
<property name="hexpand">true</property>
<child> <child>
<object class="GtkButton" id="btn_save"> <object class="GtkBox">
<property name="label">Save Changes</property> <property name="orientation">vertical</property>
<property name="halign">center</property> <property name="vexpand">True</property>
<style> <property name="hexpand">True</property>
<class name="pill" /> <property name="valign">center</property>
<class name="suggested-action" /> <child>
</style> <object class="AdwPreferencesPage">
<child>
<object class="AdwPreferencesGroup">
<child>
<object class="AdwActionRow">
<property name="title">Apport</property>
<property name="subtitle">If enabled, the Bug Reporter utility will be installed.</property>
<property name="activatable-widget">switch_apport</property>
<child>
<object class="GtkSwitch" id="switch_apport">
<property name="valign">center</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkButton" id="btn_save">
<property name="label">Save Changes</property>
<property name="halign">center</property>
<style>
<class name="pill" />
<class name="suggested-action" />
</style>
</object>
</child>
</object> </object>
</child> </child>
</object> </object>
@ -156,7 +254,7 @@
<object class="AdwStatusPage"> <object class="AdwStatusPage">
<property name="icon-name">emblem-default-symbolic</property> <property name="icon-name">emblem-default-symbolic</property>
<property name="title">Done!</property> <property name="title">Done!</property>
<property name="description">You can now enjoy your new Ubuntu experience.</property> <property name="description">You can now enjoy your Vanila OS experience.</property>
<property name="halign">fill</property> <property name="halign">fill</property>
<property name="valign">fill</property> <property name="valign">fill</property>
<property name="hexpand">true</property> <property name="hexpand">true</property>

@ -35,6 +35,7 @@ configure_file(
subdir('utils') subdir('utils')
subdir('models') subdir('models')
subdir('dialogs')
vanilla_first_setup_sources = [ vanilla_first_setup_sources = [
'__init__.py', '__init__.py',

@ -6,15 +6,16 @@ logger = logging.getLogger("FirstSetup::Config")
class Config: class Config:
def __init__(self, snap: bool, flatpak: bool, apport: bool, distrobox: bool): def __init__(self, snap: bool, flatpak: bool, appimage: bool, apport: bool, distrobox: bool):
self.snap = snap self.snap = snap
self.flatpak = flatpak self.flatpak = flatpak
self.appimage = appimage
self.apport = apport self.apport = apport
self.distrobox = distrobox self.distrobox = distrobox
def get_str(self) -> str: def get_str(self) -> str:
return "snap::{0}|flatpak::{1}|apport::{2}|distrobox::{3}".format( return "snap::{0}|flatpak::{1}|appimage::{2}|apport::{3}|distrobox::{4}".format(
self.snap, self.flatpak, self.apport, self.distrobox self.snap, self.flatpak, self.appimage, self.apport, self.distrobox
) )
def set_val(self, key: str, val: bool): def set_val(self, key: str, val: bool):
@ -22,6 +23,8 @@ class Config:
self.snap = val self.snap = val
elif key == "flatpak": elif key == "flatpak":
self.flatpak = val self.flatpak = val
elif key == "appimage":
self.appimage = val
elif key == "apport": elif key == "apport":
self.apport = val self.apport = val
elif key == "distrobox": elif key == "distrobox":
@ -40,12 +43,14 @@ class Config:
snap = items[0].split('::')[1] snap = items[0].split('::')[1]
flatpak = items[1].split('::')[1] flatpak = items[1].split('::')[1]
apport = items[2].split('::')[1] appimage = items[2].split('::')[1]
distrobox = items[3].split('::')[1] apport = items[3].split('::')[1]
distrobox = items[4].split('::')[1]
return cls( return cls(
snap=get_bool(snap), snap=get_bool(snap),
flatpak=get_bool(flatpak), flatpak=get_bool(flatpak),
appimage=get_bool(appimage),
apport=get_bool(apport), apport=get_bool(apport),
distrobox=get_bool(distrobox) distrobox=get_bool(distrobox)
) )

@ -1,6 +1,7 @@
class Preset: class Preset:
snap: bool = True snap: bool = False
flatpak: bool = True flatpak: bool = True
apport: bool = True appimage: bool = False
apport: bool = False
distrobox: bool = True distrobox: bool = True

@ -22,6 +22,7 @@ class Configurator:
logging.info(f"Applying config: {self.config.get_str()}") logging.info(f"Applying config: {self.config.get_str()}")
self.__enable_snap() if self.config.snap else self.__disable_snap() self.__enable_snap() if self.config.snap else self.__disable_snap()
self.__enable_flatpak() if self.config.flatpak else self.__disable_flatpak() self.__enable_flatpak() if self.config.flatpak else self.__disable_flatpak()
self.__enable_appimage() if self.config.appimage else self.__disable_appimage()
self.__enable_apport() if self.config.apport else self.__disable_apport() self.__enable_apport() if self.config.apport else self.__disable_apport()
if self.config.distrobox: if self.config.distrobox:
self.__enable_distrobox() self.__enable_distrobox()
@ -63,6 +64,19 @@ class Configurator:
if checks.is_flatpak_installed(): if checks.is_flatpak_installed():
Apt.purge(['flatpak']) Apt.purge(['flatpak'])
def __enable_appimage(self):
if self.fake:
return self.__fake("Fake: AppImage enabled")
Apt.install(['fuse2'])
Apt.update()
def __disable_appimage(self):
if self.fake:
return self.__fake("Fake: AppImage disabled")
# Apt.purge(['libfuse2']) # NOTE: we should not remove libfuse2, it may be needed by other packages at this point
def __enable_apport(self): def __enable_apport(self):
if self.fake: if self.fake:

@ -2,5 +2,6 @@
<gresources> <gresources>
<gresource prefix="/pm/mirko/FirstSetup"> <gresource prefix="/pm/mirko/FirstSetup">
<file>gtk/window.ui</file> <file>gtk/window.ui</file>
<file>gtk/dialog-subsystem.ui</file>
</gresource> </gresource>
</gresources> </gresources>

@ -22,6 +22,7 @@ from vanilla_first_setup.models.config import Config
from vanilla_first_setup.utils.processor import Processor from vanilla_first_setup.utils.processor import Processor
from vanilla_first_setup.utils.run_async import RunAsync from vanilla_first_setup.utils.run_async import RunAsync
from vanilla_first_setup.utils.welcome_langs import welcome from vanilla_first_setup.utils.welcome_langs import welcome
from vanilla_first_setup.dialogs.subsystem import SubSystemDialog
@Gtk.Template(resource_path='/pm/mirko/FirstSetup/gtk/window.ui') @Gtk.Template(resource_path='/pm/mirko/FirstSetup/gtk/window.ui')
@ -30,24 +31,31 @@ class FirstSetupWindow(Adw.ApplicationWindow):
carousel = Gtk.Template.Child() carousel = Gtk.Template.Child()
btn_start = Gtk.Template.Child() btn_start = Gtk.Template.Child()
btn_next = Gtk.Template.Child()
btn_save = Gtk.Template.Child() btn_save = Gtk.Template.Child()
btn_close = Gtk.Template.Child() btn_close = Gtk.Template.Child()
btn_no_subsystem = Gtk.Template.Child()
btn_use_subsystem = Gtk.Template.Child()
btn_info_subsystem = Gtk.Template.Child()
switch_snap = Gtk.Template.Child() switch_snap = Gtk.Template.Child()
switch_flatpak = Gtk.Template.Child() switch_flatpak = Gtk.Template.Child()
switch_appimage = Gtk.Template.Child()
switch_apport = Gtk.Template.Child() switch_apport = Gtk.Template.Child()
switch_distrobox = Gtk.Template.Child()
spinner = Gtk.Template.Child() spinner = Gtk.Template.Child()
status_welcome = Gtk.Template.Child() status_welcome = Gtk.Template.Child()
page_welcome = -1 page_welcome = -1
page_configuration = 0 page_configuration = 0
page_progress = 1 page_subsystem = 1
page_done = 2 page_extras = 2
page_progress = 3
page_done = 4
def __init__(self, **kwargs): def __init__(self, **kwargs):
super().__init__(**kwargs) super().__init__(**kwargs)
self.__config = Config( self.__config = Config(
snap=Preset.snap, snap=Preset.snap,
flatpak=Preset.flatpak, flatpak=Preset.flatpak,
appimage=Preset.appimage,
apport=Preset.apport, apport=Preset.apport,
distrobox=Preset.distrobox distrobox=Preset.distrobox
) )
@ -58,20 +66,22 @@ class FirstSetupWindow(Adw.ApplicationWindow):
def __buiild_ui(self): def __buiild_ui(self):
self.switch_snap.set_active(Preset.snap) self.switch_snap.set_active(Preset.snap)
self.switch_flatpak.set_active(Preset.flatpak) self.switch_flatpak.set_active(Preset.flatpak)
self.switch_appimage.set_active(Preset.appimage)
self.switch_apport.set_active(Preset.apport) self.switch_apport.set_active(Preset.apport)
self.switch_distrobox.set_active(Preset.distrobox)
def __connect_signals(self): def __connect_signals(self):
self.btn_start.connect('clicked', self.__on_btn_start_clicked) self.btn_start.connect('clicked', self.__on_btn_start_clicked)
self.btn_next.connect('clicked', self.__on_btn_next_clicked)
self.btn_save.connect('clicked', self.on_btn_save_clicked) self.btn_save.connect('clicked', self.on_btn_save_clicked)
self.btn_close.connect('clicked', self.on_btn_close_clicked) self.btn_close.connect('clicked', self.on_btn_close_clicked)
self.btn_no_subsystem.connect('clicked', self.on_btn_subsystem_clicked, False)
self.btn_use_subsystem.connect('clicked', self.on_btn_subsystem_clicked, True)
self.btn_info_subsystem.connect('clicked', self.__on_btn_info_subsystem_clicked)
self.switch_snap.connect('state-set', self.__on_switch_snap_state_set) self.switch_snap.connect('state-set', self.__on_switch_snap_state_set)
self.switch_flatpak.connect( self.switch_flatpak.connect(
'state-set', self.__on_switch_flatpak_state_set) 'state-set', self.__on_switch_flatpak_state_set)
self.switch_apport.connect( self.switch_apport.connect(
'state-set', self.__on_switch_apport_state_set) 'state-set', self.__on_switch_apport_state_set)
self.switch_distrobox.connect(
'state-set', self.__on_switch_distrobox_state_set)
def __show_page(self, page: int): def __show_page(self, page: int):
_page = self.carousel.get_nth_page(page + 1) _page = self.carousel.get_nth_page(page + 1)
@ -79,6 +89,9 @@ class FirstSetupWindow(Adw.ApplicationWindow):
def __on_btn_start_clicked(self, widget): def __on_btn_start_clicked(self, widget):
self.__show_page(self.page_configuration) self.__show_page(self.page_configuration)
def __on_btn_next_clicked(self, widget):
self.__show_page(self.page_subsystem)
def on_btn_save_clicked(self, widget): def on_btn_save_clicked(self, widget):
def on_done(result, error=None): def on_done(result, error=None):
@ -105,6 +118,13 @@ class FirstSetupWindow(Adw.ApplicationWindow):
def on_btn_close_clicked(self, widget): def on_btn_close_clicked(self, widget):
self.get_application().quit() self.get_application().quit()
def on_btn_subsystem_clicked(self, widget, state):
self.__config.set_val('distrobox', state)
self.__show_page(self.page_extras)
def __on_btn_info_subsystem_clicked(self, widget):
SubSystemDialog(self).show()
def __start_welcome_animation(self): def __start_welcome_animation(self):
def change_langs(): def change_langs():
for lang in welcome: for lang in welcome:

Loading…
Cancel
Save