Skip to content

Commit

Permalink
feat:face_template (#70)
Browse files Browse the repository at this point in the history
extract face from naptime skill
  • Loading branch information
JarbasAl authored Dec 26, 2024
1 parent 55bf23b commit b92f48b
Show file tree
Hide file tree
Showing 7 changed files with 167 additions and 0 deletions.
133 changes: 133 additions & 0 deletions ovos_gui/res/gui/qt5/Face.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
import QtQuick.Layouts 1.4
import QtQuick 2.4
import QtQuick.Controls 2.0
import org.kde.kirigami 2.4 as Kirigami

import Mycroft 1.0 as Mycroft

Item {
id: root

property bool eyesOpen
property string mouth
property alias mouthItem: mouthItem

Item {
id: fixedProportionsContainer

anchors.centerIn: parent
readonly property real proportion: 1.6

width: parent.height / parent.width >= proportion ? parent.width : height / 1.6
height: parent.height / parent.width >= proportion ? width * 1.6 : parent.height

Item {
anchors {
left: parent.left
top: parent.top
topMargin: parent.height * 0.28
leftMargin: parent.width * 0.02
}

width: parent.width * 0.35
height: width
Image {
anchors.fill: parent
visible: root.eyesOpen
source: Qt.resolvedUrl("face/Eyeball.svg")
fillMode: Image.PreserveAspectFit
}
Image {
anchors {
left: parent.left
right: parent.right
bottom: parent.bottom
leftMargin: width * 0.001
rightMargin: width * 0.001
}
height: width / (sourceSize.width/sourceSize.height)
visible: !root.eyesOpen
source: Qt.resolvedUrl("face/lid.svg")
fillMode: Image.PreserveAspectFit
}
Image {
anchors {
left: parent.left
right: parent.right
top: parent.top
leftMargin: width * 0.001
rightMargin: width * 0.001
}
height: width / (sourceSize.width/sourceSize.height)
visible: root.eyesOpen
source: Qt.resolvedUrl("face/upper-lid.svg")
fillMode: Image.PreserveAspectFit
}
}

Item {
anchors {
right: parent.right
top: parent.top
topMargin: parent.height * 0.28
rightMargin: parent.width * 0.02
}

width: parent.width * 0.35
height: width
Image {
anchors.fill: parent
visible: root.eyesOpen
source: Qt.resolvedUrl("face/Eyeball.svg")
fillMode: Image.PreserveAspectFit
}
Image {
anchors {
left: parent.left
right: parent.right
bottom: parent.bottom
leftMargin: width * 0.001
rightMargin: width * 0.001
}
height: width / (sourceSize.width/sourceSize.height)
visible: !root.eyesOpen
source: Qt.resolvedUrl("face/lid.svg")
fillMode: Image.PreserveAspectFit
}
Image {
anchors {
left: parent.left
right: parent.right
top: parent.top
leftMargin: width * 0.001
rightMargin: width * 0.001
}
height: width / (sourceSize.width/sourceSize.height)
visible: root.eyesOpen
source: Qt.resolvedUrl("face/upper-lid.svg")
fillMode: Image.PreserveAspectFit
}
}

Item {
id: mouthItem
anchors {
horizontalCenter: parent.horizontalCenter
bottom: parent.bottom
bottomMargin: parent.height * 0.26
}
width: parent.width / 2
height: smile.implicitHeight
Image {
id: smile
anchors {
left: parent.left
right: parent.right
verticalCenter: parent.verticalCenter
}
fillMode: Image.PreserveAspectFit
source: Qt.resolvedUrl("face/" + root.mouth)
}
}
}
}
19 changes: 19 additions & 0 deletions ovos_gui/res/gui/qt5/SYSTEM_Face.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import QtQuick.Layouts 1.4
import QtQuick 2.4
import QtQuick.Controls 2.0
import org.kde.kirigami 2.4 as Kirigami

import Mycroft 1.0 as Mycroft

Mycroft.CardDelegate {
id: root

contentItem: Face {
// Set eyesOpen based on sessionData.sleeping
eyesOpen: !sessionData.sleeping

// Set mouth based on sessionData.sleeping
mouth: sessionData.sleeping ? "GreySmile.svg" : "Smile.svg"
}

}
3 changes: 3 additions & 0 deletions ovos_gui/res/gui/qt5/face/Eyeball.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions ovos_gui/res/gui/qt5/face/GreySmile.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions ovos_gui/res/gui/qt5/face/Smile.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions ovos_gui/res/gui/qt5/face/lid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions ovos_gui/res/gui/qt5/face/upper-lid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b92f48b

Please sign in to comment.