mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 15:07:28 -06:00
added column for removing the magic number
CURA-11003
This commit is contained in:
parent
a6e91fecf3
commit
2ed0377a05
1 changed files with 168 additions and 157 deletions
|
@ -15,7 +15,7 @@ import Cura 1.1 as Cura
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
id: base
|
id: base
|
||||||
property bool findingPrinters: false
|
property bool searchFilterApplied: false
|
||||||
// The currently selected machine item in the local machine list.
|
// The currently selected machine item in the local machine list.
|
||||||
property var currentItem: machineList.currentIndex >= 0 ? machineList.model.getItem(machineList.currentIndex) : null
|
property var currentItem: machineList.currentIndex >= 0 ? machineList.model.getItem(machineList.currentIndex) : null
|
||||||
// The currently active (expanded) section/category, where section/category is the grouping of local machine items.
|
// The currently active (expanded) section/category, where section/category is the grouping of local machine items.
|
||||||
|
@ -65,7 +65,7 @@ Item
|
||||||
{
|
{
|
||||||
id: printerSearchTimer
|
id: printerSearchTimer
|
||||||
onTriggered: filter.editingFinished()
|
onTriggered: filter.editingFinished()
|
||||||
interval: 500
|
interval: 50
|
||||||
running: false
|
running: false
|
||||||
repeat: false
|
repeat: false
|
||||||
}
|
}
|
||||||
|
@ -79,10 +79,24 @@ Item
|
||||||
base.currentSections = base.currentSections;
|
base.currentSections = base.currentSections;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Row
|
||||||
|
{
|
||||||
|
id: localPrinterSelectionItem
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
Column
|
||||||
|
{
|
||||||
|
id: root
|
||||||
|
width: Math.floor(parent.width * 0.48)
|
||||||
|
height: parent.height
|
||||||
|
Item
|
||||||
|
{
|
||||||
|
width: root.width
|
||||||
|
height: filter.height
|
||||||
Cura.TextField
|
Cura.TextField
|
||||||
{
|
{
|
||||||
id: filter
|
id: filter
|
||||||
width: Math.floor(parent.width * 0.48)
|
width:parent.width
|
||||||
implicitHeight: parent.height
|
implicitHeight: parent.height
|
||||||
placeholderText: catalog.i18nc("@label:textbox", "Search Printer")
|
placeholderText: catalog.i18nc("@label:textbox", "Search Printer")
|
||||||
font: UM.Theme.getFont("default_italic")
|
font: UM.Theme.getFont("default_italic")
|
||||||
|
@ -107,14 +121,14 @@ Item
|
||||||
onEditingFinished:
|
onEditingFinished:
|
||||||
{
|
{
|
||||||
machineDefinitionsModel.filter = {"id" : "*" + text.toLowerCase() + "*", "visible": true}
|
machineDefinitionsModel.filter = {"id" : "*" + text.toLowerCase() + "*", "visible": true}
|
||||||
base.findingPrinters = (text.length > 0)
|
base.searchFilterApplied = (text.length > 0)
|
||||||
updateDefinitionModel()
|
updateDefinitionModel()
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onEscapePressed: filter.text = ""
|
Keys.onEscapePressed: filter.text = ""
|
||||||
function updateDefinitionModel()
|
function updateDefinitionModel()
|
||||||
{
|
{
|
||||||
if (base.findingPrinters)
|
if (base.searchFilterApplied)
|
||||||
{
|
{
|
||||||
base.currentSections.clear()
|
base.currentSections.clear()
|
||||||
for (var i = 0; i < machineDefinitionsModel.count; i++)
|
for (var i = 0; i < machineDefinitionsModel.count; i++)
|
||||||
|
@ -143,11 +157,12 @@ Item
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UM.SimpleButton
|
UM.SimpleButton
|
||||||
{
|
{
|
||||||
id: clearFilterButton
|
id: clearFilterButton
|
||||||
iconSource: UM.Theme.getIcon("Cancel")
|
iconSource: UM.Theme.getIcon("Cancel")
|
||||||
visible: base.findingPrinters
|
visible: base.searchFilterApplied
|
||||||
|
|
||||||
height: Math.round(filter.height * 0.4)
|
height: Math.round(filter.height * 0.4)
|
||||||
width: visible ? height : 0
|
width: visible ? height : 0
|
||||||
|
@ -165,19 +180,14 @@ Item
|
||||||
filter.forceActiveFocus()
|
filter.forceActiveFocus()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Row
|
|
||||||
{
|
|
||||||
id: localPrinterSelectionItem
|
|
||||||
anchors.fill: parent
|
|
||||||
|
|
||||||
//Selecting a local printer to add from this list.
|
//Selecting a local printer to add from this list.
|
||||||
ListView
|
ListView
|
||||||
{
|
{
|
||||||
id: machineList
|
id: machineList
|
||||||
width: Math.floor(parent.width * 0.48)
|
width:root.width
|
||||||
height: parent.height - filter.height
|
height: root.height - filter.height
|
||||||
y: filter.height
|
|
||||||
clip: true
|
clip: true
|
||||||
ScrollBar.vertical: UM.ScrollBar {}
|
ScrollBar.vertical: UM.ScrollBar {}
|
||||||
|
|
||||||
|
@ -265,6 +275,7 @@ Item
|
||||||
onClicked: base.updateCurrentItem(index)
|
onClicked: base.updateCurrentItem(index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Vertical line
|
// Vertical line
|
||||||
Rectangle
|
Rectangle
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue