This commit is contained in:
Diego Prado Gesto 2017-11-22 20:11:24 +01:00
commit 2042cdf155
10 changed files with 1501 additions and 1332 deletions

1
.gitignore vendored
View File

@ -44,6 +44,7 @@ plugins/cura-god-mode-plugin
plugins/cura-big-flame-graph plugins/cura-big-flame-graph
plugins/cura-siemensnx-plugin plugins/cura-siemensnx-plugin
plugins/CuraVariSlicePlugin plugins/CuraVariSlicePlugin
plugins/CuraLiveScriptingPlugin
#Build stuff #Build stuff
CMakeCache.txt CMakeCache.txt

View File

@ -67,7 +67,6 @@ class PrintInformation(QObject):
self._base_name = "" self._base_name = ""
self._abbr_machine = "" self._abbr_machine = ""
self._job_name = "" self._job_name = ""
self._project_name = ""
Application.getInstance().globalContainerStackChanged.connect(self._updateJobName) Application.getInstance().globalContainerStackChanged.connect(self._updateJobName)
Application.getInstance().fileLoaded.connect(self.setBaseName) Application.getInstance().fileLoaded.connect(self.setBaseName)
@ -253,26 +252,13 @@ class PrintInformation(QObject):
self._job_name = name self._job_name = name
self.jobNameChanged.emit() self.jobNameChanged.emit()
@pyqtSlot(str)
def setProjectName(self, name):
self._project_name = name
self.setJobName(name)
jobNameChanged = pyqtSignal() jobNameChanged = pyqtSignal()
@pyqtProperty(str, notify = jobNameChanged) @pyqtProperty(str, notify = jobNameChanged)
def jobName(self): def jobName(self):
return self._job_name return self._job_name
def _updateJobName(self, is_project_name_empty = False): def _updateJobName(self):
# if the project name is set, we use the project name as the job name, so the job name should not get updated
# if a model file is loaded after that.
if self._project_name != "":
if is_project_name_empty:
self._project_name = ""
else:
return
if self._base_name == "": if self._base_name == "":
self._job_name = "" self._job_name = ""
self.jobNameChanged.emit() self.jobNameChanged.emit()
@ -298,7 +284,11 @@ class PrintInformation(QObject):
return self._base_name return self._base_name
@pyqtSlot(str) @pyqtSlot(str)
def setBaseName(self, base_name): def setProjectName(self, name):
self.setBaseName(name, is_project_file = True)
@pyqtSlot(str)
def setBaseName(self, base_name, is_project_file = False):
# Ensure that we don't use entire path but only filename # Ensure that we don't use entire path but only filename
name = os.path.basename(base_name) name = os.path.basename(base_name)
@ -306,14 +296,16 @@ class PrintInformation(QObject):
# extension. This cuts the extension off if necessary. # extension. This cuts the extension off if necessary.
name = os.path.splitext(name)[0] name = os.path.splitext(name)[0]
# if this is a profile file, always update the job name
# name is "" when I first had some meshes and afterwards I deleted them so the naming should start again # name is "" when I first had some meshes and afterwards I deleted them so the naming should start again
is_empty = name == "" is_empty = name == ""
if is_empty or (self._base_name == "" and self._base_name != name): if is_project_file or (is_empty or (self._base_name == "" and self._base_name != name)):
# remove ".curaproject" suffix from (imported) the file name # remove ".curaproject" suffix from (imported) the file name
if name.endswith(".curaproject"): if name.endswith(".curaproject"):
name = name[:name.rfind(".curaproject")] name = name[:name.rfind(".curaproject")]
self._base_name = name self._base_name = name
self._updateJobName(is_project_name_empty = is_empty) self._updateJobName()
## Created an acronymn-like abbreviated machine name from the currently active machine name ## Created an acronymn-like abbreviated machine name from the currently active machine name
# Called each time the global stack is switched # Called each time the global stack is switched

View File

@ -409,7 +409,7 @@ class CuraContainerRegistry(ContainerRegistry):
extruder_stack = None extruder_stack = None
# if extruders are defined in the machine definition use those instead # if extruders are defined in the machine definition use those instead
if machine.extruders and len(machine.extruders) > 0: if machine.extruders and "0" in machine.extruders:
new_extruder_id = machine.extruders["0"].getId() new_extruder_id = machine.extruders["0"].getId()
extruder_stack = machine.extruders["0"] extruder_stack = machine.extruders["0"]
@ -449,9 +449,16 @@ class CuraContainerRegistry(ContainerRegistry):
extruder_stack.setVariantById(variant_id) extruder_stack.setVariantById(variant_id)
extruder_stack.setMaterialById("default") extruder_stack.setMaterialById("default")
extruder_stack.setQualityById("default") extruder_stack.setQualityById("default")
if machine.qualityChanges.getId() != "empty_quality_changes":
extruder_quality_changes_container = self.findInstanceContainers(name = machine.qualityChanges.getName(), extruder = extruder_id)
if extruder_quality_changes_container:
quality_changes_id = extruder_quality_changes_container[0].getId()
extruder_stack.setQualityChangesById(quality_changes_id)
self.addContainer(extruder_stack) self.addContainer(extruder_stack)
return extruder_stack
# Fix the extruders that were upgraded to ExtruderStack instances during addContainer. # Fix the extruders that were upgraded to ExtruderStack instances during addContainer.
# The stacks are now responsible for setting the next stack on deserialize. However, # The stacks are now responsible for setting the next stack on deserialize. However,
# due to problems with loading order, some stacks may not have the proper next stack # due to problems with loading order, some stacks may not have the proper next stack

View File

@ -620,12 +620,17 @@ class MachineManager(QObject):
@pyqtProperty(str, notify=activeQualityChanged) @pyqtProperty(str, notify=activeQualityChanged)
def activeQualityId(self) -> str: def activeQualityId(self) -> str:
if self._active_container_stack: if self._active_container_stack:
quality = self._active_container_stack.qualityChanges
if quality and not isinstance(quality, type(self._empty_quality_changes_container)):
return quality.getId()
quality = self._active_container_stack.quality quality = self._active_container_stack.quality
if quality: if isinstance(quality, type(self._empty_quality_container)):
return quality.getId() return ""
quality_changes = self._active_container_stack.qualityChanges
if quality and quality_changes:
if isinstance(quality_changes, type(self._empty_quality_changes_container)):
# It's a built-in profile
return quality.getId()
else:
# Custom profile
return quality_changes.getId()
return "" return ""
@pyqtProperty(str, notify=activeQualityChanged) @pyqtProperty(str, notify=activeQualityChanged)
@ -690,9 +695,9 @@ class MachineManager(QObject):
@pyqtProperty(str, notify = activeQualityChanged) @pyqtProperty(str, notify = activeQualityChanged)
def activeQualityChangesId(self) -> str: def activeQualityChangesId(self) -> str:
if self._active_container_stack: if self._active_container_stack:
changes = self._active_container_stack.qualityChanges quality_changes = self._active_container_stack.qualityChanges
if changes and changes.getId() != "empty": if quality_changes and not isinstance(quality_changes, type(self._empty_quality_changes_container)):
return changes.getId() return quality_changes.getId()
return "" return ""
## Check if a container is read_only ## Check if a container is read_only

View File

@ -746,7 +746,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
# If not extruder stacks were saved in the project file (pre 3.1) create one manually # If not extruder stacks were saved in the project file (pre 3.1) create one manually
# We re-use the container registry's addExtruderStackForSingleExtrusionMachine method for this # We re-use the container registry's addExtruderStackForSingleExtrusionMachine method for this
if not extruder_stacks: if not extruder_stacks:
self._container_registry.addExtruderStackForSingleExtrusionMachine(global_stack, "fdmextruder") extruder_stacks.append(self._container_registry.addExtruderStackForSingleExtrusionMachine(global_stack, "fdmextruder"))
except: except:
Logger.logException("w", "We failed to serialize the stack. Trying to clean up.") Logger.logException("w", "We failed to serialize the stack. Trying to clean up.")

View File

@ -114,8 +114,10 @@ class VersionUpgrade30to31(VersionUpgrade):
# Copy global quality changes to extruder quality changes for single extrusion machines # Copy global quality changes to extruder quality changes for single extrusion machines
if parser["metadata"]["type"] == "quality_changes": if parser["metadata"]["type"] == "quality_changes":
all_quality_changes = self._getSingleExtrusionMachineQualityChanges(parser) all_quality_changes = self._getSingleExtrusionMachineQualityChanges(parser)
if len(all_quality_changes) == 1 and not all_quality_changes[0].has_option("metadata", "extruder"): # Note that DO NOT!!! use the quality_changes returned from _getSingleExtrusionMachineQualityChanges().
self._createExtruderQualityChangesForSingleExtrusionMachine(filename, all_quality_changes[0]) # Those are loaded from the hard drive which are original files that haven't been upgraded yet.
if len(all_quality_changes) == 1 and not parser.has_option("metadata", "extruder"):
self._createExtruderQualityChangesForSingleExtrusionMachine(filename, parser)
# Update version numbers # Update version numbers
parser["general"]["version"] = "2" parser["general"]["version"] = "2"

File diff suppressed because it is too large Load Diff

View File

@ -5,8 +5,8 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Cura 3.0\n" "Project-Id-Version: Cura 3.1\n"
"Report-Msgid-Bugs-To: http://github.com/ultimaker/uranium\n" "Report-Msgid-Bugs-To: r.dulek@ultimaker.com\n"
"POT-Creation-Date: 2017-11-21 16:58+0000\n" "POT-Creation-Date: 2017-11-21 16:58+0000\n"
"PO-Revision-Date: 2017-09-20 14:31+0900\n" "PO-Revision-Date: 2017-09-20 14:31+0900\n"
"Last-Translator: Brule\n" "Last-Translator: Brule\n"

File diff suppressed because it is too large Load Diff

View File

@ -159,7 +159,7 @@ UM.PreferencesPage
append({ text: "Nederlands", code: "nl_NL" }) append({ text: "Nederlands", code: "nl_NL" })
append({ text: "Polski", code: "pl_PL" }) append({ text: "Polski", code: "pl_PL" })
append({ text: "Português do Brasil", code: "pt_BR" }) append({ text: "Português do Brasil", code: "pt_BR" })
append({ text: "Русский", code: "ru_RU" }) //Russian is disabled for being incomplete: append({ text: "Русский", code: "ru_RU" })
append({ text: "Türkçe", code: "tr_TR" }) append({ text: "Türkçe", code: "tr_TR" })
append({ text: "简体中文", code: "zh_CN" }) append({ text: "简体中文", code: "zh_CN" })