Skip to content

Commit 36ef76b

Browse files
authored
refactor/deprecate enclosure (#29)
add deprecation warnings in mycroft.enclosure and mycroft.client.enclosure display manager is an early implementation aimed at the mark1 it has since been replaced more than once: - active skills in intent stage - idle screen manager for the mk2 (skill) DisplayManager is virtually unused, afaik nothing uses it and even if something does parse ipc or import this class it is not getting accurate data not all methods of enclosure api make a skill active this implementation was abandoned before it was ever finished DisplayManager will be refactored and ported into PHAL active skills (in the sense of interacting with hardware) will be tracked there authored-by: jarbasai <jarbasai@mailfence.com>
1 parent 5d5f4ee commit 36ef76b

File tree

15 files changed

+562
-857
lines changed

15 files changed

+562
-857
lines changed
Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
# Copyright 2017 Mycroft AI Inc.
2-
#
3-
# Licensed under the Apache License, Version 2.0 (the "License");
4-
# you may not use this file except in compliance with the License.
5-
# You may obtain a copy of the License at
6-
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
9-
# Unless required by applicable law or agreed to in writing, software
10-
# distributed under the License is distributed on an "AS IS" BASIS,
11-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
# See the License for the specific language governing permissions and
13-
# limitations under the License.
14-
#
1+
"""
2+
NOTE: this is dead code! do not use!
3+
4+
This file is only present to ensure backwards compatibility
5+
in case someone is importing from here
6+
7+
This is only meant for 3rd party code expecting ovos-core
8+
to be a drop in replacement for mycroft-core
9+
10+
"""

mycroft/client/enclosure/__main__.py

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,17 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
#
15-
"""Entrypoint for enclosure service.
15+
"""
16+
NOTE: this is dead code! do not use!
17+
18+
This file is only present to ensure backwards compatibility
19+
in case someone is importing from here
20+
21+
This is only meant for 3rd party code expecting ovos-core
22+
to be a drop in replacement for mycroft-core
1623
17-
This provides any "enclosure" specific functionality, for example GUI or
18-
control over the Mark-1 Faceplate.
1924
"""
25+
2026
from mycroft.configuration import setup_locale
2127
from mycroft.configuration import Configuration
2228
from mycroft.util.log import LOG
@@ -46,10 +52,17 @@ def create_enclosure(platform):
4652
"""
4753
if platform == "mycroft_mark_1":
4854
LOG.info("Creating Mark I Enclosure")
55+
LOG.warning("'mycroft_mark_1' enclosure has been deprecated!\n"
56+
"'mark_1' support is being migrated into PHAL\n"
57+
"see https://github.com/OpenVoiceOS/ovos_phal_mk1")
4958
from mycroft.client.enclosure.mark1 import EnclosureMark1
5059
enclosure = EnclosureMark1()
5160
elif platform == "mycroft_mark_2":
5261
LOG.info("Creating Mark II Enclosure")
62+
LOG.warning("'mycroft_mark_2' enclosure has been deprecated!\n"
63+
"It was never implemented outside the mk2 feature branch\n"
64+
"mark_2 support is being migrated into PHAL\n"
65+
"see https://github.com/OpenVoiceOS/ovos_phal_mk2")
5366
from mycroft.client.enclosure.mark2 import EnclosureMark2
5467
enclosure = EnclosureMark2()
5568
else:
@@ -69,9 +82,11 @@ def main(ready_hook=on_ready, error_hook=on_error, stopping_hook=on_stopping):
6982
NOTE: in ovos-core the GUI protocol is handled in it's own service and not part of the enclosure like in mycroft-core!
7083
You need to also run mycroft.gui process separately, it has been extracted into it's own module
7184
"""
72-
LOG.warning("mycroft.client.enclosure is in the process of being deprecated in ovos-core!")
73-
LOG.warning("You need to also run mycroft.gui process separately, it has been extracted into it's own module")
74-
85+
LOG.warning("mycroft.client.enclosure is in the process of being deprecated in ovos-core!\n"
86+
"see https://github.com/OpenVoiceOS/ovos_PHAL\n"
87+
"Be sure to run mycroft.gui process separately, it has been extracted into it's own module!\n"
88+
"The only reason to run mycroft.client.enclosure is mark1 support\n"
89+
"this module will be removed in version 0.0.3")
7590
# Read the system configuration
7691
config = Configuration.get(remote=False)
7792
platform = config.get("enclosure", {}).get("platform")

mycroft/client/enclosure/base.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
#
15+
"""
16+
NOTE: this is dead code! do not use!
17+
18+
This file is only present to ensure backwards compatibility
19+
in case someone is importing from here
20+
21+
This is only meant for 3rd party code expecting ovos-core
22+
to be a drop in replacement for mycroft-core
23+
24+
"""
1525

1626
from mycroft.configuration import Configuration
1727
from mycroft.messagebus.client import MessageBusClient
Lines changed: 9 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,12 @@
1-
# Copyright 2017 Mycroft AI Inc.
2-
#
3-
# Licensed under the Apache License, Version 2.0 (the "License");
4-
# you may not use this file except in compliance with the License.
5-
# You may obtain a copy of the License at
6-
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
9-
# Unless required by applicable law or agreed to in writing, software
10-
# distributed under the License is distributed on an "AS IS" BASIS,
11-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
# See the License for the specific language governing permissions and
13-
# limitations under the License.
14-
#
15-
import subprocess
16-
import time
17-
import sys
18-
from threading import Thread, Timer
1+
"""
2+
NOTE: this is dead code! do not use!
193
20-
import mycroft.dialog
21-
from mycroft.client.enclosure.base import Enclosure
22-
from mycroft.api import has_been_paired
23-
from mycroft.audio import wait_while_speaking
24-
from mycroft.enclosure.display_manager import \
25-
init_display_manager_bus_connection
26-
from mycroft.messagebus.message import Message
27-
from mycroft.util import connected
28-
from mycroft.util.log import LOG
4+
This file is only present to ensure backwards compatibility
5+
in case someone is importing from here
296
7+
This is only meant for 3rd party code expecting ovos-core
8+
to be a drop in replacement for mycroft-core
9+
"""
10+
11+
from mycroft.client.enclosure.base import Enclosure as EnclosureGeneric
3012

31-
class EnclosureGeneric(Enclosure):
32-
"""
33-
Serves as a communication interface between a simple text frontend and
34-
Mycroft Core. This is used for Picroft or other headless systems,
35-
and/or for users of the CLI.
36-
"""
37-
def __init__(self):
38-
super().__init__()
39-
# initiates the web sockets on display manager
40-
# NOTE: this is a temporary place to connect the display manager
41-
init_display_manager_bus_connection()

mycroft/client/enclosure/mark1/__init__.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,19 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
#
15+
16+
"""
17+
NOTE: this is dead code! do not use!
18+
19+
This file is only present to ensure backwards compatibility
20+
in case someone is importing from here
21+
22+
This is only meant for 3rd party code expecting ovos-core
23+
to be a drop in replacement for mycroft-core
24+
25+
TODO: consider importing from PHAL if it's compatible
26+
"""
27+
1528
import subprocess
1629
import time
1730
from alsaaudio import Mixer
@@ -28,8 +41,6 @@
2841
from mycroft.client.enclosure.mark1.arduino import EnclosureArduino
2942
from mycroft.client.enclosure.mark1.eyes import EnclosureEyes
3043
from mycroft.client.enclosure.mark1.mouth import EnclosureMouth
31-
from mycroft.enclosure.display_manager import \
32-
init_display_manager_bus_connection
3344
from mycroft.configuration import LocalConf, USER_CONFIG
3445
from mycroft.messagebus.message import Message
3546
from mycroft.util import play_wav, create_signal, connected, check_for_signal
@@ -290,10 +301,6 @@ def __init__(self):
290301
# Notifications from mycroft-core
291302
self.bus.on("enclosure.notify.no_internet", self.on_no_internet)
292303

293-
# initiates the web sockets on display manager
294-
# NOTE: this is a temporary place to connect the display manager
295-
init_display_manager_bus_connection()
296-
297304
def on_arduino_responded(self, event=None):
298305
self.eyes = EnclosureEyes(self.bus, self.writer)
299306
self.mouth = EnclosureMouth(self.bus, self.writer)

mycroft/client/enclosure/mark1/arduino.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
"""
15+
NOTE: this is dead code! do not use!
16+
17+
This file is only present to ensure backwards compatibility
18+
in case someone is importing from here
19+
20+
This is only meant for 3rd party code expecting ovos-core
21+
to be a drop in replacement for mycroft-core
22+
23+
TODO: consider importing from PHAL if it's compatible
24+
"""
1425

1526

1627
class EnclosureArduino:

mycroft/client/enclosure/mark1/eyes.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
"""
15+
NOTE: this is dead code! do not use!
16+
17+
This file is only present to ensure backwards compatibility
18+
in case someone is importing from here
19+
20+
This is only meant for 3rd party code expecting ovos-core
21+
to be a drop in replacement for mycroft-core
22+
23+
TODO: consider importing from PHAL if it's compatible
24+
"""
1425

1526

1627
class EnclosureEyes:

mycroft/client/enclosure/mark1/mouth.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,18 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
#
15+
"""
16+
NOTE: this is dead code! do not use!
17+
18+
This file is only present to ensure backwards compatibility
19+
in case someone is importing from here
20+
21+
This is only meant for 3rd party code expecting ovos-core
22+
to be a drop in replacement for mycroft-core
23+
24+
TODO: consider importing from PHAL if it's compatible
25+
"""
26+
1527
import time
1628
from PIL import Image
1729

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,11 @@
1-
# Copyright 2017 Mycroft AI Inc.
2-
#
3-
# Licensed under the Apache License, Version 2.0 (the "License");
4-
# you may not use this file except in compliance with the License.
5-
# You may obtain a copy of the License at
6-
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
9-
# Unless required by applicable law or agreed to in writing, software
10-
# distributed under the License is distributed on an "AS IS" BASIS,
11-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
# See the License for the specific language governing permissions and
13-
# limitations under the License.
14-
#
15-
from mycroft.client.enclosure.base import Enclosure
1+
"""
2+
NOTE: this is dead code! do not use!
163
4+
This file is only present to ensure backwards compatibility
5+
in case someone is importing from here
176
18-
class EnclosureMark2(Enclosure):
7+
This is only meant for 3rd party code expecting ovos-core
8+
to be a drop in replacement for mycroft-core
9+
"""
1910

20-
def __init__(self):
21-
super().__init__()
22-
23-
# TODO: Any Mark II specific startup actions
11+
from mycroft.client.enclosure.base import Enclosure as EnclosureMark2

mycroft/enclosure/__init__.py

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
1-
# Copyright 2017 Mycroft AI Inc.
2-
#
3-
# Licensed under the Apache License, Version 2.0 (the "License");
4-
# you may not use this file except in compliance with the License.
5-
# You may obtain a copy of the License at
6-
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
9-
# Unless required by applicable law or agreed to in writing, software
10-
# distributed under the License is distributed on an "AS IS" BASIS,
11-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
# See the License for the specific language governing permissions and
13-
# limitations under the License.
1+
"""
2+
NOTE: this is dead code! do not use!
143
15-
from mycroft.enclosure.api import EnclosureAPI
16-
from mycroft.enclosure.display_manager import DisplayManager
4+
This file is only present to ensure backwards compatibility
5+
in case someone is importing from here
6+
7+
This is only meant for 3rd party code expecting ovos-core
8+
to be a drop in replacement for mycroft-core
9+
10+
"""
11+
from ovos_utils.enclosure.api import EnclosureAPI

0 commit comments

Comments
 (0)