mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 19:49:00 +08:00
Change UM.Dialog to Controls.Dialog in connect to printer by ip window
As `UM.Dialog` is opened using in a new window, the error-confirmation that was displayed in a `UM.Dialog` was displayed _behind_ the window object. CURA 8687
This commit is contained in:
parent
ca0d84dcae
commit
3f658a4914
@ -288,7 +288,7 @@ Cura.MachineAction
|
|||||||
standardButtons: Dialog.Ok
|
standardButtons: Dialog.Ok
|
||||||
}
|
}
|
||||||
|
|
||||||
UM.Dialog
|
Dialog
|
||||||
{
|
{
|
||||||
id: manualPrinterDialog
|
id: manualPrinterDialog
|
||||||
property string printerKey
|
property string printerKey
|
||||||
@ -296,17 +296,18 @@ Cura.MachineAction
|
|||||||
|
|
||||||
title: catalog.i18nc("@title:window", "Printer Address")
|
title: catalog.i18nc("@title:window", "Printer Address")
|
||||||
|
|
||||||
minimumWidth: 400 * screenScaleFactor
|
width: UM.Theme.getSize("small_popup_dialog").width
|
||||||
minimumHeight: 130 * screenScaleFactor
|
|
||||||
width: minimumWidth
|
anchors.centerIn: Overlay.overlay
|
||||||
height: minimumHeight
|
|
||||||
|
standardButtons: Dialog.Yes | Dialog.No
|
||||||
|
|
||||||
signal showDialog(string key, string address)
|
signal showDialog(string key, string address)
|
||||||
onShowDialog:
|
onShowDialog:
|
||||||
{
|
{
|
||||||
printerKey = key;
|
printerKey = key;
|
||||||
addressText = address;
|
addressText = address;
|
||||||
manualPrinterDialog.show();
|
manualPrinterDialog.open();
|
||||||
addressField.selectAll();
|
addressField.selectAll();
|
||||||
addressField.focus = true;
|
addressField.focus = true;
|
||||||
}
|
}
|
||||||
@ -327,54 +328,40 @@ Cura.MachineAction
|
|||||||
{
|
{
|
||||||
id: addressField
|
id: addressField
|
||||||
width: parent.width
|
width: parent.width
|
||||||
validator: RegExpValidator
|
validator: RegExpValidator { regExp: /[a-zA-Z0-9\.\-\_]*/ }
|
||||||
{
|
|
||||||
regExp: /[a-zA-Z0-9\.\-\_]*/
|
|
||||||
}
|
|
||||||
|
|
||||||
onAccepted: btnOk.clicked()
|
onAccepted: btnOk.clicked()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rightButtons: [
|
onRejected:
|
||||||
Button {
|
{
|
||||||
text: catalog.i18nc("@action:button","Cancel")
|
manualPrinterDialog.reject()
|
||||||
onClicked:
|
manualPrinterDialog.hide()
|
||||||
{
|
}
|
||||||
manualPrinterDialog.reject()
|
onAccepted:
|
||||||
manualPrinterDialog.hide()
|
{
|
||||||
}
|
// Validate the input first
|
||||||
},
|
if (!networkingUtil.isValidIP(manualPrinterDialog.addressText))
|
||||||
Button {
|
{
|
||||||
id: btnOk
|
invalidIPAddressMessageDialog.open()
|
||||||
text: catalog.i18nc("@action:button", "OK")
|
return
|
||||||
onClicked:
|
|
||||||
{
|
|
||||||
// Validate the input first
|
|
||||||
if (!networkingUtil.isValidIP(manualPrinterDialog.addressText))
|
|
||||||
{
|
|
||||||
invalidIPAddressMessageDialog.open()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// if the entered IP address has already been discovered, switch the current item to that item
|
|
||||||
// and do nothing else.
|
|
||||||
for (var i = 0; i < manager.foundDevices.length; i++)
|
|
||||||
{
|
|
||||||
var device = manager.foundDevices[i]
|
|
||||||
if (device.address == manualPrinterDialog.addressText)
|
|
||||||
{
|
|
||||||
currentItemIndex = i
|
|
||||||
manualPrinterDialog.hide()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
manager.setManualDevice(manualPrinterDialog.printerKey, manualPrinterDialog.addressText)
|
|
||||||
manualPrinterDialog.hide()
|
|
||||||
}
|
|
||||||
enabled: manualPrinterDialog.addressText.trim() != ""
|
|
||||||
}
|
}
|
||||||
]
|
|
||||||
|
// if the entered IP address has already been discovered, switch the current item to that item
|
||||||
|
// and do nothing else.
|
||||||
|
for (var i = 0; i < manager.foundDevices.length; i++)
|
||||||
|
{
|
||||||
|
var device = manager.foundDevices[i]
|
||||||
|
if (device.address == manualPrinterDialog.addressText)
|
||||||
|
{
|
||||||
|
currentItemIndex = i
|
||||||
|
manualPrinterDialog.hide()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
manager.setManualDevice(manualPrinterDialog.printerKey, manualPrinterDialog.addressText)
|
||||||
|
manualPrinterDialog.hide()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user