mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
Don't depend on the name of resource folders not changing
If we choose to rename the resource folders, then this plug-in should still look in the old resource folders. So hard-code these resource folders in the state that they were in at version 2.5 so that we can freely change them in a modern version.
This commit is contained in:
parent
572afb052e
commit
2e6401b7dc
1 changed files with 6 additions and 8 deletions
|
@ -1,4 +1,4 @@
|
||||||
# Copyright (c) 2017 Ultimaker B.V.
|
# Copyright (c) 2018 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
import configparser #To parse the files we need to upgrade and write the new files.
|
import configparser #To parse the files we need to upgrade and write the new files.
|
||||||
|
@ -9,8 +9,6 @@ from urllib.parse import quote_plus
|
||||||
from UM.Resources import Resources
|
from UM.Resources import Resources
|
||||||
from UM.VersionUpgrade import VersionUpgrade
|
from UM.VersionUpgrade import VersionUpgrade
|
||||||
|
|
||||||
from cura.CuraApplication import CuraApplication
|
|
||||||
|
|
||||||
_removed_settings = { #Settings that were removed in 2.5.
|
_removed_settings = { #Settings that were removed in 2.5.
|
||||||
"start_layers_at_same_position",
|
"start_layers_at_same_position",
|
||||||
"sub_div_rad_mult"
|
"sub_div_rad_mult"
|
||||||
|
@ -152,7 +150,7 @@ class VersionUpgrade25to26(VersionUpgrade):
|
||||||
|
|
||||||
## Acquires the next unique extruder stack index number for the Custom FDM Printer.
|
## Acquires the next unique extruder stack index number for the Custom FDM Printer.
|
||||||
def _acquireNextUniqueCustomFdmPrinterExtruderStackIdIndex(self):
|
def _acquireNextUniqueCustomFdmPrinterExtruderStackIdIndex(self):
|
||||||
extruder_stack_dir = Resources.getPath(CuraApplication.ResourceTypes.ExtruderStack)
|
extruder_stack_dir = os.path.join(Resources.getDataStoragePath(), "extruders")
|
||||||
file_name_list = os.listdir(extruder_stack_dir)
|
file_name_list = os.listdir(extruder_stack_dir)
|
||||||
file_name_list = [os.path.basename(file_name) for file_name in file_name_list]
|
file_name_list = [os.path.basename(file_name) for file_name in file_name_list]
|
||||||
while True:
|
while True:
|
||||||
|
@ -173,7 +171,7 @@ class VersionUpgrade25to26(VersionUpgrade):
|
||||||
|
|
||||||
def _checkCustomFdmPrinterHasExtruderStack(self, machine_id):
|
def _checkCustomFdmPrinterHasExtruderStack(self, machine_id):
|
||||||
# go through all extruders and make sure that this custom FDM printer has extruder stacks.
|
# go through all extruders and make sure that this custom FDM printer has extruder stacks.
|
||||||
extruder_stack_dir = Resources.getPath(CuraApplication.ResourceTypes.ExtruderStack)
|
extruder_stack_dir = os.path.join(Resources.getDataStoragePath(), "extruders")
|
||||||
has_extruders = False
|
has_extruders = False
|
||||||
for item in os.listdir(extruder_stack_dir):
|
for item in os.listdir(extruder_stack_dir):
|
||||||
file_path = os.path.join(extruder_stack_dir, item)
|
file_path = os.path.join(extruder_stack_dir, item)
|
||||||
|
@ -245,9 +243,9 @@ class VersionUpgrade25to26(VersionUpgrade):
|
||||||
parser.write(extruder_output)
|
parser.write(extruder_output)
|
||||||
extruder_filename = quote_plus(stack_id) + ".extruder.cfg"
|
extruder_filename = quote_plus(stack_id) + ".extruder.cfg"
|
||||||
|
|
||||||
extruder_stack_dir = Resources.getPath(CuraApplication.ResourceTypes.ExtruderStack)
|
extruder_stack_dir = os.path.join(Resources.getDataStoragePath(), "extruders")
|
||||||
definition_changes_dir = Resources.getPath(CuraApplication.ResourceTypes.DefinitionChangesContainer)
|
definition_changes_dir = os.path.join(Resources.getDataStoragePath(), "definition_changes")
|
||||||
user_settings_dir = Resources.getPath(CuraApplication.ResourceTypes.UserInstanceContainer)
|
user_settings_dir = os.path.join(Resources.getDataStoragePath(), "user")
|
||||||
|
|
||||||
with open(os.path.join(definition_changes_dir, definition_changes_filename), "w", encoding = "utf-8") as f:
|
with open(os.path.join(definition_changes_dir, definition_changes_filename), "w", encoding = "utf-8") as f:
|
||||||
f.write(definition_changes_output.getvalue())
|
f.write(definition_changes_output.getvalue())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue