mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-04-23 06:09:38 +08:00
Clean up and code style fixing
Contributes to CURA-6683.
This commit is contained in:
parent
4dd6c5b03a
commit
0b9052b068
@ -24,12 +24,30 @@ Item
|
|||||||
readonly property string infill_mesh_type: "infill_mesh"
|
readonly property string infill_mesh_type: "infill_mesh"
|
||||||
readonly property string anti_overhang_mesh_type: "anti_overhang_mesh"
|
readonly property string anti_overhang_mesh_type: "anti_overhang_mesh"
|
||||||
|
|
||||||
property var current_mesh_type: UM.ActiveTool.properties.getValue("MeshType")
|
property var currentMeshType: UM.ActiveTool.properties.getValue("MeshType")
|
||||||
|
|
||||||
|
// Update the view every time the currentMeshType changes
|
||||||
|
onCurrentMeshTypeChanged:
|
||||||
|
{
|
||||||
|
// set checked state of mesh type buttons
|
||||||
|
normalButton.checked = currentMeshType === normal_mesh_type
|
||||||
|
supportMeshButton.checked = currentMeshType === support_mesh_type
|
||||||
|
overhangMeshButton.checked = currentMeshType === infill_mesh_type || currentMeshType === cutting_mesh_type
|
||||||
|
antiOverhangMeshButton.checked = currentMeshType === anti_overhang_mesh_type
|
||||||
|
|
||||||
onCurrent_mesh_typeChanged: updateView(current_mesh_type)
|
// update active type label
|
||||||
|
for (var button in meshTypeButtons.children)
|
||||||
|
{
|
||||||
|
if (meshTypeButtons.children[button].checked)
|
||||||
|
{
|
||||||
|
meshTypeLabel.text = catalog.i18nc("@label","Mesh Type") + ": " + meshTypeButtons.children[button].text
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function setOverhangsMeshType(){
|
function setOverhangsMeshType()
|
||||||
|
{
|
||||||
if (infillOnlyCheckbox.checked)
|
if (infillOnlyCheckbox.checked)
|
||||||
{
|
{
|
||||||
setMeshType(infill_mesh_type)
|
setMeshType(infill_mesh_type)
|
||||||
@ -40,27 +58,11 @@ Item
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setMeshType(type){
|
function setMeshType(type)
|
||||||
|
{
|
||||||
UM.ActiveTool.setProperty("MeshType", type)
|
UM.ActiveTool.setProperty("MeshType", type)
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateView(type) {
|
|
||||||
// set checked state of mesh type buttons
|
|
||||||
normalButton.checked = type === normal_mesh_type
|
|
||||||
supportMeshButton.checked = type === support_mesh_type
|
|
||||||
overhangMeshButton.checked = type === infill_mesh_type || type === cutting_mesh_type
|
|
||||||
antiOverhangMeshButton.checked = type === anti_overhang_mesh_type
|
|
||||||
|
|
||||||
// update active type label
|
|
||||||
for (var button in meshTypeButtons.children)
|
|
||||||
{
|
|
||||||
if(meshTypeButtons.children[button].checked){
|
|
||||||
meshTypeLabel.text = catalog.i18nc("@label","Mesh Type") + ": " + meshTypeButtons.children[button].text
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
UM.I18nCatalog { id: catalog; name: "uranium"}
|
UM.I18nCatalog { id: catalog; name: "uranium"}
|
||||||
|
|
||||||
Column
|
Column
|
||||||
@ -143,13 +145,14 @@ Item
|
|||||||
|
|
||||||
style: UM.Theme.styles.checkbox;
|
style: UM.Theme.styles.checkbox;
|
||||||
|
|
||||||
visible: current_mesh_type === infill_mesh_type || current_mesh_type === cutting_mesh_type
|
visible: currentMeshType === infill_mesh_type || currentMeshType === cutting_mesh_type
|
||||||
onClicked: setOverhangsMeshType()
|
onClicked: setOverhangsMeshType()
|
||||||
|
|
||||||
Binding {
|
Binding
|
||||||
|
{
|
||||||
target: infillOnlyCheckbox
|
target: infillOnlyCheckbox
|
||||||
property: "checked"
|
property: "checked"
|
||||||
value: current_mesh_type === infill_mesh_type
|
value: currentMeshType === infill_mesh_type
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,7 +163,7 @@ Item
|
|||||||
id: currentSettings
|
id: currentSettings
|
||||||
property int maximumHeight: 200 * screenScaleFactor
|
property int maximumHeight: 200 * screenScaleFactor
|
||||||
height: Math.min(contents.count * (UM.Theme.getSize("section").height + UM.Theme.getSize("default_lining").height), maximumHeight)
|
height: Math.min(contents.count * (UM.Theme.getSize("section").height + UM.Theme.getSize("default_lining").height), maximumHeight)
|
||||||
visible: current_mesh_type != "anti_overhang_mesh"
|
visible: currentMeshType != "anti_overhang_mesh"
|
||||||
|
|
||||||
ScrollView
|
ScrollView
|
||||||
{
|
{
|
||||||
@ -190,7 +193,7 @@ Item
|
|||||||
{
|
{
|
||||||
var excluded_settings = [ "support_mesh", "anti_overhang_mesh", "cutting_mesh", "infill_mesh" ]
|
var excluded_settings = [ "support_mesh", "anti_overhang_mesh", "cutting_mesh", "infill_mesh" ]
|
||||||
|
|
||||||
if(current_mesh_type == "support_mesh")
|
if(currentMeshType == "support_mesh")
|
||||||
{
|
{
|
||||||
excluded_settings = excluded_settings.concat(base.all_categories_except_support)
|
excluded_settings = excluded_settings.concat(base.all_categories_except_support)
|
||||||
}
|
}
|
||||||
@ -204,7 +207,8 @@ Item
|
|||||||
|
|
||||||
// For some reason the model object is updated after removing him from the memory and
|
// For some reason the model object is updated after removing him from the memory and
|
||||||
// it happens only on Windows. For this reason, set the destroyed value manually.
|
// it happens only on Windows. For this reason, set the destroyed value manually.
|
||||||
Component.onDestruction: {
|
Component.onDestruction:
|
||||||
|
{
|
||||||
setDestroyed(true)
|
setDestroyed(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -229,7 +233,8 @@ Item
|
|||||||
//causing nasty issues when selecting different options. So disable asynchronous loading of enum type completely.
|
//causing nasty issues when selecting different options. So disable asynchronous loading of enum type completely.
|
||||||
asynchronous: model.type != "enum" && model.type != "extruder"
|
asynchronous: model.type != "enum" && model.type != "extruder"
|
||||||
|
|
||||||
onLoaded: {
|
onLoaded:
|
||||||
|
{
|
||||||
settingLoader.item.showRevertButton = false
|
settingLoader.item.showRevertButton = false
|
||||||
settingLoader.item.showInheritButton = false
|
settingLoader.item.showInheritButton = false
|
||||||
settingLoader.item.showLinkedSettingIcon = false
|
settingLoader.item.showLinkedSettingIcon = false
|
||||||
@ -385,7 +390,7 @@ Item
|
|||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
settingPickDialog.visible = true;
|
settingPickDialog.visible = true;
|
||||||
if (current_mesh_type == "support_mesh")
|
if (currentMeshType == "support_mesh")
|
||||||
{
|
{
|
||||||
settingPickDialog.additional_excluded_settings = base.all_categories_except_support;
|
settingPickDialog.additional_excluded_settings = base.all_categories_except_support;
|
||||||
}
|
}
|
||||||
@ -413,7 +418,7 @@ Item
|
|||||||
if(visible)
|
if(visible)
|
||||||
{
|
{
|
||||||
// Set skip setting, it will prevent from resetting selected mesh_type
|
// Set skip setting, it will prevent from resetting selected mesh_type
|
||||||
contents.model.visibilityHandler.addSkipResetSetting(current_mesh_type)
|
contents.model.visibilityHandler.addSkipResetSetting(currentMeshType)
|
||||||
listview.model.forceUpdate()
|
listview.model.forceUpdate()
|
||||||
|
|
||||||
updateFilter()
|
updateFilter()
|
||||||
@ -435,10 +440,12 @@ Item
|
|||||||
listview.model.filter = new_filter
|
listview.model.filter = new_filter
|
||||||
}
|
}
|
||||||
|
|
||||||
TextField {
|
TextField
|
||||||
|
{
|
||||||
id: filterInput
|
id: filterInput
|
||||||
|
|
||||||
anchors {
|
anchors
|
||||||
|
{
|
||||||
top: parent.top
|
top: parent.top
|
||||||
left: parent.left
|
left: parent.left
|
||||||
right: toggleShowAll.left
|
right: toggleShowAll.left
|
||||||
@ -454,7 +461,8 @@ Item
|
|||||||
{
|
{
|
||||||
id: toggleShowAll
|
id: toggleShowAll
|
||||||
|
|
||||||
anchors {
|
anchors
|
||||||
|
{
|
||||||
top: parent.top
|
top: parent.top
|
||||||
right: parent.right
|
right: parent.right
|
||||||
}
|
}
|
||||||
@ -521,11 +529,10 @@ Item
|
|||||||
}
|
}
|
||||||
|
|
||||||
rightButtons: [
|
rightButtons: [
|
||||||
Button {
|
Button
|
||||||
|
{
|
||||||
text: catalog.i18nc("@action:button", "Close")
|
text: catalog.i18nc("@action:button", "Close")
|
||||||
onClicked: {
|
onClicked: settingPickDialog.visible = false
|
||||||
settingPickDialog.visible = false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user