Add new pages

pull/6/head
axtloss 2 years ago
parent 66b5725a14
commit 046387da1c

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

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

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

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

@ -6,11 +6,13 @@
<file>widgets/layout.ui</file>
<file>widgets/variant.ui</file>
<file>widgets/desktop.ui</file>
<file>widgets/disk.ui</file>
<file>pages/keyboard_screen.ui</file>
<file>pages/timezone_screen.ui</file>
<file>pages/user_screen.ui</file>
<file>pages/desktop_screen.ui</file>
<file>pages/misc_screen.ui</file>
<file>pages/partition_screen.ui</file>
<file>gtk/help-overlay.ui</file>
<file>crystal-logo-minimal.png</file>
</gresource>

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

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

@ -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"]
}
}
}
}

@ -3,7 +3,6 @@ using Adw 1;
template DesktopEntry : Adw.ActionRow {
title: "DesktopEntry";
Gtk.Box {
Gtk.CheckButton select_button {
use-underline: true;

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

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

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

@ -7,5 +7,6 @@ jade_gui_sources = [
'layout.py',
'variant.py',
'desktop.py',
'disk.py'
]
install_data(jade_gui_sources, install_dir: widgetsdir)

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

Loading…
Cancel
Save