Skip to content
This repository was archived by the owner on Sep 8, 2024. It is now read-only.

Commit 814a9a8

Browse files
committed
Check if GUI is connected rather than maintain list of platforms
There are already many Mycroft platforms that have GUIs and this will only grow. We want to know if the device has a GUI connected rather than if it is in a pre-defined list of platforms.
1 parent ea15759 commit 814a9a8

File tree

2 files changed

+1
-13
lines changed

2 files changed

+1
-13
lines changed

mycroft/skills/common_query_skill.py

+1-8
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ def is_CQSVisualMatchLevel(match_level):
3636
return isinstance(match_level, type(CQSVisualMatchLevel.EXACT))
3737

3838

39-
VISUAL_DEVICES = ['mycroft_mark_2']
40-
4139
"""these are for the confidence calculation"""
4240
# how much each topic word is worth
4341
# when found in the answer
@@ -53,10 +51,6 @@ def is_CQSVisualMatchLevel(match_level):
5351
WORD_COUNT_DIVISOR = 100
5452

5553

56-
def handles_visuals(platform):
57-
return platform in VISUAL_DEVICES
58-
59-
6054
class CommonQuerySkill(MycroftSkill, ABC):
6155
"""Question answering skills should be based on this class.
6256
@@ -149,9 +143,8 @@ def __calc_confidence(self, match, phrase, level, answer):
149143
num_sentences = float(float(len(answer.split("."))) / float(10))
150144

151145
# Add bonus if match has visuals and the device supports them.
152-
platform = self.config_core.get("enclosure", {}).get("platform")
153146
bonus = 0.0
154-
if is_CQSVisualMatchLevel(level) and handles_visuals(platform):
147+
if is_CQSVisualMatchLevel(level) and self.gui.connected:
155148
bonus = 0.1
156149

157150
# extract topic

test/unittests/skills/test_common_query_skill.py

-5
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@ def test_lifecycle(self):
2323
bus.on.assert_any_call('question:action', AnyCallable())
2424
skill.shutdown()
2525

26-
def test_handles_visuals(self):
27-
"""Test the helper method to determine if the skill handles visuals."""
28-
self.assertTrue(handles_visuals('mycroft_mark_2'))
29-
self.assertFalse(handles_visuals('mycroft_mark_1'))
30-
3126
def test_common_test_skill_action(self):
3227
"""Test that the optional action is triggered."""
3328
query_action = self.bus.on.call_args_list[-1][0][1]

0 commit comments

Comments
 (0)