mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-06-30 00:45:13 +08:00
Rename MarketplaceLicenseDialog to MultipleLicenceDialog
CURA-9146
This commit is contained in:
parent
5ce5ce769e
commit
3ed182cd74
@ -28,7 +28,7 @@ class LicensePresenter(QObject):
|
|||||||
super().__init__()
|
super().__init__()
|
||||||
self._presented = False
|
self._presented = False
|
||||||
"""Whether present() has been called and state is expected to be initialized"""
|
"""Whether present() has been called and state is expected to be initialized"""
|
||||||
self._catalog = i18nCatalog("cura")
|
|
||||||
self._dialog = None # type: Optional[QObject]
|
self._dialog = None # type: Optional[QObject]
|
||||||
self._package_manager = app.getPackageManager() # type: PackageManager
|
self._package_manager = app.getPackageManager() # type: PackageManager
|
||||||
# Emits List[Dict[str, [Any]] containing for example
|
# Emits List[Dict[str, [Any]] containing for example
|
||||||
@ -37,13 +37,15 @@ class LicensePresenter(QObject):
|
|||||||
|
|
||||||
self._current_package_idx = 0
|
self._current_package_idx = 0
|
||||||
self._package_models = [] # type: List[Dict]
|
self._package_models = [] # type: List[Dict]
|
||||||
|
|
||||||
|
self._catalog = i18nCatalog("cura")
|
||||||
decline_button_text = self._catalog.i18nc("@button", "Decline and remove from account")
|
decline_button_text = self._catalog.i18nc("@button", "Decline and remove from account")
|
||||||
self._license_model = LicenseModel(decline_button_text=decline_button_text) # type: LicenseModel
|
self._license_model = LicenseModel(decline_button_text=decline_button_text) # type: LicenseModel
|
||||||
self._page_count = 0
|
self._page_count = 0
|
||||||
|
|
||||||
self._app = app
|
self._app = app
|
||||||
|
|
||||||
self._compatibility_dialog_path = "resources/qml/MarketplaceLicenseDialog.qml"
|
self._compatibility_dialog_path = "resources/qml/MultipleLicenseDialog.qml"
|
||||||
|
|
||||||
def present(self, plugin_path: str, packages: Dict[str, Dict[str, str]]) -> None:
|
def present(self, plugin_path: str, packages: Dict[str, Dict[str, str]]) -> None:
|
||||||
"""Show a license dialog for multiple packages where users can read a license and accept or decline them
|
"""Show a license dialog for multiple packages where users can read a license and accept or decline them
|
||||||
@ -90,7 +92,6 @@ class LicensePresenter(QObject):
|
|||||||
self._checkNextPage()
|
self._checkNextPage()
|
||||||
|
|
||||||
def _initState(self, packages: Dict[str, Dict[str, Any]]) -> None:
|
def _initState(self, packages: Dict[str, Dict[str, Any]]) -> None:
|
||||||
|
|
||||||
implicitly_accepted_count = 0
|
implicitly_accepted_count = 0
|
||||||
|
|
||||||
for package_id, item in packages.items():
|
for package_id, item in packages.items():
|
||||||
@ -114,7 +115,6 @@ class LicensePresenter(QObject):
|
|||||||
self._page_count = len(self._package_models) - implicitly_accepted_count
|
self._page_count = len(self._package_models) - implicitly_accepted_count
|
||||||
self._license_model.setPageCount(self._page_count)
|
self._license_model.setPageCount(self._page_count)
|
||||||
|
|
||||||
|
|
||||||
def _presentCurrentPackage(self) -> None:
|
def _presentCurrentPackage(self) -> None:
|
||||||
package_model = self._package_models[self._current_package_idx]
|
package_model = self._package_models[self._current_package_idx]
|
||||||
package_info = self._package_manager.getPackageInfo(package_model["package_path"])
|
package_info = self._package_manager.getPackageInfo(package_model["package_path"])
|
||||||
|
@ -6,41 +6,33 @@ import QtQuick.Window 2.2
|
|||||||
import QtQuick.Controls 2.3
|
import QtQuick.Controls 2.3
|
||||||
import QtQuick.Layouts 1.3
|
import QtQuick.Layouts 1.3
|
||||||
|
|
||||||
import UM 1.1 as UM
|
import UM 1.5 as UM
|
||||||
import Cura 1.6 as Cura
|
import Cura 1.6 as Cura
|
||||||
|
|
||||||
UM.Dialog
|
UM.Dialog
|
||||||
{
|
{
|
||||||
id: licenseDialog
|
id: licenseDialog
|
||||||
title: licenseModel.dialogTitle
|
title: licenseModel.dialogTitle
|
||||||
Component.onCompleted:
|
|
||||||
{
|
|
||||||
for(var p in licenseModel)
|
|
||||||
console.log(p + ": " + item[p]);
|
|
||||||
}
|
|
||||||
|
|
||||||
minimumWidth: UM.Theme.getSize("license_window_minimum").width
|
minimumWidth: UM.Theme.getSize("modal_window_minimum").width
|
||||||
minimumHeight: UM.Theme.getSize("license_window_minimum").height
|
minimumHeight: UM.Theme.getSize("modal_window_minimum").height
|
||||||
width: minimumWidth
|
width: minimumWidth
|
||||||
height: minimumHeight
|
height: minimumHeight
|
||||||
backgroundColor: UM.Theme.getColor("main_background")
|
backgroundColor: UM.Theme.getColor("main_background")
|
||||||
margin: screenScaleFactor * 10
|
margin: UM.Theme.getSize("default_margin").width
|
||||||
|
|
||||||
ColumnLayout
|
ColumnLayout
|
||||||
{
|
{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
spacing: UM.Theme.getSize("thick_margin").height
|
spacing: UM.Theme.getSize("thick_margin").height
|
||||||
|
|
||||||
UM.I18nCatalog{id: catalog; name: "cura"}
|
UM.I18nCatalog { id: catalog; name: "cura" }
|
||||||
|
|
||||||
Label
|
UM.Label
|
||||||
{
|
{
|
||||||
id: licenseHeader
|
id: licenseHeader
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
text: catalog.i18nc("@label", "You need to accept the license to install the package")
|
text: catalog.i18nc("@label", "You need to accept the license to install the package")
|
||||||
color: UM.Theme.getColor("text")
|
|
||||||
wrapMode: Text.Wrap
|
|
||||||
renderType: Text.NativeRendering
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
@ -63,24 +55,19 @@ UM.Dialog
|
|||||||
mipmap: true
|
mipmap: true
|
||||||
}
|
}
|
||||||
|
|
||||||
Label
|
UM.Label
|
||||||
{
|
{
|
||||||
id: packageName
|
id: packageName
|
||||||
text: licenseModel.packageName
|
text: licenseModel.packageName
|
||||||
color: UM.Theme.getColor("text")
|
|
||||||
font.bold: true
|
font.bold: true
|
||||||
anchors.verticalCenter: icon.verticalCenter
|
anchors.verticalCenter: icon.verticalCenter
|
||||||
height: contentHeight
|
height: contentHeight
|
||||||
wrapMode: Text.Wrap
|
|
||||||
renderType: Text.NativeRendering
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Cura.ScrollableTextArea
|
Cura.ScrollableTextArea
|
||||||
{
|
{
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
||||||
@ -88,8 +75,8 @@ UM.Dialog
|
|||||||
textArea.text: licenseModel.licenseText
|
textArea.text: licenseModel.licenseText
|
||||||
textArea.readOnly: true
|
textArea.readOnly: true
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rightButtons:
|
rightButtons:
|
||||||
[
|
[
|
||||||
Cura.PrimaryButton
|
Cura.PrimaryButton
|
Loading…
x
Reference in New Issue
Block a user