mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
CURA-5035 Simplify selection
This commit is contained in:
parent
dc0dcac199
commit
f2301eec31
6 changed files with 11 additions and 21 deletions
|
@ -9,7 +9,7 @@ import UM 1.1 as UM
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
id: base
|
id: base
|
||||||
property var details: toolbox.authorsModel.items[0]
|
property var details: toolbox.viewSelection
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
ToolboxBackColumn
|
ToolboxBackColumn
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,7 +9,7 @@ import UM 1.1 as UM
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
id: base
|
id: base
|
||||||
property var details: toolbox.packagesModel.items[0]
|
property var details: toolbox.viewSelection
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
width: parent.width
|
width: parent.width
|
||||||
ToolboxBackColumn
|
ToolboxBackColumn
|
||||||
|
|
|
@ -88,22 +88,15 @@ Item
|
||||||
}
|
}
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
|
toolbox.viewSelection = model
|
||||||
switch(toolbox.viewCategory)
|
switch(toolbox.viewCategory)
|
||||||
{
|
{
|
||||||
case "material":
|
case "material":
|
||||||
console.log("OKAY FILTER BY AUTHOR", model.name)
|
|
||||||
toolbox.viewSelection = model.name
|
|
||||||
toolbox.viewPage = "author"
|
toolbox.viewPage = "author"
|
||||||
console.log(toolbox)
|
toolbox.filterModelByProp("packages", "author_name", model.name)
|
||||||
var name = model.name
|
|
||||||
toolbox.filterModelByProp("authors", "name", name)
|
|
||||||
toolbox.filterModelByProp("packages", "author_name", name)
|
|
||||||
console.log(toolbox)
|
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
toolbox.viewSelection = model.id
|
|
||||||
toolbox.viewPage = "detail"
|
toolbox.viewPage = "detail"
|
||||||
toolbox.filterModelByProp("authors", "name", model.author_name)
|
|
||||||
toolbox.filterModelByProp("packages", "id", model.id)
|
toolbox.filterModelByProp("packages", "id", model.id)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,18 +64,15 @@ Item
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
|
toolbox.viewSelection = model
|
||||||
switch(toolbox.viewCategory)
|
switch(toolbox.viewCategory)
|
||||||
{
|
{
|
||||||
case "material":
|
case "material":
|
||||||
toolbox.viewSelection = model.name
|
|
||||||
toolbox.viewPage = "author"
|
toolbox.viewPage = "author"
|
||||||
toolbox.filterModelByProp("authors", "name", model.name)
|
|
||||||
toolbox.filterModelByProp("packages", "author_name", model.name)
|
toolbox.filterModelByProp("packages", "author_name", model.name)
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
toolbox.viewSelection = model.id
|
|
||||||
toolbox.viewPage = "detail"
|
toolbox.viewPage = "detail"
|
||||||
toolbox.filterModelByProp("authors", "name", model.author_name)
|
|
||||||
toolbox.filterModelByProp("packages", "id", model.id)
|
toolbox.filterModelByProp("packages", "id", model.id)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,6 @@ Item
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
toolbox.filterModelByProp("packages", "type", "plugin")
|
toolbox.filterModelByProp("packages", "type", "plugin")
|
||||||
toolbox.filterModelByProp("authors", "type", "plugin")
|
|
||||||
toolbox.viewCategory = "plugin"
|
toolbox.viewCategory = "plugin"
|
||||||
toolbox.viewPage = "overview"
|
toolbox.viewPage = "overview"
|
||||||
}
|
}
|
||||||
|
@ -39,7 +38,6 @@ Item
|
||||||
active: toolbox.viewCategory == "material"
|
active: toolbox.viewCategory == "material"
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
toolbox.filterModelByProp("packages", "type", "material")
|
|
||||||
toolbox.filterModelByProp("authors", "type", "material")
|
toolbox.filterModelByProp("authors", "type", "material")
|
||||||
toolbox.viewCategory = "material"
|
toolbox.viewCategory = "material"
|
||||||
toolbox.viewPage = "overview"
|
toolbox.viewPage = "overview"
|
||||||
|
|
|
@ -122,7 +122,7 @@ class Toolbox(QObject, Extension):
|
||||||
# View selection defines what is currently selected and should be
|
# View selection defines what is currently selected and should be
|
||||||
# used in filtering. This could be an author name (if _view_page is set
|
# used in filtering. This could be an author name (if _view_page is set
|
||||||
# to "author" or a plugin name if it is set to "detail").
|
# to "author" or a plugin name if it is set to "detail").
|
||||||
self._view_selection = ""
|
self._view_selection = None
|
||||||
|
|
||||||
# Active package refers to which package is currently being downloaded,
|
# Active package refers to which package is currently being downloaded,
|
||||||
# installed, or otherwise modified.
|
# installed, or otherwise modified.
|
||||||
|
@ -553,11 +553,13 @@ class Toolbox(QObject, Extension):
|
||||||
def viewPage(self) -> str:
|
def viewPage(self) -> str:
|
||||||
return self._view_page
|
return self._view_page
|
||||||
|
|
||||||
def setViewSelection(self, selection: str = ""):
|
def setViewSelection(self, selection: dict):
|
||||||
|
selection.setParent(self)
|
||||||
self._view_selection = selection
|
self._view_selection = selection
|
||||||
self.viewChanged.emit()
|
self.viewChanged.emit()
|
||||||
@pyqtProperty(str, fset = setViewSelection, notify = viewChanged)
|
@pyqtProperty(QObject, fset = setViewSelection, notify = viewChanged)
|
||||||
def viewSelection(self) -> str:
|
def viewSelection(self) -> dict:
|
||||||
|
print(dir(self._view_selection))
|
||||||
return self._view_selection
|
return self._view_selection
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue