Populate disks page

pull/6/head
axtloss 2 years ago
parent 7d5538ab64
commit ead0e4af54

@ -30,6 +30,11 @@ class MiscScreen(Adw.Bin):
theme_switch = Gtk.Template.Child()
next_page_button = Gtk.Template.Child()
hostname = "crystal"
ipv_enabled = False
crystal_theming_enabled = False
timeshift_enabled = True
def __init__(self, window, main_carousel, next_page, application, **kwargs):
super().__init__(**kwargs)
self.window = window
@ -38,4 +43,8 @@ class MiscScreen(Adw.Bin):
self.next_page_button.connect("clicked", self.carousel_next)
def carousel_next(self, widget):
self.hostname = self.hostname_entry.get_text()
self.ipv_enabled = self.ipv_switch.get_state()
self.crystal_theming_enabled = self.theme_switch.get_state()
self.timeshift_enabled = self.timeshift_switch.get_state()
self.carousel.scroll_to(self.next_page, True)

@ -63,6 +63,8 @@ subdir('widgets')
subdir('functions')
subdir('classes')
subdir('locales')
subdir('utils')
subdir('scripts')
jade_gui_sources = [
'__init__.py',

@ -0,0 +1,2 @@
#!/usr/bin/bash
flatpak-spawn --host lsblk -pdo SIZE $1 | grep -v SIZE

@ -0,0 +1,2 @@
#!/usr/bin/bash
flatpak-spawn --host lsblk -pdo name | grep -v zram | grep -v NAME | grep -v loop | grep -v sr

@ -0,0 +1,8 @@
pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())
scriptsdir = join_paths(pkgdatadir, 'jade_gui/scripts')
jade_gui_sources = [
'getDisks.sh',
'getDiskSize.sh',
]
install_data(jade_gui_sources, install_dir: scriptsdir)

@ -0,0 +1,30 @@
# exec.py
#
# Copyright 2022 axtlos
#
# 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/>.
#
# SPDX-License-Identifier: GPL-3.0-only
import subprocess
def get_disks():
command=subprocess.run(["bash", "-c", "bash -- /app/share/jade_gui/jade_gui/scripts/getDisks.sh"], capture_output=True)
disks=command.stdout.decode('utf-8')[:-1].split('\n')
return disks
def get_disk_size(disk: str):
command=subprocess.run(["bash", "-c", "bash -- /app/share/jade_gui/jade_gui/scripts/getDiskSize.sh "+disk], capture_output=True)
size=command.stdout.decode('utf-8').strip('\n')
print(disk+":"+size)
return size+"iB"

@ -0,0 +1,8 @@
pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())
utilsdir = join_paths(pkgdatadir, 'jade_gui/utils')
jade_gui_sources = [
'__init__.py',
'disks.py',
]
install_data(jade_gui_sources, install_dir: utilsdir)

@ -36,6 +36,7 @@ from .functions.finished_screen import FinishedScreen
from .locales.locales_list import locations
from .keymaps import keymaps
from .desktops import desktops
from .utils import disks
@Gtk.Template(resource_path='/al/getcryst/jadegui/window.ui')
class JadeGuiWindow(Gtk.ApplicationWindow):
@ -92,26 +93,25 @@ class JadeGuiWindow(Gtk.ApplicationWindow):
self.keyboard_screen.list_keyboard_layouts.append(KeyboardLayout(window=self, country=keymap.layout, country_shorthand=keymap.backend_layout, variants=keymap.variant, **kwargs))
### ---------
### Test variants
### ---------
### Test desktops
onyx = DesktopEntry(window=self, desktop="Onyx", button_group=None, **kwargs) # Manually specifying onyx since the other entries need a button group to attach to
self.desktop_screen.list_desktops.append(onyx)
for desktop in desktops:
if desktop is not "Onyx":
if desktop != "Onyx":
print(desktop)
self.desktop_screen.list_desktops.append(DesktopEntry(window=self, desktop=desktop, button_group=onyx.select_button, **kwargs))
### ---------
### 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)
available_disks = disks.get_disks()
firstdisk = DiskEntry(window=self, disk=available_disks[0], disk_size=disks.get_disk_size(available_disks[0]), button_group=None, **kwargs)
self.partition_screen.partition_list.append(firstdisk)
print(available_disks[0])
print(available_disks)
for disk in available_disks:
if disk != available_disks[0]:
print(disk)
self.partition_screen.partition_list.append(DiskEntry(window=self, disk=disk, disk_size=disks.get_disk_size(disk), button_group=firstdisk.select_button, **kwargs))
### ---------
def nextPage(self, idk):

Loading…
Cancel
Save