ENH: Show Printer Thumbnail From Profile Folder

Change-Id: I1ebea7016bcf8725d80d450ea82ff85941cb0dc8
(cherry picked from commit 9cd50c690a70f103a9140fdb85cca7d2858874b0)
This commit is contained in:
zorro.zhang 2023-06-14 11:29:09 +08:00 committed by Lane.Wei
parent 5cd1c1b685
commit 26ec9ae385
4 changed files with 27 additions and 8 deletions

View File

@ -36,7 +36,7 @@
.PrinterArea
{
padding: 10px;
padding: 0px;
display: flex;
flex-wrap: wrap;
}
@ -45,7 +45,7 @@
{
width: 160px;
text-align: center;
padding: 10px;
padding: 8px;
}
.PrinterBlock img

View File

@ -41,6 +41,12 @@ function HandleStudio( pVal )
}
function ShowPrinterThumb(pItem, strImg)
{
$(pItem).attr('src',strImg);
$(pItem).attr('onerror',null);
}
function HandleModelList( pVal )
{
if( !pVal.hasOwnProperty("model") )
@ -75,7 +81,10 @@ function HandleModelList( pVal )
'</div>'+
'</div>';
$('#Content').append(HtmlNewVendor);
if(sVV=='Bambu Lab')
$('#Content').html( HtmlNewVendor + $('#Content').html() );
else
$('#Content').append( HtmlNewVendor );
}
let ModelName=OneModel['model'];
@ -93,8 +102,9 @@ function HandleModelList( pVal )
}
let CoverImage="../../image/printer/"+OneModel['model']+"_cover.png";
let CoverImage2="../../../profiles/"+strVendor+"/"+OneModel['model']+"_cover.png";
ModelHtml[strVendor]+='<div class="PrinterBlock">'+
' <div class="PImg"><img src="'+CoverImage+'" /></div>'+
' <div class="PImg"><img src="'+CoverImage+'" onerror="ShowPrinterThumb(this,\''+CoverImage2+'\')" /></div>'+
' <div class="PName">'+OneModel['model']+'</div>'+ HtmlNozzel +'</div>';
}

View File

@ -59,7 +59,7 @@
.PrinterArea
{
padding: 10px;
padding: 0px;
display: flex;
flex-wrap: wrap;
}
@ -68,7 +68,7 @@
{
width: 160px;
text-align: center;
padding: 10px;
padding: 8px;
}
.PrinterBlock img

View File

@ -40,6 +40,11 @@ function HandleStudio( pVal )
}
}
function ShowPrinterThumb(pItem, strImg)
{
$(pItem).attr('src',strImg);
$(pItem).attr('onerror',null);
}
function HandleModelList( pVal )
{
@ -75,7 +80,10 @@ function HandleModelList( pVal )
'</div>'+
'</div>';
$('#Content').append(HtmlNewVendor);
if(sVV=='Bambu Lab')
$('#Content').html( HtmlNewVendor + $('#Content').html() );
else
$('#Content').append( HtmlNewVendor );
}
let ModelName=OneModel['model'];
@ -93,8 +101,9 @@ function HandleModelList( pVal )
}
let CoverImage="../../image/printer/"+OneModel['model']+"_cover.png";
let CoverImage2="../../../profiles/"+strVendor+"/"+OneModel['model']+"_cover.png";
ModelHtml[strVendor]+='<div class="PrinterBlock">'+
' <div class="PImg"><img src="'+CoverImage+'" /></div>'+
' <div class="PImg"><img src="'+CoverImage+'" onerror="ShowPrinterThumb(this,\''+CoverImage2+'\')" /></div>'+
' <div class="PName">'+OneModel['model']+'</div>'+ HtmlNozzel +'</div>';
}