diff --git a/data/icons/padlock2-symbolic.svg b/data/icons/padlock2-symbolic.svg
new file mode 100644
index 0000000..e0724b7
--- /dev/null
+++ b/data/icons/padlock2-symbolic.svg
@@ -0,0 +1,2 @@
+
+
diff --git a/src/functions/keyboard_screen.py b/src/functions/keyboard_screen.py
index 2b62c0e..f39d7ae 100644
--- a/src/functions/keyboard_screen.py
+++ b/src/functions/keyboard_screen.py
@@ -1,3 +1,23 @@
+# keyboard_Screen.py
+
+#
+# Copyright 2022 user
+
+#
+# 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 Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# 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 .
+
+
from gi.repository import Gtk, Adw
from gettext import gettext as _
@@ -40,6 +60,7 @@ class KeyboardScreen(Adw.Bin):
def selected_variant(self, widget, row):
if row is not None:
print("variant selected")
+ self.carousel.scroll_to(self.next_page, True)
else:
print("row is none!! variant")
diff --git a/src/functions/meson.build b/src/functions/meson.build
index c6c2267..383cd5d 100644
--- a/src/functions/meson.build
+++ b/src/functions/meson.build
@@ -5,5 +5,6 @@ jade_gui_sources = [
'__init__.py',
'keyboard_screen.py',
'timezone_screen.py',
+ 'user_screen.py',
]
install_data(jade_gui_sources, install_dir: functionsdir)
\ No newline at end of file
diff --git a/src/functions/timezone_screen.py b/src/functions/timezone_screen.py
index abb8972..b1a34dc 100644
--- a/src/functions/timezone_screen.py
+++ b/src/functions/timezone_screen.py
@@ -1,3 +1,23 @@
+# timezone_screen.py
+
+#
+# Copyright 2022 user
+
+#
+# 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 Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# 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 .
+
+
from gi.repository import Gtk, Adw
from gettext import gettext as _
diff --git a/src/functions/user_screen.py b/src/functions/user_screen.py
new file mode 100644
index 0000000..cbeee5f
--- /dev/null
+++ b/src/functions/user_screen.py
@@ -0,0 +1,78 @@
+# user_screen.py
+
+#
+# Copyright 2022 user
+
+#
+# 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 Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# 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 .
+
+
+from gi.repository import Gtk, Adw
+from gettext import gettext as _
+import re
+
+@Gtk.Template(resource_path='/al/getcyrst/jadegui/pages/user_screen.ui')
+class UserScreen(Adw.Bin):
+ __gtype_name__ = "UserScreen"
+
+ username_entry = Gtk.Template.Child()
+ password_entry = Gtk.Template.Child()
+ password_confirmation = Gtk.Template.Child()
+ enable_sudo_switch = Gtk.Template.Child()
+ enable_root_switch = Gtk.Template.Child()
+
+ def __init__(self, window, main_carousel, next_page, application, **kwargs):
+ super().__init__(**kwargs)
+ self.window = window
+ self.carousel = main_carousel
+ self.sudo_enabled = True
+ self.root_enabled = True
+ self.next_page = next_page
+ self.enable_root_switch.set_active(self.root_enabled)
+ self.enable_sudo_switch.set_active(self.sudo_enabled)
+ self.username_entry.connect('changed', self.username_passes_regex)
+ self.enable_root_switch.connect('state-set', self.enable_root_user)
+ self.enable_sudo_switch.connect('state-set', self.enable_sudo)
+
+ def username_passes_regex(self, widget):
+ input = self.username_entry.get_text()
+ print(input)
+ if not re.search("^[a-z_]([a-z0-9_-]{0,31}|[a-z0-9_-]{0,30}\$)$", input):
+ print("Invalid username!")
+ else:
+ print("Valid username!")
+
+ def enable_root_user(self, widget, switch_state):
+ print("root")
+ print(self.root_enabled)
+ print(switch_state)
+ if switch_state == False and not self.sudo_enabled:
+ self.root_enabled = switch_state
+ self.sudo_enabled = not switch_state
+ self.enable_sudo_switch.set_active(not switch_state)
+ else:
+ self.root_enabled = switch_state
+
+
+
+ def enable_sudo(self, widget, switch_state):
+ print("sudo")
+ print(self.root_enabled)
+ print(switch_state)
+ if switch_state == False and not self.root_enabled:
+ self.sudo_enabled = switch_state
+ self.root_enabled = not switch_state
+ self.enable_root_switch.set_active(not switch_state)
+ else:
+ self.sudo_enabled = switch_state
diff --git a/src/jade_gui.gresource.xml b/src/jade_gui.gresource.xml
index e1d78a9..f741c89 100644
--- a/src/jade_gui.gresource.xml
+++ b/src/jade_gui.gresource.xml
@@ -7,6 +7,7 @@
widgets/variant.uipages/keyboard_screen.uipages/timezone_screen.ui
+ pages/user_screen.uigtk/help-overlay.uicrystal-logo-minimal.png
diff --git a/src/jade_gui.in b/src/jade_gui.in
index ba35488..d4987bc 100755
--- a/src/jade_gui.in
+++ b/src/jade_gui.in
@@ -40,7 +40,9 @@ if __name__ == '__main__':
from gi.repository import Gio
resource = Gio.Resource.load(os.path.join(pkgdatadir, 'jade_gui.gresource'))
+ icons = Gio.Resource.load(os.path.join(pkgdatadir, 'jade_gui_resources.gresource'))
resource._register()
+ icons._register()
from jade_gui import main
sys.exit(main.main(VERSION))
diff --git a/src/meson.build b/src/meson.build
index e7a2c54..a029dd7 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -11,6 +11,7 @@ blueprints = custom_target('blueprints',
'widgets/variant.blp',
'pages/keyboard_screen.blp',
'pages/timezone_screen.blp',
+ 'pages/user_screen.blp',
),
output: '.',
command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'],
@@ -18,6 +19,14 @@ blueprints = custom_target('blueprints',
+gnome.compile_resources('jade_gui_resources',
+ 'resources.gresource.xml',
+ gresource_bundle: true,
+ install: true,
+ install_dir: pkgdatadir,
+)
+
+
gnome.compile_resources('jade_gui',
'jade_gui.gresource.xml',
dependencies: blueprints,
diff --git a/src/pages/user_screen.blp b/src/pages/user_screen.blp
new file mode 100644
index 0000000..2eb0d05
--- /dev/null
+++ b/src/pages/user_screen.blp
@@ -0,0 +1,68 @@
+using Gtk 4.0;
+using Adw 1;
+
+template UserScreen : Adw.Bin {
+ hexpand: true;
+ vexpand: true;
+ Gtk.Box {
+ vexpand: true;
+ hexpand: true;
+ Adw.StatusPage {
+ hexpand: true;
+ vexpand: true;
+ title: "Create your user";
+ description: "You can add more users in the settings on the installed system";
+ Adw.PreferencesPage {
+ Adw.PreferencesGroup {
+ Gtk.Entry username_entry {
+ margin-bottom: 7;
+ primary-icon-name: "avatar-default-symbolic";
+ primary-icon-activatable: false;
+ secondary-icon-name: "edit-clear";
+ secondary-icon-activatable: true;
+ placeholder-text: "Enter your username";
+ }
+ Gtk.Entry password_entry {
+ margin-top: 7;
+ margin-bottom: 7;
+ primary-icon-name: "system-lock-screen-symbolic";
+ primary-icon-activatable: false;
+ secondary-icon-name: "edit-clear";
+ secondary-icon-activatable: true;
+ placeholder-text: "Enter your password";
+ }
+ Gtk.Entry password_confirmation {
+ margin-top: 7;
+ margin-bottom: 7;
+ primary-icon-name: "system-lock-screen-symbolic";
+ primary-icon-activatable: false;
+ secondary-icon-name: "edit-clear";
+ secondary-icon-activatable: true;
+ placeholder-text: "Repeat your password";
+ styles ["big"]
+ }
+ Gtk.ListBox { // TODO: MOVE TO ADVANCED/MISC SECTION???
+ margin-top: 7;
+ styles ["boxed-list"]
+ Adw.ActionRow {
+ title: "Enable administrative rights for user";
+ subtitle: "Allows the user to use sudo";
+ Gtk.Switch enable_sudo_switch {
+ valign: center;
+ state: true;
+ }
+ }
+ Adw.ActionRow {
+ title: "Enable superuser account";
+ subtitle: "Allows using the root user";
+ Gtk.Switch enable_root_switch {
+ valign: center;
+ state: false;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/resources.gresource.xml b/src/resources.gresource.xml
new file mode 100644
index 0000000..80f1250
--- /dev/null
+++ b/src/resources.gresource.xml
@@ -0,0 +1,6 @@
+
+
+
+ ../data/icons/padlock2-symbolic.svg
+
+
diff --git a/src/window.py b/src/window.py
index c87f0c9..158bf76 100644
--- a/src/window.py
+++ b/src/window.py
@@ -24,6 +24,7 @@ from .widgets.layout import KeyboardLayout
from .widgets.variant import KeyboardVariant
from .functions.keyboard_screen import KeyboardScreen
from .functions.timezone_screen import TimezoneScreen
+from .functions.user_screen import UserScreen
@Gtk.Template(resource_path='/al/getcyrst/jadegui/window.ui')
class JadeGuiWindow(Gtk.ApplicationWindow):
@@ -41,10 +42,12 @@ class JadeGuiWindow(Gtk.ApplicationWindow):
def __init__(self, **kwargs):
super().__init__(**kwargs)
- self.keyboard_screen = KeyboardScreen(window=self, main_carousel=self.carousel, next_page=None, **kwargs)
+ self.user_screen = UserScreen(window=self, main_carousel=self.carousel, next_page=None, **kwargs)
+ self.keyboard_screen = KeyboardScreen(window=self, main_carousel=self.carousel, next_page=self.user_screen, **kwargs)
self.timezone_screen = TimezoneScreen(window=self, main_carousel=self.carousel, next_page=self.keyboard_screen, **kwargs)
self.carousel.append(self.timezone_screen)
self.carousel.append(self.keyboard_screen)
+ self.carousel.append(self.user_screen)
### Widgets for first page (welcome screen)
self.quit_button.connect("clicked", self.confirmQuit)
self.next_button.connect("clicked", self.nextPage)