disk: add empty state (no disks)
* add icon to represent no disks * use AdwStatusPage to represent empty state * return alternating dummy disks or no disks in demo-mode
This commit is contained in:
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M 4.0000003,0 C 2.3554526,0 1,1.3554897 1,3 V 5.4999999 H 3.0000004 V 3 c 0,-0.5546835 0.4453168,-0.9999999 0.9999999,-0.9999999 H 5.0000006 V 0 Z M 6.0000005,0 V 2.0000001 H 10 V 0 Z M 11,0 v 2.0000001 h 1.000001 C 12.570293,2.0000001 13,2.4297071 13,3 v 2.4999999 h 2 V 3 C 15,1.3554897 13.64451,0 12.000001,0 Z M 8.0000006,3 C 5.7890526,3 4.0000003,4.7890896 4.0000003,6.9999999 V 11 H 8.0000006 C 10.500007,11 12.000001,9.210948 12.000001,6.9999999 12.000001,4.7890896 10.210948,3 8.0000006,3 Z m 0,2.0000001 C 9.1054746,5.0000001 10,5.8945637 10,6.9999999 c 0,1.105474 -0.8945254,2.0000002 -1.9999994,2.0000002 -1.105474,0 -2.0000001,-0.8945262 -2.0000001,-2.0000002 0,-1.1054362 0.8945261,-1.9999998 2.0000001,-1.9999998 z M 1,6.5000002 V 10.5 H 3.0000004 V 6.5000002 Z m 12,0 V 10.5 h 2 V 6.5000002 Z M 1,11.5 V 13 c 0,1.644549 1.3554526,3 3.0000003,3 H 5.0000006 V 13 H 4.0000003 C 3.4453172,13 3.0000004,12.554683 3.0000004,12 v -0.5 z m 12,0 V 12 c 0,0.570331 -0.429707,1 -0.999999,1 H 11 v 3 h 1.000001 C 13.64451,16 15,14.644549 15,13 V 11.5 Z M 6.0000005,13 v 3 H 10 v -3 z" style="marker:none" overflow="visible" fill="#2e3436"/></svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
@@ -10,8 +10,9 @@
|
||||
|
||||
<!-- Icons -->
|
||||
<file preprocess="xml-stripblanks">icon/scalable/actions/globe-symbolic.svg</file>
|
||||
<file preprocess="xml-stripblanks">icon/scalable/actions/question-round-symbolic.svg</file>
|
||||
<file preprocess="xml-stripblanks">icon/scalable/actions/language-symbolic.svg</file>
|
||||
<file preprocess="xml-stripblanks">icon/scalable/actions/no-disk-symbolic.svg</file>
|
||||
<file preprocess="xml-stripblanks">icon/scalable/actions/question-round-symbolic.svg</file>
|
||||
<file preprocess="xml-stripblanks">icon/scalable/actions/user-symbolic.svg</file>
|
||||
|
||||
<!-- UI Files -->
|
||||
|
||||
@@ -163,6 +163,15 @@ template DiskPage : Box {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
StackPage {
|
||||
name: "no-disks";
|
||||
child:
|
||||
Adw.StatusPage {
|
||||
title: _("No Disks avaliable");
|
||||
description: _("Connect a disk and reload this page.");
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,9 @@ GIGABYTE_FACTOR = 1024 * 1024 * 1024
|
||||
@Gtk.Template(resource_path='/com/github/p3732/os-installer/ui/pages/disk.ui')
|
||||
class DiskPage(Gtk.Box, Page):
|
||||
__gtype_name__ = __qualname__
|
||||
image_name = 'drive-harddisk-system-symbolic'
|
||||
no_disk_image_name = 'no-disk-symbolic'
|
||||
default_image_name = 'drive-harddisk-system-symbolic'
|
||||
image_name = default_image_name
|
||||
can_reload = True
|
||||
|
||||
disk_label = Gtk.Template.Child()
|
||||
@@ -52,8 +54,14 @@ class DiskPage(Gtk.Box, Page):
|
||||
disks = disk_provider.get_testing_dummy_disks()
|
||||
else:
|
||||
disks = disk_provider.get_disks()
|
||||
reset_model(self.disk_list_model, disks)
|
||||
self.list_stack.set_visible_child_name('disks')
|
||||
if len(disks) == 0:
|
||||
self.list_stack.set_visible_child_name('no-disks')
|
||||
self.image_name = self.no_disk_image_name
|
||||
else:
|
||||
reset_model(self.disk_list_model, disks)
|
||||
self.list_stack.set_visible_child_name('disks')
|
||||
self.image_name = self.default_image_name
|
||||
global_state.set_title_image(self.image_name)
|
||||
|
||||
def _setup_partition_list(self, disk_info):
|
||||
self.current_disk = disk_info
|
||||
|
||||
@@ -114,6 +114,9 @@ class DiskProvider:
|
||||
return disks
|
||||
|
||||
def get_testing_dummy_disks(self):
|
||||
self.flip = not self.flip if hasattr(self, 'flip') and self.flip else True
|
||||
if self.flip:
|
||||
return []
|
||||
smol_partition = DeviceInfo("sm0l partiton", 1000, "/dev/00null")
|
||||
smol_disk = Disk("Dummy", 10000, "/dev/null", ([smol_partition], None))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user