mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
[AddPrinterByIp] Finish GUI as a facade first for review. [CURA-6057]
This commit is contained in:
parent
c1cde2ebc0
commit
3c0583bef0
2 changed files with 109 additions and 32 deletions
|
@ -1,5 +1,5 @@
|
|||
|
||||
|
||||
# Copyright (c) 2019 Ultimaker B.V.
|
||||
# Cura is released under the terms of the LGPLv3 or higher.
|
||||
import os
|
||||
from typing import TYPE_CHECKING, Optional
|
||||
|
||||
|
@ -60,6 +60,8 @@ class WelcomePagesModel(ListModel):
|
|||
"CloudContent.qml"))),
|
||||
})
|
||||
|
||||
self.setItems(self._pages)
|
||||
|
||||
|
||||
def addPage(self):
|
||||
pass
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
import QtQuick 2.10
|
||||
import QtQuick.Controls 2.3
|
||||
import QtQuick.Layouts 1.3
|
||||
|
||||
import UM 1.3 as UM
|
||||
import Cura 1.1 as Cura
|
||||
|
@ -15,6 +16,53 @@ Item
|
|||
{
|
||||
UM.I18nCatalog { id: catalog; name: "cura" }
|
||||
|
||||
id: addPrinterByIpScreen
|
||||
|
||||
property bool hasPushedAdd: false
|
||||
property bool hasSentRequest: false
|
||||
property bool haveConnection: false
|
||||
|
||||
Timer
|
||||
{
|
||||
id: tempTimerButton
|
||||
|
||||
interval: 1200
|
||||
running: false
|
||||
repeat: false
|
||||
onTriggered:
|
||||
{
|
||||
hasPushedAdd = true
|
||||
tempTimerRequest.running = true
|
||||
}
|
||||
}
|
||||
// TODO: Remove timers after review interface!
|
||||
|
||||
Timer
|
||||
{
|
||||
id: tempTimerRequest
|
||||
|
||||
interval: 1200
|
||||
running: false
|
||||
repeat: false
|
||||
onTriggered:
|
||||
{
|
||||
hasSentRequest = true
|
||||
tempTimerConnection.running = true
|
||||
}
|
||||
}
|
||||
// TODO: Remove timers after review interface!
|
||||
|
||||
Timer
|
||||
{
|
||||
id: tempTimerConnection
|
||||
|
||||
interval: 1200
|
||||
running: false
|
||||
repeat: false
|
||||
onTriggered: haveConnection = true
|
||||
}
|
||||
// TODO: Remove timers after review interface!
|
||||
|
||||
Label
|
||||
{
|
||||
id: titleLabel
|
||||
|
@ -37,15 +85,9 @@ Item
|
|||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
width: parent.width * 3 / 4
|
||||
|
||||
border.color: "#dfdfdf"
|
||||
border.width: 1
|
||||
|
||||
Item
|
||||
{
|
||||
width: parent.width
|
||||
//anchors.top: parent.top
|
||||
//anchors.topMargin: 20
|
||||
//anchors.bottomMargin: 20
|
||||
|
||||
Label
|
||||
{
|
||||
|
@ -55,6 +97,7 @@ Item
|
|||
anchors.top: parent.top
|
||||
anchors.margins: 20
|
||||
//anchors.bottomMargin: 20
|
||||
font: UM.Theme.getFont("default")
|
||||
|
||||
text: catalog.i18nc("@label", "Enter the IP address or hostname of your printer on the network.")
|
||||
}
|
||||
|
@ -69,21 +112,19 @@ Item
|
|||
TextField
|
||||
{
|
||||
id: hostnameField
|
||||
anchors.top: parent.top
|
||||
anchors.verticalCenter: addPrinterButton.verticalCenter
|
||||
anchors.left: parent.left
|
||||
//anchors.bottom: parent.bottom
|
||||
height: addPrinterButton.height
|
||||
anchors.right: addPrinterButton.left
|
||||
anchors.margins: 20
|
||||
//width: parent.width / 2
|
||||
//horizontalAlignment: Text.AlignLeft
|
||||
font: UM.Theme.getFont("default")
|
||||
|
||||
//editable: true
|
||||
text: ""
|
||||
|
||||
//validator: RegExpValidator
|
||||
//{
|
||||
// regExp: /[a-zA-Z0-9\.\-\_]*/
|
||||
//}
|
||||
validator: RegExpValidator
|
||||
{
|
||||
regExp: /[a-zA-Z0-9\.\-\_]*/
|
||||
}
|
||||
|
||||
onAccepted: addPrinterButton.clicked()
|
||||
}
|
||||
|
@ -93,7 +134,6 @@ Item
|
|||
id: addPrinterButton
|
||||
anchors.top: parent.top
|
||||
anchors.right: parent.right
|
||||
//anchors.bottom: parent.bottom
|
||||
anchors.margins: 20
|
||||
width: 140
|
||||
fixedWidthMode: true
|
||||
|
@ -101,13 +141,22 @@ Item
|
|||
text: catalog.i18nc("@button", "Add")
|
||||
onClicked:
|
||||
{
|
||||
// fire off method, then wait for event
|
||||
// TEMP: Simulate successfull connection to printer with 127.0.0.1 or unsuccessful with anything else
|
||||
// TODO, alter after review interface, now it just starts the timers.
|
||||
|
||||
|
||||
// manager.setManualDevice(manualPrinterDialog.printerKey, manualPrinterDialog.addressText) // manager not defined
|
||||
// manualPrinterDialog.hide()
|
||||
if (hostnameField.text.trim() != "")
|
||||
{
|
||||
addPrinterByIpScreen.hasPushedAdd = true
|
||||
tempTimerRequest.running = true
|
||||
}
|
||||
}
|
||||
|
||||
enabled: ! addPrinterByIpScreen.hasPushedAdd
|
||||
BusyIndicator
|
||||
{
|
||||
anchors.fill: parent
|
||||
running: { ! parent.enabled && ! addPrinterByIpScreen.hasSentRequest }
|
||||
}
|
||||
//enabled: hostnameField.trim() != ""
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,25 +164,51 @@ Item
|
|||
{
|
||||
width: parent.width
|
||||
anchors.top: userInputFields.bottom
|
||||
anchors.margins: 20
|
||||
|
||||
Label
|
||||
{
|
||||
id: visTestA
|
||||
id: waitResponseLabel
|
||||
anchors.top: parent.top
|
||||
anchors.margins: 20
|
||||
font: UM.Theme.getFont("default")
|
||||
|
||||
visible: false
|
||||
visible: { addPrinterByIpScreen.hasSentRequest && ! addPrinterByIpScreen.haveConnection }
|
||||
text: catalog.i18nc("@label", "The printer at this address has not responded yet.")
|
||||
}
|
||||
|
||||
Label
|
||||
Rectangle
|
||||
{
|
||||
id: visTestB
|
||||
id: printerInfoLabels
|
||||
anchors.top: parent.top
|
||||
anchors.margins: 20
|
||||
|
||||
visible: true
|
||||
text: "PLACEHOLDER"
|
||||
visible: addPrinterByIpScreen.haveConnection
|
||||
|
||||
Label
|
||||
{
|
||||
id: printerNameLabel
|
||||
anchors.top: parent.top
|
||||
font: UM.Theme.getFont("large")
|
||||
|
||||
text: "Davids-desktop" // TODO: placeholder, alter after interface review.
|
||||
}
|
||||
|
||||
GridLayout
|
||||
{
|
||||
anchors.top: printerNameLabel.bottom
|
||||
columns: 2
|
||||
columnSpacing: 20
|
||||
|
||||
Text { font: UM.Theme.getFont("default"); text: "Type" }
|
||||
Text { font: UM.Theme.getFont("default"); text: "Ultimaker S5" } // TODO: placeholder, alter after interface review.
|
||||
|
||||
Text { font: UM.Theme.getFont("default"); text: "Firmware version" }
|
||||
Text { font: UM.Theme.getFont("default"); text: "4.3.3.20180529" } // TODO: placeholder, alter after interface review.
|
||||
|
||||
Text { font: UM.Theme.getFont("default"); text: "Address" }
|
||||
Text { font: UM.Theme.getFont("default"); text: "10.183.1.115" } // TODO: placeholder, alter after interface review.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -148,9 +223,9 @@ Item
|
|||
text: catalog.i18nc("@button", "Back")
|
||||
width: 140
|
||||
fixedWidthMode: true
|
||||
onClicked: base.showPreviousPage() // TODO?
|
||||
onClicked: base.showPreviousPage()
|
||||
|
||||
enabled: true // TODO
|
||||
enabled: true
|
||||
}
|
||||
|
||||
Cura.PrimaryButton
|
||||
|
@ -164,6 +239,6 @@ Item
|
|||
fixedWidthMode: true
|
||||
onClicked: base.showNextPage()
|
||||
|
||||
enabled: false // TODO
|
||||
enabled: addPrinterByIpScreen.haveConnection
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue