Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

realign ui to be consistent with vanilla-installer #249

Merged
merged 1 commit into from
Dec 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions vanilla_first_setup/assets/theme-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions vanilla_first_setup/assets/theme-default.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 5 additions & 6 deletions vanilla_first_setup/defaults/theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
# 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, Gio
from gi.repository import Gtk, Gio, Adw


@Gtk.Template(resource_path="/org/vanillaos/FirstSetup/gtk/default-theme.ui")
class VanillaDefaultTheme(Gtk.Box):
class VanillaDefaultTheme(Adw.Bin):
__gtype_name__ = "VanillaDefaultTheme"

btn_next = Gtk.Template.Child()
Expand All @@ -32,8 +32,10 @@ def __init__(self, window, distro_info, key, step, **kwargs):
self.__key = key
self.__step = step
self.__theme = "light"
self.__style_manager = self.__window.style_manager

self.__build_ui()
self.btn_default.set_active(not self.__style_manager.get_dark())
self.btn_dark.set_active(self.__style_manager.get_dark())

self.btn_next.connect("clicked", self.__window.next)
self.btn_default.connect("toggled", self.__set_theme, "light")
Expand All @@ -43,9 +45,6 @@ def __init__(self, window, distro_info, key, step, **kwargs):
def step_id(self):
return self.__key

def __build_ui(self):
self.btn_dark.set_group(self.btn_default)

def __set_theme(self, widget, theme: str):
pref = "prefer-dark" if theme == "dark" else "default"
gtk = "Adwaita-dark" if theme == "dark" else "Adwaita"
Expand Down
35 changes: 19 additions & 16 deletions vanilla_first_setup/gtk/default-hostname.ui
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,25 @@
<interface>
<requires lib="gtk" version="4.0"/>
<template class="VanillaDefaultHostname" parent="AdwBin">
<property name="halign">fill</property>
<property name="valign">center</property>
<property name="hexpand">true</property>
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<object class="GtkOverlay">
<property name="valign">center</property>
<child type="overlay">
<object class="GtkButton" id="btn_next">
<property name="margin-end">12</property>
<property name="margin-start">12</property>
<property name="icon-name">go-next-symbolic</property>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="tooltip-text" translatable="yes">Next</property>
<style>
<class name="circular" />
<class name="suggested-action" />
</style>
</object>
</child>
<child>
<object class="AdwStatusPage" id="status_page">
<property name="icon-name">computer-symbolic</property>
Expand All @@ -29,17 +42,7 @@
</child>
</object>
</child>
<child>
<object class="GtkButton" id="btn_next">
<property name="halign">center</property>
<property name="label" translatable="yes">Next</property>
<style>
<class name="pill"/>
<class name="suggested-action"/>
</style>
</object>
</child>
</object>
</child>
</template>
</interface>
</interface>
171 changes: 121 additions & 50 deletions vanilla_first_setup/gtk/default-theme.ui
Original file line number Diff line number Diff line change
@@ -1,60 +1,131 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="4.0"/>
<requires lib="libadwaita" version="1.0" />
<template class="VanillaDefaultTheme" parent="GtkBox">
<property name="orientation">vertical</property>
<property name="halign">fill</property>
<requires lib="gtk" version="4.0"/>
<requires lib="libadwaita" version="1.0" />
<template class="VanillaDefaultTheme" parent="AdwBin">
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<child>
<object class="GtkOverlay">
<property name="valign">center</property>
<property name="hexpand">true</property>
<child>
<object class="GtkBox">
<child type="overlay">
<object class="GtkButton" id="btn_next">
<property name="margin-end">12</property>
<property name="margin-start">12</property>
<property name="icon-name">go-next-symbolic</property>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="spacing">10</property>
<property name="halign">center</property>
<child>
<object class="GtkCheckButton" id="btn_default">
<property name="tooltip-text" translatable="yes">Default</property>
<property name="halign">center</property>
<property name="active">True</property>
<style>
<class name="theme-selector" />
<class name="light" />
<class name="card" />
</style>
</object>
</child>
<child>
<object class="GtkCheckButton" id="btn_dark">
<property name="tooltip-text" translatable="yes">Dark</property>
<property name="halign">center</property>
<style>
<class name="theme-selector" />
<class name="dark" />
<class name="card" />
</style>
</object>
</child>
</object>
<property name="tooltip-text" translatable="yes">Next</property>
<style>
<class name="circular" />
<class name="suggested-action" />
</style>
</object>
</child>
<child>
<object class="AdwStatusPage">
<property name="title" translatable="yes">Color Scheme</property>
<property name="description" translatable="yes">Choose a color scheme for your system</property>
<property name="halign">fill</property>
<property name="valign">fill</property>
<property name="hexpand">true</property>
<object class="AdwStatusPage">
<property name="title" translatable="yes">Color Scheme</property>
<property name="description" translatable="yes">Choose a color scheme for your system</property>
<child>
<object class="AdwClamp">
<property name="maximum_size">500</property>
<property name="tightening_threshold">400</property>
<child>
<object class="GtkButton" id="btn_next">
<property name="label" translatable="yes">Next</property>
<property name="halign">center</property>
<style>
<class name="pill" />
<class name="suggested-action" />
</style>
</object>
<object class="AdwPreferencesGroup">
<child>
<object class="AdwPreferencesRow">
<property name="activatable">False</property>
<property name="focusable">False</property>
<child>
<object class="AdwClamp">
<property name="maximum_size">400</property>
<property name="tightening_threshold">300</property>
<child>
<object class="GtkGrid">
<property name="column-homogeneous">True</property>
<property name="column-spacing">24</property>
<property name="row-spacing">12</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<property name="margin-top">18</property>
<property name="margin-bottom">12</property>
<property name="hexpand">True</property>
<child>
<object class="GtkToggleButton" id="btn_default">
<child>
<object class="GtkPicture">
<property name="hexpand">True</property>
<property name="halign">center</property>
<property name="can-shrink">False</property>
<property name="file">resource:///org/vanillaos/FirstSetup/assets/theme-default.svg</property>
<style>
<class name="appearance-thumbnail"/>
</style>
</object>
</child>
<style>
<class name="background-preview-button"/>
</style>
<layout>
<property name="column">0</property>
<property name="row">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="default_label">
<property name="label" translatable="yes">Default</property>
<layout>
<property name="column">0</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkToggleButton" id="btn_dark">
<property name="group">btn_default</property>
<child>
<object class="GtkPicture">
<property name="hexpand">True</property>
<property name="halign">center</property>
<property name="can-shrink">False</property>
<property name="file">resource:///org/vanillaos/FirstSetup/assets/theme-dark.svg</property>
<style>
<class name="appearance-thumbnail"/>
</style>
</object>
</child>
<style>
<class name="background-preview-button"/>
</style>
<layout>
<property name="column">1</property>
<property name="row">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="dark_label">
<property name="label" translatable="yes">Dark</property>
<layout>
<property name="column">1</property>
<property name="row">1</property>
</layout>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</object>
</child>
</object>
</child>
</template>
</object>
</child>
</template>
</interface>
100 changes: 54 additions & 46 deletions vanilla_first_setup/gtk/default-user.ui
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,68 @@
<interface>
<requires lib="gtk" version="4.0"/>
<template class="VanillaDefaultUser" parent="AdwBin">
<property name="halign">fill</property>
<property name="valign">center</property>
<property name="hexpand">true</property>
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="AdwAvatar">
<object class="GtkOverlay">
<property name="valign">center</property>
<child type="overlay">
<object class="GtkButton" id="btn_next">
<property name="margin-end">12</property>
<property name="margin-start">12</property>
<property name="icon-name">go-next-symbolic</property>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="size">128</property>
<property name="show-initials">true</property>
<property name="text" bind-source="fullname_entry" bind-property="text" bind-flags="sync-create"/>
<property name="tooltip-text" translatable="yes">Next</property>
<style>
<class name="circular" />
<class name="suggested-action" />
</style>
</object>
</child>
<child>
<object class="AdwStatusPage" id="status_page">
<property name="title" translatable="yes">Create User</property>
<property name="description" translatable="yes">Provide details for your user account</property>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="AdwPreferencesPage">
<object class="AdwAvatar">
<property name="valign">center</property>
<property name="size">128</property>
<property name="show-initials">true</property>
<property name="text" bind-source="fullname_entry" bind-property="text" bind-flags="sync-create"/>
</object>
</child>
<child>
<object class="AdwStatusPage" id="status_page">
<property name="title" translatable="yes">Create User</property>
<property name="description" translatable="yes">Provide details for your user account</property>
<child>
<object class="AdwPreferencesGroup">
<child>
<object class="AdwEntryRow" id="fullname_entry">
<property name="title" translatable="yes">Name</property>
<property name="input-purpose">name</property>
</object>
</child>
<child>
<object class="AdwEntryRow" id="username_entry">
<property name="title" translatable="yes">Username</property>
<property name="input-purpose">name</property>
</object>
</child>
<child>
<object class="AdwPasswordEntryRow" id="password_entry">
<property name="title" translatable="yes">Password</property>
<property name="input-purpose">password</property>
</object>
</child>
<object class="AdwPreferencesPage">
<child>
<object class="AdwPasswordEntryRow" id="password_confirmation">
<property name="title" translatable="yes">Confirm Password</property>
<property name="input-purpose">password</property>
<object class="AdwPreferencesGroup">
<child>
<object class="AdwEntryRow" id="fullname_entry">
<property name="title" translatable="yes">Name</property>
<property name="input-purpose">name</property>
</object>
</child>
<child>
<object class="AdwEntryRow" id="username_entry">
<property name="title" translatable="yes">Username</property>
<property name="input-purpose">name</property>
</object>
</child>
<child>
<object class="AdwPasswordEntryRow" id="password_entry">
<property name="title" translatable="yes">Password</property>
<property name="input-purpose">password</property>
</object>
</child>
<child>
<object class="AdwPasswordEntryRow" id="password_confirmation">
<property name="title" translatable="yes">Confirm Password</property>
<property name="input-purpose">password</property>
</object>
</child>
</object>
</child>
</object>
Expand All @@ -54,16 +72,6 @@
</child>
</object>
</child>
<child>
<object class="GtkButton" id="btn_next">
<property name="halign">center</property>
<property name="label" translatable="yes">Next</property>
<style>
<class name="pill"/>
<class name="suggested-action"/>
</style>
</object>
</child>
</object>
</child>
</template>
Expand Down
Loading