1
1
mirror of https://github.com/OpenVoiceOS/OpenVoiceOS synced 2025-03-18 12:30:09 +01:00

Fix resting screen issue.

This commit is contained in:
j1nx 2021-01-09 14:58:33 +01:00
parent a606114deb
commit bb7e6c3d3b
13 changed files with 238 additions and 146 deletions

View File

@ -158,7 +158,7 @@ menu "Additional external python modules"
endmenu
menu "Mycroft A.I. Personal Assistant"
source "$BR2_EXTERNAL_OPENVOICEOS_PATH/package/python-mycroft/Config.in"
# source "$BR2_EXTERNAL_OPENVOICEOS_PATH/package/mycroft-embedded-shell/Config.in"
source "$BR2_EXTERNAL_OPENVOICEOS_PATH/package/mycroft-embedded-shell/Config.in"
source "$BR2_EXTERNAL_OPENVOICEOS_PATH/package/mycroft-gui/Config.in"
source "$BR2_EXTERNAL_OPENVOICEOS_PATH/package/mycroft-service/Config.in"
source "$BR2_EXTERNAL_OPENVOICEOS_PATH/package/mycroft-splash/Config.in"

View File

@ -296,7 +296,7 @@ BR2_PACKAGE_NODEJS=y
BR2_PACKAGE_NODEJS_NPM=y
BR2_PACKAGE_NODEJS_MODULES_ADDITIONAL="node-red node-red-dashboard node-red-contrib-string"
BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_PYTHON3_PY_PYC=y
BR2_PACKAGE_PYTHON3_PY_ONLY=y
BR2_PACKAGE_PYTHON3_BZIP2=y
BR2_PACKAGE_PYTHON3_CODECSCJK=y
BR2_PACKAGE_PYTHON3_CURSES=y
@ -557,5 +557,6 @@ BR2_PACKAGE_PYTHON_TZLOCAL=y
BR2_PACKAGE_PYTHON_VLC=y
BR2_PACKAGE_PYTHON_XMLRUNNER=y
BR2_PACKAGE_PYTHON_MYCROFT=y
BR2_PACKAGE_MYCROFT_EMBEDDED_SHELL=y
BR2_PACKAGE_MYCROFT_GUI=y
BR2_PACKAGE_MYCROFT_SERVICE=y

View File

@ -8,7 +8,7 @@ cd /opt/mycroft/skills/skill-ovos-enclosure && git stash
cd /opt/mycroft/skills/skill-ovos-mycroftgui && git stash
cd /opt/mycroft/skills/skill-ovos-pairing && git stash
cd /opt/mycroft/skills/skill-ovos-homescreen && git stash
cd /opt/mycroft/skills/skill-date-time.mycroftai && git stash
cd /opt/mycroft/skills/mycroft-date-time.mycroftai && git stash
chown -R mycroft.mycroft /opt/mycroft
echo "[OK]"

View File

@ -20,8 +20,8 @@
"pulse_duck": true
},
"skills": {
"blacklisted_skills": ["mycroft-pairing.mycroftai", "mycroft-mark-2.mycroftai"],
"priority_skills": ["skill-ovos-enclosure", "skill-ovos-mycroftgui", "skill-balena-wifi-setup", "skill-ovos-pairing", "skill-date-time", "skill-ovos-homescreen"]
"blacklisted_skills": ["mycroft-pairing.mycroftai"],
"priority_skills": ["skill-ovos-enclosure", "skill-ovos-mycroftgui", "skill-balena-wifi-setup", "skill-ovos-pairing"]
},
"log_level": "INFO"
}

View File

@ -21,6 +21,7 @@ class WifiConnect(MycroftSkill):
self.pswd = None
self.grace_period = 45
self.time_between_checks = 30 # seconds
self.mycroft_ready = False
self.wifi_command = "sudo /usr/local/sbin/wifi-connect --portal-ssid {ssid}"
if self.pswd:
self.wifi_command += " --portal-passphrase {pswd}"
@ -35,8 +36,13 @@ class WifiConnect(MycroftSkill):
self.make_priority()
self.add_event("mycroft.internet.connected",
self.handle_internet_connected)
self.add_event("mycroft.ready",
self.handle_mycroft_ready)
self.start_internet_check()
def handle_mycroft_ready(self):
self.mycroft_ready = True
def make_priority(self):
if not self.skill_id:
# might not be set yet....
@ -221,24 +227,13 @@ class WifiConnect(MycroftSkill):
# GUI events
def prompt_to_join_ap(self, message=None):
"""Provide instructions for setting up wifi."""
self.gui.remove_page("status.qml")
self.gui["phone_image"] = "1_phone_connect-to-ap.png"
self.gui["prompt"] = "Connect to the Wi-Fi network"
self.gui["highlight"] = self.ssid
self.gui["color"] = self.settings["color"]
self.gui.show_page("prompt.qml", override_idle=True, override_animations=True)
self.manage_setup_display("join-ap", "prompt")
# allow GUI to linger around for a bit, will block the wifi setup loop
sleep(2)
def prompt_to_select_network(self, message=None):
"""Prompt user to select network and login."""
self.gui.remove_page("status.qml")
self.gui.clear()
self.gui["phone_image"] = "3_phone_choose-wifi.png"
self.gui["prompt"] = "Select local Wi-Fi network to connect"
self.gui["highlight"] = "OVOS Device"
self.gui["color"] = self.settings["color"]
self.gui.show_page("prompt.qml", override_idle=True, override_animations=True)
self.manage_setup_display("select-network", "prompt")
# allow GUI to linger around for a bit, will block the wifi setup loop
sleep(2)
@ -250,33 +245,55 @@ class WifiConnect(MycroftSkill):
# stop watchdog on internet connection
if self.settings["stop_on_internet"]:
self.monitoring = False
self.gui.remove_page("prompt.qml")
self.gui.clear()
self.gui["icon"] = "check-circle.svg"
self.gui["label"] = "Connected"
self.gui["bgColor"] = "#40DBB0"
self.gui.remove_page("prompt.qml")
self.gui.show_page("status.qml", override_idle=True, override_animations=True)
self.manage_setup_display("setup-completed", "status")
# allow GUI to linger around for a bit, will block the wifi setup loop
sleep(3)
if not is_paired():
self.bus.emit(Message("mycroft.not.paired"))
else:
self.bus.emit(Message("show.not.ready"))
self.gui.release()
else:
self.manage_setup_display("not-ready", "status")
def report_setup_failed(self, message=None):
"""Wifi setup failed"""
self.speak_dialog("wifi_error")
self.gui.remove_page("prompt.qml")
self.gui.clear()
self.gui["icon"] = "times-circle.svg"
self.gui["label"] = "Connection Failed"
self.gui["bgColor"] = "#FF0000"
self.gui.show_page("status.qml", override_idle=True, override_animations=True)
self.manage_setup_display("setup-failed", "status")
# allow GUI to linger around for a bit, will block the wifi setup loop
sleep(2)
def manage_setup_display(self, state, page_type):
self.gui.clear()
if state == "join-ap" and page_type == "prompt":
self.gui["image"] = "1_phone_connect-to-ap.png"
self.gui["label"] = "Connect to the Wi-Fi network"
self.gui["highlight"] = self.ssid
self.gui["color"] = self.settings["color"]
self.gui["page_type"] = "Prompt"
self.gui.show_page("NetworkLoader.qml", override_animations=True)
elif state == "select-network" and page_type == "prompt":
self.gui["image"] = "3_phone_choose-wifi.png"
self.gui["label"] = "Select local Wi-Fi network to connect"
self.gui["highlight"] = "OVOS Device"
self.gui["color"] = self.settings["color"]
self.gui["page_type"] = "Prompt"
self.gui.show_page("NetworkLoader.qml", override_animations=True)
elif state == "setup-completed" and page_type == "status":
self.gui["image"] = "icons/check-circle.svg"
self.gui["label"] = "Connected"
self.gui["highlight"] = ""
self.gui["color"] = "#40DBB0"
self.gui["page_type"] = "Status"
self.gui.show_page("NetworkLoader.qml", override_animations=True)
elif state == "setup-failed" and page_type == "status":
self.gui["image"] = "icons/times-circle.svg"
self.gui["label"] = "Connection Failed"
self.gui["highlight"] = ""
self.gui["color"] = "#FF0000"
self.gui["page_type"] = "Status"
self.gui.show_page("NetworkLoader.qml", override_animations=True)
elif state == "not-ready" and page_type == "status":
self.gui.show_page("NotReady.qml", override_animations=True)
# cleanup
def stop_setup(self):
if self.wifi_process is not None:
@ -309,5 +326,3 @@ class WifiConnect(MycroftSkill):
def create_skill():
return WifiConnect()

View File

@ -0,0 +1,24 @@
import QtQuick.Layouts 1.4
import QtQuick 2.4
import QtQuick.Controls 2.0
import org.kde.kirigami 2.5 as Kirigami
import Mycroft 1.0 as Mycroft
Mycroft.Delegate {
id: mainLoaderView
property var pageType: sessionData.page_type
leftPadding: 0
rightPadding: 0
bottomPadding: 0
topPadding: 0
contentItem: Loader {
id: rootLoader
}
onPageTypeChanged: {
console.log(sessionData.page_type)
rootLoader.setSource(sessionData.page_type + ".qml")
}
}

View File

@ -0,0 +1,65 @@
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
import org.kde.lottie 1.0
Mycroft.Delegate {
id: mainLoaderView
property var pageType: sessionData.page_type
leftPadding: 0
rightPadding: 0
bottomPadding: 0
topPadding: 0
Rectangle {
anchors.fill: parent
color: "#000000"
ColumnLayout {
id: grid
anchors.fill: parent
anchors.margins: Kirigami.Units.largeSpacing
Label {
id: statusLabel
Layout.alignment: Qt.AlignHCenter
font.pixelSize: parent.height * 0.075
wrapMode: Text.WordWrap
renderType: Text.NativeRendering
font.family: "Noto Sans Display"
font.styleName: "Black"
text: "Starting Up"
color: "white"
}
Label {
id: statusLabel2
Layout.alignment: Qt.AlignHCenter
font.pixelSize: parent.height * 0.075
wrapMode: Text.WordWrap
renderType: Text.NativeRendering
font.family: "Noto Sans Display"
font.styleName: "Black"
text: "Loading..."
color: "#ff0000"
}
LottieAnimation {
id: statusIcon
visible: true
enabled: true
Layout.fillWidth: true
Layout.fillHeight: true
Layout.alignment: Qt.AlignHCenter
loops: Animation.Infinite
fillMode: Image.PreserveAspectFit
running: true
source: Qt.resolvedUrl("animations/installing.json")
}
}
}
}

View File

@ -0,0 +1,82 @@
/*
* Copyright 2018 by Aditya Mehra <aix.m@outlook.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
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
Rectangle {
id: root
property var spacingUnit: 30
property bool horizontalMode: root.width > root.height ? 1 : 0
anchors.fill: parent
color: "#000000"
GridLayout {
anchors.fill: parent
anchors.margins: Kirigami.Units.largeSpacing
columns: horizontalMode ? 2 : 1
ColumnLayout {
Layout.fillWidth: true
Layout.fillHeight: true
Kirigami.Heading {
id: sentence
Layout.fillWidth: true
Layout.alignment: horizontalMode ? Qt.AlignLeft : Qt.AlignHCenter | Qt.AlignVCenter
Layout.leftMargin: horizontalMode ? spacingUnit : 0
horizontalAlignment: horizontalMode ? Text.AlignLeft : Text.AlignHCenter
verticalAlignment: horizontalMode ? Text.AlignVCenter : Text.AlignTop
wrapMode: Text.WordWrap
elide: Text.ElideRight
font.family: "Noto Sans"
font.bold: true
font.weight: Font.Bold
font.pixelSize: horizontalMode ? root.width * 0.065 : root.height * 0.075
text: sessionData.label
}
Kirigami.Heading {
id: url
Layout.fillWidth: true
Layout.leftMargin: horizontalMode ? spacingUnit : 0
Layout.alignment: horizontalMode ? Qt.AlignLeft : Qt.AlignHCenter | Qt.AlignTop
horizontalAlignment: horizontalMode ? Text.AlignLeft : Text.AlignHCenter
verticalAlignment: horizontalMode ? Text.AlignVCenter : Text.AlignTop
wrapMode: Text.WordWrap
elide: Text.ElideRight
font.family: "Noto Sans"
font.bold: true
font.weight: Font.Bold
font.pixelSize: horizontalMode ? root.width * 0.065 : root.height * 0.075
color: sessionData.color
text: sessionData.highlight
}
}
Image {
id: img
source: sessionData.image
Layout.preferredWidth: horizontalMode ? parent.width / 2 : parent.width
Layout.preferredHeight: horizontalMode ? parent.height * 0.9 : parent.height / 2
Layout.alignment: Qt.AlignBottom
fillMode: Image.PreserveAspectFit
}
}
}

View File

@ -5,33 +5,31 @@ import org.kde.kirigami 2.4 as Kirigami
import Mycroft 1.0 as Mycroft
Mycroft.ProportionalDelegate {
Rectangle {
id: root
skillBackgroundColorOverlay: sessionData.bgColor
anchors.fill: parent
color: sessionData.color
property bool horizontalMode: root.width > root.height ? 1 : 0
ColumnLayout {
id: grid
anchors.centerIn: parent
anchors.fill: parent
Image {
id: statusIcon
visible: true
enabled: true
anchors.horizontalCenter: grid.horizontalCenter
Layout.preferredWidth: proportionalGridUnit * 50
Layout.preferredHeight: proportionalGridUnit * 50
source: Qt.resolvedUrl(`icons/${sessionData.icon}`)
}
/* Add some spacing between icon and text */
Item {
height: Kirigami.Units.largeSpacing
Layout.preferredWidth: horizontalMode ? parent.width / 4 : parent.width / 2
Layout.preferredHeight: width
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
source: sessionData.image
}
Label {
id: statusLabel
Layout.alignment: Qt.AlignHCenter
font.pixelSize: 65
Layout.alignment: Qt.AlignBottom | Qt.AlignHCenter
Layout.bottomMargin: Kirigami.Units.largeSpacing
font.pixelSize: parent.width * 0.075
wrapMode: Text.WordWrap
renderType: Text.NativeRendering
font.family: "Noto Sans Display"
@ -41,4 +39,4 @@ Mycroft.ProportionalDelegate {
color: "white"
}
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -1,94 +0,0 @@
/*
* Copyright 2018 by Aditya Mehra <aix.m@outlook.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
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.Delegate {
id: root
property var spacingUnit: 30
property var phone: sessionData.phone_image
property var prompt: sessionData.prompt
property var highlight: sessionData.highlight
property var color: sessionData.color
property bool horizontalMode: root.width > root.height ? 1 : 0
leftPadding: 0
rightPadding: 0
topPadding: 0
bottomPadding: 0
Rectangle {
anchors.fill: parent
color: "#000000"
GridLayout {
anchors.fill: parent
anchors.margins: Kirigami.Units.largeSpacing
columns: horizontalMode ? 2 : 1
ColumnLayout {
Layout.fillWidth: true
Layout.fillHeight: true
Kirigami.Heading {
id: sentence
Layout.fillWidth: true
Layout.alignment: horizontalMode ? Qt.AlignLeft : Qt.AlignHCenter | Qt.AlignVCenter
Layout.leftMargin: horizontalMode ? spacingUnit : 0
horizontalAlignment: horizontalMode ? Text.AlignLeft : Text.AlignHCenter
verticalAlignment: horizontalMode ? Text.AlignVCenter : Text.AlignTop
wrapMode: Text.WordWrap
elide: Text.ElideRight
font.family: "Noto Sans"
font.bold: true
font.weight: Font.Bold
font.pixelSize: horizontalMode ? root.width * 0.065 : root.height * 0.075
text: prompt
}
Kirigami.Heading {
id: url
Layout.fillWidth: true
Layout.leftMargin: horizontalMode ? spacingUnit : 0
Layout.alignment: horizontalMode ? Qt.AlignLeft : Qt.AlignHCenter | Qt.AlignTop
horizontalAlignment: horizontalMode ? Text.AlignLeft : Text.AlignHCenter
verticalAlignment: horizontalMode ? Text.AlignVCenter : Text.AlignTop
wrapMode: Text.WordWrap
elide: Text.ElideRight
font.family: "Noto Sans"
font.bold: true
font.weight: Font.Bold
font.pixelSize: horizontalMode ? root.width * 0.065 : root.height * 0.075
color: root.color
text: highlight
}
}
Image {
id: img
source: Qt.resolvedUrl(phone)
Layout.preferredWidth: horizontalMode ? parent.width / 2 : parent.width
Layout.preferredHeight: horizontalMode ? parent.height * 0.9 : parent.height / 2
Layout.alignment: Qt.AlignBottom
fillMode: Image.PreserveAspectFit
}
}
}
}

@ -1 +1 @@
Subproject commit ee7be95809963a4557d941f614fbb6bdb9093bd9
Subproject commit d8fea7c156fc91043d0782de94d5c348c12b71d7