mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-13 01:37:51 -06:00
Fix rebase bug regarding package compatibility
CURA-6983
This commit is contained in:
parent
88e5626b59
commit
1a1e8a9525
3 changed files with 17 additions and 27 deletions
|
@ -48,7 +48,7 @@ UM.Dialog{
|
||||||
{
|
{
|
||||||
font: UM.Theme.getFont("default")
|
font: UM.Theme.getFont("default")
|
||||||
text: catalog.i18nc("@label", "The following packages will be added:")
|
text: catalog.i18nc("@label", "The following packages will be added:")
|
||||||
visible: toolbox.has_compatible_packages
|
visible: subscribedPackagesModel.hasCompatiblePackages
|
||||||
color: UM.Theme.getColor("text")
|
color: UM.Theme.getColor("text")
|
||||||
height: contentHeight + UM.Theme.getSize("default_margin").height
|
height: contentHeight + UM.Theme.getSize("default_margin").height
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ UM.Dialog{
|
||||||
{
|
{
|
||||||
font: UM.Theme.getFont("default")
|
font: UM.Theme.getFont("default")
|
||||||
text: catalog.i18nc("@label", "The following packages can not be installed because of incompatible Cura version:")
|
text: catalog.i18nc("@label", "The following packages can not be installed because of incompatible Cura version:")
|
||||||
visible: toolbox.has_incompatible_packages
|
visible: subscribedPackagesModel.hasIncompatiblePackages
|
||||||
color: UM.Theme.getColor("text")
|
color: UM.Theme.getColor("text")
|
||||||
height: contentHeight + UM.Theme.getSize("default_margin").height
|
height: contentHeight + UM.Theme.getSize("default_margin").height
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Copyright (c) 2020 Ultimaker B.V.
|
# Copyright (c) 2020 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
from PyQt5.QtCore import Qt
|
from PyQt5.QtCore import Qt, pyqtProperty
|
||||||
from UM.Qt.ListModel import ListModel
|
from UM.Qt.ListModel import ListModel
|
||||||
from cura import ApplicationMetadata
|
from cura import ApplicationMetadata
|
||||||
|
|
||||||
|
@ -19,6 +19,20 @@ class SubscribedPackagesModel(ListModel):
|
||||||
self.addRoleName(Qt.UserRole + 2, "icon_url")
|
self.addRoleName(Qt.UserRole + 2, "icon_url")
|
||||||
self.addRoleName(Qt.UserRole + 3, "is_compatible")
|
self.addRoleName(Qt.UserRole + 3, "is_compatible")
|
||||||
|
|
||||||
|
@pyqtProperty(bool, constant=True)
|
||||||
|
def hasCompatiblePackages(self) -> bool:
|
||||||
|
for item in self._items:
|
||||||
|
if item['is_compatible']:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
@pyqtProperty(bool, constant=True)
|
||||||
|
def hasIncompatiblePackages(self) -> bool:
|
||||||
|
for item in self._items:
|
||||||
|
if not item['is_compatible']:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def setMetadata(self, data):
|
def setMetadata(self, data):
|
||||||
if self._metadata != data:
|
if self._metadata != data:
|
||||||
self._metadata = data
|
self._metadata = data
|
||||||
|
@ -52,16 +66,4 @@ class SubscribedPackagesModel(ListModel):
|
||||||
self._items.append(package)
|
self._items.append(package)
|
||||||
self.setItems(self._items)
|
self.setItems(self._items)
|
||||||
|
|
||||||
def hasCompatiblePackages(self) -> bool:
|
|
||||||
has_compatible_items = False
|
|
||||||
for item in self._items:
|
|
||||||
if item['is_compatible'] == True:
|
|
||||||
has_compatible_items = True
|
|
||||||
return has_compatible_items
|
|
||||||
|
|
||||||
def hasIncompatiblePackages(self) -> bool:
|
|
||||||
has_incompatible_items = False
|
|
||||||
for item in self._items:
|
|
||||||
if item['is_compatible'] == False:
|
|
||||||
has_incompatible_items = True
|
|
||||||
return has_incompatible_items
|
|
|
@ -733,18 +733,6 @@ class Toolbox(QObject, Extension):
|
||||||
def authorsModel(self) -> AuthorsModel:
|
def authorsModel(self) -> AuthorsModel:
|
||||||
return cast(AuthorsModel, self._models["authors"])
|
return cast(AuthorsModel, self._models["authors"])
|
||||||
|
|
||||||
@pyqtProperty(QObject, constant = True)
|
|
||||||
def subscribedPackagesModel(self) -> SubscribedPackagesModel:
|
|
||||||
return cast(SubscribedPackagesModel, self._models["subscribed_packages"])
|
|
||||||
|
|
||||||
@pyqtProperty(bool, constant=True)
|
|
||||||
def has_compatible_packages(self) -> str:
|
|
||||||
return self._models["subscribed_packages"].hasCompatiblePackages()
|
|
||||||
|
|
||||||
@pyqtProperty(bool, constant=True)
|
|
||||||
def has_incompatible_packages(self) -> str:
|
|
||||||
return self._models["subscribed_packages"].hasIncompatiblePackages()
|
|
||||||
|
|
||||||
@pyqtProperty(QObject, constant = True)
|
@pyqtProperty(QObject, constant = True)
|
||||||
def packagesModel(self) -> PackagesModel:
|
def packagesModel(self) -> PackagesModel:
|
||||||
return cast(PackagesModel, self._models["packages"])
|
return cast(PackagesModel, self._models["packages"])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue