First batch of bug fixes

libadwaita-rewrite
axtloss 2 years ago
parent d18cae4a1e
commit 3e5139ab04

@ -52,43 +52,46 @@ class InstallPrefs:
def generate_json(self):
prefs = {
"partition": {
"device": self.disk,
"mode": "Auto",
"efi": self.is_efi,
"partitions": "",
'"partition"': {
'"device"': '"'+self.disk+'"',
'"mode"': '"Auto"',
'"efi"': self.is_efi,
'"partitions"': [],
},
"bootloader": {
"type": self.bootloader_type,
"location": self.bootloader_location,
'"bootloader"': {
'"type"': '"'+self.bootloader_type+'"',
'"location"': '"'+self.bootloader_location+'"'
},
"locale": {
"locale": [
self.timezone.locale
'"locale"': {
'"locale"': [
'"'+ self.timezone.locale+'"'
],
"keymap": self.layout.country_shorthand,
"timezone": self.timezone.region+"/"+self.timezone.location,
'"keymap"': '"'+self.layout.country_shorthand+'"',
'"timezone"': '"'+self.timezone.region+"/"+self.timezone.location+'"'
},
"networking": {
"hostname": self.hostname,
"ipv6": self.ipv_enabled,
'"networking"': {
'"hostname"': '"'+self.hostname+'"',
'"ipv6"': self.ipv_enabled
},
"users": [
'"users"': [
{
"name": self.username,
"password": self.password,
"hasroot": self.enable_sudo,
},
'"name"': '"'+self.username+'"',
'"password"': '"'+self.password+'"',
'"hasroot"': self.enable_sudo
}
],
"rootpass": self.password,
"desktop": self.desktop.lower(),
"unakite": {
"enable": False,
"root": "/dev/null",
"oldroot": self.disk,
"efidir": "/dev/null",
"bootdev": "/dev/null",
'"rootpass"': '"'+self.password+'"',
'"desktop"': '"'+self.desktop.lower()+'"',
'"timeshift"': self.timeshift_enable,
'"extra_packages"': [],
'"flatpak"': True,
'"unakite"': {
'"enable"': False,
'"root"': '"/dev/null"',
'"oldroot"': '"'+self.disk+'"',
'"efidir"': '"/dev/null"',
'"bootdev"': '"/dev/null"'
},
"kernel": "linux"
'"kernel"': '"linux"'
}
return json.dumps(prefs)

@ -45,7 +45,7 @@ class PartitionScreen(Adw.Bin):
row.select_button.set_active(True)
self.selected_partition = row
else:
print("row is none!!")
print("ERROR: invalid row slected")
def carousel_next(self, widget):
self.window.summary_screen.initialize()

@ -20,7 +20,7 @@
from gi.repository import Gtk, Adw
from gettext import gettext as _
import re
import re, subprocess
@Gtk.Template(resource_path='/al/getcryst/jadegui/pages/user_screen.ui')
class UserScreen(Adw.Bin):
@ -95,11 +95,17 @@ class UserScreen(Adw.Bin):
if self.password_entry.get_text() == self.password_confirmation.get_text():
self.next_page.set_sensitive(True)
self.password_confirmation.remove_css_class('error')
self.password = self.password_entry.get_text()
elif self.password_entry.get_text() != self.password_confirmation.get_text():
self.password = self.encrypt_password(self.password_entry.get_text())
else:
self.next_page.set_sensitive(False)
self.password_confirmation.add_css_class('error')
def encrypt_password(self, password):
command=subprocess.run(["openssl", "passwd", "-6", password], capture_output=True)
password_encrypted=command.stdout.decode('utf-8').strip('\n')
return password_encrypted
def carousel_next(self, widget):
if self.move_to_summary:
self.window.summary_screen.initialize()

@ -16,6 +16,7 @@ template PartitionScreen : Adw.Bin {
Adw.PreferencesPage {
Adw.PreferencesGroup {
Gtk.ListBox partition_list {
activate-on-single-click: true;
styles ["boxed-list"]
}
// Gtk.ListBox {

@ -19,10 +19,10 @@ template UserScreen : Adw.Bin {
Adw.EntryRow username_entry {
title: "Enter your username";
}
Adw.EntryRow password_entry {
Adw.PasswordEntryRow password_entry {
title: "Enter your password";
}
Adw.EntryRow password_confirmation {
Adw.PasswordEntryRow password_confirmation {
title: "Repeat your password";
}
Gtk.ListBox { // TODO: MOVE TO ADVANCED/MISC SECTION???

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

@ -0,0 +1,2 @@
#!/usr/bin/bash
flatpak-spawn --host lsblk -d -o rota $1 | grep -v ROTA

@ -1,4 +1,4 @@
#!/usr/bin/bash
flatpak-spawn --host pkexec jade /tmp/jade.json
flatpak-spawn --host pkexec jade config /tmp/jade.json
#flatpak-spawn --host echo "hi"
#flatpak-spawn --host pkexec whoami

@ -7,5 +7,7 @@ jade_gui_sources = [
'checkEFI.sh',
'install.sh',
'savePrefs.sh',
'getDiskType.sh',
'getDiskName.sh',
]
install_data(jade_gui_sources, install_dir: scriptsdir)

@ -33,3 +33,15 @@ def get_uefi():
command=subprocess.run(["bash", "-c", "bash -- /app/share/jade_gui/jade_gui/scripts/checkEFI.sh"], capture_output=True)
isEfi=True if command.stdout.decode('utf-8').strip('\n') == "UEFI" else False
return isEfi
def get_disk_type(disk: str):
command=subprocess.run(["bash", "-c", "bash -- /app/share/jade_gui/jade_gui/scripts/getDiskType.sh "+disk], capture_output=True)
disk_type=command.stdout.decode('utf-8').strip()
print(disk_type)
if disk_type == "0":
return "Solid-State Drive (SSD)"
elif disk_type == "1":
return "Hard Disk (HDD)"
else:
return "Drive type unknown"

@ -31,4 +31,11 @@ class DesktopEntry(Adw.ActionRow):
self.window = window
self.set_title(desktop)
self.select_button.set_group(button_group)
self.select_button.connect("toggled", self.toggled_cb)
def toggled_cb(self, check_button):
if check_button.props.active:
row = check_button.get_ancestor(Gtk.ListBoxRow)
row.activate()
self.selected_partition = row.get_title()

@ -3,8 +3,19 @@ using Adw 1;
template DiskEntry : Adw.ActionRow {
title: "Disk";
subtitle: "disk size";
subtitle: "Disk type";
activatable-widget: select_button;
Gtk.Box {
spacing: 6;
Gtk.Label size_label {
valign: center;
label: "Disk size";
styles ["tag", "caption"]
}
Gtk.Separator {
margin-top: 12;
margin-bottom: 12;
}
Gtk.CheckButton select_button {
use-underline: true;
}

@ -24,12 +24,24 @@ from gettext import gettext as _
class DiskEntry(Adw.ActionRow):
__gtype_name__ = 'DiskEntry'
size_label = Gtk.Template.Child()
select_button = Gtk.Template.Child()
def __init__(self, window, disk, disk_size, button_group, application, **kwargs):
def __init__(self, window, disk, disk_size, disk_type, button_group, application, **kwargs):
super().__init__(**kwargs)
self.window = window
self.disk = disk
self.disk_size = disk
self.set_title(disk)
self.set_subtitle(disk_size)
self.disk_size = disk_size
self.disk_type = disk_type
self.set_title(disk.strip('/dev/'))
self.set_subtitle(disk_type)
self.size_label.set_label("Disk Size: "+disk_size)
self.select_button.set_group(button_group)
self.select_button.connect("toggled", self.toggled_cb)
def toggled_cb(self, check_button):
if check_button.props.active:
row = check_button.get_ancestor(Gtk.ListBoxRow)
row.emit('activate')
self.selected_partition = row.get_title()

@ -107,16 +107,31 @@ class JadeGuiWindow(Gtk.ApplicationWindow):
### Test partitions
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)
firstdisk = DiskEntry(
window=self,
disk=available_disks[0],
disk_size=disks.get_disk_size(available_disks[0]),
disk_type=disks.get_disk_type(available_disks[0]),
#disk_model=disks.get_disk_model(available_disks[0]),
button_group=None,
**kwargs
)
self.partition_screen.partition_list.append(firstdisk)
self.partition_screen.selected_partition = self.partition_screen.partition_list.get_row_at_index(0)
self.partition_screen.partition_list.select_row(firstdisk)
#print(available_disks[0])
#print(available_disks)
firstdisk.toggled_cb(firstdisk.select_button)
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))
self.partition_screen.partition_list.append(
DiskEntry(
window=self,
disk=disk,
disk_size=disks.get_disk_size(disk),
disk_type=disks.get_disk_type(disk),
#disk_model=disks.get_disk_model(disk),
button_group=firstdisk.select_button,
**kwargs
)
)
### ---------
def nextPage(self, idk):

Loading…
Cancel
Save