diff --git a/mycroft/client/enclosure/__init__.py b/mycroft/client/enclosure/__init__.py index f0db2a5afc..50dd0f51d1 100644 --- a/mycroft/client/enclosure/__init__.py +++ b/mycroft/client/enclosure/__init__.py @@ -24,6 +24,7 @@ from threading import Thread, Timer import serial +import mycroft.dialog from mycroft.client.enclosure.arduino import EnclosureArduino from mycroft.client.enclosure.eyes import EnclosureEyes from mycroft.client.enclosure.mouth import EnclosureMouth @@ -80,7 +81,7 @@ class EnclosureReader(Thread): self.ws.emit(Message("enclosure.start")) if "mycroft.stop" in data: - create_signal('buttonPress') # FIXME - Must use WS instead + create_signal('buttonPress') self.ws.emit(Message("mycroft.stop")) if "volume.up" in data: @@ -138,7 +139,7 @@ class EnclosureReader(Thread): shell=True) self.ws.emit(Message("mycroft.wifi.reset")) self.ws.emit(Message("speak", { - 'utterance': "This unit has been reset"})) + 'utterance': mycroft.dialog.get("reset to factory defaults")})) time.sleep(5) self.ws.emit(Message("enclosure.mouth.reset")) subprocess.call('systemctl reboot -i', shell=True) @@ -147,9 +148,13 @@ class EnclosureReader(Thread): # This is handled by the wifi client self.ws.emit(Message("mycroft.enable.ssh")) self.ws.emit(Message("speak", { - 'utterance': "SSH will be enabled on next boot"})) - time.sleep(5) - subprocess.call('systemctl reboot -i', shell=True) + 'utterance': mycroft.dialog.get("ssh enabled")})) + + if "unit.disable-ssh" in data: + # This is handled by the wifi client + self.ws.emit(Message("mycroft.disable.ssh")) + self.ws.emit(Message("speak", { + 'utterance': mycroft.dialog.get("ssh disabled")})) def stop(self): self.alive = False diff --git a/mycroft/dialog/__init__.py b/mycroft/dialog/__init__.py index 6b4cd226a3..174aed6029 100644 --- a/mycroft/dialog/__init__.py +++ b/mycroft/dialog/__init__.py @@ -110,7 +110,7 @@ class DialogLoader(object): return self.__renderer -def get(phrase, lang, context=None): +def get(phrase, lang=None, context=None): """ Looks up a resource file for the given phrase. If no file is found, the requested phrase is returned as the string. @@ -125,6 +125,10 @@ def get(phrase, lang, context=None): str: a randomized and/or translated version of the phrase """ + if not lang: + from mycroft.configuration import ConfigurationManager + lang = ConfigurationManager.instance().get("lang") + filename = "text/"+lang.lower()+"/"+phrase+".dialog" template = resolve_resource_file(filename) if not template: diff --git a/mycroft/res/text/en-us/reset to factory defaults.dialog b/mycroft/res/text/en-us/reset to factory defaults.dialog new file mode 100644 index 0000000000..5586e32024 --- /dev/null +++ b/mycroft/res/text/en-us/reset to factory defaults.dialog @@ -0,0 +1 @@ +I have been reset to factory defaults. diff --git a/mycroft/res/text/en-us/ssh disabled.dialog b/mycroft/res/text/en-us/ssh disabled.dialog new file mode 100644 index 0000000000..23379aaa6c --- /dev/null +++ b/mycroft/res/text/en-us/ssh disabled.dialog @@ -0,0 +1 @@ +SSH logins will be disabled next time I restart \ No newline at end of file diff --git a/mycroft/res/text/en-us/ssh enabled.dialog b/mycroft/res/text/en-us/ssh enabled.dialog new file mode 100644 index 0000000000..55ecf53e8c --- /dev/null +++ b/mycroft/res/text/en-us/ssh enabled.dialog @@ -0,0 +1 @@ +SSH will be enabled next time I restart