rename SoftwareRow to generic SelectionRow
This commit is contained in:
@@ -21,7 +21,7 @@ blueprints = custom_target('blueprints',
|
||||
'ui/widgets/device_row.blp',
|
||||
'ui/widgets/page_wrapper.blp',
|
||||
'ui/widgets/progress_row.blp',
|
||||
'ui/widgets/software_row.blp',
|
||||
'ui/widgets/selection_row.blp',
|
||||
),
|
||||
output: '.',
|
||||
command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'],
|
||||
|
||||
@@ -38,6 +38,6 @@
|
||||
<file preprocess="xml-stripblanks">ui/widgets/device_row.ui</file>
|
||||
<file preprocess="xml-stripblanks">ui/widgets/page_wrapper.ui</file>
|
||||
<file preprocess="xml-stripblanks">ui/widgets/progress_row.ui</file>
|
||||
<file preprocess="xml-stripblanks">ui/widgets/software_row.ui</file>
|
||||
<file preprocess="xml-stripblanks">ui/widgets/selection_row.ui</file>
|
||||
</gresource>
|
||||
</gresources>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Gtk 4.0;
|
||||
using Adw 1;
|
||||
|
||||
template SoftwareRow : Adw.ActionRow {
|
||||
template SelectionRow : Adw.ActionRow {
|
||||
activatable: true;
|
||||
focusable: true;
|
||||
height-request: 84;
|
||||
@@ -5,7 +5,7 @@ from gi.repository import Gio, Gtk
|
||||
from .global_state import global_state
|
||||
from .page import Page
|
||||
from .software_provider import get_software_suggestions
|
||||
from .widgets import reset_model, SoftwareRow
|
||||
from .widgets import reset_model, SelectionRow
|
||||
|
||||
|
||||
@Gtk.Template(resource_path='/com/github/p3732/os-installer/ui/pages/software.ui')
|
||||
@@ -19,7 +19,8 @@ class SoftwarePage(Gtk.Box, Page):
|
||||
def __init__(self, **kwargs):
|
||||
Gtk.Box.__init__(self, **kwargs)
|
||||
self.software_list.bind_model(
|
||||
self.software_model, lambda o: SoftwareRow(o))
|
||||
self.software_model,
|
||||
lambda pkg: SelectionRow(pkg.name, pkg.description, pkg.icon_path, pkg.suggested, pkg.package))
|
||||
|
||||
def _setup_software(self):
|
||||
suggestions = get_software_suggestions()
|
||||
|
||||
@@ -63,21 +63,24 @@ class ProgressRow(Adw.ActionRow):
|
||||
return self.get_title()
|
||||
|
||||
|
||||
@Gtk.Template(resource_path='/com/github/p3732/os-installer/ui/widgets/software_row.ui')
|
||||
class SoftwareRow(Adw.ActionRow):
|
||||
__gtype_name__ = 'SoftwareRow'
|
||||
@Gtk.Template(resource_path='/com/github/p3732/os-installer/ui/widgets/selection_row.ui')
|
||||
class SelectionRow(Adw.ActionRow):
|
||||
__gtype_name__ = 'SelectionRow'
|
||||
|
||||
icon = Gtk.Template.Child()
|
||||
switch = Gtk.Template.Child()
|
||||
|
||||
def __init__(self, package, **kwargs):
|
||||
def __init__(self, title, description, icon_path, default_state, info, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
self.set_title(package.name)
|
||||
self.set_subtitle(package.description)
|
||||
self.icon.set_from_file(package.icon_path)
|
||||
self.switch.set_state(package.suggested)
|
||||
self.set_title(title)
|
||||
self.set_subtitle(description)
|
||||
self.switch.set_state(default_state)
|
||||
if icon_path == None:
|
||||
self.icon.set_visible(False)
|
||||
else:
|
||||
self.icon.set_from_file(icon_path)
|
||||
|
||||
self.info = package.package
|
||||
self.info = info
|
||||
|
||||
def is_activated(self):
|
||||
return self.switch.get_active()
|
||||
|
||||
Reference in New Issue
Block a user