Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export/import/backup modules #26

Open
javidominguez opened this issue Mar 31, 2024 · 1 comment
Open

Export/import/backup modules #26

javidominguez opened this issue Mar 31, 2024 · 1 comment

Comments

@javidominguez
Copy link

It is not a priority but it would be advisable to implement a simple way to export and import modules.Not all users are knowledgeable enough to browse to the folder where the json files are to make a copy themselves.

@AAClause
Copy link
Member

AAClause commented Apr 1, 2024

Hi @javidominguez,
Thanks for your suggestion!
In the meantime, just know that you can package a web module into an add-on. Here's an example:

webModuleSample/
|-- manifest.ini
`-- webModulesMC
    |-- nvaccess.json
    |-- nvaccess.py
webModuleSample/manifest.ini
name = webModuleSample
summary = "Not your average sample; this is the Chuck Norris of webmodule samples, flexing on nvaccess.org"
description = """Let's paint a picture here. Imagine stumbling upon the Excalibur of webmodules. Got it? Good. Now wake up, because reality is even better. This webmodule sample is so revolutionary, other samples have developed an inferiority complex.

To give it a whirl:

- Propel yourself over to nvaccess.org. Of course, make sure you've got the webAccess add-on, along with this bad boy, ready to rock 'n' roll.
- Once you're in it to win it:
  * Smash CTRL+SHIFT+p to let NVDA know who's boss.
  * Hit page up/down with the finesse of a ninja to snag focus on the download link in the menu (psyche! not on the download page, gotcha).
- Landed on the download page? Sweet. Here, you can zero in on the download button with the ol' page up/download jig or show that button who's daddy with CTRL+SHIFT+d.
"""
author = "Anonymous Hero"
url = https://example.com
version = 42.0  # Because why not make it the answer to life, the universe, and everything? 
docFileName = "README_OR_ELSE.html"
minimumNVDAVersion = 2022.1
lastTestedNVDAVersion = 2024.1
updateChannel = dev
webModuleSample/webModulesMC/nvaccess.json
{
    "WebModule": {
        "name": "nvaccess",
        "url": [
            "www.nvaccess.org"
        ],
        "windowTitle": "",
        "help": ""
    },
    "formatVersion": "0.7-dev",
    "Rules": {
        "context - download page": {
            "name": "context - download page",
            "type": "pageType",
            "criteria": [
                {
                    "tag": "header",
                    "className": "download&header-title"
                }
            ],
            "gestures": {},
            "multiple": false,
            "formMode": false,
            "skip": false,
            "sayName": true
        },
        "sample marker (download link)": {
            "name": "sample marker (download link)",
            "type": "marker",
            "criteria": [
                {
                    "contextPageType": "!context - download page",
                    "text": "Download",
                    "tag": "a",
                    "states": "16777216"
                }
            ],
            "gestures": {},
            "multiple": false,
            "formMode": false,
            "skip": false,
            "sayName": false
        },
        "download button": {
            "name": "download button",
            "type": "marker",
            "criteria": [
                {
                    "contextPageType": "context - download page",
                    "text": "DOWNLOAD",
                    "tag": "button",
                    "states": "16777216"
                }
            ],
            "gestures": {
                "kb:control+d+shift": "activate"
            },
            "multiple": false,
            "formMode": false,
            "skip": false,
            "sayName": true
        },
        "proclaim": {
            "name": "proclaim",
            "type": "marker",
            "criteria": [
                {
                    "tag": "div"
                }
            ],
            "gestures": {
                "kb:control+p+shift": "proclaim"
            },
            "multiple": false,
            "formMode": false,
            "skip": true,
            "sayName": true
        }
    }
}
webModuleSample/webModulesMC/nvaccess.py
import ui
from globalPlugins.webAccess import webModuleHandler

API_VERSION = str(webModuleHandler.WebModule.API_VERSION)

EPIC_ANNOUNCEMENT = "Congratulations, you've chosen NVDA, the pinnacle of screen readers. This is your expressway to barrier-free browsing, where each spoken word and each felt Braille dot shatter the walls of exclusion. With NVDA, the web unfolds, offering voice and touch to those thirsty for knowledge and interaction. A triumph for accessibility, a revolution for inclusivity. Welcome to an era where seeing differently is not a hindrance, but a wealth."

class WebModule(webModuleHandler.WebModule):

	def action_proclaim(self, result, gesture):
		ui.message(EPIC_ANNOUNCEMENT)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants