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

This commit is contained in:
Jaime van Kessel 2016-06-08 17:47:46 +02:00
commit 85d5247deb
30 changed files with 201 additions and 34 deletions

View File

@ -0,0 +1,104 @@
from UM.Application import Application
from UM.Qt.ListModel import ListModel
from PyQt5.QtCore import pyqtProperty, Qt, pyqtSignal, pyqtSlot, QUrl
from UM.Settings.ContainerRegistry import ContainerRegistry
from UM.Settings.InstanceContainer import InstanceContainer
class ContainerSettingsModel(ListModel):
LabelRole = Qt.UserRole + 1
CategoryRole = Qt.UserRole + 2
UnitRole = Qt.UserRole + 3
ValuesRole = Qt.UserRole + 4
def __init__(self, parent = None):
super().__init__(parent)
self.addRoleName(self.LabelRole, "label")
self.addRoleName(self.CategoryRole, "category")
self.addRoleName(self.UnitRole, "unit")
self.addRoleName(self.ValuesRole, "values")
self._container_ids = []
self._container = None
self._global_container_stack = None
Application.getInstance().globalContainerStackChanged.connect(self._onGlobalContainerChanged)
self._update()
def _onGlobalContainerChanged(self):
if self._global_container_stack:
self._global_container_stack.containersChanged.disconnect(self._onInstanceContainersChanged)
self._global_container_stack.propertyChanged.disconnect(self._onGlobalPropertyChanged)
self._global_container_stack = Application.getInstance().getGlobalContainerStack()
if self._global_container_stack:
Preferences.getInstance().setValue("cura/active_machine", self._global_container_stack.getId())
self._global_container_stack.containersChanged.connect(self._onInstanceContainersChanged)
self._global_container_stack.propertyChanged.connect(self._onGlobalPropertyChanged)
self._update()
def _onGlobalPropertyChanged(self, key, property_name):
if property_name == "value":
self._update()
def _onInstanceContainersChanged(self, container):
self._update()
def _update(self):
self.clear()
if len(self._container_ids) == 0:
return
keys = []
containers = []
for container_id in self._container_ids:
container = ContainerRegistry.getInstance().findContainers(id = container_id)
if not container:
return
keys = keys + list(container[0].getAllKeys())
containers.append(container[0])
keys = list(set(keys))
keys.sort()
for key in keys:
definition = None
category = None
values = []
for container in containers:
instance = container.getInstance(key)
if instance:
definition = instance.definition
# Traverse up to find the category
category = definition
while category.type != "category":
category = category.parent
values.append(container.getProperty(key, "value"))
else:
values.append("")
self.appendItem({
"key": key,
"values": values,
"label": definition.label,
"unit": definition.unit,
"category": category.label
})
## Set the id of the container which has the settings this model should list.
def setContainers(self, container_ids):
self._container_ids = container_ids
self._update()
containersChanged = pyqtSignal()
@pyqtProperty("QVariantList", fset = setContainers, notify = containersChanged)
def containers(self):
return self.container_ids

View File

@ -42,6 +42,7 @@ from . import MultiMaterialDecorator
from . import ZOffsetDecorator
from . import CuraSplashScreen
from . import MachineManagerModel
from . import ContainerSettingsModel
from PyQt5.QtCore import pyqtSlot, QUrl, pyqtSignal, pyqtProperty, QEvent, Q_ENUMS
from PyQt5.QtGui import QColor, QIcon
@ -400,6 +401,8 @@ class CuraApplication(QtApplication):
qmlRegisterType(ExtrudersModel.ExtrudersModel, "Cura", 1, 0, "ExtrudersModel")
qmlRegisterType(ContainerSettingsModel.ContainerSettingsModel, "Cura", 1, 0, "ContainerSettingsModel")
qmlRegisterSingletonType(QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, "Actions.qml")), "Cura", 1, 0, "Actions")
engine.rootContext().setContextProperty("ExtruderManager", ExtruderManager.ExtruderManager.getInstance())

View File

@ -36,7 +36,7 @@ class ExtruderManager(QObject):
if not UM.Application.getInstance().getGlobalContainerStack():
return None #No active machine, so no active extruder.
try:
return self._extruder_trains[UM.Application.getInstance().getGlobalContainerStack().getId()][str(self._active_extruder_index)]
return self._extruder_trains[UM.Application.getInstance().getGlobalContainerStack().getBottom().getId()][str(self._active_extruder_index)]
except KeyError: #Extruder index could be -1 if the global tab is selected, or the entry doesn't exist if the machine definition is wrong.
return None

View File

@ -205,6 +205,13 @@ class MachineManagerModel(QObject):
def isGlobalStackValid(self):
return self._global_stack_valid
@pyqtProperty(str, notify = globalContainerChanged)
def activeUserProfileId(self):
if self._global_container_stack:
return self._global_container_stack.getTop().getId()
return ""
@pyqtProperty(str, notify = globalContainerChanged)
def activeMachineName(self):
if self._global_container_stack:

View File

@ -103,7 +103,7 @@ class ProcessSlicedLayersJob(Job):
Job.yieldThread()
Job.yieldThread()
current_layer += 1
progress = (current_layer / layer_count) * 100
progress = (current_layer / layer_count) * 99
# TODO: Rebuild the layer data mesh once the layer has been processed.
# This needs some work in LayerData so we can add the new layers instead of recreating the entire mesh.

View File

@ -10,6 +10,7 @@ from UM.Scene.Selection import Selection
from UM.Math.Color import Color
from UM.Mesh.MeshData import MeshData
from UM.Job import Job
from UM.Preferences import Preferences
from UM.View.RenderBatch import RenderBatch
from UM.View.GL.OpenGL import OpenGL
@ -41,7 +42,10 @@ class LayerView(View):
self._top_layers_job = None
self._activity = False
self._solid_layers = 1
Preferences.getInstance().addPreference("view/top_layer_count", 1)
Preferences.getInstance().preferenceChanged.connect(self._onPreferencesChanged)
self._solid_layers = int(Preferences.getInstance().getValue("view/top_layer_count"))
self._top_layer_timer = QTimer()
self._top_layer_timer.setInterval(50)
@ -209,6 +213,16 @@ class LayerView(View):
self._top_layers_job = None
def _onPreferencesChanged(self, preference):
if preference != "view/top_layer_count":
return
self._solid_layers = int(Preferences.getInstance().getValue("view/top_layer_count"))
self._current_layer_mesh = None
self._current_layer_jumps = None
self._top_layer_timer.start()
class _CreateTopLayersJob(Job):
def __init__(self, scene, layer_number, solid_layers):
super().__init__()

View File

@ -890,7 +890,7 @@
"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": 45,
"default_value": 90,
"minimum_value": "0",
"maximum_value_warning": "100",
"type": "int",

View File

@ -93,7 +93,7 @@ UM.ManagementPage
Row {
id: currentSettingsActions
visible: base.currentItem.id == -1 || currentItem.id == Cura.MachineManager.activeQualityId
visible: currentItem.id == Cura.MachineManager.activeQualityId
anchors.left: parent.left
anchors.top: profileName.bottom
@ -128,16 +128,23 @@ UM.ManagementPage
anchors.bottom: parent.bottom
ListView {
model: base.currentItem ? base.currentItem.settings: null
model: Cura.ContainerSettingsModel{ containers: (currentItem.id == Cura.MachineManager.activeQualityId) ? [base.currentItem.id, Cura.MachineManager.activeUserProfileId] : [base.currentItem.id] }
delegate: Row {
property variant setting: model
spacing: UM.Theme.getSize("default_margin").width
Label {
text: model.label
elide: Text.ElideMiddle
width: scrollView.width / 100 * 40
}
Repeater {
model: setting.values.length
Label {
text: model.value.toString()
text: setting.values[index].toString()
width: scrollView.width / 100 * 10
font.strikeout: index < setting.values.length - 1 && setting.values[index + 1] != ""
opacity: font.strikeout ? 0.5 : 1
}
}
Label {
text: model.unit

View File

@ -220,6 +220,8 @@ Item {
{
id: controlContainer;
enabled: provider.isValueUsed
anchors.right: parent.right;
anchors.rightMargin: UM.Theme.getSize("default_margin").width
anchors.verticalCenter: parent.verticalCenter;

View File

@ -104,7 +104,7 @@ Item
anchors.leftMargin: model.index * (extruderSelection.width / machineExtruderCount.properties.value)
anchors.verticalCenter: parent.verticalCenter
width: parent.width / machineExtruderCount.properties.value
text: model.text
text: model.name
exclusiveGroup: extruderMenuGroup;
checkable: true;
checked: base.currentExtruderIndex == index
@ -138,10 +138,11 @@ Item
}
}
ExclusiveGroup { id: extruderMenuGroup; }
ListView{
ListView
{
id: extrudersList
property var index: 0
model: extrudersListModel
model: Cura.ExtrudersModel {}
delegate: wizardDelegate
anchors.top: parent.top
anchors.left: parent.left
@ -149,28 +150,6 @@ Item
}
}
ListModel
{
id: extrudersListModel
Component.onCompleted: populateExtruderModel()
}
Connections
{
id: machineChange
target: Cura.MachineManager
onGlobalContainerChanged: populateExtruderModel()
}
function populateExtruderModel()
{
extrudersListModel.clear();
for(var extruder = 0; extruder < machineExtruderCount.properties.value ; extruder++) {
extrudersListModel.append({
text: catalog.i18nc("@label", "Extruder %1").arg(extruder + 1)
})
}
}
Rectangle {
id: variantRow
anchors.top: extruderSelection.visible ? extruderSelection.bottom : machineSelectionRow.bottom

View File

@ -19,6 +19,7 @@ UM.PreferencesPage
{
UM.Preferences.resetPreference("view/show_overhang");
UM.Preferences.resetPreference("view/center_on_select");
UM.Preferences.resetPreference("view/top_layer_count");
}
Column
@ -57,12 +58,38 @@ UM.PreferencesPage
}
}
UM.TooltipArea {
width: childrenRect.width;
height: childrenRect.height;
text: catalog.i18nc("@info:tooltip","Display 5 top layers in layer view or only the top-most layer. Rendering 5 layers takes longer, but may show more information.")
CheckBox
{
id: topLayerCheckbox
text: catalog.i18nc("@action:button","Display five top layers in layer view.");
checked: UM.Preferences.getValue("view/top_layer_count") == 5
onClicked:
{
if(UM.Preferences.getValue("view/top_layer_count") == 5)
{
UM.Preferences.setValue("view/top_layer_count", 1)
}
else
{
UM.Preferences.setValue("view/top_layer_count", 5)
}
}
}
}
Connections {
target: UM.Preferences
onPreferenceChanged:
{
overhangCheckbox.checked = boolCheck(UM.Preferences.getValue("view/show_overhang"))
centerCheckbox.checked = boolCheck(UM.Preferences.getValue("view/center_on_select"))
topLayerCheckbox = UM.Preferences.getValue("view/top_layer_count") == 5
}
}
}

View File

@ -15,6 +15,8 @@ wall_thickness = 0.7
top_bottom_thickness = 0.75
infill_sparse_density = 18
speed_print = 55
speed_wall = 40
speed_topbottom = 30
speed_travel = 150
speed_layer_0 = 30
cool_min_layer_time = 3

View File

@ -15,6 +15,7 @@ wall_thickness = 1.05
top_bottom_thickness = 0.72
infill_sparse_density = 22
speed_print = 45
speed_wall = 30
cool_min_layer_time = 3
cool_fan_speed_min = 20
cool_min_speed = 10

View File

@ -15,6 +15,7 @@ wall_thickness = 1.05
top_bottom_thickness = 0.8
infill_sparse_density = 20
speed_print = 45
speed_wall = 30
cool_min_layer_time = 3
cool_fan_speed_min = 20
cool_min_speed = 10

View File

@ -15,6 +15,7 @@ wall_thickness = 1.59
top_bottom_thickness = 1.2
infill_sparse_density = 20
speed_print = 40
speed_infill = 55
cool_min_layer_time = 3
cool_fan_speed_min = 50
cool_min_speed = 20

View File

@ -15,6 +15,7 @@ wall_thickness = 0.7
top_bottom_thickness = 0.75
infill_sparse_density = 18
speed_print = 45
speed_wall = 40
speed_travel = 150
speed_layer_0 = 30
cool_min_layer_time = 3

View File

@ -15,6 +15,7 @@ wall_thickness = 1.05
top_bottom_thickness = 0.72
infill_sparse_density = 22
speed_print = 45
speed_wall = 30
cool_min_layer_time = 2
cool_fan_speed_min = 80
cool_min_speed = 15

View File

@ -15,6 +15,7 @@ wall_thickness = 1.05
top_bottom_thickness = 0.8
infill_sparse_density = 20
speed_print = 45
speed_wall = 30
cool_min_layer_time = 3
cool_fan_speed_min = 80
cool_min_speed = 10

View File

@ -15,6 +15,8 @@ wall_thickness = 0.7
top_bottom_thickness = 0.75
infill_sparse_density = 18
speed_print = 60
speed_wall = 50
speed_topbottom = 30
speed_travel = 150
speed_layer_0 = 30
cool_min_layer_time = 5

View File

@ -15,5 +15,6 @@ wall_thickness = 1.05
top_bottom_thickness = 0.72
infill_sparse_density = 22
speed_print = 50
speed_topbottom = 20
cool_min_layer_time = 5
cool_min_speed = 10

View File

@ -15,5 +15,6 @@ wall_thickness = 1.05
top_bottom_thickness = 0.8
infill_sparse_density = 20
speed_print = 50
speed_topbottom = 20
cool_min_layer_time = 5
cool_min_speed = 10

View File

@ -15,5 +15,8 @@ wall_thickness = 1.59
top_bottom_thickness = 1.2
infill_sparse_density = 20
speed_print = 55
speed_wall = 40
speed_wall_0 = 25
speed_topbottom = 20
cool_min_layer_time = 5
cool_min_speed = 10

View File

@ -15,5 +15,6 @@ wall_thickness = 2.1
top_bottom_thickness = 1.2
infill_sparse_density = 20
speed_print = 40
speed_wall_0 = 25
cool_min_layer_time = 5
cool_min_speed = 10

View File

@ -15,6 +15,8 @@ wall_thickness = 0.7
top_bottom_thickness = 0.75
infill_sparse_density = 18
speed_print = 55
speed_wall = 40
speed_topbottom = 30
speed_travel = 150
speed_layer_0 = 30
cool_min_layer_time = 3

View File

@ -15,6 +15,7 @@ wall_thickness = 1.05
top_bottom_thickness = 0.72
infill_sparse_density = 22
speed_print = 45
speed_wall = 30
cool_min_layer_time = 3
cool_fan_speed_min = 20
cool_min_speed = 10

View File

@ -15,6 +15,7 @@ wall_thickness = 1.05
top_bottom_thickness = 0.8
infill_sparse_density = 20
speed_print = 45
speed_wall = 30
cool_min_layer_time = 3
cool_fan_speed_min = 20
cool_min_speed = 10

View File

@ -15,6 +15,7 @@ wall_thickness = 1.59
top_bottom_thickness = 1.2
infill_sparse_density = 20
speed_print = 40
speed_infill = 55
cool_min_layer_time = 3
cool_fan_speed_min = 50
cool_min_speed = 20

View File

@ -15,6 +15,7 @@ wall_thickness = 0.7
top_bottom_thickness = 0.75
infill_sparse_density = 18
speed_print = 45
speed_wall = 40
speed_travel = 150
speed_layer_0 = 30
cool_min_layer_time = 3

View File

@ -15,6 +15,7 @@ wall_thickness = 1.05
top_bottom_thickness = 0.72
infill_sparse_density = 22
speed_print = 45
speed_wall = 30
cool_min_layer_time = 2
cool_fan_speed_min = 80
cool_min_speed = 15

View File

@ -15,6 +15,7 @@ wall_thickness = 1.05
top_bottom_thickness = 0.8
infill_sparse_density = 20
speed_print = 45
speed_wall = 30
cool_min_layer_time = 3
cool_fan_speed_min = 80
cool_min_speed = 10