Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions archinstall/lib/menu/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def __init__(
preview_location: Literal['right', 'bottom'] | None = None,
multi: bool = False,
enable_filter: bool = False,
wrap_preview: bool = False,
):
self._header = header
self._title = title
Expand All @@ -29,6 +30,7 @@ def __init__(
self._preview_location = preview_location
self._multi = multi
self._enable_filter = enable_filter
self._wrap_preview = wrap_preview

async def show(self) -> Result[ValueT]:
if self._multi:
Expand All @@ -39,6 +41,7 @@ async def show(self) -> Result[ValueT]:
allow_reset=self._allow_reset,
preview_location=self._preview_location,
enable_filter=self._enable_filter,
wrap_preview=self._wrap_preview,
).run()
else:
result = await OptionListScreen[ValueT](
Expand All @@ -49,6 +52,7 @@ async def show(self) -> Result[ValueT]:
allow_reset=self._allow_reset,
preview_location=self._preview_location,
enable_filter=self._enable_filter,
wrap_preview=self._wrap_preview,
).run()

if result.type_ == ResultType.Reset:
Expand Down
1 change: 0 additions & 1 deletion archinstall/lib/models/packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ class AvailablePackage(BaseModel):
def longest_key(self) -> int:
return max(len(key) for key in self.model_dump().keys())

# return all package info line by line
def info(self) -> str:
output = ''
for key, value in self.model_dump().items():
Expand Down
7 changes: 4 additions & 3 deletions archinstall/lib/packages/packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def installed_package(package: str) -> LocalPackage | None:
try:
package_info = []
for line in Pacman.run(f'-Q --info {package}'):
package_info.append(line.decode().strip())
package_info.append(line.decode().rstrip())

return _parse_package_output(package_info, LocalPackage)
except SysCallError:
Expand Down Expand Up @@ -53,7 +53,7 @@ def available_package(package: str) -> AvailablePackage | None:
try:
package_info: list[str] = []
for line in Pacman.run(f'-S --info {package}'):
package_info.append(line.decode().strip())
package_info.append(line.decode().rstrip())

return _parse_package_output(package_info, AvailablePackage)
except SysCallError:
Expand All @@ -79,7 +79,7 @@ def list_available_packages(
debug(f'Failed to sync Arch Linux package database: {e}')

for line in Pacman.run('-S --info'):
dec_line = line.decode().strip()
dec_line = line.decode().rstrip()
current_package.append(dec_line)

if dec_line.startswith('Validated'):
Expand Down Expand Up @@ -187,6 +187,7 @@ async def select_additional_packages(
multi=True,
preview_location='right',
enable_filter=True,
wrap_preview=True,
).show()

match pck_result.type_:
Expand Down
24 changes: 22 additions & 2 deletions archinstall/tui/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,11 @@ class OptionListScreen(BaseScreen[ValueT]):
color: white;
text-style: bold;
}

.wrap-preview {
width: 100%;
height: auto;
}
"""

def __init__(
Expand All @@ -211,13 +216,15 @@ def __init__(
allow_reset: bool = False,
preview_location: Literal['right', 'bottom'] | None = None,
enable_filter: bool = False,
wrap_preview: bool = False,
):
super().__init__(allow_skip, allow_reset)
self._group = group
self._header = header
self._title = title
self._preview_location = preview_location
self._filter = enable_filter
self._wrap_preview = wrap_preview
self._show_frame = False

self._options = self._get_options()
Expand Down Expand Up @@ -280,7 +287,10 @@ def compose(self) -> ComposeResult:
with Container():
yield option_list
yield Rule(orientation=rule_orientation)
yield ScrollableContainer(Label('', id='preview_content', markup=False))
preview_label = Label('', id='preview_content', markup=False)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you test this?
You have only defined the wrap-preview CSS for SelectListScreen

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. It works. But I think I understand what you mean...

if self._wrap_preview:
preview_label.add_class('wrap-preview')
yield ScrollableContainer(preview_label)

if self._filter:
yield Input(placeholder='/filter', id='filter-input')
Expand Down Expand Up @@ -433,6 +443,11 @@ class SelectListScreen(BaseScreen[ValueT]):
color: white;
text-style: bold;
}

.wrap-preview {
width: 100%;
height: auto;
}
"""

def __init__(
Expand All @@ -443,13 +458,15 @@ def __init__(
allow_reset: bool = False,
preview_location: Literal['right', 'bottom'] | None = None,
enable_filter: bool = False,
wrap_preview: bool = False,
):
super().__init__(allow_skip, allow_reset)
self._group = group
self._header = header
self._preview_location = preview_location
self._show_frame = False
self._filter = enable_filter
self._wrap_preview = wrap_preview

self._selected_items: list[MenuItem] = self._group.selected_items
self._options: list[Selection[MenuItem]] = self._get_selections()
Expand Down Expand Up @@ -510,7 +527,10 @@ def compose(self) -> ComposeResult:
with Container():
yield selection_list
yield Rule(orientation=rule_orientation)
yield ScrollableContainer(Label('', id='preview_content', markup=False))
preview_label = Label('', id='preview_content', markup=False)
if self._wrap_preview:
preview_label.add_class('wrap-preview')
yield ScrollableContainer(preview_label)

if self._filter:
yield Input(placeholder='/filter', id='filter-input')
Expand Down