mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Start work on 'AddPrinterByIp' for WelcomePages. [CURA-6057]
This commit is contained in:
parent
6ebfaff61e
commit
113c37f555
3 changed files with 175 additions and 4 deletions
|
@ -11,7 +11,6 @@ from UM.Resources import Resources
|
|||
if TYPE_CHECKING:
|
||||
from PyQt5.QtCore import QObject
|
||||
|
||||
|
||||
class WelcomePagesModel(ListModel):
|
||||
|
||||
IdRole = Qt.UserRole + 1 # Page ID
|
||||
|
@ -50,16 +49,19 @@ class WelcomePagesModel(ListModel):
|
|||
os.path.join("WelcomePages",
|
||||
"DataCollectionsContent.qml"))),
|
||||
})
|
||||
self._pages.append({"id": "add_printer_by_ip",
|
||||
"page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles,
|
||||
os.path.join("WelcomePages",
|
||||
"AddPrinterByIpContent.qml"))),
|
||||
})
|
||||
self._pages.append({"id": "cloud",
|
||||
"page_url": QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles,
|
||||
os.path.join("WelcomePages",
|
||||
"CloudContent.qml"))),
|
||||
})
|
||||
|
||||
self.setItems(self._pages)
|
||||
|
||||
def addPage(self):
|
||||
pass
|
||||
|
||||
|
||||
__all__ = ["WelcomePagesModel"]
|
||||
|
|
|
@ -371,7 +371,7 @@ Cura.MachineAction
|
|||
|
||||
Label
|
||||
{
|
||||
text: catalog.i18nc("@alabel", "Enter the IP address or hostname of your printer on the network.")
|
||||
text: catalog.i18nc("@label", "Enter the IP address or hostname of your printer on the network.")
|
||||
width: parent.width
|
||||
wrapMode: Text.WordWrap
|
||||
renderType: Text.NativeRendering
|
||||
|
|
169
resources/qml/WelcomePages/AddPrinterByIpContent.qml
Normal file
169
resources/qml/WelcomePages/AddPrinterByIpContent.qml
Normal file
|
@ -0,0 +1,169 @@
|
|||
// Copyright (c) 2019 Ultimaker B.V.
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.10
|
||||
import QtQuick.Controls 2.3
|
||||
|
||||
import UM 1.3 as UM
|
||||
import Cura 1.1 as Cura
|
||||
|
||||
|
||||
//
|
||||
// This component contains the content for the 'by IP' page of the "Add New Printer" flow of the on-boarding process.
|
||||
//
|
||||
Item
|
||||
{
|
||||
UM.I18nCatalog { id: catalog; name: "cura" }
|
||||
|
||||
Label
|
||||
{
|
||||
id: titleLabel
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 40
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: catalog.i18nc("@label", "Add printer by IP adress")
|
||||
color: UM.Theme.getColor("primary_button")
|
||||
font: UM.Theme.getFont("large_bold")
|
||||
renderType: Text.NativeRendering
|
||||
}
|
||||
|
||||
Rectangle
|
||||
{
|
||||
anchors.top: titleLabel.bottom
|
||||
anchors.bottom: connectButton.top
|
||||
anchors.topMargin: 40
|
||||
anchors.bottomMargin: 40
|
||||
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
|
||||
{
|
||||
id: explainLabel
|
||||
height: contentHeight
|
||||
width: parent.width
|
||||
anchors.top: parent.top
|
||||
anchors.margins: 20
|
||||
//anchors.bottomMargin: 20
|
||||
|
||||
text: catalog.i18nc("@label", "Enter the IP address or hostname of your printer on the network.")
|
||||
}
|
||||
|
||||
Item
|
||||
{
|
||||
id: userInputFields
|
||||
height: childrenRect.height
|
||||
width: parent.width
|
||||
anchors.top: explainLabel.bottom
|
||||
|
||||
TextField
|
||||
{
|
||||
id: hostnameField
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
//anchors.bottom: parent.bottom
|
||||
anchors.right: addPrinterButton.left
|
||||
anchors.margins: 20
|
||||
//width: parent.width / 2
|
||||
//horizontalAlignment: Text.AlignLeft
|
||||
|
||||
//editable: true
|
||||
text: ""
|
||||
|
||||
//validator: RegExpValidator
|
||||
//{
|
||||
// regExp: /[a-zA-Z0-9\.\-\_]*/
|
||||
//}
|
||||
|
||||
onAccepted: addPrinterButton.clicked()
|
||||
}
|
||||
|
||||
Cura.PrimaryButton
|
||||
{
|
||||
id: addPrinterButton
|
||||
anchors.top: parent.top
|
||||
anchors.right: parent.right
|
||||
//anchors.bottom: parent.bottom
|
||||
anchors.margins: 20
|
||||
width: 140
|
||||
fixedWidthMode: true
|
||||
|
||||
text: catalog.i18nc("@button", "Add")
|
||||
onClicked:
|
||||
{
|
||||
// fire off method, then wait for event
|
||||
|
||||
|
||||
// manager.setManualDevice(manualPrinterDialog.printerKey, manualPrinterDialog.addressText) // manager not defined
|
||||
// manualPrinterDialog.hide()
|
||||
}
|
||||
//enabled: hostnameField.trim() != ""
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle
|
||||
{
|
||||
width: parent.width
|
||||
anchors.top: userInputFields.bottom
|
||||
|
||||
Label
|
||||
{
|
||||
id: visTestA
|
||||
anchors.top: parent.top
|
||||
anchors.margins: 20
|
||||
|
||||
visible: false
|
||||
text: catalog.i18nc("@label", "The printer at this address has not responded yet.")
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
id: visTestB
|
||||
anchors.top: parent.top
|
||||
anchors.margins: 20
|
||||
|
||||
visible: true
|
||||
text: "PLACEHOLDER"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Cura.PrimaryButton
|
||||
{
|
||||
id: backButton
|
||||
anchors.left: parent.left
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.margins: 40
|
||||
text: catalog.i18nc("@button", "Back")
|
||||
width: 140
|
||||
fixedWidthMode: true
|
||||
onClicked: base.showPreviousPage() // TODO?
|
||||
|
||||
enabled: true // TODO
|
||||
}
|
||||
|
||||
Cura.PrimaryButton
|
||||
{
|
||||
id: connectButton
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.margins: 40
|
||||
text: catalog.i18nc("@button", "Connect")
|
||||
width: 140
|
||||
fixedWidthMode: true
|
||||
onClicked: base.showNextPage()
|
||||
|
||||
enabled: false // TODO
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue