|
@@ -258,9 +258,12 @@ class CuraApplication(QtApplication):
|
|
def ultimakerCloudAccountRootUrl(self) -> str:
|
|
def ultimakerCloudAccountRootUrl(self) -> str:
|
|
return UltimakerCloudAuthentication.CuraCloudAccountAPIRoot
|
|
return UltimakerCloudAuthentication.CuraCloudAccountAPIRoot
|
|
|
|
|
|
- # Adds command line options to the command line parser. This should be called after the application is created and
|
|
|
|
- # before the pre-start.
|
|
|
|
def addCommandLineOptions(self):
|
|
def addCommandLineOptions(self):
|
|
|
|
+ """Adds command line options to the command line parser.
|
|
|
|
+
|
|
|
|
+ This should be called after the application is created and before the pre-start.
|
|
|
|
+ """
|
|
|
|
+
|
|
super().addCommandLineOptions()
|
|
super().addCommandLineOptions()
|
|
self._cli_parser.add_argument("--help", "-h",
|
|
self._cli_parser.add_argument("--help", "-h",
|
|
action = "store_true",
|
|
action = "store_true",
|
|
@@ -322,8 +325,9 @@ class CuraApplication(QtApplication):
|
|
Logger.log("i", "Single instance commands were sent, exiting")
|
|
Logger.log("i", "Single instance commands were sent, exiting")
|
|
sys.exit(0)
|
|
sys.exit(0)
|
|
|
|
|
|
- # Adds expected directory names and search paths for Resources.
|
|
|
|
def __addExpectedResourceDirsAndSearchPaths(self):
|
|
def __addExpectedResourceDirsAndSearchPaths(self):
|
|
|
|
+ """Adds expected directory names and search paths for Resources."""
|
|
|
|
+
|
|
# this list of dir names will be used by UM to detect an old cura directory
|
|
# this list of dir names will be used by UM to detect an old cura directory
|
|
for dir_name in ["extruders", "machine_instances", "materials", "plugins", "quality", "quality_changes", "user", "variants", "intent"]:
|
|
for dir_name in ["extruders", "machine_instances", "materials", "plugins", "quality", "quality_changes", "user", "variants", "intent"]:
|
|
Resources.addExpectedDirNameInData(dir_name)
|
|
Resources.addExpectedDirNameInData(dir_name)
|
|
@@ -365,9 +369,12 @@ class CuraApplication(QtApplication):
|
|
SettingDefinition.addSettingType("[int]", None, str, None)
|
|
SettingDefinition.addSettingType("[int]", None, str, None)
|
|
|
|
|
|
|
|
|
|
- # Adds custom property types, settings types, and extra operators (functions) that need to be registered in
|
|
|
|
- # SettingDefinition and SettingFunction.
|
|
|
|
def _initializeSettingFunctions(self):
|
|
def _initializeSettingFunctions(self):
|
|
|
|
+ """Adds custom property types, settings types, and extra operators (functions).
|
|
|
|
+
|
|
|
|
+ Whom need to be registered in SettingDefinition and SettingFunction.
|
|
|
|
+ """
|
|
|
|
+
|
|
self._cura_formula_functions = CuraFormulaFunctions(self)
|
|
self._cura_formula_functions = CuraFormulaFunctions(self)
|
|
|
|
|
|
SettingFunction.registerOperator("extruderValue", self._cura_formula_functions.getValueInExtruder)
|
|
SettingFunction.registerOperator("extruderValue", self._cura_formula_functions.getValueInExtruder)
|
|
@@ -377,8 +384,9 @@ class CuraApplication(QtApplication):
|
|
SettingFunction.registerOperator("valueFromContainer", self._cura_formula_functions.getValueFromContainerAtIndex)
|
|
SettingFunction.registerOperator("valueFromContainer", self._cura_formula_functions.getValueFromContainerAtIndex)
|
|
SettingFunction.registerOperator("extruderValueFromContainer", self._cura_formula_functions.getValueFromContainerAtIndexInExtruder)
|
|
SettingFunction.registerOperator("extruderValueFromContainer", self._cura_formula_functions.getValueFromContainerAtIndexInExtruder)
|
|
|
|
|
|
- # Adds all resources and container related resources.
|
|
|
|
def __addAllResourcesAndContainerResources(self) -> None:
|
|
def __addAllResourcesAndContainerResources(self) -> None:
|
|
|
|
+ """Adds all resources and container related resources."""
|
|
|
|
+
|
|
Resources.addStorageType(self.ResourceTypes.QualityInstanceContainer, "quality")
|
|
Resources.addStorageType(self.ResourceTypes.QualityInstanceContainer, "quality")
|
|
Resources.addStorageType(self.ResourceTypes.QualityChangesInstanceContainer, "quality_changes")
|
|
Resources.addStorageType(self.ResourceTypes.QualityChangesInstanceContainer, "quality_changes")
|
|
Resources.addStorageType(self.ResourceTypes.VariantInstanceContainer, "variants")
|
|
Resources.addStorageType(self.ResourceTypes.VariantInstanceContainer, "variants")
|
|
@@ -403,8 +411,9 @@ class CuraApplication(QtApplication):
|
|
Resources.addType(self.ResourceTypes.QmlFiles, "qml")
|
|
Resources.addType(self.ResourceTypes.QmlFiles, "qml")
|
|
Resources.addType(self.ResourceTypes.Firmware, "firmware")
|
|
Resources.addType(self.ResourceTypes.Firmware, "firmware")
|
|
|
|
|
|
- # Adds all empty containers.
|
|
|
|
def __addAllEmptyContainers(self) -> None:
|
|
def __addAllEmptyContainers(self) -> None:
|
|
|
|
+ """Adds all empty containers."""
|
|
|
|
+
|
|
# Add empty variant, material and quality containers.
|
|
# Add empty variant, material and quality containers.
|
|
# Since they are empty, they should never be serialized and instead just programmatically created.
|
|
# Since they are empty, they should never be serialized and instead just programmatically created.
|
|
# We need them to simplify the switching between materials.
|
|
# We need them to simplify the switching between materials.
|
|
@@ -429,9 +438,11 @@ class CuraApplication(QtApplication):
|
|
self._container_registry.addContainer(cura.Settings.cura_empty_instance_containers.empty_quality_changes_container)
|
|
self._container_registry.addContainer(cura.Settings.cura_empty_instance_containers.empty_quality_changes_container)
|
|
self.empty_quality_changes_container = cura.Settings.cura_empty_instance_containers.empty_quality_changes_container
|
|
self.empty_quality_changes_container = cura.Settings.cura_empty_instance_containers.empty_quality_changes_container
|
|
|
|
|
|
- # Initializes the version upgrade manager with by providing the paths for each resource type and the latest
|
|
|
|
- # versions.
|
|
|
|
def __setLatestResouceVersionsForVersionUpgrade(self):
|
|
def __setLatestResouceVersionsForVersionUpgrade(self):
|
|
|
|
+ """Initializes the version upgrade manager with by providing the paths for each resource type and the latest
|
|
|
|
+ versions.
|
|
|
|
+ """
|
|
|
|
+
|
|
self._version_upgrade_manager.setCurrentVersions(
|
|
self._version_upgrade_manager.setCurrentVersions(
|
|
{
|
|
{
|
|
("quality", InstanceContainer.Version * 1000000 + self.SettingVersion): (self.ResourceTypes.QualityInstanceContainer, "application/x-uranium-instancecontainer"),
|
|
("quality", InstanceContainer.Version * 1000000 + self.SettingVersion): (self.ResourceTypes.QualityInstanceContainer, "application/x-uranium-instancecontainer"),
|
|
@@ -446,8 +457,9 @@ class CuraApplication(QtApplication):
|
|
}
|
|
}
|
|
)
|
|
)
|
|
|
|
|
|
- # Runs preparations that needs to be done before the starting process.
|
|
|
|
def startSplashWindowPhase(self) -> None:
|
|
def startSplashWindowPhase(self) -> None:
|
|
|
|
+ """Runs preparations that needs to be done before the starting process."""
|
|
|
|
+
|
|
super().startSplashWindowPhase()
|
|
super().startSplashWindowPhase()
|
|
|
|
|
|
if not self.getIsHeadLess():
|
|
if not self.getIsHeadLess():
|
|
@@ -503,7 +515,7 @@ class CuraApplication(QtApplication):
|
|
# Set the setting version for Preferences
|
|
# Set the setting version for Preferences
|
|
preferences = self.getPreferences()
|
|
preferences = self.getPreferences()
|
|
preferences.addPreference("metadata/setting_version", 0)
|
|
preferences.addPreference("metadata/setting_version", 0)
|
|
- preferences.setValue("metadata/setting_version", self.SettingVersion) #Don't make it equal to the default so that the setting version always gets written to the file.
|
|
|
|
|
|
+ preferences.setValue("metadata/setting_version", self.SettingVersion) # Don't make it equal to the default so that the setting version always gets written to the file.
|
|
|
|
|
|
preferences.addPreference("cura/active_mode", "simple")
|
|
preferences.addPreference("cura/active_mode", "simple")
|
|
|
|
|
|
@@ -607,12 +619,13 @@ class CuraApplication(QtApplication):
|
|
def callConfirmExitDialogCallback(self, yes_or_no: bool) -> None:
|
|
def callConfirmExitDialogCallback(self, yes_or_no: bool) -> None:
|
|
self._confirm_exit_dialog_callback(yes_or_no)
|
|
self._confirm_exit_dialog_callback(yes_or_no)
|
|
|
|
|
|
- ## Signal to connect preferences action in QML
|
|
|
|
showPreferencesWindow = pyqtSignal()
|
|
showPreferencesWindow = pyqtSignal()
|
|
|
|
+ """Signal to connect preferences action in QML"""
|
|
|
|
|
|
- ## Show the preferences window
|
|
|
|
@pyqtSlot()
|
|
@pyqtSlot()
|
|
def showPreferences(self) -> None:
|
|
def showPreferences(self) -> None:
|
|
|
|
+ """Show the preferences window"""
|
|
|
|
+
|
|
self.showPreferencesWindow.emit()
|
|
self.showPreferencesWindow.emit()
|
|
|
|
|
|
# This is called by drag-and-dropping curapackage files.
|
|
# This is called by drag-and-dropping curapackage files.
|
|
@@ -630,10 +643,9 @@ class CuraApplication(QtApplication):
|
|
self._setLoadingHint(self._i18n_catalog.i18nc("@info:progress", "Initializing Active Machine..."))
|
|
self._setLoadingHint(self._i18n_catalog.i18nc("@info:progress", "Initializing Active Machine..."))
|
|
super().setGlobalContainerStack(stack)
|
|
super().setGlobalContainerStack(stack)
|
|
|
|
|
|
- ## A reusable dialogbox
|
|
|
|
- #
|
|
|
|
showMessageBox = pyqtSignal(str,str, str, str, int, int,
|
|
showMessageBox = pyqtSignal(str,str, str, str, int, int,
|
|
arguments = ["title", "text", "informativeText", "detailedText","buttons", "icon"])
|
|
arguments = ["title", "text", "informativeText", "detailedText","buttons", "icon"])
|
|
|
|
+ """ A reusable dialogbox"""
|
|
|
|
|
|
def messageBox(self, title, text,
|
|
def messageBox(self, title, text,
|
|
informativeText = "",
|
|
informativeText = "",
|
|
@@ -711,9 +723,12 @@ class CuraApplication(QtApplication):
|
|
def setDefaultPath(self, key, default_path):
|
|
def setDefaultPath(self, key, default_path):
|
|
self.getPreferences().setValue("local_file/%s" % key, QUrl(default_path).toLocalFile())
|
|
self.getPreferences().setValue("local_file/%s" % key, QUrl(default_path).toLocalFile())
|
|
|
|
|
|
- ## Handle loading of all plugin types (and the backend explicitly)
|
|
|
|
- # \sa PluginRegistry
|
|
|
|
def _loadPlugins(self) -> None:
|
|
def _loadPlugins(self) -> None:
|
|
|
|
+ """Handle loading of all plugin types (and the backend explicitly)
|
|
|
|
+
|
|
|
|
+ :py:class:`Uranium.UM.PluginRegistry`
|
|
|
|
+ """
|
|
|
|
+
|
|
self._plugin_registry.setCheckIfTrusted(ApplicationMetadata.IsEnterpriseVersion)
|
|
self._plugin_registry.setCheckIfTrusted(ApplicationMetadata.IsEnterpriseVersion)
|
|
|
|
|
|
self._plugin_registry.addType("profile_reader", self._addProfileReader)
|
|
self._plugin_registry.addType("profile_reader", self._addProfileReader)
|
|
@@ -737,9 +752,12 @@ class CuraApplication(QtApplication):
|
|
|
|
|
|
self._plugins_loaded = True
|
|
self._plugins_loaded = True
|
|
|
|
|
|
- ## Set a short, user-friendly hint about current loading status.
|
|
|
|
- # The way this message is displayed depends on application state
|
|
|
|
def _setLoadingHint(self, hint: str):
|
|
def _setLoadingHint(self, hint: str):
|
|
|
|
+ """Set a short, user-friendly hint about current loading status.
|
|
|
|
+
|
|
|
|
+ The way this message is displayed depends on application state
|
|
|
|
+ """
|
|
|
|
+
|
|
if self.started:
|
|
if self.started:
|
|
Logger.info(hint)
|
|
Logger.info(hint)
|
|
else:
|
|
else:
|
|
@@ -824,12 +842,14 @@ class CuraApplication(QtApplication):
|
|
|
|
|
|
initializationFinished = pyqtSignal()
|
|
initializationFinished = pyqtSignal()
|
|
|
|
|
|
- ## Run Cura without GUI elements and interaction (server mode).
|
|
|
|
def runWithoutGUI(self):
|
|
def runWithoutGUI(self):
|
|
|
|
+ """Run Cura without GUI elements and interaction (server mode)."""
|
|
|
|
+
|
|
self.closeSplash()
|
|
self.closeSplash()
|
|
|
|
|
|
- ## Run Cura with GUI (desktop mode).
|
|
|
|
def runWithGUI(self):
|
|
def runWithGUI(self):
|
|
|
|
+ """Run Cura with GUI (desktop mode)."""
|
|
|
|
+
|
|
self._setLoadingHint(self._i18n_catalog.i18nc("@info:progress", "Setting up scene..."))
|
|
self._setLoadingHint(self._i18n_catalog.i18nc("@info:progress", "Setting up scene..."))
|
|
|
|
|
|
controller = self.getController()
|
|
controller = self.getController()
|
|
@@ -979,10 +999,13 @@ class CuraApplication(QtApplication):
|
|
self._setting_inheritance_manager = SettingInheritanceManager.createSettingInheritanceManager()
|
|
self._setting_inheritance_manager = SettingInheritanceManager.createSettingInheritanceManager()
|
|
return self._setting_inheritance_manager
|
|
return self._setting_inheritance_manager
|
|
|
|
|
|
- ## Get the machine action manager
|
|
|
|
- # We ignore any *args given to this, as we also register the machine manager as qml singleton.
|
|
|
|
- # It wants to give this function an engine and script engine, but we don't care about that.
|
|
|
|
def getMachineActionManager(self, *args: Any) -> MachineActionManager.MachineActionManager:
|
|
def getMachineActionManager(self, *args: Any) -> MachineActionManager.MachineActionManager:
|
|
|
|
+ """Get the machine action manager
|
|
|
|
+
|
|
|
|
+ We ignore any *args given to this, as we also register the machine manager as qml singleton.
|
|
|
|
+ It wants to give this function an engine and script engine, but we don't care about that.
|
|
|
|
+ """
|
|
|
|
+
|
|
return cast(MachineActionManager.MachineActionManager, self._machine_action_manager)
|
|
return cast(MachineActionManager.MachineActionManager, self._machine_action_manager)
|
|
|
|
|
|
@pyqtSlot(result = QObject)
|
|
@pyqtSlot(result = QObject)
|
|
@@ -1002,8 +1025,9 @@ class CuraApplication(QtApplication):
|
|
self._simple_mode_settings_manager = SimpleModeSettingsManager()
|
|
self._simple_mode_settings_manager = SimpleModeSettingsManager()
|
|
return self._simple_mode_settings_manager
|
|
return self._simple_mode_settings_manager
|
|
|
|
|
|
- ## Handle Qt events
|
|
|
|
def event(self, event):
|
|
def event(self, event):
|
|
|
|
+ """Handle Qt events"""
|
|
|
|
+
|
|
if event.type() == QEvent.FileOpen:
|
|
if event.type() == QEvent.FileOpen:
|
|
if self._plugins_loaded:
|
|
if self._plugins_loaded:
|
|
self._openFile(event.file())
|
|
self._openFile(event.file())
|
|
@@ -1015,8 +1039,9 @@ class CuraApplication(QtApplication):
|
|
def getAutoSave(self) -> Optional[AutoSave]:
|
|
def getAutoSave(self) -> Optional[AutoSave]:
|
|
return self._auto_save
|
|
return self._auto_save
|
|
|
|
|
|
- ## Get print information (duration / material used)
|
|
|
|
def getPrintInformation(self):
|
|
def getPrintInformation(self):
|
|
|
|
+ """Get print information (duration / material used)"""
|
|
|
|
+
|
|
return self._print_information
|
|
return self._print_information
|
|
|
|
|
|
def getQualityProfilesDropDownMenuModel(self, *args, **kwargs):
|
|
def getQualityProfilesDropDownMenuModel(self, *args, **kwargs):
|
|
@@ -1032,10 +1057,12 @@ class CuraApplication(QtApplication):
|
|
def getCuraAPI(self, *args, **kwargs) -> "CuraAPI":
|
|
def getCuraAPI(self, *args, **kwargs) -> "CuraAPI":
|
|
return self._cura_API
|
|
return self._cura_API
|
|
|
|
|
|
- ## Registers objects for the QML engine to use.
|
|
|
|
- #
|
|
|
|
- # \param engine The QML engine.
|
|
|
|
def registerObjects(self, engine):
|
|
def registerObjects(self, engine):
|
|
|
|
+ """Registers objects for the QML engine to use.
|
|
|
|
+
|
|
|
|
+ :param engine: The QML engine.
|
|
|
|
+ """
|
|
|
|
+
|
|
super().registerObjects(engine)
|
|
super().registerObjects(engine)
|
|
|
|
|
|
# global contexts
|
|
# global contexts
|
|
@@ -1169,8 +1196,9 @@ class CuraApplication(QtApplication):
|
|
if node is not None and (node.getMeshData() is not None or node.callDecoration("getLayerData")):
|
|
if node is not None and (node.getMeshData() is not None or node.callDecoration("getLayerData")):
|
|
self._update_platform_activity_timer.start()
|
|
self._update_platform_activity_timer.start()
|
|
|
|
|
|
- ## Update scene bounding box for current build plate
|
|
|
|
def updatePlatformActivity(self, node = None):
|
|
def updatePlatformActivity(self, node = None):
|
|
|
|
+ """Update scene bounding box for current build plate"""
|
|
|
|
+
|
|
count = 0
|
|
count = 0
|
|
scene_bounding_box = None
|
|
scene_bounding_box = None
|
|
is_block_slicing_node = False
|
|
is_block_slicing_node = False
|
|
@@ -1214,9 +1242,10 @@ class CuraApplication(QtApplication):
|
|
self._platform_activity = True if count > 0 else False
|
|
self._platform_activity = True if count > 0 else False
|
|
self.activityChanged.emit()
|
|
self.activityChanged.emit()
|
|
|
|
|
|
- ## Select all nodes containing mesh data in the scene.
|
|
|
|
@pyqtSlot()
|
|
@pyqtSlot()
|
|
def selectAll(self):
|
|
def selectAll(self):
|
|
|
|
+ """Select all nodes containing mesh data in the scene."""
|
|
|
|
+
|
|
if not self.getController().getToolsEnabled():
|
|
if not self.getController().getToolsEnabled():
|
|
return
|
|
return
|
|
|
|
|
|
@@ -1235,9 +1264,10 @@ class CuraApplication(QtApplication):
|
|
|
|
|
|
Selection.add(node)
|
|
Selection.add(node)
|
|
|
|
|
|
- ## Reset all translation on nodes with mesh data.
|
|
|
|
@pyqtSlot()
|
|
@pyqtSlot()
|
|
def resetAllTranslation(self):
|
|
def resetAllTranslation(self):
|
|
|
|
+ """Reset all translation on nodes with mesh data."""
|
|
|
|
+
|
|
Logger.log("i", "Resetting all scene translations")
|
|
Logger.log("i", "Resetting all scene translations")
|
|
nodes = []
|
|
nodes = []
|
|
for node in DepthFirstIterator(self.getController().getScene().getRoot()):
|
|
for node in DepthFirstIterator(self.getController().getScene().getRoot()):
|
|
@@ -1263,9 +1293,10 @@ class CuraApplication(QtApplication):
|
|
op.addOperation(SetTransformOperation(node, Vector(0, center_y, 0)))
|
|
op.addOperation(SetTransformOperation(node, Vector(0, center_y, 0)))
|
|
op.push()
|
|
op.push()
|
|
|
|
|
|
- ## Reset all transformations on nodes with mesh data.
|
|
|
|
@pyqtSlot()
|
|
@pyqtSlot()
|
|
def resetAll(self):
|
|
def resetAll(self):
|
|
|
|
+ """Reset all transformations on nodes with mesh data."""
|
|
|
|
+
|
|
Logger.log("i", "Resetting all scene transformations")
|
|
Logger.log("i", "Resetting all scene transformations")
|
|
nodes = []
|
|
nodes = []
|
|
for node in DepthFirstIterator(self.getController().getScene().getRoot()):
|
|
for node in DepthFirstIterator(self.getController().getScene().getRoot()):
|
|
@@ -1291,9 +1322,10 @@ class CuraApplication(QtApplication):
|
|
op.addOperation(SetTransformOperation(node, Vector(0, center_y, 0), Quaternion(), Vector(1, 1, 1)))
|
|
op.addOperation(SetTransformOperation(node, Vector(0, center_y, 0), Quaternion(), Vector(1, 1, 1)))
|
|
op.push()
|
|
op.push()
|
|
|
|
|
|
- ## Arrange all objects.
|
|
|
|
@pyqtSlot()
|
|
@pyqtSlot()
|
|
def arrangeObjectsToAllBuildPlates(self) -> None:
|
|
def arrangeObjectsToAllBuildPlates(self) -> None:
|
|
|
|
+ """Arrange all objects."""
|
|
|
|
+
|
|
nodes_to_arrange = []
|
|
nodes_to_arrange = []
|
|
for node in DepthFirstIterator(self.getController().getScene().getRoot()):
|
|
for node in DepthFirstIterator(self.getController().getScene().getRoot()):
|
|
if not isinstance(node, SceneNode):
|
|
if not isinstance(node, SceneNode):
|
|
@@ -1346,17 +1378,21 @@ class CuraApplication(QtApplication):
|
|
nodes_to_arrange.append(node)
|
|
nodes_to_arrange.append(node)
|
|
self.arrange(nodes_to_arrange, fixed_nodes = [])
|
|
self.arrange(nodes_to_arrange, fixed_nodes = [])
|
|
|
|
|
|
- ## Arrange a set of nodes given a set of fixed nodes
|
|
|
|
- # \param nodes nodes that we have to place
|
|
|
|
- # \param fixed_nodes nodes that are placed in the arranger before finding spots for nodes
|
|
|
|
def arrange(self, nodes: List[SceneNode], fixed_nodes: List[SceneNode]) -> None:
|
|
def arrange(self, nodes: List[SceneNode], fixed_nodes: List[SceneNode]) -> None:
|
|
|
|
+ """Arrange a set of nodes given a set of fixed nodes
|
|
|
|
+
|
|
|
|
+ :param nodes: nodes that we have to place
|
|
|
|
+ :param fixed_nodes: nodes that are placed in the arranger before finding spots for nodes
|
|
|
|
+ """
|
|
|
|
+
|
|
min_offset = self.getBuildVolume().getEdgeDisallowedSize() + 2 # Allow for some rounding errors
|
|
min_offset = self.getBuildVolume().getEdgeDisallowedSize() + 2 # Allow for some rounding errors
|
|
job = ArrangeObjectsJob(nodes, fixed_nodes, min_offset = max(min_offset, 8))
|
|
job = ArrangeObjectsJob(nodes, fixed_nodes, min_offset = max(min_offset, 8))
|
|
job.start()
|
|
job.start()
|
|
|
|
|
|
- ## Reload all mesh data on the screen from file.
|
|
|
|
@pyqtSlot()
|
|
@pyqtSlot()
|
|
def reloadAll(self) -> None:
|
|
def reloadAll(self) -> None:
|
|
|
|
+ """Reload all mesh data on the screen from file."""
|
|
|
|
+
|
|
Logger.log("i", "Reloading all loaded mesh data.")
|
|
Logger.log("i", "Reloading all loaded mesh data.")
|
|
nodes = []
|
|
nodes = []
|
|
has_merged_nodes = False
|
|
has_merged_nodes = False
|
|
@@ -1466,8 +1502,9 @@ class CuraApplication(QtApplication):
|
|
group_node.setName("MergedMesh") # add a specific name to distinguish this node
|
|
group_node.setName("MergedMesh") # add a specific name to distinguish this node
|
|
|
|
|
|
|
|
|
|
- ## Updates origin position of all merged meshes
|
|
|
|
def updateOriginOfMergedMeshes(self, _):
|
|
def updateOriginOfMergedMeshes(self, _):
|
|
|
|
+ """Updates origin position of all merged meshes"""
|
|
|
|
+
|
|
group_nodes = []
|
|
group_nodes = []
|
|
for node in DepthFirstIterator(self.getController().getScene().getRoot()):
|
|
for node in DepthFirstIterator(self.getController().getScene().getRoot()):
|
|
if isinstance(node, CuraSceneNode) and node.getName() == "MergedMesh":
|
|
if isinstance(node, CuraSceneNode) and node.getName() == "MergedMesh":
|
|
@@ -1585,9 +1622,10 @@ class CuraApplication(QtApplication):
|
|
scene from its source file. The function gets all the nodes that exist in the file through the job result, and
|
|
scene from its source file. The function gets all the nodes that exist in the file through the job result, and
|
|
then finds the scene node that it wants to refresh by its object id. Each job refreshes only one node.
|
|
then finds the scene node that it wants to refresh by its object id. Each job refreshes only one node.
|
|
|
|
|
|
- :param job: The ReadMeshJob running in the background that reads all the meshes in a file
|
|
|
|
- :return: None
|
|
|
|
|
|
+ :param job: The :py:class:`Uranium.UM.ReadMeshJob.ReadMeshJob` running in the background that reads all the
|
|
|
|
+ meshes in a file
|
|
"""
|
|
"""
|
|
|
|
+
|
|
job_result = job.getResult() # nodes that exist inside the file read by this job
|
|
job_result = job.getResult() # nodes that exist inside the file read by this job
|
|
if len(job_result) == 0:
|
|
if len(job_result) == 0:
|
|
Logger.log("e", "Reloading the mesh failed.")
|
|
Logger.log("e", "Reloading the mesh failed.")
|
|
@@ -1633,12 +1671,15 @@ class CuraApplication(QtApplication):
|
|
def additionalComponents(self):
|
|
def additionalComponents(self):
|
|
return self._additional_components
|
|
return self._additional_components
|
|
|
|
|
|
- ## Add a component to a list of components to be reparented to another area in the GUI.
|
|
|
|
- # The actual reparenting is done by the area itself.
|
|
|
|
- # \param area_id \type{str} Identifying name of the area to which the component should be reparented
|
|
|
|
- # \param component \type{QQuickComponent} The component that should be reparented
|
|
|
|
@pyqtSlot(str, "QVariant")
|
|
@pyqtSlot(str, "QVariant")
|
|
- def addAdditionalComponent(self, area_id, component):
|
|
|
|
|
|
+ def addAdditionalComponent(self, area_id: str, component):
|
|
|
|
+ """Add a component to a list of components to be reparented to another area in the GUI.
|
|
|
|
+
|
|
|
|
+ The actual reparenting is done by the area itself.
|
|
|
|
+ :param area_id: dentifying name of the area to which the component should be reparented
|
|
|
|
+ :param (QQuickComponent) component: The component that should be reparented
|
|
|
|
+ """
|
|
|
|
+
|
|
if area_id not in self._additional_components:
|
|
if area_id not in self._additional_components:
|
|
self._additional_components[area_id] = []
|
|
self._additional_components[area_id] = []
|
|
self._additional_components[area_id].append(component)
|
|
self._additional_components[area_id].append(component)
|
|
@@ -1653,10 +1694,13 @@ class CuraApplication(QtApplication):
|
|
|
|
|
|
@pyqtSlot(QUrl, str)
|
|
@pyqtSlot(QUrl, str)
|
|
@pyqtSlot(QUrl)
|
|
@pyqtSlot(QUrl)
|
|
- ## Open a local file
|
|
|
|
- # \param project_mode How to handle project files. Either None(default): Follow user preference, "open_as_model" or
|
|
|
|
- # "open_as_project". This parameter is only considered if the file is a project file.
|
|
|
|
def readLocalFile(self, file: QUrl, project_mode: Optional[str] = None):
|
|
def readLocalFile(self, file: QUrl, project_mode: Optional[str] = None):
|
|
|
|
+ """Open a local file
|
|
|
|
+
|
|
|
|
+ :param project_mode: How to handle project files. Either None(default): Follow user preference, "open_as_model"
|
|
|
|
+ or "open_as_project". This parameter is only considered if the file is a project file.
|
|
|
|
+ """
|
|
|
|
+
|
|
if not file.isValid():
|
|
if not file.isValid():
|
|
return
|
|
return
|
|
|
|
|
|
@@ -1829,9 +1873,8 @@ class CuraApplication(QtApplication):
|
|
|
|
|
|
@pyqtSlot(str, result=bool)
|
|
@pyqtSlot(str, result=bool)
|
|
def checkIsValidProjectFile(self, file_url):
|
|
def checkIsValidProjectFile(self, file_url):
|
|
- """
|
|
|
|
- Checks if the given file URL is a valid project file.
|
|
|
|
- """
|
|
|
|
|
|
+ """ Checks if the given file URL is a valid project file. """
|
|
|
|
+
|
|
file_path = QUrl(file_url).toLocalFile()
|
|
file_path = QUrl(file_url).toLocalFile()
|
|
workspace_reader = self.getWorkspaceFileHandler().getReaderForFile(file_path)
|
|
workspace_reader = self.getWorkspaceFileHandler().getReaderForFile(file_path)
|
|
if workspace_reader is None:
|
|
if workspace_reader is None:
|