mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 14:37:29 -06:00
Use plugin Id instead of __file__ for XmlMaterialProfile
CURA-6255
This commit is contained in:
parent
49b93db6df
commit
128bfa987e
3 changed files with 22 additions and 2 deletions
|
@ -9,6 +9,7 @@ import sys
|
|||
from typing import Any, Dict, List, Optional, Tuple, cast, Set, Union
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
from UM.PluginRegistry import PluginRegistry
|
||||
from UM.Resources import Resources
|
||||
from UM.Logger import Logger
|
||||
import UM.Dictionary
|
||||
|
@ -19,6 +20,7 @@ from UM.ConfigurationErrorMessage import ConfigurationErrorMessage
|
|||
from cura.CuraApplication import CuraApplication
|
||||
from cura.Machines.ContainerTree import ContainerTree
|
||||
from cura.Machines.VariantType import VariantType
|
||||
from plugins.XmlMaterialProfile import PluginInfo
|
||||
|
||||
try:
|
||||
from .XmlMaterialValidator import XmlMaterialValidator
|
||||
|
@ -1068,7 +1070,9 @@ class XmlMaterialProfile(InstanceContainer):
|
|||
# This loads the mapping from a file.
|
||||
@classmethod
|
||||
def getProductIdMap(cls) -> Dict[str, List[str]]:
|
||||
product_to_id_file = os.path.join(os.path.dirname(sys.modules[cls.__module__].__file__), "product_to_id.json")
|
||||
plugin_id = PluginInfo.getInstance().getPluginId()
|
||||
plugin_path = PluginRegistry.getInstance().getPluginPath(plugin_id)
|
||||
product_to_id_file = os.path.join(plugin_path, "product_to_id.json")
|
||||
with open(product_to_id_file, encoding = "utf-8") as f:
|
||||
product_to_id_map = json.load(f)
|
||||
product_to_id_map = {key: [value] for key, value in product_to_id_map.items()}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue