Merge branch 'master' of github.com:Ultimaker/Cura into speed_up_layerview

This commit is contained in:
Jaime van Kessel 2020-01-03 11:15:24 +01:00
commit 552ce1fc66
No known key found for this signature in database
GPG Key ID: 3710727397403C91
9 changed files with 282 additions and 251 deletions

View File

@ -753,6 +753,11 @@ class CuraApplication(QtApplication):
def run(self):
super().run()
Logger.log("i", "Initializing machine error checker")
self._machine_error_checker = MachineErrorChecker(self)
self._machine_error_checker.initialize()
self.processEvents()
Logger.log("i", "Initializing machine manager")
self._setLoadingHint(self._i18n_catalog.i18nc("@info:progress", "Initializing machine manager..."))
self._machine_manager = MachineManager(self, parent = self)
@ -762,11 +767,6 @@ class CuraApplication(QtApplication):
self._container_manager = ContainerManager(self)
self.processEvents()
Logger.log("i", "Initializing machine error checker")
self._machine_error_checker = MachineErrorChecker(self)
self._machine_error_checker.initialize()
self.processEvents()
# Check if we should run as single instance or not. If so, set up a local socket server which listener which
# coordinates multiple Cura instances and accepts commands.
if self._use_single_instance:

View File

@ -1,6 +1,6 @@
from UM.Logger import Logger
from PyQt5.QtCore import Qt, pyqtSlot, QObject
from PyQt5.QtCore import Qt, pyqtSlot, QObject, QTimer
from PyQt5.QtWidgets import QApplication
from UM.Scene.Camera import Camera
@ -26,16 +26,23 @@ class CuraSceneController(QObject):
self._last_selected_index = 0
self._max_build_plate = 1 # default
self._change_timer = QTimer()
self._change_timer.setInterval(100)
self._change_timer.setSingleShot(True)
self._change_timer.timeout.connect(self.updateMaxBuildPlate)
Application.getInstance().getController().getScene().sceneChanged.connect(self.updateMaxBuildPlateDelayed)
Application.getInstance().getController().getScene().sceneChanged.connect(self.updateMaxBuildPlate) # it may be a bit inefficient when changing a lot simultaneously
def updateMaxBuildPlate(self, *args):
def updateMaxBuildPlateDelayed(self, *args):
if args:
source = args[0]
else:
source = None
if not isinstance(source, SceneNode) or isinstance(source, Camera):
return
self._change_timer.start()
def updateMaxBuildPlate(self, *args):
max_build_plate = self._calcMaxBuildPlate()
changed = False
if max_build_plate != self._max_build_plate:

View File

@ -7,7 +7,7 @@ import os
import unicodedata
from typing import Dict, List, Optional, TYPE_CHECKING
from PyQt5.QtCore import QObject, pyqtSignal, pyqtProperty, pyqtSlot
from PyQt5.QtCore import QObject, pyqtSignal, pyqtProperty, pyqtSlot, QTimer
from UM.Logger import Logger
from UM.Qt.Duration import Duration
@ -47,7 +47,12 @@ class PrintInformation(QObject):
if self._backend:
self._backend.printDurationMessage.connect(self._onPrintDurationMessage)
self._application.getController().getScene().sceneChanged.connect(self._onSceneChanged)
self._application.getController().getScene().sceneChanged.connect(self._onSceneChangedDelayed)
self._change_timer = QTimer()
self._change_timer.setInterval(100)
self._change_timer.setSingleShot(True)
self._change_timer.timeout.connect(self._onSceneChanged)
self._is_user_specified_job_name = False
self._base_name = ""
@ -418,12 +423,14 @@ class PrintInformation(QObject):
self._onPrintDurationMessage(build_plate, temp_message, temp_material_amounts)
## Listen to scene changes to check if we need to reset the print information
def _onSceneChanged(self, scene_node: SceneNode) -> None:
def _onSceneChangedDelayed(self, scene_node: SceneNode) -> None:
# Ignore any changes that are not related to sliceable objects
if not isinstance(scene_node, SceneNode)\
or not scene_node.callDecoration("isSliceable")\
if not isinstance(scene_node, SceneNode) \
or not scene_node.callDecoration("isSliceable") \
or not scene_node.callDecoration("getBuildPlateNumber") == self._active_build_plate:
return
self._change_timer.start()
## Listen to scene changes to check if we need to reset the print information
def _onSceneChanged(self) -> None:
self.setToZeroPrintInformation(self._active_build_plate)

View File

@ -58,5 +58,5 @@ Button {
checkable: true
checked: definition.expanded
onClicked: definition.expanded ? settingDefinitionsModel.collapse(definition.key) : settingDefinitionsModel.expandRecursive(definition.key)
onClicked: definition.expanded ? settingDefinitionsModel.collapseRecursive(definition.key) : settingDefinitionsModel.expandRecursive(definition.key)
}

View File

@ -2681,150 +2681,6 @@
"maximum_value_warning": "150",
"settable_per_mesh": true
},
"retraction_enable":
{
"label": "Enable Retraction",
"description": "Retract the filament when the nozzle is moving over a non-printed area. ",
"type": "bool",
"default_value": true,
"settable_per_mesh": false,
"settable_per_extruder": true
},
"retract_at_layer_change":
{
"label": "Retract at Layer Change",
"description": "Retract the filament when the nozzle is moving to the next layer.",
"type": "bool",
"default_value": false,
"settable_per_mesh": false,
"settable_per_extruder": true
},
"retraction_amount":
{
"label": "Retraction Distance",
"description": "The length of material retracted during a retraction move.",
"unit": "mm",
"type": "float",
"default_value": 6.5,
"minimum_value_warning": "-0.0001",
"maximum_value_warning": "10.0",
"enabled": "retraction_enable and machine_gcode_flavor != \"UltiGCode\"",
"settable_per_mesh": false,
"settable_per_extruder": true
},
"retraction_speed":
{
"label": "Retraction Speed",
"description": "The speed at which the filament is retracted and primed during a retraction move.",
"unit": "mm/s",
"type": "float",
"default_value": 25,
"minimum_value": "0.0001",
"minimum_value_warning": "1",
"maximum_value": "machine_max_feedrate_e if retraction_enable else float('inf')",
"maximum_value_warning": "70",
"enabled": "retraction_enable and machine_gcode_flavor != \"UltiGCode\"",
"settable_per_mesh": false,
"settable_per_extruder": true,
"children":
{
"retraction_retract_speed":
{
"label": "Retraction Retract Speed",
"description": "The speed at which the filament is retracted during a retraction move.",
"unit": "mm/s",
"type": "float",
"default_value": 25,
"minimum_value": "0.0001",
"maximum_value": "machine_max_feedrate_e if retraction_enable else float('inf')",
"minimum_value_warning": "1",
"maximum_value_warning": "70",
"enabled": "retraction_enable and machine_gcode_flavor != \"UltiGCode\"",
"value": "retraction_speed",
"settable_per_mesh": false,
"settable_per_extruder": true
},
"retraction_prime_speed":
{
"label": "Retraction Prime Speed",
"description": "The speed at which the filament is primed during a retraction move.",
"unit": "mm/s",
"type": "float",
"default_value": 25,
"minimum_value": "0.0001",
"maximum_value": "machine_max_feedrate_e if retraction_enable else float('inf')",
"minimum_value_warning": "1",
"maximum_value_warning": "70",
"enabled": "retraction_enable and machine_gcode_flavor != \"UltiGCode\"",
"value": "retraction_speed",
"settable_per_mesh": false,
"settable_per_extruder": true
}
}
},
"retraction_extra_prime_amount":
{
"label": "Retraction Extra Prime Amount",
"description": "Some material can ooze away during a travel move, which can be compensated for here.",
"unit": "mm³",
"type": "float",
"default_value": 0,
"minimum_value_warning": "-0.0001",
"maximum_value_warning": "5.0",
"enabled": "retraction_enable",
"settable_per_mesh": false,
"settable_per_extruder": true
},
"retraction_min_travel":
{
"label": "Retraction Minimum Travel",
"description": "The minimum distance of travel needed for a retraction to happen at all. This helps to get fewer retractions in a small area.",
"unit": "mm",
"type": "float",
"default_value": 1.5,
"value": "line_width * 2",
"minimum_value": "0",
"minimum_value_warning": "line_width * 1.5",
"maximum_value_warning": "10",
"settable_per_mesh": false,
"settable_per_extruder": true
},
"retraction_count_max":
{
"label": "Maximum Retraction Count",
"description": "This setting limits the number of retractions occurring within the minimum extrusion distance window. Further retractions within this window will be ignored. This avoids retracting repeatedly on the same piece of filament, as that can flatten the filament and cause grinding issues.",
"default_value": 90,
"minimum_value": "0",
"maximum_value_warning": "100",
"type": "int",
"enabled": "retraction_enable",
"settable_per_mesh": false,
"settable_per_extruder": true
},
"retraction_extrusion_window":
{
"label": "Minimum Extrusion Distance Window",
"description": "The window in which the maximum retraction count is enforced. This value should be approximately the same as the retraction distance, so that effectively the number of times a retraction passes the same patch of material is limited.",
"unit": "mm",
"type": "float",
"default_value": 4.5,
"minimum_value": "0",
"maximum_value_warning": "retraction_amount * 2",
"value": "retraction_amount",
"enabled": "retraction_enable",
"settable_per_mesh": false,
"settable_per_extruder": true
},
"limit_support_retractions":
{
"label": "Limit Support Retractions",
"description": "Omit retraction when moving from support to support in a straight line. Enabling this setting saves print time, but can lead to excessive stringing within the support structure.",
"type": "bool",
"default_value": true,
"enabled": "retraction_enable and (support_enable or support_tree_enable)",
"settable_per_mesh": false,
"settable_per_extruder": true
},
"material_standby_temperature":
{
"label": "Standby Temperature",
@ -2838,83 +2694,6 @@
"enabled": "extruders_enabled_count > 1 and machine_nozzle_temp_enabled",
"settable_per_mesh": false,
"settable_per_extruder": true
},
"switch_extruder_retraction_amount":
{
"label": "Nozzle Switch Retraction Distance",
"description": "The amount of retraction when switching extruders. Set to 0 for no retraction at all. This should generally be the same as the length of the heat zone.",
"type": "float",
"unit": "mm",
"enabled": "retraction_enable",
"default_value": 20,
"value": "machine_heat_zone_length",
"minimum_value_warning": "0",
"maximum_value_warning": "100",
"settable_per_mesh": false,
"settable_per_extruder": true
},
"switch_extruder_retraction_speeds":
{
"label": "Nozzle Switch Retraction Speed",
"description": "The speed at which the filament is retracted. A higher retraction speed works better, but a very high retraction speed can lead to filament grinding.",
"type": "float",
"unit": "mm/s",
"enabled": "retraction_enable",
"default_value": 20,
"minimum_value": "0.1",
"minimum_value_warning": "1",
"maximum_value": "machine_max_feedrate_e if retraction_enable else float('inf')",
"maximum_value_warning": "70",
"settable_per_mesh": false,
"settable_per_extruder": true,
"children":
{
"switch_extruder_retraction_speed":
{
"label": "Nozzle Switch Retract Speed",
"description": "The speed at which the filament is retracted during a nozzle switch retract.",
"type": "float",
"unit": "mm/s",
"enabled": "retraction_enable",
"default_value": 20,
"value": "switch_extruder_retraction_speeds",
"minimum_value": "0.1",
"minimum_value_warning": "1",
"maximum_value": "machine_max_feedrate_e if retraction_enable else float('inf')",
"maximum_value_warning": "70",
"settable_per_mesh": false,
"settable_per_extruder": true
},
"switch_extruder_prime_speed":
{
"label": "Nozzle Switch Prime Speed",
"description": "The speed at which the filament is pushed back after a nozzle switch retraction.",
"type": "float",
"unit": "mm/s",
"enabled": "retraction_enable",
"default_value": 20,
"value": "switch_extruder_retraction_speeds",
"minimum_value": "0.1",
"minimum_value_warning": "1",
"maximum_value": "machine_max_feedrate_e if retraction_enable else float('inf')",
"maximum_value_warning": "70",
"settable_per_mesh": false,
"settable_per_extruder": true
}
}
},
"switch_extruder_extra_prime_amount":
{
"label": "Nozzle Switch Extra Prime Amount",
"description": "Extra material to prime after nozzle switching.",
"type": "float",
"unit": "mm³",
"default_value": 0,
"minimum_value_warning": "0",
"maximum_value_warning": "100",
"enabled": "retraction_enable",
"settable_per_mesh": false,
"settable_per_extruder": true
}
}
},
@ -3830,6 +3609,150 @@
"type": "category",
"children":
{
"retraction_enable":
{
"label": "Enable Retraction",
"description": "Retract the filament when the nozzle is moving over a non-printed area. ",
"type": "bool",
"default_value": true,
"settable_per_mesh": false,
"settable_per_extruder": true
},
"retract_at_layer_change":
{
"label": "Retract at Layer Change",
"description": "Retract the filament when the nozzle is moving to the next layer.",
"type": "bool",
"default_value": false,
"settable_per_mesh": false,
"settable_per_extruder": true
},
"retraction_amount":
{
"label": "Retraction Distance",
"description": "The length of material retracted during a retraction move.",
"unit": "mm",
"type": "float",
"default_value": 6.5,
"minimum_value_warning": "-0.0001",
"maximum_value_warning": "10.0",
"enabled": "retraction_enable and machine_gcode_flavor != \"UltiGCode\"",
"settable_per_mesh": false,
"settable_per_extruder": true
},
"retraction_speed":
{
"label": "Retraction Speed",
"description": "The speed at which the filament is retracted and primed during a retraction move.",
"unit": "mm/s",
"type": "float",
"default_value": 25,
"minimum_value": "0.0001",
"minimum_value_warning": "1",
"maximum_value": "machine_max_feedrate_e if retraction_enable else float('inf')",
"maximum_value_warning": "70",
"enabled": "retraction_enable and machine_gcode_flavor != \"UltiGCode\"",
"settable_per_mesh": false,
"settable_per_extruder": true,
"children":
{
"retraction_retract_speed":
{
"label": "Retraction Retract Speed",
"description": "The speed at which the filament is retracted during a retraction move.",
"unit": "mm/s",
"type": "float",
"default_value": 25,
"minimum_value": "0.0001",
"maximum_value": "machine_max_feedrate_e if retraction_enable else float('inf')",
"minimum_value_warning": "1",
"maximum_value_warning": "70",
"enabled": "retraction_enable and machine_gcode_flavor != \"UltiGCode\"",
"value": "retraction_speed",
"settable_per_mesh": false,
"settable_per_extruder": true
},
"retraction_prime_speed":
{
"label": "Retraction Prime Speed",
"description": "The speed at which the filament is primed during a retraction move.",
"unit": "mm/s",
"type": "float",
"default_value": 25,
"minimum_value": "0.0001",
"maximum_value": "machine_max_feedrate_e if retraction_enable else float('inf')",
"minimum_value_warning": "1",
"maximum_value_warning": "70",
"enabled": "retraction_enable and machine_gcode_flavor != \"UltiGCode\"",
"value": "retraction_speed",
"settable_per_mesh": false,
"settable_per_extruder": true
}
}
},
"retraction_extra_prime_amount":
{
"label": "Retraction Extra Prime Amount",
"description": "Some material can ooze away during a travel move, which can be compensated for here.",
"unit": "mm³",
"type": "float",
"default_value": 0,
"minimum_value_warning": "-0.0001",
"maximum_value_warning": "5.0",
"enabled": "retraction_enable",
"settable_per_mesh": false,
"settable_per_extruder": true
},
"retraction_min_travel":
{
"label": "Retraction Minimum Travel",
"description": "The minimum distance of travel needed for a retraction to happen at all. This helps to get fewer retractions in a small area.",
"unit": "mm",
"type": "float",
"default_value": 1.5,
"value": "line_width * 2",
"minimum_value": "0",
"minimum_value_warning": "line_width * 1.5",
"maximum_value_warning": "10",
"settable_per_mesh": false,
"settable_per_extruder": true
},
"retraction_count_max":
{
"label": "Maximum Retraction Count",
"description": "This setting limits the number of retractions occurring within the minimum extrusion distance window. Further retractions within this window will be ignored. This avoids retracting repeatedly on the same piece of filament, as that can flatten the filament and cause grinding issues.",
"default_value": 90,
"minimum_value": "0",
"maximum_value_warning": "100",
"type": "int",
"enabled": "retraction_enable",
"settable_per_mesh": false,
"settable_per_extruder": true
},
"retraction_extrusion_window":
{
"label": "Minimum Extrusion Distance Window",
"description": "The window in which the maximum retraction count is enforced. This value should be approximately the same as the retraction distance, so that effectively the number of times a retraction passes the same patch of material is limited.",
"unit": "mm",
"type": "float",
"default_value": 4.5,
"minimum_value": "0",
"maximum_value_warning": "retraction_amount * 2",
"value": "retraction_amount",
"enabled": "retraction_enable",
"settable_per_mesh": false,
"settable_per_extruder": true
},
"limit_support_retractions":
{
"label": "Limit Support Retractions",
"description": "Omit retraction when moving from support to support in a straight line. Enabling this setting saves print time, but can lead to excessive stringing within the support structure.",
"type": "bool",
"default_value": true,
"enabled": "retraction_enable and (support_enable or support_tree_enable)",
"settable_per_mesh": false,
"settable_per_extruder": true
},
"retraction_combing":
{
"label": "Combing Mode",
@ -5843,6 +5766,83 @@
"maximum_value_warning": "20",
"settable_per_mesh": false,
"settable_per_extruder": false
},
"switch_extruder_retraction_amount":
{
"label": "Nozzle Switch Retraction Distance",
"description": "The amount of retraction when switching extruders. Set to 0 for no retraction at all. This should generally be the same as the length of the heat zone.",
"type": "float",
"unit": "mm",
"enabled": "retraction_enable and extruders_enabled_count > 1",
"default_value": 20,
"value": "machine_heat_zone_length",
"minimum_value_warning": "0",
"maximum_value_warning": "100",
"settable_per_mesh": false,
"settable_per_extruder": true
},
"switch_extruder_retraction_speeds":
{
"label": "Nozzle Switch Retraction Speed",
"description": "The speed at which the filament is retracted. A higher retraction speed works better, but a very high retraction speed can lead to filament grinding.",
"type": "float",
"unit": "mm/s",
"enabled": "retraction_enable and extruders_enabled_count > 1",
"default_value": 20,
"minimum_value": "0.1",
"minimum_value_warning": "1",
"maximum_value": "machine_max_feedrate_e if retraction_enable else float('inf')",
"maximum_value_warning": "70",
"settable_per_mesh": false,
"settable_per_extruder": true,
"children":
{
"switch_extruder_retraction_speed":
{
"label": "Nozzle Switch Retract Speed",
"description": "The speed at which the filament is retracted during a nozzle switch retract.",
"type": "float",
"unit": "mm/s",
"enabled": "retraction_enable and extruders_enabled_count > 1",
"default_value": 20,
"value": "switch_extruder_retraction_speeds",
"minimum_value": "0.1",
"minimum_value_warning": "1",
"maximum_value": "machine_max_feedrate_e if retraction_enable else float('inf')",
"maximum_value_warning": "70",
"settable_per_mesh": false,
"settable_per_extruder": true
},
"switch_extruder_prime_speed":
{
"label": "Nozzle Switch Prime Speed",
"description": "The speed at which the filament is pushed back after a nozzle switch retraction.",
"type": "float",
"unit": "mm/s",
"enabled": "retraction_enable and extruders_enabled_count > 1",
"default_value": 20,
"value": "switch_extruder_retraction_speeds",
"minimum_value": "0.1",
"minimum_value_warning": "1",
"maximum_value": "machine_max_feedrate_e if retraction_enable else float('inf')",
"maximum_value_warning": "70",
"settable_per_mesh": false,
"settable_per_extruder": true
}
}
},
"switch_extruder_extra_prime_amount":
{
"label": "Nozzle Switch Extra Prime Amount",
"description": "Extra material to prime after nozzle switching.",
"type": "float",
"unit": "mm³",
"default_value": 0,
"minimum_value_warning": "0",
"maximum_value_warning": "100",
"enabled": "retraction_enable and extruders_enabled_count > 1",
"settable_per_mesh": false,
"settable_per_extruder": true
}
}
},

View File

@ -14,6 +14,8 @@ Menu
property QtObject settingVisibilityPresetsModel: CuraApplication.getSettingVisibilityPresetsModel()
signal collapseAllCategories()
Instantiator
{
model: settingVisibilityPresetsModel.items
@ -34,6 +36,15 @@ Menu
onObjectRemoved: menu.removeItem(object)
}
MenuSeparator {}
MenuItem
{
text: catalog.i18nc("@action:inmenu", "Collapse All Categories")
onTriggered:
{
collapseAllCategories();
}
}
MenuSeparator {}
MenuItem
{

View File

@ -30,11 +30,11 @@ Button
{
return UM.Theme.getColor("setting_category_disabled")
}
else if (base.hovered && base.checkable && base.checked)
else if (base.hovered && base.expanded)
{
return UM.Theme.getColor("setting_category_active_hover")
}
else if (base.pressed || (base.checkable && base.checked))
else if (base.pressed || base.expanded)
{
return UM.Theme.getColor("setting_category_active")
}
@ -55,6 +55,7 @@ Button
signal setActiveFocusToNextSetting(bool forward)
property var focusItem: base
property bool expanded: definition.expanded
contentItem: Item
{
@ -79,10 +80,10 @@ Button
if (!base.enabled)
{
return UM.Theme.getColor("setting_category_disabled_text")
} else if ((base.hovered || base.activeFocus) && base.checkable && base.checked)
} else if ((base.hovered || base.activeFocus) && base.expanded)
{
return UM.Theme.getColor("setting_category_active_hover_text")
} else if (base.pressed || (base.checkable && base.checked))
} else if (base.pressed || base.expanded)
{
return UM.Theme.getColor("setting_category_active_text")
} else if (base.hovered || base.activeFocus)
@ -107,7 +108,7 @@ Button
height: UM.Theme.getSize("standard_arrow").height
sourceSize.height: width
color: UM.Theme.getColor("setting_control_button")
source: base.checked ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left")
source: definition.expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left")
}
}
@ -123,11 +124,11 @@ Button
{
return UM.Theme.getColor("setting_category_disabled_text")
}
else if((base.hovered || base.activeFocus) && base.checkable && base.checked)
else if((base.hovered || base.activeFocus) && base.expanded)
{
return UM.Theme.getColor("setting_category_active_hover_text")
}
else if(base.pressed || (base.checkable && base.checked))
else if(base.pressed || base.expanded)
{
return UM.Theme.getColor("setting_category_active_text")
}
@ -144,14 +145,11 @@ Button
sourceSize.height: width + 15 * screenScaleFactor
}
checkable: true
checked: definition.expanded
onClicked:
{
if (definition.expanded)
{
settingDefinitionsModel.collapse(definition.key)
settingDefinitionsModel.collapseRecursive(definition.key)
}
else
{
@ -226,7 +224,6 @@ Button
onClicked:
{
settingDefinitionsModel.expandRecursive(definition.key)
base.checked = true
base.showAllHiddenInheritedSettings(definition.key)
}

View File

@ -48,7 +48,7 @@ SettingItem
case "False":
return false
default:
return value
return (value !== undefined) ? value : false
}
}

View File

@ -185,7 +185,16 @@ Item
label: Label {}
}
menu: SettingVisibilityPresetsMenu {}
menu: SettingVisibilityPresetsMenu
{
onCollapseAllCategories:
{
settingsSearchTimer.stop()
filter.text = "" // clear search field
filter.editingFinished()
definitionsModel.collapseAllCategories()
}
}
}
// Mouse area that gathers the scroll events to not propagate it to the main view.