mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-21 20:19:32 +08:00
Merge branch 'CURA-6255_incorrect_usage_of__file__' of github.com:Ultimaker/Cura
This commit is contained in:
commit
a1f8c3f281
@ -88,7 +88,8 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
|
||||
self._firmware_name_requested = False
|
||||
self._firmware_updater = AvrFirmwareUpdater(self)
|
||||
|
||||
self._monitor_view_qml_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "MonitorItem.qml")
|
||||
plugin_path = cast(str, PluginRegistry.getInstance().getPluginPath("USBPrinting"))
|
||||
self._monitor_view_qml_path = os.path.join(plugin_path, "MonitorItem.qml")
|
||||
|
||||
CuraApplication.getInstance().getOnExitCallbackManager().addCallback(self._checkActivePrintingUponAppExit)
|
||||
|
||||
|
15
plugins/XmlMaterialProfile/PluginInfo.py
Normal file
15
plugins/XmlMaterialProfile/PluginInfo.py
Normal file
@ -0,0 +1,15 @@
|
||||
from UM.PluginObject import PluginObject
|
||||
|
||||
|
||||
class PluginInfo(PluginObject):
|
||||
__instance = None # type: PluginInfo
|
||||
|
||||
def __init__(self, *args, **kwags):
|
||||
super().__init__(*args, **kwags)
|
||||
if PluginInfo.__instance is not None:
|
||||
raise RuntimeError("Try to create singleton '%s' more than once" % self.__class__.__name__)
|
||||
PluginInfo.__instance = self
|
||||
|
||||
@classmethod
|
||||
def getInstance(cls, *args, **kwargs) -> "PluginInfo":
|
||||
return cls.__instance
|
@ -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
|
||||
@ -1068,7 +1069,8 @@ 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_path = cast(str, PluginRegistry.getInstance().getPluginPath("XmlMaterialProfile"))
|
||||
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…
x
Reference in New Issue
Block a user