mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-18 03:54:17 +02:00
Add printer model display to file cards for .3mf files
Co-authored-by: cadtoolbox <12723486+cadtoolbox@users.noreply.github.com>
This commit is contained in:
co-authored by
cadtoolbox
parent
248cbaf8f0
commit
4f54251189
@@ -664,10 +664,12 @@ async def list_files(
|
||||
print_name = None
|
||||
print_time = None
|
||||
filament_grams = None
|
||||
sliced_for_model = None
|
||||
if f.file_metadata:
|
||||
print_name = f.file_metadata.get("print_name")
|
||||
print_time = f.file_metadata.get("print_time_seconds")
|
||||
filament_grams = f.file_metadata.get("filament_used_grams")
|
||||
sliced_for_model = f.file_metadata.get("sliced_for_model")
|
||||
|
||||
file_list.append(
|
||||
FileListResponse(
|
||||
@@ -685,6 +687,7 @@ async def list_files(
|
||||
print_name=print_name,
|
||||
print_time_seconds=print_time,
|
||||
filament_used_grams=filament_grams,
|
||||
sliced_for_model=sliced_for_model,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -154,6 +154,7 @@ class FileListResponse(BaseModel):
|
||||
print_name: str | None = None
|
||||
print_time_seconds: int | None = None
|
||||
filament_used_grams: float | None = None
|
||||
sliced_for_model: str | None = None
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
@@ -3820,6 +3820,7 @@ export interface LibraryFileListItem {
|
||||
print_name: string | null;
|
||||
print_time_seconds: number | null;
|
||||
filament_used_grams: number | null;
|
||||
sliced_for_model: string | null;
|
||||
}
|
||||
|
||||
export interface LibraryFileUpdate {
|
||||
|
||||
@@ -962,6 +962,12 @@ function FileCard({ file, isSelected, isMobile, onSelect, onDelete, onDownload,
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
{file.sliced_for_model && (
|
||||
<div className="mt-1 text-xs text-purple-400 flex items-center gap-1">
|
||||
<Printer className="w-3 h-3" />
|
||||
{file.sliced_for_model}
|
||||
</div>
|
||||
)}
|
||||
{file.print_count > 0 && (
|
||||
<div className="mt-1 text-xs text-bambu-green">
|
||||
{t('fileManager.printedCount', { count: file.print_count })}
|
||||
|
||||
Reference in New Issue
Block a user