mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
Fixed "Quit" button & others
- Quit button in the dialog post-install now quits the application instead of simply closing the window - Improved styling: - All colors now pulled from `UM.Theme.getColor()` - Dialog has white background - Buttons look like Cura buttons - Removed inaccurate comments regarding the structure that were created while working on it
This commit is contained in:
parent
757f83fad2
commit
d3b2241616
2 changed files with 62 additions and 46 deletions
|
@ -26,40 +26,6 @@ from cura.CuraApplication import CuraApplication
|
||||||
|
|
||||||
i18n_catalog = i18nCatalog("cura")
|
i18n_catalog = i18nCatalog("cura")
|
||||||
|
|
||||||
# Architecture thoughts:
|
|
||||||
# ------------------------------------------------------------------------------
|
|
||||||
# The plugin manager has 2 parts: the browser and the installer.
|
|
||||||
#
|
|
||||||
# UNINSTALLING:
|
|
||||||
# ------------------------------------------------------------------------------
|
|
||||||
# Uninstalling is done via the PluginRegistry's uninstallPlugin() method,
|
|
||||||
# supplied with a plugin_id. Uninstalling is currently done instantly so there's
|
|
||||||
# no need to use an list of "newly uninstalled plugins" but this will be needed
|
|
||||||
# in the future with more complex plugins, as well as when merging the built-in
|
|
||||||
# plugins into the plugin browser.
|
|
||||||
#
|
|
||||||
# STATUS:
|
|
||||||
# ------------------------------------------------------------------------------
|
|
||||||
# 'status' is used to keep track of installations and uninstallations. It is
|
|
||||||
# intended to replace "newly installed" and "newly uninstalled" lists. These
|
|
||||||
# lists introduce a lot of complexity if a plugin finds itself on both lists.
|
|
||||||
#
|
|
||||||
# 'status' can have several values:
|
|
||||||
# - "uninstalled"
|
|
||||||
# - "will_install"
|
|
||||||
# - "installed"
|
|
||||||
# - "will_uninstall"
|
|
||||||
#
|
|
||||||
# This is more civilized than checking if a plugin's metadata exists. It also
|
|
||||||
# means uninstalling doesn't require erasing the metadata.
|
|
||||||
#
|
|
||||||
# ACTIVE:
|
|
||||||
# ------------------------------------------------------------------------------
|
|
||||||
# Although 'active' could have been lumped with 'status', it is essentially a
|
|
||||||
# sub-status within 'installed' and 'will_uninstall'. Rather than create more
|
|
||||||
# statuses such as 'active_installed' and 'active_will_uninstall', the 'active'
|
|
||||||
# property is just a boolean used in conjunction with 'status'.
|
|
||||||
|
|
||||||
class PluginBrowser(QObject, Extension):
|
class PluginBrowser(QObject, Extension):
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
|
|
@ -19,7 +19,7 @@ Window {
|
||||||
height: 640 * screenScaleFactor
|
height: 640 * screenScaleFactor
|
||||||
minimumWidth: 350 * screenScaleFactor
|
minimumWidth: 350 * screenScaleFactor
|
||||||
minimumHeight: 350 * screenScaleFactor
|
minimumHeight: 350 * screenScaleFactor
|
||||||
color: "white"
|
color: UM.Theme.getColor("sidebar")
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: view
|
id: view
|
||||||
|
@ -157,7 +157,7 @@ Window {
|
||||||
}
|
}
|
||||||
label: Text {
|
label: Text {
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
color: "white"
|
color: UM.Theme.getColor("button_text")
|
||||||
font {
|
font {
|
||||||
pixelSize: 13
|
pixelSize: 13
|
||||||
bold: true
|
bold: true
|
||||||
|
@ -191,7 +191,7 @@ Window {
|
||||||
}
|
}
|
||||||
label: Text {
|
label: Text {
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
color: "grey"
|
color: UM.Theme.getColor("text")
|
||||||
text: control.text
|
text: control.text
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
}
|
}
|
||||||
|
@ -284,33 +284,83 @@ Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UM.Dialog {
|
Window {
|
||||||
id: restartDialog
|
id: restartDialog
|
||||||
// title: catalog.i18nc("@title:tab", "Plugins");
|
// title: catalog.i18nc("@title:tab", "Plugins");
|
||||||
width: 360 * screenScaleFactor
|
width: 360 * screenScaleFactor
|
||||||
height: 180 * screenScaleFactor
|
height: 120 * screenScaleFactor
|
||||||
minimumWidth: 360 * screenScaleFactor
|
minimumWidth: 360 * screenScaleFactor
|
||||||
minimumHeight: 180 * screenScaleFactor
|
minimumHeight: 120 * screenScaleFactor
|
||||||
|
color: UM.Theme.getColor("sidebar")
|
||||||
property var message;
|
property var message;
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: message
|
id: message
|
||||||
|
anchors {
|
||||||
|
left: parent.left
|
||||||
|
leftMargin: UM.Theme.getSize("default_margin").width
|
||||||
|
top: parent.top
|
||||||
|
topMargin: UM.Theme.getSize("default_margin").height
|
||||||
|
}
|
||||||
text: restartDialog.message != null ? restartDialog.message : ""
|
text: restartDialog.message != null ? restartDialog.message : ""
|
||||||
}
|
}
|
||||||
Button {
|
Button {
|
||||||
id: laterButton
|
id: laterButton
|
||||||
text: "Later"
|
text: "Later"
|
||||||
onClicked: restartDialog.close();
|
onClicked: restartDialog.close();
|
||||||
anchors.left: parent.left
|
anchors {
|
||||||
anchors.bottom: parent.bottom
|
left: parent.left
|
||||||
|
leftMargin: UM.Theme.getSize("default_margin").width
|
||||||
|
bottom: parent.bottom
|
||||||
|
bottomMargin: UM.Theme.getSize("default_margin").height
|
||||||
}
|
}
|
||||||
|
style: ButtonStyle {
|
||||||
|
background: Rectangle {
|
||||||
|
color: "transparent"
|
||||||
|
implicitWidth: 96
|
||||||
|
implicitHeight: 30
|
||||||
|
border {
|
||||||
|
width: 1
|
||||||
|
color: UM.Theme.getColor("lining")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
label: Text {
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
|
text: control.text
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
id: restartButton
|
id: restartButton
|
||||||
text: "Restart now"
|
text: "Quit Cura"
|
||||||
onClicked: restartDialog.close();
|
anchors {
|
||||||
anchors.right: parent.right
|
right: parent.right
|
||||||
anchors.bottom: parent.bottom
|
rightMargin: UM.Theme.getSize("default_margin").width
|
||||||
|
bottom: parent.bottom
|
||||||
|
bottomMargin: UM.Theme.getSize("default_margin").height
|
||||||
|
}
|
||||||
|
onClicked: manager.restart()
|
||||||
|
style: ButtonStyle {
|
||||||
|
background: Rectangle {
|
||||||
|
implicitWidth: 96
|
||||||
|
implicitHeight: 30
|
||||||
|
color: UM.Theme.getColor("primary")
|
||||||
|
}
|
||||||
|
label: Text {
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
color: UM.Theme.getColor("button_text")
|
||||||
|
font {
|
||||||
|
pixelSize: 13
|
||||||
|
bold: true
|
||||||
|
}
|
||||||
|
text: control.text
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue