Solved merge conflict

This commit is contained in:
Jack Ha 2016-07-19 10:27:59 +02:00
commit 0bf037a160
6 changed files with 61 additions and 75 deletions

View file

@ -1,6 +1,7 @@
# Copyright (c) 2015 Ultimaker B.V. # Copyright (c) 2015 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher. # Cura is released under the terms of the AGPLv3 or higher.
from cura.Settings.ExtruderManager import ExtruderManager
from UM.i18n import i18nCatalog from UM.i18n import i18nCatalog
from UM.Scene.Platform import Platform from UM.Scene.Platform import Platform
from UM.Scene.SceneNode import SceneNode from UM.Scene.SceneNode import SceneNode
@ -20,6 +21,10 @@ catalog = i18nCatalog("cura")
import numpy import numpy
# Setting for clearance around the prime
PRIME_CLEARANCE = 10
def approximatedCircleVertices(r): def approximatedCircleVertices(r):
""" """
Return vertices from an approximated circle. Return vertices from an approximated circle.
@ -281,6 +286,29 @@ class BuildVolume(SceneNode):
disallowed_areas = self._active_container_stack.getProperty("machine_disallowed_areas", "value") disallowed_areas = self._active_container_stack.getProperty("machine_disallowed_areas", "value")
areas = [] areas = []
# Add extruder prime locations as disallowed areas.
# Probably needs some rework after coordinate system change.
machine_definition = self._active_container_stack.getBottom()
current_machine_id = machine_definition.getId()
extruder_manager = ExtruderManager.getInstance()
extruders = extruder_manager.getMachineExtruders(current_machine_id)
machine_width = machine_definition.getProperty("machine_width", "value")
machine_depth = machine_definition.getProperty("machine_depth", "value")
for single_extruder in extruders:
extruder_prime_pos_x = single_extruder.getProperty("extruder_prime_pos_x", "value")
extruder_prime_pos_y = single_extruder.getProperty("extruder_prime_pos_y", "value")
# TODO: calculate everything in CuraEngine/Firmware/lower left as origin coordinates.
# Here we transform the extruder prime pos (lower left as origin) to Cura coordinates
# (center as origin, y from back to front)
prime_x = extruder_prime_pos_x - machine_width / 2
prime_y = machine_depth / 2 - extruder_prime_pos_y
disallowed_areas.append([
[prime_x - PRIME_CLEARANCE, prime_y - PRIME_CLEARANCE],
[prime_x + PRIME_CLEARANCE, prime_y - PRIME_CLEARANCE],
[prime_x + PRIME_CLEARANCE, prime_y + PRIME_CLEARANCE],
[prime_x - PRIME_CLEARANCE, prime_y + PRIME_CLEARANCE],
])
skirt_size = self._getSkirtSize(self._active_container_stack) skirt_size = self._getSkirtSize(self._active_container_stack)
if disallowed_areas: if disallowed_areas:

View file

@ -187,18 +187,26 @@ class ExtruderManager(QObject):
# Find a quality to use for this extruder. # Find a quality to use for this extruder.
quality = container_registry.getEmptyInstanceContainer() quality = container_registry.getEmptyInstanceContainer()
# First add any quality. Later, overwrite with preference if the preference is valid. search_criteria = { "type": "quality" }
qualities = container_registry.findInstanceContainers(type = "quality") if machine_definition.getMetaDataEntry("has_machine_quality"):
if len(qualities) >= 1: search_criteria["definition"] = machine_definition.id
quality = qualities[0] if machine_definition.getMetaDataEntry("has_materials") and material:
preferred_quality_id = machine_definition.getMetaDataEntry("preferred_quality") search_criteria["material"] = material.id
if preferred_quality_id: else:
preferred_quality = container_registry.findInstanceContainers(id = preferred_quality_id, type = "quality") search_criteria["definition"] = "fdmprinter"
if len(preferred_quality) >= 1:
quality = preferred_quality[0] preferred_quality = machine_definition.getMetaDataEntry("preferred_quality")
else: if preferred_quality:
UM.Logger.log("w", "The preferred quality \"%s\" of machine %s doesn't exist or is not a quality profile.", preferred_quality_id, machine_id) search_criteria["id"] = preferred_quality
# And leave it at the default quality.
containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(**search_criteria)
if not containers and preferred_quality:
UM.Logger.log("w", "The preferred quality \"%s\" of machine %s doesn't exist or is not a quality profile.", preferred_quality, machine_id)
search_criteria.pop("id", None)
containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(**search_criteria)
if containers:
quality = containers[0]
container_stack.addContainer(quality) container_stack.addContainer(quality)
user_profile = container_registry.findInstanceContainers(type = "user", extruder = extruder_stack_id) user_profile = container_registry.findInstanceContainers(type = "user", extruder = extruder_stack_id)

View file

@ -788,13 +788,10 @@ class MachineManager(QObject):
return self._empty_quality_container return self._empty_quality_container
def _onMachineNameChanged(self): def _onMachineNameChanged(self):
print("machine name changed")
self.globalContainerChanged.emit() self.globalContainerChanged.emit()
def _onMaterialNameChanged(self): def _onMaterialNameChanged(self):
print("material name changed")
self.activeMaterialChanged.emit() self.activeMaterialChanged.emit()
def _onQualityNameChanged(self): def _onQualityNameChanged(self):
print("quality name changed")
self.activeQualityChanged.emit() self.activeQualityChanged.emit()

View file

@ -89,6 +89,7 @@ class CuraEngineBackend(Backend):
self._always_restart = True #Always restart the engine when starting a new slice. Don't keep the process running. TODO: Fix engine statelessness. self._always_restart = True #Always restart the engine when starting a new slice. Don't keep the process running. TODO: Fix engine statelessness.
self._process_layers_job = None #The currently active job to process layers, or None if it is not processing layers. self._process_layers_job = None #The currently active job to process layers, or None if it is not processing layers.
self._backend_log_max_lines = 200 # Maximal count of lines to buffer
self._error_message = None #Pop-up message that shows errors. self._error_message = None #Pop-up message that shows errors.
self.backendQuit.connect(self._onBackendQuit) self.backendQuit.connect(self._onBackendQuit)

View file

@ -196,7 +196,6 @@ Cura.MachineAction
visible: checkupMachineAction.usbConnected visible: checkupMachineAction.usbConnected
Button Button
{ {
height: 20
text: checkupMachineAction.heatupHotendStarted ? catalog.i18nc("@action:button","Stop Heating") : catalog.i18nc("@action:button","Start Heating") text: checkupMachineAction.heatupHotendStarted ? catalog.i18nc("@action:button","Stop Heating") : catalog.i18nc("@action:button","Start Heating")
onClicked: onClicked:
{ {
@ -259,7 +258,6 @@ Cura.MachineAction
Button Button
{ {
text: checkupMachineAction.heatupBedStarted ?catalog.i18nc("@action:button","Stop Heating") : catalog.i18nc("@action:button","Start Heating") text: checkupMachineAction.heatupBedStarted ?catalog.i18nc("@action:button","Stop Heating") : catalog.i18nc("@action:button","Start Heating")
height: 20
onClicked: onClicked:
{ {
if (checkupMachineAction.heatupBedStarted) if (checkupMachineAction.heatupBedStarted)

View file

@ -22,6 +22,18 @@ UM.MainWindow
Component.onCompleted: Component.onCompleted:
{ {
Printer.setMinimumWindowSize(UM.Theme.getSize("window_minimum_size")) Printer.setMinimumWindowSize(UM.Theme.getSize("window_minimum_size"))
// Workaround silly issues with QML Action's shortcut property.
//
// Currently, there is no way to define shortcuts as "Application Shortcut".
// This means that all Actions are "Window Shortcuts". The code for this
// implements a rather naive check that just checks if any of the action's parents
// are a window. Since the "Actions" object is a singleton it has no parent by
// default. If we set its parent to something contained in this window, the
// shortcut will activate properly because one of its parents is a window.
//
// This has been fixed for QtQuick Controls 2 since the Shortcut item has a context property.
Cura.Actions.parent = backgroundItem
} }
Item Item
@ -517,64 +529,6 @@ UM.MainWindow
} }
} }
// Workaround for shortcuts not working for singletons.
// The main window eats all the events, so we need to pass them manually.
Action
{
shortcut: StandardKey.Undo
onTriggered: Cura.Actions.undo.trigger()
}
Action
{
shortcut: StandardKey.Redo
onTriggered: Cura.Actions.redo.trigger()
}
Action
{
shortcut: StandardKey.Quit
onTriggered: Cura.Actions.quit.trigger()
}
Action
{
shortcut: StandardKey.Help
onTriggered: Cura.Actions.help.trigger()
}
Action
{
shortcut: StandardKey.Delete
onTriggered: Cura.Actions.delete.trigger()
}
Action
{
shortcut: "Ctrl+G"
onTriggered: Cura.Actions.groupObjects.trigger()
}
Action
{
shortcut: "Ctrl+Shift+G"
onTriggered: Cura.Actions.unGroupObjects.trigger()
}
Action
{
shortcut: "Ctrl+Alt+G"
onTriggered: Cura.Actions.mergeObjects.trigger()
}
Action
{
shortcut: "Ctrl+D"
onTriggered: Cura.Actions.deleteAll.trigger()
}
Action
{
shortcut: StandardKey.Open
onTriggered: Cura.Actions.open.trigger()
}
Action
{
shortcut: StandardKey.WhatsThis
onTriggered: Cura.Actions.showEngineLog.trigger()
}
Menu Menu
{ {
id: objectContextMenu; id: objectContextMenu;