mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Merge branch 'master' into WIP_improve_initialization
This commit is contained in:
commit
f395f1eebc
8 changed files with 42 additions and 26 deletions
|
@ -89,7 +89,6 @@ class CuraPackageManager(QObject):
|
|||
"installed": self._installed_package_dict,
|
||||
"to_remove": list(self._to_remove_package_set),
|
||||
"to_install": self._to_install_package_dict}
|
||||
data_dict["to_remove"] = list(data_dict["to_remove"])
|
||||
json.dump(data_dict, f, sort_keys = True, indent = 4)
|
||||
Logger.log("i", "Package management file %s was saved", self._user_package_management_file_path)
|
||||
|
||||
|
@ -103,7 +102,6 @@ class CuraPackageManager(QObject):
|
|||
|
||||
# (for initialize) Installs all packages that have been scheduled to be installed.
|
||||
def _installAllScheduledPackages(self) -> None:
|
||||
|
||||
while self._to_install_package_dict:
|
||||
package_id, package_info = list(self._to_install_package_dict.items())[0]
|
||||
self._installPackage(package_info)
|
||||
|
@ -111,6 +109,12 @@ class CuraPackageManager(QObject):
|
|||
del self._to_install_package_dict[package_id]
|
||||
self._saveManagementData()
|
||||
|
||||
def getBundledPackageInfo(self, package_id: str) -> Optional[dict]:
|
||||
package_info = None
|
||||
if package_id in self._bundled_package_dict:
|
||||
package_info = self._bundled_package_dict[package_id]["package_info"]
|
||||
return package_info
|
||||
|
||||
# Checks the given package is installed. If so, return a dictionary that contains the package's information.
|
||||
def getInstalledPackageInfo(self, package_id: str) -> Optional[dict]:
|
||||
if package_id in self._to_remove_package_set:
|
||||
|
|
|
@ -66,6 +66,7 @@ class PrintInformation(QObject):
|
|||
self._backend.printDurationMessage.connect(self._onPrintDurationMessage)
|
||||
self._application.getController().getScene().sceneChanged.connect(self._onSceneChanged)
|
||||
|
||||
self._is_user_specified_job_name = False
|
||||
self._base_name = ""
|
||||
self._abbr_machine = ""
|
||||
self._job_name = ""
|
||||
|
@ -281,10 +282,13 @@ class PrintInformation(QObject):
|
|||
|
||||
# Manual override of job name should also set the base name so that when the printer prefix is updated, it the
|
||||
# prefix can be added to the manually added name, not the old base name
|
||||
@pyqtSlot(str)
|
||||
def setJobName(self, name):
|
||||
@pyqtSlot(str, bool)
|
||||
def setJobName(self, name, is_user_specified_job_name = False):
|
||||
self._is_user_specified_job_name = is_user_specified_job_name
|
||||
self._job_name = name
|
||||
self._base_name = name.replace(self._abbr_machine + "_", "")
|
||||
if name == "":
|
||||
self._is_user_specified_job_name = False
|
||||
self.jobNameChanged.emit()
|
||||
|
||||
jobNameChanged = pyqtSignal()
|
||||
|
@ -296,11 +300,15 @@ class PrintInformation(QObject):
|
|||
def _updateJobName(self):
|
||||
if self._base_name == "":
|
||||
self._job_name = ""
|
||||
self._is_user_specified_job_name = False
|
||||
self.jobNameChanged.emit()
|
||||
return
|
||||
|
||||
base_name = self._stripAccents(self._base_name)
|
||||
self._setAbbreviatedMachineName()
|
||||
|
||||
# Only update the job name when it's not user-specified.
|
||||
if not self._is_user_specified_job_name:
|
||||
if self._pre_sliced:
|
||||
self._job_name = catalog.i18nc("@label", "Pre-sliced file {0}", base_name)
|
||||
elif self._application.getInstance().getPreferences().getValue("cura/jobname_prefix"):
|
||||
|
|
|
@ -250,8 +250,6 @@ class Toolbox(QObject, Extension):
|
|||
if remote_package:
|
||||
download_url = remote_package["download_url"]
|
||||
Logger.log("d", "Updating package [%s]..." % plugin_id)
|
||||
if self._package_manager.isUserInstalledPackage(plugin_id):
|
||||
self.uninstall(plugin_id)
|
||||
self.startDownload(download_url)
|
||||
else:
|
||||
Logger.log("e", "Could not update package [%s] because there is no remote package info available.", plugin_id)
|
||||
|
@ -318,19 +316,21 @@ class Toolbox(QObject, Extension):
|
|||
remote_version = Version(remote_package["package_version"])
|
||||
return remote_version > local_version
|
||||
|
||||
@pyqtSlot(str, result=bool)
|
||||
@pyqtSlot(str, result = bool)
|
||||
def canDowngrade(self, package_id: str) -> bool:
|
||||
# If the currently installed version is higher than the bundled version (if present), the we can downgrade
|
||||
# this package.
|
||||
local_package = self._package_manager.getInstalledPackageInfo(package_id)
|
||||
if local_package is None:
|
||||
return False
|
||||
|
||||
remote_package = self.getRemotePackage(package_id)
|
||||
if remote_package is None:
|
||||
bundled_package = self._package_manager.getBundledPackageInfo(package_id)
|
||||
if bundled_package is None:
|
||||
return False
|
||||
|
||||
local_version = Version(local_package["package_version"])
|
||||
remote_version = Version(remote_package["package_version"])
|
||||
return remote_version < local_version
|
||||
bundled_version = Version(bundled_package["package_version"])
|
||||
return bundled_version < local_version
|
||||
|
||||
@pyqtSlot(str, result = bool)
|
||||
def isInstalled(self, package_id: str) -> bool:
|
||||
|
|
|
@ -379,13 +379,14 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
|
|||
|
||||
def resumePrint(self):
|
||||
self._paused = False
|
||||
self._sendNextGcodeLine() #Send one line of g-code next so that we'll trigger an "ok" response loop even if we're not polling temperatures.
|
||||
|
||||
def cancelPrint(self):
|
||||
self._gcode_position = 0
|
||||
self._gcode.clear()
|
||||
self._printers[0].updateActivePrintJob(None)
|
||||
self._is_printing = False
|
||||
self._is_paused = False
|
||||
self._paused = False
|
||||
|
||||
# Turn off temperatures, fan and steppers
|
||||
self._sendCommand("M140 S0")
|
||||
|
|
|
@ -21,7 +21,7 @@ def getMetaData():
|
|||
},
|
||||
"quality_changes": {
|
||||
"get_version": upgrade.getCfgVersion,
|
||||
"location": {"./quality"}
|
||||
"location": {"./quality_changes"}
|
||||
},
|
||||
"user": {
|
||||
"get_version": upgrade.getCfgVersion,
|
||||
|
|
|
@ -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.
|
||||
|
||||
import copy
|
||||
|
@ -12,10 +12,10 @@ import xml.etree.ElementTree as ET
|
|||
from UM.Resources import Resources
|
||||
from UM.Logger import Logger
|
||||
from cura.CuraApplication import CuraApplication
|
||||
|
||||
import UM.Dictionary
|
||||
from UM.Settings.InstanceContainer import InstanceContainer
|
||||
from UM.Settings.ContainerRegistry import ContainerRegistry
|
||||
from UM.ConfigurationErrorMessage import ConfigurationErrorMessage
|
||||
|
||||
from .XmlMaterialValidator import XmlMaterialValidator
|
||||
|
||||
|
@ -540,7 +540,9 @@ class XmlMaterialProfile(InstanceContainer):
|
|||
|
||||
validation_message = XmlMaterialValidator.validateMaterialMetaData(meta_data)
|
||||
if validation_message is not None:
|
||||
raise Exception("Not valid material profile: %s" % (validation_message))
|
||||
ConfigurationErrorMessage.getInstance().addFaultyContainers(self.getId())
|
||||
Logger.log("e", "Not a valid material profile: {message}".format(message = validation_message))
|
||||
return
|
||||
|
||||
property_values = {}
|
||||
properties = data.iterfind("./um:properties/*", self.__namespaces)
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
"visible": true,
|
||||
"author": "Ruben Dulek",
|
||||
"manufacturer": "Malyan",
|
||||
"machine_x3g_variant": "r1d",
|
||||
"file_formats": "application/x3g"
|
||||
},
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ Item {
|
|||
text: PrintInformation.jobName
|
||||
horizontalAlignment: TextInput.AlignRight
|
||||
onTextChanged: {
|
||||
PrintInformation.setJobName(text);
|
||||
PrintInformation.setJobName(text, true);
|
||||
}
|
||||
onEditingFinished: {
|
||||
if (printJobTextfield.text != ''){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue