From a06f1211d2c8689af8090d2aaa02a61329380a83 Mon Sep 17 00:00:00 2001 From: axtloss Date: Fri, 8 Jul 2022 16:03:07 +0200 Subject: [PATCH] help git is being scary --- al.getcyrst.jadegui.json | 2 +- data/al.getcryst.jadegui.appdata.xml.in | 9 ++ data/al.getcryst.jadegui.desktop.in | 11 ++ data/al.getcryst.jadegui.gschema.xml | 5 + .../scalable/apps/al.getcryst.jadegui.svg | 130 ++++++++++++++++++ .../apps/al.getcryst.jadegui-symbolic.svg | 1 + data/icons/meson.build | 2 +- data/meson.build | 10 +- po/POTFILES | 6 +- src/functions/desktop_screen.py | 44 ++++++ src/functions/keyboard_screen.py | 2 +- src/functions/meson.build | 1 + src/functions/timezone_screen.py | 2 +- src/functions/user_screen.py | 14 +- src/jade_gui.gresource.xml | 4 +- src/main.py | 2 +- src/meson.build | 2 + src/pages/desktop_screen.blp | 36 +++++ src/pages/user_screen.blp | 23 ++-- src/widgets/desktop.blp | 12 ++ src/widgets/desktop.py | 34 +++++ src/widgets/layout.py | 2 +- src/widgets/meson.build | 1 + src/widgets/timezone.py | 2 +- src/widgets/variant.py | 2 +- src/window.blp | 4 +- src/window.py | 20 ++- src/window.ui | 4 +- 28 files changed, 347 insertions(+), 40 deletions(-) create mode 100644 data/al.getcryst.jadegui.appdata.xml.in create mode 100644 data/al.getcryst.jadegui.desktop.in create mode 100644 data/al.getcryst.jadegui.gschema.xml create mode 100644 data/icons/hicolor/scalable/apps/al.getcryst.jadegui.svg create mode 100644 data/icons/hicolor/symbolic/apps/al.getcryst.jadegui-symbolic.svg create mode 100644 src/functions/desktop_screen.py create mode 100644 src/pages/desktop_screen.blp create mode 100644 src/widgets/desktop.blp create mode 100644 src/widgets/desktop.py diff --git a/al.getcyrst.jadegui.json b/al.getcyrst.jadegui.json index 5ff8e6e..2b10841 100644 --- a/al.getcyrst.jadegui.json +++ b/al.getcyrst.jadegui.json @@ -1,5 +1,5 @@ { - "app-id" : "al.getcyrst.jadegui", + "app-id" : "al.getcryst.jadegui", "runtime" : "org.gnome.Platform", "runtime-version" : "master", "sdk" : "org.gnome.Sdk", diff --git a/data/al.getcryst.jadegui.appdata.xml.in b/data/al.getcryst.jadegui.appdata.xml.in new file mode 100644 index 0000000..8143858 --- /dev/null +++ b/data/al.getcryst.jadegui.appdata.xml.in @@ -0,0 +1,9 @@ + + + al.getcryst.jadegui.desktop + CC0-1.0 + GPL-3.0-or-later + +

No description

+
+
diff --git a/data/al.getcryst.jadegui.desktop.in b/data/al.getcryst.jadegui.desktop.in new file mode 100644 index 0000000..7b9fac1 --- /dev/null +++ b/data/al.getcryst.jadegui.desktop.in @@ -0,0 +1,11 @@ +[Desktop Entry] +Name=jade_gui + +Exec=jade_gui + +Icon=al.getcryst.jadegui + +Terminal=false +Type=Application +Categories=GTK; +StartupNotify=true diff --git a/data/al.getcryst.jadegui.gschema.xml b/data/al.getcryst.jadegui.gschema.xml new file mode 100644 index 0000000..8763ef6 --- /dev/null +++ b/data/al.getcryst.jadegui.gschema.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/data/icons/hicolor/scalable/apps/al.getcryst.jadegui.svg b/data/icons/hicolor/scalable/apps/al.getcryst.jadegui.svg new file mode 100644 index 0000000..a74c4df --- /dev/null +++ b/data/icons/hicolor/scalable/apps/al.getcryst.jadegui.svg @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + application-x-executable + + + + + + + + + + + + + + + + diff --git a/data/icons/hicolor/symbolic/apps/al.getcryst.jadegui-symbolic.svg b/data/icons/hicolor/symbolic/apps/al.getcryst.jadegui-symbolic.svg new file mode 100644 index 0000000..0444828 --- /dev/null +++ b/data/icons/hicolor/symbolic/apps/al.getcryst.jadegui-symbolic.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/data/icons/meson.build b/data/icons/meson.build index 3e79b99..76c72f2 100644 --- a/data/icons/meson.build +++ b/data/icons/meson.build @@ -1,4 +1,4 @@ -application_id = 'al.getcyrst.jadegui' +application_id = 'al.getcryst.jadegui' scalable_dir = join_paths('hicolor', 'scalable', 'apps') install_data( diff --git a/data/meson.build b/data/meson.build index ce13d79..41b505b 100644 --- a/data/meson.build +++ b/data/meson.build @@ -1,6 +1,6 @@ desktop_file = i18n.merge_file( - input: 'al.getcyrst.jadegui.desktop.in', - output: 'al.getcyrst.jadegui.desktop', + input: 'al.getcryst.jadegui.desktop.in', + output: 'al.getcryst.jadegui.desktop', type: 'desktop', po_dir: '../po', install: true, @@ -15,8 +15,8 @@ if desktop_utils.found() endif appstream_file = i18n.merge_file( - input: 'al.getcyrst.jadegui.appdata.xml.in', - output: 'al.getcyrst.jadegui.appdata.xml', + input: 'al.getcryst.jadegui.appdata.xml.in', + output: 'al.getcryst.jadegui.appdata.xml', po_dir: '../po', install: true, install_dir: join_paths(get_option('datadir'), 'appdata') @@ -29,7 +29,7 @@ if appstream_util.found() ) endif -install_data('al.getcyrst.jadegui.gschema.xml', +install_data('al.getcryst.jadegui.gschema.xml', install_dir: join_paths(get_option('datadir'), 'glib-2.0/schemas') ) diff --git a/po/POTFILES b/po/POTFILES index b8bb135..79c2026 100644 --- a/po/POTFILES +++ b/po/POTFILES @@ -1,6 +1,6 @@ -data/al.getcyrst.jadegui.desktop.in -data/al.getcyrst.jadegui.appdata.xml.in -data/al.getcyrst.jadegui.gschema.xml +data/al.getcryst.jadegui.desktop.in +data/al.getcryst.jadegui.appdata.xml.in +data/al.getcryst.jadegui.gschema.xml src/window.ui src/main.py diff --git a/src/functions/desktop_screen.py b/src/functions/desktop_screen.py new file mode 100644 index 0000000..c8eb85e --- /dev/null +++ b/src/functions/desktop_screen.py @@ -0,0 +1,44 @@ +# desktop_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 _ + +@Gtk.Template(resource_path='/al/getcryst/jadegui/pages/desktop_screen.ui') +class DesktopScreen(Adw.Bin): + __gtype_name__ = 'DesktopScreen' + + list_desktops = Gtk.Template.Child() + + def __init__(self, window, main_carousel, next_page, application, **kwargs): + super().__init__(**kwargs) + self.window = window + self.carousel = main_carousel + self.next_page = next_page + + self.list_desktops.connect("row-selected", self.selected_timezone) + + def selected_timezone(self, widget, row): + if row is not None: + print(row.get_title()) + row.select_button.set_active(True) + else: + print("row is none!!") + diff --git a/src/functions/keyboard_screen.py b/src/functions/keyboard_screen.py index f39d7ae..dad22ed 100644 --- a/src/functions/keyboard_screen.py +++ b/src/functions/keyboard_screen.py @@ -21,7 +21,7 @@ from gi.repository import Gtk, Adw from gettext import gettext as _ -@Gtk.Template(resource_path='/al/getcyrst/jadegui/pages/keyboard_screen.ui') +@Gtk.Template(resource_path='/al/getcryst/jadegui/pages/keyboard_screen.ui') class KeyboardScreen(Adw.Bin): __gtype_name__ = 'KeyboardScreen' diff --git a/src/functions/meson.build b/src/functions/meson.build index 383cd5d..fdb6cc5 100644 --- a/src/functions/meson.build +++ b/src/functions/meson.build @@ -6,5 +6,6 @@ jade_gui_sources = [ 'keyboard_screen.py', 'timezone_screen.py', 'user_screen.py', + 'desktop_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 b1a34dc..3a3327b 100644 --- a/src/functions/timezone_screen.py +++ b/src/functions/timezone_screen.py @@ -21,7 +21,7 @@ from gi.repository import Gtk, Adw from gettext import gettext as _ -@Gtk.Template(resource_path='/al/getcyrst/jadegui/pages/timezone_screen.ui') +@Gtk.Template(resource_path='/al/getcryst/jadegui/pages/timezone_screen.ui') class TimezoneScreen(Adw.Bin): __gtype_name__ = 'TimezoneScreen' diff --git a/src/functions/user_screen.py b/src/functions/user_screen.py index dfc15c1..692146d 100644 --- a/src/functions/user_screen.py +++ b/src/functions/user_screen.py @@ -22,7 +22,7 @@ from gi.repository import Gtk, Adw from gettext import gettext as _ import re -@Gtk.Template(resource_path='/al/getcyrst/jadegui/pages/user_screen.ui') +@Gtk.Template(resource_path='/al/getcryst/jadegui/pages/user_screen.ui') class UserScreen(Adw.Bin): __gtype_name__ = "UserScreen" @@ -31,12 +31,13 @@ class UserScreen(Adw.Bin): password_confirmation = Gtk.Template.Child() enable_sudo_switch = Gtk.Template.Child() enable_root_switch = Gtk.Template.Child() - next_page = Gtk.Template.Child() + next_page_button = Gtk.Template.Child() def __init__(self, window, main_carousel, next_page, application, **kwargs): super().__init__(**kwargs) self.window = window self.carousel = main_carousel + self.next_page = next_page self.sudo_enabled = True self.root_enabled = True self.enable_root_switch.set_active(self.root_enabled) @@ -46,6 +47,7 @@ class UserScreen(Adw.Bin): self.enable_sudo_switch.connect('state-set', self.enable_sudo) self.password_entry.connect('changed', self.verify_password) self.password_confirmation.connect('changed', self.verify_password) + self.next_page_button.connect('clicked', self.carousel_next) def username_passes_regex(self, widget): input = self.username_entry.get_text() @@ -86,8 +88,10 @@ class UserScreen(Adw.Bin): def verify_password(self, widget): if self.password_entry.get_text() == self.password_confirmation.get_text(): self.next_page.set_sensitive(True) - self.password_confirmation.add_css_class('error') + self.password_confirmation.remove_css_class('error') elif self.password_entry.get_text() != self.password_confirmation.get_text(): self.next_page.set_sensitive(False) - self.password_confirmation.remove_css_class('error') - + self.password_confirmation.add_css_class('error') + + def carousel_next(self, widget): + self.carousel.scroll_to(self.next_page, True) diff --git a/src/jade_gui.gresource.xml b/src/jade_gui.gresource.xml index f741c89..2883495 100644 --- a/src/jade_gui.gresource.xml +++ b/src/jade_gui.gresource.xml @@ -1,13 +1,15 @@ - + window.ui widgets/timezone.ui widgets/layout.ui widgets/variant.ui + widgets/desktop.ui pages/keyboard_screen.ui pages/timezone_screen.ui pages/user_screen.ui + pages/desktop_screen.ui gtk/help-overlay.ui crystal-logo-minimal.png diff --git a/src/main.py b/src/main.py index 1f50a21..3c6ee7e 100644 --- a/src/main.py +++ b/src/main.py @@ -32,7 +32,7 @@ class Jade_guiApplication(Adw.Application): def __init__(self): - super().__init__(application_id='al.getcyrst.jadegui', + super().__init__(application_id='al.getcryst.jadegui', flags=Gio.ApplicationFlags.FLAGS_NONE) self.create_action('quit', self.quit, ['q']) self.create_action('about', self.on_about_action) diff --git a/src/meson.build b/src/meson.build index a029dd7..506685c 100644 --- a/src/meson.build +++ b/src/meson.build @@ -9,9 +9,11 @@ blueprints = custom_target('blueprints', 'widgets/timezone.blp', 'widgets/layout.blp', 'widgets/variant.blp', + 'widgets/desktop.blp', 'pages/keyboard_screen.blp', 'pages/timezone_screen.blp', 'pages/user_screen.blp', + 'pages/desktop_screen.blp', ), output: '.', command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'], diff --git a/src/pages/desktop_screen.blp b/src/pages/desktop_screen.blp new file mode 100644 index 0000000..aaffabc --- /dev/null +++ b/src/pages/desktop_screen.blp @@ -0,0 +1,36 @@ +using Gtk 4.0; +using Adw 1; + +template DesktopScreen : Adw.Bin { + vexpand: true; + hexpand: true; + Gtk.Box { + vexpand: true; + hexpand: true; + Adw.StatusPage { + title: "Select a desktop"; + description: "You can install more desktops later"; + Adw.PreferencesPage { + Adw. PreferencesGroup { + Gtk.ListBox list_desktops { + hexpand: true; + vexpand: true; + styles ["boxed-list"] + } + } + } + } + Gtk.Overlay { + [overlay] + Gtk.Button next_page { + margin-end: 20; + margin-bottom: 20; + label: "Next"; + halign: end; + valign: end; + tooltip-text: "Move to next page"; + styles ["suggested-action"] + } + } + } +} \ No newline at end of file diff --git a/src/pages/user_screen.blp b/src/pages/user_screen.blp index b8035ed..fcaf16a 100644 --- a/src/pages/user_screen.blp +++ b/src/pages/user_screen.blp @@ -5,17 +5,6 @@ template UserScreen : Adw.Bin { hexpand: true; vexpand: true; - Gtk.Overlay { - Gtk.Button next_page { - margin-end: 20; - margin-bottom: 20; - label: "Next"; - halign: end; - valign: end; - tooltip-text: "Move to next page"; - styles ["suggested-action"] - } - } Gtk.Box { vexpand: true; @@ -59,5 +48,17 @@ template UserScreen : Adw.Bin { } } } + Gtk.Overlay { + [overlay] + Gtk.Button next_page_button { + margin-end: 20; + margin-bottom: 20; + label: "Next"; + halign: end; + valign: end; + tooltip-text: "Move to next page"; + styles ["suggested-action"] + } + } } } \ No newline at end of file diff --git a/src/widgets/desktop.blp b/src/widgets/desktop.blp new file mode 100644 index 0000000..9f73000 --- /dev/null +++ b/src/widgets/desktop.blp @@ -0,0 +1,12 @@ +using Gtk 4.0; +using Adw 1; + +template DesktopEntry : Adw.ActionRow { + title: "DesktopEntry"; + + Gtk.Box { + Gtk.CheckButton select_button { + use-underline: true; + } + } +} \ No newline at end of file diff --git a/src/widgets/desktop.py b/src/widgets/desktop.py new file mode 100644 index 0000000..07767ae --- /dev/null +++ b/src/widgets/desktop.py @@ -0,0 +1,34 @@ +# desktop.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, GLib, Adw +from gettext import gettext as _ + +@Gtk.Template(resource_path='/al/getcryst/jadegui/widgets/desktop.ui') +class DesktopEntry(Adw.ActionRow): + __gtype_name__ = 'DesktopEntry' + + select_button = Gtk.Template.Child() + + def __init__(self, window, desktop, button_group, application, **kwargs): + super().__init__(**kwargs) + + self.set_title(desktop) + self.select_button.set_group(button_group) + diff --git a/src/widgets/layout.py b/src/widgets/layout.py index 49731cf..b4264a4 100644 --- a/src/widgets/layout.py +++ b/src/widgets/layout.py @@ -20,7 +20,7 @@ from gi.repository import Gtk, GLib, Adw from gettext import gettext as _ -@Gtk.Template(resource_path='/al/getcyrst/jadegui/widgets/layout.ui') +@Gtk.Template(resource_path='/al/getcryst/jadegui/widgets/layout.ui') class KeyboardLayout(Adw.ActionRow): __gtype_name__ = 'KeyboardLayout' diff --git a/src/widgets/meson.build b/src/widgets/meson.build index f494968..d15f9f5 100644 --- a/src/widgets/meson.build +++ b/src/widgets/meson.build @@ -6,5 +6,6 @@ jade_gui_sources = [ 'timezone.py', 'layout.py', 'variant.py', + 'desktop.py', ] install_data(jade_gui_sources, install_dir: widgetsdir) \ No newline at end of file diff --git a/src/widgets/timezone.py b/src/widgets/timezone.py index b0ea3cf..a6a5d41 100644 --- a/src/widgets/timezone.py +++ b/src/widgets/timezone.py @@ -22,7 +22,7 @@ import pytz from gi.repository import Gtk, GLib, Adw from gettext import gettext as _ -@Gtk.Template(resource_path='/al/getcyrst/jadegui/widgets/timezone.ui') +@Gtk.Template(resource_path='/al/getcryst/jadegui/widgets/timezone.ui') class TimezoneEntry(Adw.ActionRow): __gtype_name__ = 'TimezoneEntry' diff --git a/src/widgets/variant.py b/src/widgets/variant.py index 8ffaa89..8b0eddc 100644 --- a/src/widgets/variant.py +++ b/src/widgets/variant.py @@ -20,7 +20,7 @@ from gi.repository import Gtk, GLib, Adw from gettext import gettext as _ -@Gtk.Template(resource_path='/al/getcyrst/jadegui/widgets/variant.ui') +@Gtk.Template(resource_path='/al/getcryst/jadegui/widgets/variant.ui') class KeyboardVariant(Adw.ActionRow): __gtype_name__ = 'KeyboardVariant' diff --git a/src/window.blp b/src/window.blp index ccc5882..c693fad 100644 --- a/src/window.blp +++ b/src/window.blp @@ -11,7 +11,7 @@ template JadeGuiWindow : Gtk.ApplicationWindow { Adw.HeaderBar header_bar { title-widget: Gtk.Box { Gtk.Image { - resource: "/al/getcyrst/jadegui/crystal-logo-minimal.png"; + resource: "/al/getcryst/jadegui/crystal-logo-minimal.png"; } Gtk.Label { margin-start: 2; @@ -47,7 +47,7 @@ template JadeGuiWindow : Gtk.ApplicationWindow { hexpand: true; Gtk.Image crystal-logo { - resource: "/al/getcyrst/jadegui/crystal-logo-minimal.png"; + resource: "/al/getcryst/jadegui/crystal-logo-minimal.png"; pixel-size: 200; margin-bottom: 25; } diff --git a/src/window.py b/src/window.py index 158bf76..f16f4f4 100644 --- a/src/window.py +++ b/src/window.py @@ -22,11 +22,13 @@ from gi.repository import Gdk from .widgets.timezone import TimezoneEntry from .widgets.layout import KeyboardLayout from .widgets.variant import KeyboardVariant +from .widgets.desktop import DesktopEntry from .functions.keyboard_screen import KeyboardScreen from .functions.timezone_screen import TimezoneScreen from .functions.user_screen import UserScreen +from .functions.desktop_screen import DesktopScreen -@Gtk.Template(resource_path='/al/getcyrst/jadegui/window.ui') +@Gtk.Template(resource_path='/al/getcryst/jadegui/window.ui') class JadeGuiWindow(Gtk.ApplicationWindow): __gtype_name__ = 'JadeGuiWindow' @@ -42,12 +44,14 @@ class JadeGuiWindow(Gtk.ApplicationWindow): def __init__(self, **kwargs): super().__init__(**kwargs) - self.user_screen = UserScreen(window=self, main_carousel=self.carousel, next_page=None, **kwargs) + self.desktop_screen = DesktopScreen(window=self, main_carousel=self.carousel, next_page=None, **kwargs) + self.user_screen = UserScreen(window=self, main_carousel=self.carousel, next_page=self.desktop_screen, **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) + self.carousel.append(self.desktop_screen) ### Widgets for first page (welcome screen) self.quit_button.connect("clicked", self.confirmQuit) self.next_button.connect("clicked", self.nextPage) @@ -80,6 +84,16 @@ class JadeGuiWindow(Gtk.ApplicationWindow): self.keyboard_screen.list_keyboard_variants.append(variant_test_three) ### --------- + ### Test desktops + desktop_test = DesktopEntry(window=self, desktop="GNOME", button_group=None, **kwargs) + desktop_test_two = DesktopEntry(window=self, desktop="Onyx", button_group=desktop_test.select_button, **kwargs) + desktop_test_three = DesktopEntry(window=self, desktop="KDE", button_group=desktop_test.select_button, **kwargs) + desktop_test.select_button.set_active(True) + self.desktop_screen.list_desktops.append(desktop_test) + self.desktop_screen.list_desktops.append(desktop_test_two) + self.desktop_screen.list_desktops.append(desktop_test_three) + ### --------- + # TODO: offload functions to seperate files/classes def nextPage(self, idk): @@ -116,6 +130,6 @@ class AboutDialog(Gtk.AboutDialog): self.props.version = "0.1.0" self.props.authors = ['user'] self.props.copyright = '2022 user' - self.props.logo_icon_name = 'al.getcyrst.jadegui' + self.props.logo_icon_name = 'al.getcryst.jadegui' self.props.modal = True self.set_transient_for(parent) diff --git a/src/window.ui b/src/window.ui index 616f254..9f4f390 100644 --- a/src/window.ui +++ b/src/window.ui @@ -12,7 +12,7 @@ - /al/getcyrst/jadegui/crystal-logo-minimal.png + /al/getcryst/jadegui/crystal-logo-minimal.png @@ -57,7 +57,7 @@ true