Merge branch 'libadwaita-rewrite' of https://github.com/crystal-linux/jade_gui into libadwaita-rewrite

pull/6/head
jasio 2 years ago
commit 18acf9f8c3
No known key found for this signature in database
GPG Key ID: 77707F7A09C1B20C

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><path d="m 8 1 c -2.199219 0 -4 1.800781 -4 4 v 2 c -1.109375 0 -2 0.890625 -2 2 v 5 c 0 0.554688 0.445312 1 1 1 h 10 c 0.554688 0 1 -0.445312 1 -1 v -5 c 0 -1.109375 -0.890625 -2 -2 -2 v -2 c 0 -2.199219 -1.800781 -4 -4 -4 z m 0 2 c 1.125 0 2 0.875 2 2 v 2 h -4 v -2 c 0 -1.125 0.875 -2 2 -2 z m 0 0" fill="#2e3436"/></svg>

After

Width:  |  Height:  |  Size: 451 B

@ -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 <http://www.gnu.org/licenses/>.
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")

@ -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)

@ -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 <http://www.gnu.org/licenses/>.
from gi.repository import Gtk, Adw
from gettext import gettext as _

@ -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 <http://www.gnu.org/licenses/>.
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

@ -7,6 +7,7 @@
<file>widgets/variant.ui</file>
<file>pages/keyboard_screen.ui</file>
<file>pages/timezone_screen.ui</file>
<file>pages/user_screen.ui</file>
<file>gtk/help-overlay.ui</file>
<file>crystal-logo-minimal.png</file>
</gresource>

@ -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))

@ -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,

@ -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;
}
}
}
}
}
}
}
}

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gtk/example/icons/scalable/actions/">
<file preprocess="xml-stripblanks">../data/icons/padlock2-symbolic.svg</file>
</gresource>
</gresources>

@ -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)

Loading…
Cancel
Save