Simplify the check for new materials

If there is at least one material, we can already show the message without checking the rest of the installed packages.

CURA-8254
This commit is contained in:
Konstantinos Karmas 2021-10-05 11:36:10 +02:00
parent 5732fc2b51
commit 658e54c8e5

View file

@ -41,11 +41,11 @@ class MaterialManagementModel(QObject):
a message prompting the user to sync the materials with their printers. a message prompting the user to sync the materials with their printers.
""" """
application = cura.CuraApplication.CuraApplication.getInstance() application = cura.CuraApplication.CuraApplication.getInstance()
new_materials_installed = False for package_id, package_data in application.getPackageManager().installed_packages.items():
for package_id, package_info in application.getPackageManager().installed_packages.items(): if package_data["package_info"]["package_type"] == "material":
new_materials_installed = package_info["package_info"]["package_type"] == "material" # At least one new material was installed
if new_materials_installed: self._showSyncNewMaterialsMessage()
self._showSyncNewMaterialsMessage() break
def _showSyncNewMaterialsMessage(self): def _showSyncNewMaterialsMessage(self):
sync_materials_message = Message( sync_materials_message = Message(