mirror of
https://github.com/We-Dont-Byte/Mind_Reader.git
synced 2024-11-14 19:25:59 +00:00
Add persistent accessibility pane (#9)
* Add persistent accessibility pane This will facilitate more extensive usage of the menu than the context menu.
This commit is contained in:
parent
2c5a381b93
commit
c0f23d6de1
14
media/dep.svg
Normal file
14
media/dep.svg
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: Sketch 40.3 (33839) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>Slice</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="dep" transform="translate(4.000000, 6.000000)" fill="#ffffff">
|
||||
<g id="Page-1">
|
||||
<path d="M5.14285714,16.2778182 C5.14285714,16.9917576 4.89285714,17.5986061 4.39285714,18.0983636 C3.89285714,18.5981212 3.28571429,18.848 2.57142857,18.848 C1.85714286,18.848 1.25,18.5981212 0.75,18.0983636 C0.25,17.5986061 0,16.9917576 0,16.2778182 C0,15.5638788 0.25,14.9570303 0.75,14.4572727 C1.25,13.9575152 1.85714286,13.7076364 2.57142857,13.7076364 C3.28571429,13.7076364 3.89285714,13.9575152 4.39285714,14.4572727 C4.89285714,14.9570303 5.14285714,15.5638788 5.14285714,16.2778182 L5.14285714,16.2778182 L5.14285714,16.2778182 Z M5.14285714,9.424 C5.14285714,10.1379394 4.89285714,10.7447879 4.39285714,11.2445455 C3.89285714,11.744303 3.28571429,11.9941818 2.57142857,11.9941818 C1.85714286,11.9941818 1.25,11.744303 0.75,11.2445455 C0.25,10.7447879 0,10.1379394 0,9.424 C0,8.7100606 0.25,8.1032121 0.75,7.6034545 C1.25,7.103697 1.85714286,6.8538182 2.57142857,6.8538182 C3.28571429,6.8538182 3.89285714,7.103697 4.39285714,7.6034545 C4.89285714,8.1032121 5.14285714,8.7100606 5.14285714,9.424 L5.14285714,9.424 L5.14285714,9.424 Z M24,14.9927273 L24,17.5629091 C24,17.6789242 23.9575893,17.779322 23.8727679,17.8641023 C23.7879464,17.9488826 23.6875,17.9912727 23.5714286,17.9912727 L7.2857143,17.9912727 C7.1696429,17.9912727 7.0691964,17.9488826 6.984375,17.8641023 C6.8995536,17.779322 6.8571429,17.6789242 6.8571429,17.5629091 L6.8571429,14.9927273 C6.8571429,14.8767121 6.8995536,14.7763144 6.984375,14.6915341 C7.0691964,14.6067538 7.1696429,14.5643636 7.2857143,14.5643636 L23.5714286,14.5643636 C23.6875,14.5643636 23.7879464,14.6067538 23.8727679,14.6915341 C23.9575893,14.7763144 24,14.8767121 24,14.9927273 L24,14.9927273 L24,14.9927273 Z M5.14285714,2.57018182 C5.14285714,3.2841212 4.89285714,3.8909697 4.39285714,4.3907273 C3.89285714,4.8904848 3.28571429,5.1403636 2.57142857,5.1403636 C1.85714286,5.1403636 1.25,4.8904848 0.75,4.3907273 C0.25,3.8909697 0,3.2841212 0,2.57018182 C0,1.85624242 0.25,1.24939394 0.75,0.74963636 C1.25,0.24987879 1.85714286,0 2.57142857,0 C3.28571429,0 3.89285714,0.24987879 4.39285714,0.74963636 C4.89285714,1.24939394 5.14285714,1.85624242 5.14285714,2.57018182 L5.14285714,2.57018182 L5.14285714,2.57018182 Z M24,8.1389091 L24,10.7090909 C24,10.8251061 23.9575893,10.9255038 23.8727679,11.0102841 C23.7879464,11.0950644 23.6875,11.1374545 23.5714286,11.1374545 L7.2857143,11.1374545 C7.1696429,11.1374545 7.0691964,11.0950644 6.984375,11.0102841 C6.8995536,10.9255038 6.8571429,10.8251061 6.8571429,10.7090909 L6.8571429,8.1389091 C6.8571429,8.0228939 6.8995536,7.9224962 6.984375,7.8377159 C7.0691964,7.7529356 7.1696429,7.7105455 7.2857143,7.7105455 L23.5714286,7.7105455 C23.6875,7.7105455 23.7879464,7.7529356 23.8727679,7.8377159 C23.9575893,7.9224962 24,8.0228939 24,8.1389091 L24,8.1389091 L24,8.1389091 Z M24,1.28509091 L24,3.8552727 C24,3.9712879 23.9575893,4.0716856 23.8727679,4.1564659 C23.7879464,4.2412462 23.6875,4.2836364 23.5714286,4.2836364 L7.2857143,4.2836364 C7.1696429,4.2836364 7.0691964,4.2412462 6.984375,4.1564659 C6.8995536,4.0716856 6.8571429,3.9712879 6.8571429,3.8552727 L6.8571429,1.28509091 C6.8571429,1.16907576 6.8995536,1.06867803 6.984375,0.98389773 C7.0691964,0.89911742 7.1696429,0.85672727 7.2857143,0.85672727 L23.5714286,0.85672727 C23.6875,0.85672727 23.7879464,0.89911742 23.8727679,0.98389773 C23.9575893,1.06867803 24,1.16907576 24,1.28509091 L24,1.28509091 L24,1.28509091 Z" id="Shape"></path>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 3.9 KiB |
21
package.json
21
package.json
@ -268,7 +268,26 @@
|
||||
"markdownDescription": "Specifies the serial port path to use if `#mindreader.connectAutomatically#` is not set."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"views": {
|
||||
"accessActions": [
|
||||
{
|
||||
"id": "accessActions",
|
||||
"name": "Access Actions",
|
||||
"icon": "media/dep.svg",
|
||||
"contextualTitle": "Accessibility Menu Actions"
|
||||
}
|
||||
]
|
||||
},
|
||||
"viewsContainers": {
|
||||
"activitybar": [
|
||||
{
|
||||
"id": "accessActions",
|
||||
"title": "Access Actions",
|
||||
"icon": "media/dep.svg"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"vscode:prepublish": "npm run compile",
|
||||
|
47
src/accessNodeProvider.ts
Normal file
47
src/accessNodeProvider.ts
Normal file
@ -0,0 +1,47 @@
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
// list of all actions
|
||||
let actions: AccessAction[] = [];
|
||||
|
||||
class AccessAction extends vscode.TreeItem {
|
||||
constructor(
|
||||
public readonly label: string,
|
||||
public readonly command: vscode.Command
|
||||
) {
|
||||
super(label, vscode.TreeItemCollapsibleState.None);
|
||||
}
|
||||
};
|
||||
|
||||
export default class AccessNodeProvider implements vscode.TreeDataProvider<AccessAction> {
|
||||
public getTreeItem(a: AccessAction): vscode.TreeItem {
|
||||
return a;
|
||||
}
|
||||
|
||||
public async getChildren(): Promise<AccessAction[]> {
|
||||
if (actions.length === 0) {
|
||||
// fetch and cache mind-reader options
|
||||
let cmds: string[] = await vscode.commands.getCommands(true); // get non-builtin commands
|
||||
cmds = cmds.filter(x => x.startsWith('mind-reader')); // filter mind-reader commands
|
||||
|
||||
cmds.forEach(c => {
|
||||
let humanReadable = c.replace(/^mind-reader\./, ''); // strip extensions name
|
||||
|
||||
// Convert camelCaseText to Title Case Text
|
||||
humanReadable = humanReadable.replace(/([A-Z])/g, ' $1');
|
||||
humanReadable = humanReadable.charAt(0).toUpperCase() + humanReadable.slice(1);
|
||||
|
||||
// add item to actions
|
||||
actions.push(new AccessAction(
|
||||
humanReadable,
|
||||
{
|
||||
title: humanReadable,
|
||||
command: c,
|
||||
tooltip: humanReadable
|
||||
}
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
return Promise.resolve(actions);
|
||||
}
|
||||
}
|
@ -3,6 +3,8 @@ import * as vscode from 'vscode';
|
||||
import * as pl from './pylex';
|
||||
import commands from './commands';
|
||||
|
||||
import AccessNodeProvider from './accessNodeProvider'
|
||||
|
||||
let parser: pl.Parser = new pl.Parser();
|
||||
|
||||
export function activate(context: vscode.ExtensionContext) {
|
||||
@ -19,6 +21,10 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
);
|
||||
context.subscriptions.push(disposable);
|
||||
});
|
||||
|
||||
let provider = new AccessNodeProvider();
|
||||
vscode.window.registerTreeDataProvider('accessActions', provider);
|
||||
|
||||
}
|
||||
|
||||
export function deactivate() {}
|
||||
|
Loading…
Reference in New Issue
Block a user