Hardcode plugin id for UsbPrinter and XmlMaterialProfile

Previous solution was more defensive but also introduced dependencies
and extra files for minor benefit

CURA-6255
This commit is contained in:
Nino van Hooff 2019-12-30 12:04:41 +01:00
parent 8ae7459ea7
commit 9aa5c3cd24
3 changed files with 3 additions and 8 deletions

View file

@ -88,9 +88,7 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
self._firmware_name_requested = False
self._firmware_updater = AvrFirmwareUpdater(self)
from .USBPrinterOutputDeviceManager import USBPrinterOutputDeviceManager
plugin_id = USBPrinterOutputDeviceManager.getInstance().getPluginId()
plugin_path = PluginRegistry.getInstance().getPluginPath(plugin_id)
plugin_path = PluginRegistry.getInstance().getPluginPath("USBPrinting")
self._monitor_view_qml_path = os.path.join(plugin_path, "MonitorItem.qml")
CuraApplication.getInstance().getOnExitCallbackManager().addCallback(self._checkActivePrintingUponAppExit)

View file

@ -20,7 +20,6 @@ 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
@ -1070,8 +1069,7 @@ class XmlMaterialProfile(InstanceContainer):
# This loads the mapping from a file.
@classmethod
def getProductIdMap(cls) -> Dict[str, List[str]]:
plugin_id = PluginInfo.getInstance().getPluginId()
plugin_path = PluginRegistry.getInstance().getPluginPath(plugin_id)
plugin_path = 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)

View file

@ -1,6 +1,6 @@
# Copyright (c) 2017 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from plugins.XmlMaterialProfile.PluginInfo import PluginInfo
from . import XmlMaterialProfile
from . import XmlMaterialUpgrader
@ -46,5 +46,4 @@ def register(app):
return {"version_upgrade": upgrader,
"settings_container": XmlMaterialProfile.XmlMaterialProfile("default_xml_material_profile"),
"plugin_info": PluginInfo()
}