From 1d1e5fcd1ed41ddde794439ae557b01a3494fd73 Mon Sep 17 00:00:00 2001 From: JarbasAI <33701864+JarbasAl@users.noreply.github.com> Date: Sun, 17 Nov 2024 13:58:30 +0000 Subject: [PATCH] fix!: remove screenshot intent (#138) https://github.com/OpenVoiceOS/ovos-gui-plugin-shell-companion/issues/48 --- .github/workflows/sync_tx.yml | 37 -------------- __init__.py | 32 +----------- locale/ca-es/take.screenshot.intent | 2 - locale/da-dk/take.screenshot.intent | 1 - locale/de-de/take.screenshot.intent | 2 - locale/en-us/take.screenshot.intent | 2 - locale/es-es/take.screenshot.intent | 2 - locale/fr-fr/take.screenshot.intent | 2 - locale/it-it/take.screenshot.intent | 2 - locale/nl-nl/take.screenshot.intent | 2 - locale/pt-pt/take.screenshot.intent | 2 - res/desktop/skill.json | 23 --------- scripts/sync_translations.py | 78 ----------------------------- translations/ca-es/intents.json | 6 --- translations/da-dk/intents.json | 6 --- translations/de-de/intents.json | 6 --- translations/en-us/intents.json | 6 --- translations/es-es/intents.json | 6 --- translations/fr-fr/intents.json | 6 --- translations/it-it/intents.json | 6 --- translations/nl-nl/intents.json | 6 --- translations/pt-pt/intents.json | 6 --- 22 files changed, 2 insertions(+), 239 deletions(-) delete mode 100644 .github/workflows/sync_tx.yml delete mode 100644 locale/ca-es/take.screenshot.intent delete mode 100644 locale/da-dk/take.screenshot.intent delete mode 100644 locale/de-de/take.screenshot.intent delete mode 100644 locale/en-us/take.screenshot.intent delete mode 100644 locale/es-es/take.screenshot.intent delete mode 100644 locale/fr-fr/take.screenshot.intent delete mode 100644 locale/it-it/take.screenshot.intent delete mode 100644 locale/nl-nl/take.screenshot.intent delete mode 100644 locale/pt-pt/take.screenshot.intent delete mode 100644 res/desktop/skill.json delete mode 100644 scripts/sync_translations.py delete mode 100644 translations/ca-es/intents.json delete mode 100644 translations/da-dk/intents.json delete mode 100644 translations/de-de/intents.json delete mode 100644 translations/en-us/intents.json delete mode 100644 translations/es-es/intents.json delete mode 100644 translations/fr-fr/intents.json delete mode 100644 translations/it-it/intents.json delete mode 100644 translations/nl-nl/intents.json delete mode 100644 translations/pt-pt/intents.json diff --git a/.github/workflows/sync_tx.yml b/.github/workflows/sync_tx.yml deleted file mode 100644 index 5e7d307..0000000 --- a/.github/workflows/sync_tx.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Run script on merge to dev by gitlocalize-app - -on: - workflow_dispatch: - push: - branches: - - dev - -jobs: - run-script: - runs-on: ubuntu-latest - steps: - - name: Check out repository - uses: actions/checkout@v2 - with: - ref: dev - fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. - - name: Setup Python - uses: actions/setup-python@v1 - with: - python-version: 3.9 - - - name: Run script if manual dispatch - if: github.event_name == 'workflow_dispatch' - run: | - python scripts/sync_translations.py - - - name: Run script if merged by gitlocalize-app[bot] - if: github.event_name == 'push' && github.event.head_commit.author.username == 'gitlocalize-app[bot]' - run: | - python scripts/sync_translations.py - - - name: Commit to dev - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: Update translations - branch: dev diff --git a/__init__.py b/__init__.py index 62b57cc..7443704 100644 --- a/__init__.py +++ b/__init__.py @@ -13,8 +13,6 @@ # limitations under the License. import datetime -import os -import tempfile from typing import Dict, List, Tuple from ovos_bus_client import Message @@ -24,7 +22,7 @@ from ovos_utils.log import LOG from ovos_utils.process_utils import RuntimeRequirements from ovos_utils.time import now_local -from ovos_workshop.decorators import intent_handler, resting_screen_handler +from ovos_workshop.decorators import resting_screen_handler from ovos_workshop.skills.api import SkillApi from ovos_workshop.skills.ovos import OVOSSkill @@ -107,9 +105,6 @@ def initialize(self): self.bus.on("mycroft.internet.connected", self.on_internet_connected) self.bus.on("enclosure.notify.no_internet", self.on_no_internet) - # Handle Screenshot Response - self.bus.on("ovos.display.screenshot.get.response", self.screenshot_taken) - SkillApi.connect_bus(self.bus) self._load_skill_apis() @@ -427,27 +422,4 @@ def handle_media_player_widget_update(self, message=None): "enabled": True, "widget": message.data, "state": self.media_widget_player_state - }) - - ###################################################################### - # Handle Screenshot - @intent_handler("take.screenshot.intent") - def take_screenshot(self, message): - folder_path = self.settings.get("screenshot_folder", "") - - if not folder_path: - folder_path = os.path.expanduser('~') + "/Pictures" - - if not os.path.exists(folder_path): - try: - os.makedirs(folder_path, exist_ok=True) - except OSError as e: - LOG.error("Could not create screenshot folder: " + str(e)) - folder_path = tempfile.gettempdir() - - self.bus.emit(Message("ovos.display.screenshot.get", {"folderpath": folder_path})) - - def screenshot_taken(self, message): - result = message.data.get("result") - display_message = f"Screenshot saved to {result}" - self.gui.show_notification(display_message) + }) \ No newline at end of file diff --git a/locale/ca-es/take.screenshot.intent b/locale/ca-es/take.screenshot.intent deleted file mode 100644 index 084fe3e..0000000 --- a/locale/ca-es/take.screenshot.intent +++ /dev/null @@ -1,2 +0,0 @@ -fes una captura -fes una captura de pantalla \ No newline at end of file diff --git a/locale/da-dk/take.screenshot.intent b/locale/da-dk/take.screenshot.intent deleted file mode 100644 index 7ef7ae1..0000000 --- a/locale/da-dk/take.screenshot.intent +++ /dev/null @@ -1 +0,0 @@ -tag et skærmbillede \ No newline at end of file diff --git a/locale/de-de/take.screenshot.intent b/locale/de-de/take.screenshot.intent deleted file mode 100644 index 09693b1..0000000 --- a/locale/de-de/take.screenshot.intent +++ /dev/null @@ -1,2 +0,0 @@ -einen Screenshot machen -schauspielerisch \ No newline at end of file diff --git a/locale/en-us/take.screenshot.intent b/locale/en-us/take.screenshot.intent deleted file mode 100644 index 9e12b15..0000000 --- a/locale/en-us/take.screenshot.intent +++ /dev/null @@ -1,2 +0,0 @@ -take a screenshot -take screenshot \ No newline at end of file diff --git a/locale/es-es/take.screenshot.intent b/locale/es-es/take.screenshot.intent deleted file mode 100644 index 0dee90e..0000000 --- a/locale/es-es/take.screenshot.intent +++ /dev/null @@ -1,2 +0,0 @@ -tomar captura de pantalla -tomar una captura de pantalla \ No newline at end of file diff --git a/locale/fr-fr/take.screenshot.intent b/locale/fr-fr/take.screenshot.intent deleted file mode 100644 index 3a8855e..0000000 --- a/locale/fr-fr/take.screenshot.intent +++ /dev/null @@ -1,2 +0,0 @@ -capture d'écran -prendre une capture d'écran \ No newline at end of file diff --git a/locale/it-it/take.screenshot.intent b/locale/it-it/take.screenshot.intent deleted file mode 100644 index 5d253b4..0000000 --- a/locale/it-it/take.screenshot.intent +++ /dev/null @@ -1,2 +0,0 @@ -(scatta|fai) uno screenshot -scatta una foto(grafia|) \ No newline at end of file diff --git a/locale/nl-nl/take.screenshot.intent b/locale/nl-nl/take.screenshot.intent deleted file mode 100644 index d0b3eeb..0000000 --- a/locale/nl-nl/take.screenshot.intent +++ /dev/null @@ -1,2 +0,0 @@ -maak (een) schermafbeelding -schermenhot \ No newline at end of file diff --git a/locale/pt-pt/take.screenshot.intent b/locale/pt-pt/take.screenshot.intent deleted file mode 100644 index 3079283..0000000 --- a/locale/pt-pt/take.screenshot.intent +++ /dev/null @@ -1,2 +0,0 @@ -tirar a captura de tela -tirar uma captura de tela \ No newline at end of file diff --git a/res/desktop/skill.json b/res/desktop/skill.json deleted file mode 100644 index e102723..0000000 --- a/res/desktop/skill.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "authorname": "OpenVoiceOS", - "foldername": "skill-ovos-homescreen", - "url": "https://github.com/OpenVoiceOS/skill-ovos-homescreen", - "branch": "dev", - "license": "apache-2.0", - "tags": [ - "permissive-license" - ], - "short_description": "Provides the resting screen for OVOS", - "last_updated": "2022-10-13T20:46:20Z", - "requirements": { - "python": [ - "requests>=2.26.0", - "pillow==7.1.2", - "ovos_utils>=0.0.6" - ], - "skill": [], - "system": {} - }, - "desktopFile": false, - "examples": [] -} \ No newline at end of file diff --git a/scripts/sync_translations.py b/scripts/sync_translations.py deleted file mode 100644 index 342b469..0000000 --- a/scripts/sync_translations.py +++ /dev/null @@ -1,78 +0,0 @@ -"""this script should run in every PR originated from @gitlocalize-app -TODO - before PR merge -""" - -import json -from os.path import dirname -import os - -locale = f"{dirname(dirname(__file__))}/locale" -tx = f"{dirname(dirname(__file__))}/translations" - - -for lang in os.listdir(tx): - intents = f"{tx}/{lang}/intents.json" - dialogs = f"{tx}/{lang}/dialogs.json" - vocs = f"{tx}/{lang}/vocabs.json" - regexes = f"{tx}/{lang}/regexes.json" - - if os.path.isfile(intents): - with open(intents) as f: - data = json.load(f) - for fid, samples in data.items(): - if samples: - samples = list(set([s.strip() for s in samples - if s and s.strip() != "[UNUSED]"])) # s may be None - if fid.startswith("/"): - p = f"{locale}/{lang.lower()}{fid}" - else: - p = f"{locale}/{lang.lower()}/{fid}" - os.makedirs(os.path.dirname(p), exist_ok=True) - with open(f"{locale}/{lang.lower()}/{fid}", "w") as f: - f.write("\n".join(sorted(samples))) - - if os.path.isfile(dialogs): - with open(dialogs) as f: - data = json.load(f) - for fid, samples in data.items(): - if samples: - samples = list(set([s.strip() for s in samples - if s and s.strip() != "[UNUSED]"])) # s may be None - if fid.startswith("/"): - p = f"{locale}/{lang.lower()}{fid}" - else: - p = f"{locale}/{lang.lower()}/{fid}" - os.makedirs(os.path.dirname(p), exist_ok=True) - with open(f"{locale}/{lang.lower()}/{fid}", "w") as f: - f.write("\n".join(sorted(samples))) - - if os.path.isfile(vocs): - with open(vocs) as f: - data = json.load(f) - for fid, samples in data.items(): - if samples: - samples = list(set([s.strip() for s in samples - if s and s.strip() != "[UNUSED]"])) # s may be None - if fid.startswith("/"): - p = f"{locale}/{lang.lower()}{fid}" - else: - p = f"{locale}/{lang.lower()}/{fid}" - os.makedirs(os.path.dirname(p), exist_ok=True) - with open(f"{locale}/{lang.lower()}/{fid}", "w") as f: - f.write("\n".join(sorted(samples))) - - if os.path.isfile(regexes): - with open(regexes) as f: - data = json.load(f) - for fid, samples in data.items(): - if samples: - samples = list(set([s.strip() for s in samples - if s and s.strip() != "[UNUSED]"])) # s may be None - if fid.startswith("/"): - p = f"{locale}/{lang.lower()}{fid}" - else: - p = f"{locale}/{lang.lower()}/{fid}" - os.makedirs(os.path.dirname(p), exist_ok=True) - with open(f"{locale}/{lang.lower()}/{fid}", "w") as f: - f.write("\n".join(sorted(samples))) - diff --git a/translations/ca-es/intents.json b/translations/ca-es/intents.json deleted file mode 100644 index 22f38fa..0000000 --- a/translations/ca-es/intents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "take.screenshot.intent": [ - "fes una captura de pantalla", - "fes una captura" - ] -} diff --git a/translations/da-dk/intents.json b/translations/da-dk/intents.json deleted file mode 100644 index f2983ea..0000000 --- a/translations/da-dk/intents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "take.screenshot.intent": [ - "tag et skærmbillede", - "tag et skærmbillede" - ] -} diff --git a/translations/de-de/intents.json b/translations/de-de/intents.json deleted file mode 100644 index bd10c63..0000000 --- a/translations/de-de/intents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "take.screenshot.intent": [ - "einen Screenshot machen", - "schauspielerisch" - ] -} \ No newline at end of file diff --git a/translations/en-us/intents.json b/translations/en-us/intents.json deleted file mode 100644 index a2123c3..0000000 --- a/translations/en-us/intents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "take.screenshot.intent": [ - "take screenshot", - "take a screenshot" - ] -} \ No newline at end of file diff --git a/translations/es-es/intents.json b/translations/es-es/intents.json deleted file mode 100644 index ab451ef..0000000 --- a/translations/es-es/intents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "take.screenshot.intent": [ - "tomar una captura de pantalla", - "tomar captura de pantalla" - ] -} \ No newline at end of file diff --git a/translations/fr-fr/intents.json b/translations/fr-fr/intents.json deleted file mode 100644 index 07763db..0000000 --- a/translations/fr-fr/intents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "take.screenshot.intent": [ - "prendre une capture d'\u00e9cran", - "capture d'\u00e9cran" - ] -} \ No newline at end of file diff --git a/translations/it-it/intents.json b/translations/it-it/intents.json deleted file mode 100644 index 6715e18..0000000 --- a/translations/it-it/intents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "take.screenshot.intent": [ - "(scatta|fai) uno screenshot", - "scatta una foto(grafia|)" - ] -} diff --git a/translations/nl-nl/intents.json b/translations/nl-nl/intents.json deleted file mode 100644 index db17bc5..0000000 --- a/translations/nl-nl/intents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "take.screenshot.intent": [ - "maak (een) schermafbeelding", - "schermenhot" - ] -} diff --git a/translations/pt-pt/intents.json b/translations/pt-pt/intents.json deleted file mode 100644 index 7d31cd0..0000000 --- a/translations/pt-pt/intents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "take.screenshot.intent": [ - "tirar uma captura de tela", - "tirar a captura de tela" - ] -} \ No newline at end of file