Skip to content

Commit

Permalink
feat: gui animation (#13)
Browse files Browse the repository at this point in the history
* feat: gui animation

* feat: gui animation
  • Loading branch information
JarbasAl authored Nov 15, 2024
1 parent ce48e7b commit 3257f29
Show file tree
Hide file tree
Showing 9 changed files with 116 additions and 7 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/build_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Run Build Tests
on:
push:
branches:
- master
pull_request:
branches:
- dev
workflow_dispatch:

jobs:
build_tests:
strategy:
max-parallel: 2
matrix:
python-version: [3.8, 3.9, "3.10", "3.11" ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Build Tools
run: |
python -m pip install build wheel
- name: Install System Dependencies
run: |
sudo apt-get update
sudo apt install python3-dev swig libssl-dev
- name: Build Source Packages
run: |
python setup.py sdist
- name: Build Distribution Packages
run: |
python setup.py bdist_wheel
- name: Install skill
run: |
pip install .
66 changes: 66 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Run UnitTests
on:
pull_request:
branches:
- dev
paths-ignore:
- 'version.py'
- 'examples/**'
- '.github/**'
- '.gitignore'
- 'LICENSE'
- 'CHANGELOG.md'
- 'MANIFEST.in'
- 'README.md'
- 'scripts/**'
push:
branches:
- master
paths-ignore:
- 'version.py'
- 'examples/**'
- '.github/**'
- '.gitignore'
- 'LICENSE'
- 'CHANGELOG.md'
- 'MANIFEST.in'
- 'README.md'
- 'scripts/**'
workflow_dispatch:

jobs:
unit_tests:
strategy:
matrix:
python-version: [3.9, "3.10" ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install System Dependencies
run: |
sudo apt-get update
sudo apt install python3-dev
python -m pip install build wheel
- name: Install core repo
run: |
pip install .
- name: Install test dependencies
run: |
pip install pytest pytest-timeout pytest-cov
- name: Install System Dependencies
run: |
sudo apt-get update
- name: Install ovos dependencies
run: |
pip install ovos-plugin-manager
- name: Run unittests
run: |
pytest --cov=ovos-skill-speedtest --cov-report xml test
- name: Upload coverage
env:
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
uses: codecov/codecov-action@v2
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
recursive-include locale *
recursive-include gui *
include *.txt
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ If a Raspberry Pi 3 B - connected to WiFi - runs Mycroft you won't get more than
* "Hey mycroft, run a speedtest"

## Credits
Lukas Gangel (@luke5sky)

- Original skill by Lukas Gangel (@luke5sky)
- wifi speed animation by [flaticon.com](https://www.flaticon.com/free-animated-icon/wifi-speed_15591468)

## Category
Daily
Expand Down
3 changes: 3 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def handle_speedtest_intent(self, message):
self.speak_dialog('running')
self.enclosure.deactivate_mouth_events()
self.enclosure.mouth_think()
self.gui.show_animated_image("wifi-speed.gif")
servers = []
speed = speedtest.Speedtest()
speed.get_servers(servers)
Expand All @@ -44,6 +45,7 @@ def handle_speedtest_intent(self, message):
self.enclosure.eyes_narrow()
downspeed = ('%.2f' % float((result["download"]) / 1000000))
upspeed = ('%.2f' % float((result["upload"]) / 1000000))
self.gui.show_text(f"UP: {upspeed} MB/S\nDOWN: {downspeed} MB/S")
self.enclosure.mouth_text(f"UP: {upspeed} MB/S DOWN: {downspeed} MB/S ")
self.speak_dialog('result', {'DOWN': downspeed, 'UP': upspeed}, wait=True)
time.sleep(2) # let speed test results scroll for a bit
Expand All @@ -54,3 +56,4 @@ def handle_speedtest_intent(self, message):
self.enclosure.activate_mouth_events()
self.enclosure.mouth_reset()
self.enclosure.eyes_reset()
self.gui.release()
Binary file added gui/all/wifi-speed.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@


def find_resource_files():
resource_base_dirs = ("locale", "ui", "vocab", "locale", "regex", "res")
resource_base_dirs = ("locale", "gui")
base_dir = abspath(dirname(__file__))
package_data = ["*.json"]
for res in resource_base_dirs:
Expand Down
2 changes: 1 addition & 1 deletion test/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class TestPlugin(unittest.TestCase):
@classmethod
def setUpClass(self):
self.skill_id = "ovos-skill-confucius-quotes.openvoiceos"
self.skill_id = "ovos-skill-speedtest.openvoiceos"

def test_find_plugin(self):
plugins = find_skill_plugins()
Expand Down
6 changes: 3 additions & 3 deletions test/test_skill_loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
from ovos_plugin_manager.skills import find_skill_plugins
from ovos_utils.messagebus import FakeBus
from ovos_workshop.skill_launcher import PluginSkillLoader, SkillLoader
from ovos_skill_confucius_quotes import ConfuciusQuotesSkill
from ovos_skill_speedtest import SpeedTestSkill


class TestSkillLoading(unittest.TestCase):
@classmethod
def setUpClass(self):
self.skill_id = "ovos-skill-confucius-quotes.openvoiceos"
self.skill_id = "ovos-skill-speedtest.openvoiceos"
self.path = dirname(dirname(__file__))

def test_from_class(self):
bus = FakeBus()
skill = ConfuciusQuotesSkill()
skill = SpeedTestSkill()
skill._startup(bus, self.skill_id)
self.assertEqual(skill.bus, bus)
self.assertEqual(skill.skill_id, self.skill_id)
Expand Down

0 comments on commit 3257f29

Please sign in to comment.