mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-21 20:19:32 +08:00
Refactored the onConfirmClicked function. Added the ability to auto-dismiss the incompatible packages. Changed the button text depending on the displayed list
This commit is contained in:
parent
05e17843c6
commit
38c7d80f82
@ -20,6 +20,8 @@ UM.Dialog{
|
|||||||
maximumHeight: minimumHeight
|
maximumHeight: minimumHeight
|
||||||
margin: 0
|
margin: 0
|
||||||
|
|
||||||
|
property string buttonText: subscribedPackagesModel.hasIncompatiblePackages && !subscribedPackagesModel.hasCompatiblePackages ? "Dismiss" : "Next"
|
||||||
|
|
||||||
Rectangle
|
Rectangle
|
||||||
{
|
{
|
||||||
id: root
|
id: root
|
||||||
@ -138,7 +140,7 @@ UM.Dialog{
|
|||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.margins: UM.Theme.getSize("default_margin").height
|
anchors.margins: UM.Theme.getSize("default_margin").height
|
||||||
text: catalog.i18nc("@button", "Next")
|
text: catalog.i18nc("@button", buttonText)
|
||||||
onClicked: accept()
|
onClicked: accept()
|
||||||
leftPadding: UM.Theme.getSize("dialog_primary_button_padding").width
|
leftPadding: UM.Theme.getSize("dialog_primary_button_padding").width
|
||||||
rightPadding: UM.Theme.getSize("dialog_primary_button_padding").width
|
rightPadding: UM.Theme.getSize("dialog_primary_button_padding").width
|
||||||
|
@ -29,9 +29,12 @@ class DiscrepanciesPresenter(QObject):
|
|||||||
self._dialog.accepted.connect(lambda: self._onConfirmClicked(model))
|
self._dialog.accepted.connect(lambda: self._onConfirmClicked(model))
|
||||||
|
|
||||||
def _onConfirmClicked(self, model: SubscribedPackagesModel) -> None:
|
def _onConfirmClicked(self, model: SubscribedPackagesModel) -> None:
|
||||||
# For now, all compatible packages presented to the user should be installed.
|
# If there are incompatible packages - automatically dismiss them
|
||||||
# Later, we might remove items for which the user unselected the package
|
|
||||||
if model.getIncompatiblePackages():
|
if model.getIncompatiblePackages():
|
||||||
self._package_manager.dismissAllIncompatiblePackages(model.getIncompatiblePackages())
|
self._package_manager.dismissAllIncompatiblePackages(model.getIncompatiblePackages())
|
||||||
model.setItems(model.getCompatiblePackages())
|
|
||||||
self.packageMutations.emit(model) # #### proveri sho e ova???
|
# For now, all compatible packages presented to the user should be installed.
|
||||||
|
# Later, we might remove items for which the user unselected the package
|
||||||
|
if model.getCompatiblePackages():
|
||||||
|
model.setItems(model.getCompatiblePackages())
|
||||||
|
self.packageMutations.emit(model) # #### proveri sho e ova???
|
||||||
|
Loading…
x
Reference in New Issue
Block a user