mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 11:05:57 +08:00
Adjust sizes and alignments to the print selector panel.
Contributes to CURA-5942.
This commit is contained in:
parent
23744e42d1
commit
8e47d04756
@ -46,7 +46,7 @@ Item
|
|||||||
|
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
|
||||||
width: 0.9 * prepareMenu.width
|
width: Math.round(0.9 * prepareMenu.width)
|
||||||
height: parent.height
|
height: parent.height
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
||||||
|
@ -10,6 +10,13 @@ import UM 1.2 as UM
|
|||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
id: base
|
id: base
|
||||||
|
|
||||||
|
// Enumeration with the different possible alignments of the popup with respect of the headerItem
|
||||||
|
enum PopupAlignment {
|
||||||
|
AlignLeft,
|
||||||
|
AlignRight
|
||||||
|
}
|
||||||
|
|
||||||
// The headerItem holds the QML item that is always displayed.
|
// The headerItem holds the QML item that is always displayed.
|
||||||
property alias headerItem: headerItemLoader.sourceComponent
|
property alias headerItem: headerItemLoader.sourceComponent
|
||||||
|
|
||||||
@ -21,6 +28,9 @@ Item
|
|||||||
property color headerBackgroundColor: UM.Theme.getColor("action_button")
|
property color headerBackgroundColor: UM.Theme.getColor("action_button")
|
||||||
property color headerHoverColor: UM.Theme.getColor("action_button_hovered")
|
property color headerHoverColor: UM.Theme.getColor("action_button_hovered")
|
||||||
|
|
||||||
|
// Defines the alignment of the popup with respect of the headerItem, by default to the right
|
||||||
|
property int popupAlignment: ExpandableComponent.PopupAlignment.AlignRight
|
||||||
|
|
||||||
// How much spacing is needed around the popupItem
|
// How much spacing is needed around the popupItem
|
||||||
property alias popupPadding: popup.padding
|
property alias popupPadding: popup.padding
|
||||||
|
|
||||||
@ -42,6 +52,7 @@ Item
|
|||||||
|
|
||||||
function togglePopup()
|
function togglePopup()
|
||||||
{
|
{
|
||||||
|
// print(popupAlignment, popupAlignment == PopupAlignment.AlignRight)
|
||||||
if(popup.visible)
|
if(popup.visible)
|
||||||
{
|
{
|
||||||
popup.close()
|
popup.close()
|
||||||
@ -116,8 +127,8 @@ Item
|
|||||||
sourceSize.height: height
|
sourceSize.height: height
|
||||||
visible: source != ""
|
visible: source != ""
|
||||||
width: height
|
width: height
|
||||||
height: 0.2 * base.height
|
height: Math.round(0.2 * base.height)
|
||||||
color: "black"
|
color: UM.Theme.getColor("text")
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea
|
MouseArea
|
||||||
@ -140,13 +151,15 @@ Item
|
|||||||
|
|
||||||
// Make the popup right aligned with the rest. The 3x padding is due to left, right and padding between
|
// Make the popup right aligned with the rest. The 3x padding is due to left, right and padding between
|
||||||
// the button & text.
|
// the button & text.
|
||||||
x: -width + collapseButton.width + headerItemLoader.width + 3 * background.padding
|
x: popupAlignment == ExpandableComponent.PopupAlignment.AlignRight ? -width + collapseButton.width + headerItemLoader.width + 3 * background.padding : 0
|
||||||
padding: UM.Theme.getSize("default_margin").width
|
padding: UM.Theme.getSize("default_margin").width
|
||||||
closePolicy: Popup.CloseOnPressOutsideParent
|
closePolicy: Popup.CloseOnPressOutsideParent
|
||||||
|
|
||||||
background: Rectangle
|
background: Rectangle
|
||||||
{
|
{
|
||||||
color: popupBackgroundColor
|
color: popupBackgroundColor
|
||||||
|
border.width: UM.Theme.getSize("default_lining").width
|
||||||
|
border.color: UM.Theme.getColor("lining")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,8 @@ Cura.ExpandableComponent
|
|||||||
|
|
||||||
property bool isNetworkPrinter: Cura.MachineManager.activeMachineNetworkKey != ""
|
property bool isNetworkPrinter: Cura.MachineManager.activeMachineNetworkKey != ""
|
||||||
|
|
||||||
|
popupPadding: 0
|
||||||
|
popupAlignment: ExpandableComponent.PopupAlignment.AlignLeft
|
||||||
iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left")
|
iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left")
|
||||||
|
|
||||||
UM.I18nCatalog
|
UM.I18nCatalog
|
||||||
@ -31,6 +33,7 @@ Cura.ExpandableComponent
|
|||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
height: parent.height
|
height: parent.height
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
|
renderType: Text.NativeRendering
|
||||||
font: UM.Theme.getFont("default")
|
font: UM.Theme.getFont("default")
|
||||||
color: UM.Theme.getColor("text")
|
color: UM.Theme.getColor("text")
|
||||||
}
|
}
|
||||||
@ -38,26 +41,25 @@ Cura.ExpandableComponent
|
|||||||
popupItem: Item
|
popupItem: Item
|
||||||
{
|
{
|
||||||
id: popup
|
id: popup
|
||||||
width: machineSelector.width - 2 * UM.Theme.getSize("default_margin").width
|
width: UM.Theme.getSize("machine_selector_widget_content").width
|
||||||
height: 200
|
height: UM.Theme.getSize("machine_selector_widget_content").height
|
||||||
|
|
||||||
ScrollView
|
ScrollView
|
||||||
{
|
{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
contentHeight: column.implicitHeight
|
|
||||||
contentWidth: column.implicitWidth
|
|
||||||
clip: true
|
clip: true
|
||||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
|
||||||
|
|
||||||
Column
|
Column
|
||||||
{
|
{
|
||||||
id: column
|
id: column
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
text: catalog.i18nc("@label", "Networked Printers")
|
text: catalog.i18nc("@label", "Network connected printers")
|
||||||
visible: networkedPrintersModel.items.length > 0
|
visible: networkedPrintersModel.items.length > 0
|
||||||
height: visible ? contentHeight + 2 * UM.Theme.getSize("default_margin").height : 0
|
height: visible ? contentHeight + 2 * UM.Theme.getSize("default_margin").height : 0
|
||||||
|
renderType: Text.NativeRendering
|
||||||
font: UM.Theme.getFont("medium_bold")
|
font: UM.Theme.getFont("medium_bold")
|
||||||
color: UM.Theme.getColor("text")
|
color: UM.Theme.getColor("text")
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
@ -73,13 +75,12 @@ Cura.ExpandableComponent
|
|||||||
filter: {"type": "machine", "um_network_key": "*", "hidden": "False"}
|
filter: {"type": "machine", "um_network_key": "*", "hidden": "False"}
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate: RoundButton
|
delegate: Button
|
||||||
{
|
{
|
||||||
text: name
|
text: name
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|
||||||
checkable: true
|
checkable: true
|
||||||
radius: UM.Theme.getSize("default_radius").width
|
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
togglePopup()
|
togglePopup()
|
||||||
@ -92,14 +93,14 @@ Cura.ExpandableComponent
|
|||||||
onActiveMachineNetworkGroupNameChanged: checked = Cura.MachineManager.activeMachineNetworkGroupName == model.metadata["connect_group_name"]
|
onActiveMachineNetworkGroupNameChanged: checked = Cura.MachineManager.activeMachineNetworkGroupName == model.metadata["connect_group_name"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
text: catalog.i18nc("@label", "Virtual Printers")
|
text: catalog.i18nc("@label", "Preset printers")
|
||||||
visible: virtualPrintersModel.items.length > 0
|
visible: virtualPrintersModel.items.length > 0
|
||||||
height: visible ? contentHeight + 2 * UM.Theme.getSize("default_margin").height : 0
|
height: visible ? contentHeight + 2 * UM.Theme.getSize("default_margin").height : 0
|
||||||
|
renderType: Text.NativeRendering
|
||||||
font: UM.Theme.getFont("medium_bold")
|
font: UM.Theme.getFont("medium_bold")
|
||||||
color: UM.Theme.getColor("text")
|
color: UM.Theme.getColor("text")
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
@ -115,21 +116,19 @@ Cura.ExpandableComponent
|
|||||||
filter: {"type": "machine", "um_network_key": null}
|
filter: {"type": "machine", "um_network_key": null}
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate: RoundButton
|
delegate: Button
|
||||||
{
|
{
|
||||||
text: name
|
text: name
|
||||||
width: parent.width
|
width: parent.width
|
||||||
checked: Cura.MachineManager.activeMachineId == model.id
|
checked: Cura.MachineManager.activeMachineId == model.id
|
||||||
checkable: true
|
checkable: true
|
||||||
|
|
||||||
radius: UM.Theme.getSize("default_radius").width
|
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
togglePopup()
|
togglePopup()
|
||||||
Cura.MachineManager.setActiveMachine(model.id)
|
Cura.MachineManager.setActiveMachine(model.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -367,11 +367,11 @@
|
|||||||
"sizes": {
|
"sizes": {
|
||||||
"window_minimum_size": [106, 66],
|
"window_minimum_size": [106, 66],
|
||||||
|
|
||||||
"main_window_header": [0.0, 4.5],
|
"main_window_header": [0.0, 4.0],
|
||||||
"main_window_header_button": [8, 2.35],
|
"main_window_header_button": [8, 2.35],
|
||||||
"main_window_header_button_icon": [1.2, 1.2],
|
"main_window_header_button_icon": [1.2, 1.2],
|
||||||
|
|
||||||
"stage_menu": [0.0, 4.5],
|
"stage_menu": [0.0, 4.0],
|
||||||
|
|
||||||
"account_button": [12, 3],
|
"account_button": [12, 3],
|
||||||
|
|
||||||
@ -380,14 +380,15 @@
|
|||||||
"print_setup_item": [0.0, 2.0],
|
"print_setup_item": [0.0, 2.0],
|
||||||
"print_setup_extruder_box": [0.0, 6.0],
|
"print_setup_extruder_box": [0.0, 6.0],
|
||||||
|
|
||||||
"configuration_selector_widget": [35.0, 4.5],
|
"configuration_selector_widget": [35.0, 4.0],
|
||||||
"configuration_selector_mode_tabs": [0.0, 3.0],
|
"configuration_selector_mode_tabs": [0.0, 3.0],
|
||||||
|
|
||||||
"action_panel_widget": [25.0, 0.0],
|
"action_panel_widget": [25.0, 0.0],
|
||||||
"action_panel_information_widget": [20.0, 0.0],
|
"action_panel_information_widget": [20.0, 0.0],
|
||||||
"action_panel_button": [15.0, 3.0],
|
"action_panel_button": [15.0, 3.0],
|
||||||
|
|
||||||
"machine_selector_widget": [16.0, 4.5],
|
"machine_selector_widget": [20.0, 4.0],
|
||||||
|
"machine_selector_widget_content": [25.0, 32.0],
|
||||||
|
|
||||||
"views_selector": [0.0, 4.0],
|
"views_selector": [0.0, 4.0],
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user