mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-17 03:37:48 -06:00
Display inactive DL projects as disabled
CURA-12557
This commit is contained in:
parent
2e9999ed2d
commit
a739fd21f5
5 changed files with 55 additions and 17 deletions
|
@ -11,10 +11,10 @@ Cura.RoundedRectangle
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: projectImage.height + 2 * UM.Theme.getSize("default_margin").width
|
height: projectImage.height + 2 * UM.Theme.getSize("default_margin").width
|
||||||
cornerSide: Cura.RoundedRectangle.Direction.All
|
cornerSide: Cura.RoundedRectangle.Direction.All
|
||||||
border.color: UM.Theme.getColor("lining")
|
border.color: enabled ? UM.Theme.getColor("lining") : UM.Theme.getColor("action_button_disabled_border")
|
||||||
border.width: UM.Theme.getSize("default_lining").width
|
border.width: UM.Theme.getSize("default_lining").width
|
||||||
radius: UM.Theme.getSize("default_radius").width
|
radius: UM.Theme.getSize("default_radius").width
|
||||||
color: UM.Theme.getColor("main_background")
|
color: getBackgoundColor()
|
||||||
signal clicked()
|
signal clicked()
|
||||||
property alias imageSource: projectImage.source
|
property alias imageSource: projectImage.source
|
||||||
property alias projectNameText: displayNameLabel.text
|
property alias projectNameText: displayNameLabel.text
|
||||||
|
@ -22,17 +22,18 @@ Cura.RoundedRectangle
|
||||||
property alias projectLastUpdatedText: lastUpdatedLabel.text
|
property alias projectLastUpdatedText: lastUpdatedLabel.text
|
||||||
property alias cardMouseAreaEnabled: cardMouseArea.enabled
|
property alias cardMouseAreaEnabled: cardMouseArea.enabled
|
||||||
|
|
||||||
onVisibleChanged: color = UM.Theme.getColor("main_background")
|
onVisibleChanged: color = getBackgroundColor()
|
||||||
|
|
||||||
MouseArea
|
MouseArea
|
||||||
{
|
{
|
||||||
id: cardMouseArea
|
id: cardMouseArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: base.enabled
|
||||||
onEntered: base.color = UM.Theme.getColor("action_button_hovered")
|
onEntered: color = getBackgroundColor()
|
||||||
onExited: base.color = UM.Theme.getColor("main_background")
|
onExited: color = getBackgroundColor()
|
||||||
onClicked: base.clicked()
|
onClicked: base.clicked()
|
||||||
}
|
}
|
||||||
|
|
||||||
Row
|
Row
|
||||||
{
|
{
|
||||||
id: projectInformationRow
|
id: projectInformationRow
|
||||||
|
@ -73,7 +74,7 @@ Cura.RoundedRectangle
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: Math.round(parent.height / 3)
|
height: Math.round(parent.height / 3)
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
color: UM.Theme.getColor("small_button_text")
|
color: base.enabled ? UM.Theme.getColor("small_button_text") : UM.Theme.getColor("text_disabled")
|
||||||
}
|
}
|
||||||
|
|
||||||
UM.Label
|
UM.Label
|
||||||
|
@ -82,8 +83,27 @@ Cura.RoundedRectangle
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: Math.round(parent.height / 3)
|
height: Math.round(parent.height / 3)
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
color: UM.Theme.getColor("small_button_text")
|
color: base.enabled ? UM.Theme.getColor("small_button_text") : UM.Theme.getColor("text_disabled")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getBackgroundColor()
|
||||||
|
{
|
||||||
|
if(enabled)
|
||||||
|
{
|
||||||
|
if(cardMouseArea.containsMouse)
|
||||||
|
{
|
||||||
|
return UM.Theme.getColor("action_button_hovered")
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return UM.Theme.getColor("main_background")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return UM.Theme.getColor("action_button_disabled")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -159,20 +159,33 @@ Item
|
||||||
Repeater
|
Repeater
|
||||||
{
|
{
|
||||||
model: manager.digitalFactoryProjectModel
|
model: manager.digitalFactoryProjectModel
|
||||||
delegate: ProjectSummaryCard
|
delegate: Item
|
||||||
|
{
|
||||||
|
width: parent.width
|
||||||
|
height: projectSummaryCard.height
|
||||||
|
|
||||||
|
UM.TooltipArea
|
||||||
|
{
|
||||||
|
anchors.fill: parent
|
||||||
|
text: "This project is inactive and cannot be used."
|
||||||
|
enabled: !model.active
|
||||||
|
}
|
||||||
|
|
||||||
|
ProjectSummaryCard
|
||||||
{
|
{
|
||||||
id: projectSummaryCard
|
id: projectSummaryCard
|
||||||
imageSource: model.thumbnailUrl || "../images/placeholder.svg"
|
imageSource: model.thumbnailUrl || "../images/placeholder.svg"
|
||||||
projectNameText: model.displayName
|
projectNameText: model.displayName
|
||||||
projectUsernameText: model.username
|
projectUsernameText: model.username
|
||||||
projectLastUpdatedText: "Last updated: " + model.lastUpdated
|
projectLastUpdatedText: "Last updated: " + model.lastUpdated
|
||||||
|
enabled: model.active
|
||||||
|
|
||||||
onClicked:
|
onClicked: {
|
||||||
{
|
|
||||||
manager.selectedProjectIndex = index
|
manager.selectedProjectIndex = index
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LoadMoreProjectsCard
|
LoadMoreProjectsCard
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,6 +17,7 @@ class DigitalFactoryProjectModel(ListModel):
|
||||||
ThumbnailUrlRole = Qt.ItemDataRole.UserRole + 5
|
ThumbnailUrlRole = Qt.ItemDataRole.UserRole + 5
|
||||||
UsernameRole = Qt.ItemDataRole.UserRole + 6
|
UsernameRole = Qt.ItemDataRole.UserRole + 6
|
||||||
LastUpdatedRole = Qt.ItemDataRole.UserRole + 7
|
LastUpdatedRole = Qt.ItemDataRole.UserRole + 7
|
||||||
|
ActiveRole = Qt.ItemDataRole.UserRole + 8
|
||||||
|
|
||||||
dfProjectModelChanged = pyqtSignal()
|
dfProjectModelChanged = pyqtSignal()
|
||||||
|
|
||||||
|
@ -28,6 +29,7 @@ class DigitalFactoryProjectModel(ListModel):
|
||||||
self.addRoleName(self.ThumbnailUrlRole, "thumbnailUrl")
|
self.addRoleName(self.ThumbnailUrlRole, "thumbnailUrl")
|
||||||
self.addRoleName(self.UsernameRole, "username")
|
self.addRoleName(self.UsernameRole, "username")
|
||||||
self.addRoleName(self.LastUpdatedRole, "lastUpdated")
|
self.addRoleName(self.LastUpdatedRole, "lastUpdated")
|
||||||
|
self.addRoleName(self.ActiveRole, "active")
|
||||||
self._projects = [] # type: List[DigitalFactoryProjectResponse]
|
self._projects = [] # type: List[DigitalFactoryProjectResponse]
|
||||||
|
|
||||||
def setProjects(self, df_projects: List[DigitalFactoryProjectResponse]) -> None:
|
def setProjects(self, df_projects: List[DigitalFactoryProjectResponse]) -> None:
|
||||||
|
@ -59,5 +61,6 @@ class DigitalFactoryProjectModel(ListModel):
|
||||||
"thumbnailUrl": project.thumbnail_url,
|
"thumbnailUrl": project.thumbnail_url,
|
||||||
"username": project.username,
|
"username": project.username,
|
||||||
"lastUpdated": project.last_updated.strftime(PROJECT_UPDATED_AT_DATETIME_FORMAT) if project.last_updated else "",
|
"lastUpdated": project.last_updated.strftime(PROJECT_UPDATED_AT_DATETIME_FORMAT) if project.last_updated else "",
|
||||||
|
"active": project.active,
|
||||||
})
|
})
|
||||||
self.dfProjectModelChanged.emit()
|
self.dfProjectModelChanged.emit()
|
||||||
|
|
|
@ -28,6 +28,7 @@ class DigitalFactoryProjectResponse(BaseModel):
|
||||||
team_ids: Optional[List[str]] = None,
|
team_ids: Optional[List[str]] = None,
|
||||||
status: Optional[str] = None,
|
status: Optional[str] = None,
|
||||||
technical_requirements: Optional[Dict[str, Any]] = None,
|
technical_requirements: Optional[Dict[str, Any]] = None,
|
||||||
|
is_inactive: bool = False,
|
||||||
**kwargs) -> None:
|
**kwargs) -> None:
|
||||||
"""
|
"""
|
||||||
Creates a new digital factory project response object
|
Creates a new digital factory project response object
|
||||||
|
@ -56,6 +57,7 @@ class DigitalFactoryProjectResponse(BaseModel):
|
||||||
self.last_updated = datetime.strptime(last_updated, DIGITAL_FACTORY_RESPONSE_DATETIME_FORMAT) if last_updated else None
|
self.last_updated = datetime.strptime(last_updated, DIGITAL_FACTORY_RESPONSE_DATETIME_FORMAT) if last_updated else None
|
||||||
self.status = status
|
self.status = status
|
||||||
self.technical_requirements = technical_requirements
|
self.technical_requirements = technical_requirements
|
||||||
|
self.active = not is_inactive
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
|
|
|
@ -496,7 +496,7 @@
|
||||||
"monitor_carousel_dot_current": [119, 119, 119, 255],
|
"monitor_carousel_dot_current": [119, 119, 119, 255],
|
||||||
|
|
||||||
"cloud_unavailable": [153, 153, 153, 255],
|
"cloud_unavailable": [153, 153, 153, 255],
|
||||||
"cloud_inactive": "warning",
|
"cloud_inactive": [253, 209, 58, 255],
|
||||||
"connection_badge_background": [255, 255, 255, 255],
|
"connection_badge_background": [255, 255, 255, 255],
|
||||||
"warning_badge_background": [0, 0, 0, 255],
|
"warning_badge_background": [0, 0, 0, 255],
|
||||||
"error_badge_background": [255, 255, 255, 255],
|
"error_badge_background": [255, 255, 255, 255],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue