diff --git a/src/functions/desktop_screen.py b/src/functions/desktop_screen.py index c8eb85e..005b8d7 100644 --- a/src/functions/desktop_screen.py +++ b/src/functions/desktop_screen.py @@ -26,6 +26,7 @@ class DesktopScreen(Adw.Bin): __gtype_name__ = 'DesktopScreen' list_desktops = Gtk.Template.Child() + next_page_button = Gtk.Template.Child() def __init__(self, window, main_carousel, next_page, application, **kwargs): super().__init__(**kwargs) @@ -34,6 +35,10 @@ class DesktopScreen(Adw.Bin): self.next_page = next_page self.list_desktops.connect("row-selected", self.selected_timezone) + self.next_page_button.connect("clicked", self.carousel_next) + + def carousel_next(self, widget): + self.carousel.scroll_to(self.next_page, True) def selected_timezone(self, widget, row): if row is not None: @@ -41,4 +46,3 @@ class DesktopScreen(Adw.Bin): row.select_button.set_active(True) else: print("row is none!!") - diff --git a/src/functions/meson.build b/src/functions/meson.build index 95364a7..99520e2 100644 --- a/src/functions/meson.build +++ b/src/functions/meson.build @@ -8,5 +8,6 @@ jade_gui_sources = [ 'user_screen.py', 'desktop_screen.py', 'misc_screen.py', + 'partition_screen.py', ] install_data(jade_gui_sources, install_dir: functionsdir) \ No newline at end of file diff --git a/src/functions/misc_screen.py b/src/functions/misc_screen.py index fefb3af..eaac763 100644 --- a/src/functions/misc_screen.py +++ b/src/functions/misc_screen.py @@ -24,13 +24,18 @@ from gettext import gettext as _ class MiscScreen(Adw.Bin): __gtype_name__ = "MiscScreen" - hostname_entry = Gtk.Template().Child() - ipv_switch = Gtk.Template().Child() - timeshift_switch = Gtk.Template().Child() - theme_switch = Gtk.Template().Child() + hostname_entry = Gtk.Template.Child() + ipv_switch = Gtk.Template.Child() + timeshift_switch = Gtk.Template.Child() + theme_switch = 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.next_page_button.connect("clicked", self.carousel_next) + + def carousel_next(self, widget): + self.carousel.scroll_to(self.next_page, True) diff --git a/src/functions/partition_screen.py b/src/functions/partition_screen.py new file mode 100644 index 0000000..4e581e9 --- /dev/null +++ b/src/functions/partition_screen.py @@ -0,0 +1,39 @@ +# partition_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/partition_screen.ui') +class PartitionScreen(Adw.Bin): + __gtype_name__ = "PartitionScreen" + + partition_list = Gtk.Template.Child() + next_page_button = Gtk.Template.Child() + #custom_partition = 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.next_page_button.connect("clicked", self.carousel_next) + + 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 3c03072..580dc8c 100644 --- a/src/jade_gui.gresource.xml +++ b/src/jade_gui.gresource.xml @@ -6,11 +6,13 @@ widgets/layout.ui widgets/variant.ui widgets/desktop.ui + widgets/disk.ui pages/keyboard_screen.ui pages/timezone_screen.ui pages/user_screen.ui pages/desktop_screen.ui pages/misc_screen.ui + pages/partition_screen.ui gtk/help-overlay.ui crystal-logo-minimal.png diff --git a/src/meson.build b/src/meson.build index 6bf9907..0e661e4 100644 --- a/src/meson.build +++ b/src/meson.build @@ -10,11 +10,13 @@ blueprints = custom_target('blueprints', 'widgets/layout.blp', 'widgets/variant.blp', 'widgets/desktop.blp', + 'widgets/disk.blp', 'pages/keyboard_screen.blp', 'pages/timezone_screen.blp', 'pages/user_screen.blp', 'pages/desktop_screen.blp', 'pages/misc_screen.blp', + 'pages/partition_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 index aaffabc..f88f15c 100644 --- a/src/pages/desktop_screen.blp +++ b/src/pages/desktop_screen.blp @@ -22,7 +22,7 @@ template DesktopScreen : Adw.Bin { } Gtk.Overlay { [overlay] - Gtk.Button next_page { + Gtk.Button next_page_button { margin-end: 20; margin-bottom: 20; label: "Next"; diff --git a/src/pages/partition_screen.blp b/src/pages/partition_screen.blp new file mode 100644 index 0000000..4b962c7 --- /dev/null +++ b/src/pages/partition_screen.blp @@ -0,0 +1,52 @@ +using Gtk 4.0; +using Adw 1; + +template PartitionScreen : Adw.Bin { + vexpand: true; + hexpand: true; + + Gtk.Box { + hexpand: true; + vexpand: true; + Adw.StatusPage { + hexpand: true; + vexpand: true; + title: "Now select the disk you want to install crystal on"; + description: "This will wipe the entire disk you selected"; + Adw.PreferencesPage { + Adw.PreferencesGroup { + Gtk.ListBox partition_list { + styles ["boxed-list"] + } + // Gtk.ListBox { + // margin-top: 10; + // Adw.ActionRow { + // title: "I will partition myself"; + // Gtk.Box { + // Gtk.Button custom_partition { + // label: "Continue"; + // margin-top: 5; + // margin-bottom: 5; + // } + // } + // } + // styles ["boxed-list"] + // } + } + } + + } + 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 index 9f73000..99c3ff5 100644 --- a/src/widgets/desktop.blp +++ b/src/widgets/desktop.blp @@ -3,7 +3,6 @@ using Adw 1; template DesktopEntry : Adw.ActionRow { title: "DesktopEntry"; - Gtk.Box { Gtk.CheckButton select_button { use-underline: true; diff --git a/src/widgets/desktop.py b/src/widgets/desktop.py index 07767ae..a6cc597 100644 --- a/src/widgets/desktop.py +++ b/src/widgets/desktop.py @@ -28,7 +28,7 @@ class DesktopEntry(Adw.ActionRow): def __init__(self, window, desktop, button_group, application, **kwargs): super().__init__(**kwargs) - + self.window = window self.set_title(desktop) self.select_button.set_group(button_group) diff --git a/src/widgets/disk.blp b/src/widgets/disk.blp new file mode 100644 index 0000000..5e0d37f --- /dev/null +++ b/src/widgets/disk.blp @@ -0,0 +1,12 @@ +using Gtk 4.0; +using Adw 1; + +template DiskEntry : Adw.ActionRow { + title: "Disk"; + subtitle: "disk size"; + Gtk.Box { + Gtk.CheckButton select_button { + use-underline: true; + } + } +} \ No newline at end of file diff --git a/src/widgets/disk.py b/src/widgets/disk.py new file mode 100644 index 0000000..462b3de --- /dev/null +++ b/src/widgets/disk.py @@ -0,0 +1,34 @@ +# disk.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/disk.ui') +class DiskEntry(Adw.ActionRow): + __gtype_name__ = 'DiskEntry' + + select_button = Gtk.Template.Child() + + def __init__(self, window, disk, disk_size, button_group, application, **kwargs): + super().__init__(**kwargs) + self.window = window + self.set_title(disk) + self.set_subtitle(disk_size) + self.select_button.set_group(button_group) diff --git a/src/widgets/meson.build b/src/widgets/meson.build index d15f9f5..8eda319 100644 --- a/src/widgets/meson.build +++ b/src/widgets/meson.build @@ -7,5 +7,6 @@ jade_gui_sources = [ 'layout.py', 'variant.py', 'desktop.py', + 'disk.py' ] install_data(jade_gui_sources, install_dir: widgetsdir) \ No newline at end of file diff --git a/src/window.py b/src/window.py index 124cf7c..27a585f 100644 --- a/src/window.py +++ b/src/window.py @@ -23,11 +23,13 @@ from .widgets.timezone import TimezoneEntry from .widgets.layout import KeyboardLayout from .widgets.variant import KeyboardVariant from .widgets.desktop import DesktopEntry +from .widgets.disk import DiskEntry from .functions.keyboard_screen import KeyboardScreen from .functions.timezone_screen import TimezoneScreen from .functions.user_screen import UserScreen from .functions.desktop_screen import DesktopScreen from .functions.misc_screen import MiscScreen +from .functions.partition_screen import PartitionScreen @Gtk.Template(resource_path='/al/getcryst/jadegui/window.ui') class JadeGuiWindow(Gtk.ApplicationWindow): @@ -45,7 +47,8 @@ class JadeGuiWindow(Gtk.ApplicationWindow): def __init__(self, **kwargs): super().__init__(**kwargs) - self.misc_screen = MiscScreen(window=self, main_carousel=self.carousel, next_page=None, **kwargs) + self.partition_screen = PartitionScreen(window=self, main_carousel=self.carousel, next_page=None, **kwargs) + self.misc_screen = MiscScreen(window=self, main_carousel=self.carousel, next_page=self.partition_screen, **kwargs) self.desktop_screen = DesktopScreen(window=self, main_carousel=self.carousel, next_page=self.misc_screen, **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) @@ -55,6 +58,7 @@ class JadeGuiWindow(Gtk.ApplicationWindow): self.carousel.append(self.user_screen) self.carousel.append(self.desktop_screen) self.carousel.append(self.misc_screen) + self.carousel.append(self.partition_screen) ### Widgets for first page (welcome screen) #self.quit_button.connect("clicked", self.confirmQuit) self.next_button.connect("clicked", self.nextPage) @@ -97,6 +101,15 @@ class JadeGuiWindow(Gtk.ApplicationWindow): self.desktop_screen.list_desktops.append(desktop_test_three) ### --------- + ### Test partitions + partition_test = DiskEntry(window=self, disk="/dev/sda", disk_size="2000gb", button_group=None, **kwargs) + partition_test_two = DiskEntry(window=self, disk="/dev/nvme0n1", disk_size="100mb (morbillion bytes)", button_group=partition_test.select_button, **kwargs) + partition_test_three = DiskEntry(window=self, disk="/dev/whatotherdisklabelsarethere", disk_size="no", button_group=partition_test.select_button, **kwargs) + self.partition_screen.partition_list.append(partition_test) + self.partition_screen.partition_list.append(partition_test_two) + self.partition_screen.partition_list.append(partition_test_three) + ### --------- + # TODO: offload functions to seperate files/classes def nextPage(self, idk):