mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-06-30 07:45:11 +08:00
Move button text inside QML element
cura 8587
This commit is contained in:
parent
119b86b957
commit
49a6a83fe9
@ -5,32 +5,15 @@ catalog = i18nCatalog("cura")
|
|||||||
|
|
||||||
# Model for the LicenseDialog
|
# Model for the LicenseDialog
|
||||||
class LicenseModel(QObject):
|
class LicenseModel(QObject):
|
||||||
DEFAULT_DECLINE_BUTTON_TEXT = catalog.i18nc("@button", "Decline")
|
|
||||||
ACCEPT_BUTTON_TEXT = catalog.i18nc("@button", "Agree")
|
|
||||||
|
|
||||||
dialogTitleChanged = pyqtSignal()
|
dialogTitleChanged = pyqtSignal()
|
||||||
packageNameChanged = pyqtSignal()
|
packageNameChanged = pyqtSignal()
|
||||||
licenseTextChanged = pyqtSignal()
|
licenseTextChanged = pyqtSignal()
|
||||||
|
|
||||||
def __init__(self, decline_button_text: str = DEFAULT_DECLINE_BUTTON_TEXT) -> None:
|
def __init__(self, licence_text: str, package_name: str) -> None:
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
self._dialogTitle = ""
|
|
||||||
self._license_text = ""
|
self._license_text = ""
|
||||||
self._package_name = ""
|
self._package_name = ""
|
||||||
self._decline_button_text = decline_button_text
|
|
||||||
|
|
||||||
@pyqtProperty(str, constant = True)
|
|
||||||
def acceptButtonText(self):
|
|
||||||
return self.ACCEPT_BUTTON_TEXT
|
|
||||||
|
|
||||||
@pyqtProperty(str, constant = True)
|
|
||||||
def declineButtonText(self):
|
|
||||||
return self._decline_button_text
|
|
||||||
|
|
||||||
@pyqtProperty(str, notify=dialogTitleChanged)
|
|
||||||
def dialogTitle(self) -> str:
|
|
||||||
return self._dialogTitle
|
|
||||||
|
|
||||||
@pyqtProperty(str, notify=packageNameChanged)
|
@pyqtProperty(str, notify=packageNameChanged)
|
||||||
def packageName(self) -> str:
|
def packageName(self) -> str:
|
||||||
@ -48,7 +31,3 @@ class LicenseModel(QObject):
|
|||||||
if self._license_text != license_text:
|
if self._license_text != license_text:
|
||||||
self._license_text = license_text
|
self._license_text = license_text
|
||||||
self.licenseTextChanged.emit()
|
self.licenseTextChanged.emit()
|
||||||
|
|
||||||
def _updateDialogTitle(self):
|
|
||||||
self._dialogTitle = catalog.i18nc("@title:window", "Plugin License Agreement")
|
|
||||||
self.dialogTitleChanged.emit()
|
|
||||||
|
@ -14,7 +14,7 @@ import Cura 1.6 as Cura
|
|||||||
UM.Dialog
|
UM.Dialog
|
||||||
{
|
{
|
||||||
id: licenseDialog
|
id: licenseDialog
|
||||||
title: licenseModel.dialogTitle
|
title: catalog.i18nc("@button", "Plugin license agreement")
|
||||||
minimumWidth: UM.Theme.getSize("license_window_minimum").width
|
minimumWidth: UM.Theme.getSize("license_window_minimum").width
|
||||||
minimumHeight: UM.Theme.getSize("license_window_minimum").height
|
minimumHeight: UM.Theme.getSize("license_window_minimum").height
|
||||||
width: minimumWidth
|
width: minimumWidth
|
||||||
@ -72,7 +72,7 @@ UM.Dialog
|
|||||||
[
|
[
|
||||||
Cura.PrimaryButton
|
Cura.PrimaryButton
|
||||||
{
|
{
|
||||||
text: licenseModel.acceptButtonText
|
text: catalog.i18nc("@button", "Accept")
|
||||||
onClicked: { handler.onLicenseAccepted() }
|
onClicked: { handler.onLicenseAccepted() }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -81,7 +81,7 @@ UM.Dialog
|
|||||||
[
|
[
|
||||||
Cura.SecondaryButton
|
Cura.SecondaryButton
|
||||||
{
|
{
|
||||||
text: licenseModel.declineButtonText
|
text: catalog.i18nc("@button", "Decline")
|
||||||
onClicked: { handler.onLicenseDeclined() }
|
onClicked: { handler.onLicenseDeclined() }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user