mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-24 23:23:59 -06:00
NEW: Add Custom Filament Manager UI
Jira: xxxx Change-Id: Ib2097ae7b471382c170efc5b73dcd13eb729819a
This commit is contained in:
parent
e697fee9ae
commit
f593f64cbb
6 changed files with 1102 additions and 12 deletions
|
@ -7,8 +7,13 @@ var VendorPriority=new Array("bambu lab","bambulab","bbl","kexcelled","polymaker
|
|||
function OnInit()
|
||||
{
|
||||
TranslatePage();
|
||||
OnSelectMenu(1);
|
||||
|
||||
RequestProfile();
|
||||
|
||||
RequestCustomFilaments();
|
||||
//TestCustomFilaments();
|
||||
//OnSelectMenu(2);
|
||||
}
|
||||
|
||||
function RequestProfile()
|
||||
|
@ -39,6 +44,10 @@ function HandleStudio(pVal)
|
|||
m_ProfileItem=pVal['response'];
|
||||
SortUI();
|
||||
}
|
||||
else if(strCmd=='update_custom_filaments')
|
||||
{
|
||||
UpdateCustomFilaments( pVal['data'] );
|
||||
}
|
||||
}
|
||||
|
||||
function GetFilamentShortname( sName )
|
||||
|
@ -554,5 +563,95 @@ function ConfirmSelect()
|
|||
}
|
||||
|
||||
|
||||
function OnSelectMenu( nIndex )
|
||||
{
|
||||
switch(nIndex)
|
||||
{
|
||||
case 1:
|
||||
$('#SystemFilamentBtn').addClass('TitleSelected');
|
||||
$('#SystemFilamentBtn').removeClass('TitleUnselected');
|
||||
|
||||
$('#CustomFilamentBtn').addClass('TitleUnselected');
|
||||
$('#CustomFilamentBtn').removeClass('TitleSelected');
|
||||
|
||||
$('#SystemFilamentsArea').css('display','flex');
|
||||
$('#CustomFilamentsArea').css('display','none');
|
||||
break;
|
||||
case 2:
|
||||
$('#CustomFilamentBtn').addClass('TitleSelected');
|
||||
$('#CustomFilamentBtn').removeClass('TitleUnselected');
|
||||
|
||||
$('#SystemFilamentBtn').addClass('TitleUnselected');
|
||||
$('#SystemFilamentBtn').removeClass('TitleSelected');
|
||||
|
||||
$('#CustomFilamentsArea').css('display','flex');
|
||||
$('#SystemFilamentsArea').css('display','none');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function RequestCustomFilaments()
|
||||
{
|
||||
var tSend={};
|
||||
tSend['sequence_id']=Math.round(new Date() / 1000);
|
||||
tSend['command']="request_custom_filaments";
|
||||
|
||||
SendWXMessage( JSON.stringify(tSend) );
|
||||
}
|
||||
|
||||
function TestCustomFilaments()
|
||||
{
|
||||
let strTest='{"command":"update_custom_filaments","data":[{"id":"P0c71f94","name":"AMOLEN ABS 222"},{"id":"P19cc6c5","name":"PrimaSelect PLA 231654"},{"id":"P93a5c3b","name":"3DJAKE PLA 111"}],"sequence_id":"2000"}';
|
||||
let tItem=JSON.parse(strTest);
|
||||
|
||||
HandleStudio(tItem);
|
||||
}
|
||||
|
||||
function UpdateCustomFilaments( CFList )
|
||||
{
|
||||
let strHtml='';
|
||||
let nTotal=CFList.length;
|
||||
|
||||
for(let n=0;n<nTotal;n++)
|
||||
{
|
||||
let pItem=CFList[n];
|
||||
|
||||
let F_id=pItem['id'];
|
||||
let F_name=pItem['name'];
|
||||
|
||||
let strAdd='<div class="CFilament_Item">'+
|
||||
'<a class="CFilament_Name" title="'+F_name+'">'+F_name+'</a><img onClick="CFEdit(\''+F_id+'\')" class="CFilament_EditBtn" src="../../image/edit.svg" />'+
|
||||
'</div>';
|
||||
|
||||
strHtml+=strAdd;
|
||||
}
|
||||
|
||||
$('#CFilament_List').html(strHtml);
|
||||
}
|
||||
|
||||
|
||||
function OnClickCustomFilamentAdd()
|
||||
{
|
||||
//alert('Create New Custom Filament');
|
||||
|
||||
var tSend={};
|
||||
tSend['sequence_id']=Math.round(new Date() / 1000);
|
||||
tSend['command']="create_custom_filament";
|
||||
|
||||
SendWXMessage( JSON.stringify(tSend) );
|
||||
}
|
||||
|
||||
//编辑某一个自定义材料
|
||||
function CFEdit( fid )
|
||||
{
|
||||
//alert(fid);
|
||||
|
||||
var tSend={};
|
||||
tSend['sequence_id']=Math.round(new Date() / 1000);
|
||||
tSend['command']="modify_custom_filament";
|
||||
tSend['id']=fid;
|
||||
|
||||
SendWXMessage( JSON.stringify(tSend) );
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue