mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Merge branch '2.3'
* 2.3: Set encoding to utf-8 when writing files Remove manually specified utf-8 encoding SettingInstanceManager now also watches containerchanged of extruder stacks
This commit is contained in:
commit
448d7d890c
4 changed files with 9 additions and 5 deletions
|
@ -382,7 +382,7 @@ class CuraApplication(QtApplication):
|
||||||
|
|
||||||
if path:
|
if path:
|
||||||
instance.setPath(path)
|
instance.setPath(path)
|
||||||
with SaveFile(path, "wt", -1, "utf-8") as f:
|
with SaveFile(path, "wt") as f:
|
||||||
f.write(data)
|
f.write(data)
|
||||||
|
|
||||||
for stack in ContainerRegistry.getInstance().findContainerStacks():
|
for stack in ContainerRegistry.getInstance().findContainerStacks():
|
||||||
|
@ -409,7 +409,7 @@ class CuraApplication(QtApplication):
|
||||||
path = Resources.getStoragePath(self.ResourceTypes.ExtruderStack, file_name)
|
path = Resources.getStoragePath(self.ResourceTypes.ExtruderStack, file_name)
|
||||||
if path:
|
if path:
|
||||||
stack.setPath(path)
|
stack.setPath(path)
|
||||||
with SaveFile(path, "wt", -1, "utf-8") as f:
|
with SaveFile(path, "wt") as f:
|
||||||
f.write(data)
|
f.write(data)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -56,9 +56,11 @@ class SettingInheritanceManager(QObject):
|
||||||
if new_active_stack != self._active_container_stack: # Check if changed
|
if new_active_stack != self._active_container_stack: # Check if changed
|
||||||
if self._active_container_stack: # Disconnect signal from old container (if any)
|
if self._active_container_stack: # Disconnect signal from old container (if any)
|
||||||
self._active_container_stack.propertyChanged.disconnect(self._onPropertyChanged)
|
self._active_container_stack.propertyChanged.disconnect(self._onPropertyChanged)
|
||||||
|
self._active_container_stack.containersChanged.disconnect(self._onContainersChanged)
|
||||||
|
|
||||||
self._active_container_stack = new_active_stack
|
self._active_container_stack = new_active_stack
|
||||||
self._active_container_stack.propertyChanged.connect(self._onPropertyChanged)
|
self._active_container_stack.propertyChanged.connect(self._onPropertyChanged)
|
||||||
|
self._active_container_stack.containersChanged.connect(self._onContainersChanged)
|
||||||
self._update() # Ensure that the settings_with_inheritance_warning list is populated.
|
self._update() # Ensure that the settings_with_inheritance_warning list is populated.
|
||||||
|
|
||||||
def _onPropertyChanged(self, key, property_name):
|
def _onPropertyChanged(self, key, property_name):
|
||||||
|
@ -178,7 +180,9 @@ class SettingInheritanceManager(QObject):
|
||||||
self._onActiveExtruderChanged()
|
self._onActiveExtruderChanged()
|
||||||
|
|
||||||
def _onContainersChanged(self, container):
|
def _onContainersChanged(self, container):
|
||||||
self._onActiveExtruderChanged()
|
# TODO: Multiple container changes in sequence now cause quite a few recalculations.
|
||||||
|
# This isn't that big of an issue, but it could be in the future.
|
||||||
|
self._update()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def createSettingInheritanceManager(engine=None, script_engine=None):
|
def createSettingInheritanceManager(engine=None, script_engine=None):
|
||||||
|
|
|
@ -71,7 +71,7 @@ class RemovableDriveOutputDevice(OutputDevice):
|
||||||
try:
|
try:
|
||||||
Logger.log("d", "Writing to %s", file_name)
|
Logger.log("d", "Writing to %s", file_name)
|
||||||
# Using buffering greatly reduces the write time for many lines of gcode
|
# Using buffering greatly reduces the write time for many lines of gcode
|
||||||
self._stream = open(file_name, "wt", buffering = 1)
|
self._stream = open(file_name, "wt", buffering = 1, encoding = "utf-8")
|
||||||
job = WriteMeshJob(writer, self._stream, nodes, MeshWriter.OutputMode.TextMode)
|
job = WriteMeshJob(writer, self._stream, nodes, MeshWriter.OutputMode.TextMode)
|
||||||
job.setFileName(file_name)
|
job.setFileName(file_name)
|
||||||
job.progress.connect(self._onProgress)
|
job.progress.connect(self._onProgress)
|
||||||
|
|
|
@ -111,7 +111,7 @@ class MachineInstance:
|
||||||
user_profile_file = os.path.join(user_storage, urllib.parse.quote_plus(self._name) + "_current_settings.inst.cfg")
|
user_profile_file = os.path.join(user_storage, urllib.parse.quote_plus(self._name) + "_current_settings.inst.cfg")
|
||||||
if not os.path.exists(user_storage):
|
if not os.path.exists(user_storage):
|
||||||
os.makedirs(user_storage)
|
os.makedirs(user_storage)
|
||||||
with open(user_profile_file, "w") as file_handle:
|
with open(user_profile_file, "w", encoding = "utf-8") as file_handle:
|
||||||
user_profile.write(file_handle)
|
user_profile.write(file_handle)
|
||||||
version_upgrade_manager.upgradeExtraFile(user_storage, urllib.parse.quote_plus(self._name), "user")
|
version_upgrade_manager.upgradeExtraFile(user_storage, urllib.parse.quote_plus(self._name), "user")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue