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

SubModules #37

Open
wants to merge 54 commits into
base: dev
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
255a3e0
Bump addon_lastTestedNVDAVersion
JulienCochuyt Jul 19, 2024
c5b85f5
SubModules: Set addon feature version
JulienCochuyt Jul 19, 2024
2711cbf
ElementDescription: Add document URL
JulienCochuyt Jul 21, 2024
8443a8c
SubModules: GUI/JSON: Add a new `subModule` property to zones
JulienCochuyt Jul 21, 2024
a97d2df
SubModules: GUI/JSON: Add new `url` criterion
JulienCochuyt Jul 21, 2024
ad14036
Node search: Slight optimization of role and states search
JulienCochuyt Jul 21, 2024
96177c2
Node search: Slight optimization and rationalize `in` test
JulienCochuyt Jul 21, 2024
49d621a
SubModules: Node search: Implement `url` criterion
JulienCochuyt Jul 21, 2024
3c45d7f
Zones: Support rules matching multiple results
JulienCochuyt Jul 23, 2024
295d732
SubModules: Switch WebModules package to `webModulesSM` for easier te…
JulienCochuyt Jul 25, 2024
ef8b77a
Zone: Step towards zones not bound to a single node (#43)
JulienCochuyt Jul 25, 2024
e83a67f
Remove dead code
JulienCochuyt Aug 21, 2024
49e835c
Rename more legacy "WebApp" and "MarkerManager" leftovers
JulienCochuyt Aug 21, 2024
20c013a
GUI: Follow-up of NVDA #15121
JulienCochuyt Aug 25, 2024
5761d4c
Rules offline edition (#42)
JulienCochuyt Aug 26, 2024
e33f9ce
Support the "multiple" property for rules of type "parent"
JulienCochuyt Aug 26, 2024
b55ffe9
SubModules WIP - Very early alpha
JulienCochuyt Aug 26, 2024
e516776
SubModules: GUI: Editor: Offer a combo for SubModule selection rather…
JulienCochuyt Aug 29, 2024
0a42480
SubModules: GUI: Editor: Prompt for creation of a missing SubModule
JulienCochuyt Aug 30, 2024
4ad7177
WebAccessBmdti: Force re-analysis of the nodes when manually refreshi…
JulienCochuyt Aug 30, 2024
b46b3d7
GUI: Rules Manager: Widen the "filter" field and make it enlarge with…
JulienCochuyt Sep 1, 2024
0590dc1
GUI: Rules Manager: Group by Position: Fix rendering of nested zones
JulienCochuyt Sep 1, 2024
2d0a3ff
Nodes: Fix test for boundary check
JulienCochuyt Sep 1, 2024
c4b5e06
SubModules: Control Mutation
JulienCochuyt Sep 2, 2024
d315283
SubModules: RuleManager.iterResultsAtTextInfo: Include all WebModules…
JulienCochuyt Sep 2, 2024
13bbbf0
SubModules: Helper: Cache the WebModule retrieved by position for an …
JulienCochuyt Sep 2, 2024
5bb2625
SubModules: GUI: Rule Editor: Set a more explicit dialog title
JulienCochuyt Sep 2, 2024
0a0fd72
GUI: Context: Reword "Global" to "General" to avoid confusion with "G…
JulienCochuyt Sep 4, 2024
f864da5
Restore Element Description gesture
AAClause Sep 9, 2024
10328d5
GUI: Properties: Fix display value of custom autoAction
JulienCochuyt Sep 10, 2024
1d4a253
Control Mutation: Fix error handling
JulienCochuyt Sep 10, 2024
f85d07b
fix(rule/manager): resolve AttributeError in Dialog.onRuleDelete by u…
AAClause Sep 11, 2024
93b890b
SubModules: Try fix handling of custom event handlers
JulienCochuyt Sep 10, 2024
55b928c
Switch SubModules and Control Mutation indexing from id to (docHandle…
JulienCochuyt Sep 11, 2024
b68aaa5
GUI: Rules Manager: When grouping by position, mention which alternat…
JulienCochuyt Sep 12, 2024
aa2b0c9
GUI: Rules Manager: Add grouping by context
JulienCochuyt Sep 13, 2024
e06659b
RuleManager: Restore `script_notFound` fallback
JulienCochuyt Sep 17, 2024
e790e05
fix criteria not found by searchNode when text surounded with spaces
GatienBouyssou Sep 17, 2024
8ddb6f2
NodeManager: Refine detection of control ID doubles
JulienCochuyt Sep 18, 2024
5f7cf2e
SubModules: Fix loading the proper SubModule on a nested dialog
JulienCochuyt Sep 18, 2024
455b0e6
GUI: Editors: Remove autoAction from Actions panels
JulienCochuyt Sep 13, 2024
e28d902
Criteria Editor: testCriteria: Drop properties
AAClause Sep 19, 2024
e781420
Overlay: Add support for application root elements
JulienCochuyt Sep 26, 2024
82c1846
TableHandler integration: Move `createResult` from `Criteria` to `Rule`
JulienCochuyt Oct 15, 2024
fe24a80
WebAccessBmdti: Manual refresh is now synchronous
JulienCochuyt Oct 15, 2024
a2b0e54
NodeManager: Clean-up
JulienCochuyt Oct 15, 2024
c2abec9
Bump version to 2024.10.15-dev+subModules
JulienCochuyt Nov 6, 2024
73c329c
GUI: Input Gestures: Fix adding multiple gesture bindings in a row
JulienCochuyt Nov 14, 2024
e7f4fcd
GUI: Rule Summary: Display criteria set index as 1-based
JulienCochuyt Dec 3, 2024
b303e20
GUI: Editors: Do not attempt to save gesture bindings or properties n…
JulienCochuyt Dec 6, 2024
72de3de
Bump version to 2024.12.06-dev+subModules
JulienCochuyt Dec 9, 2024
fdb3099
GUI: Rule Editor: Initially select the alternative matched at caret
JulienCochuyt Dec 9, 2024
ff8c20e
Update fr translation
JulienCochuyt Dec 10, 2024
d63ba00
GUI: Summary: Condense alternatives
JulienCochuyt Dec 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
GUI: Rules Manager: Add grouping by context
  • Loading branch information
JulienCochuyt committed Oct 17, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit aa2b0c9e3ef83c7850ff97171c1723adbd94da85
92 changes: 77 additions & 15 deletions addon/globalPlugins/webAccess/gui/rule/manager.py
Original file line number Diff line number Diff line change
@@ -30,6 +30,7 @@


from collections import namedtuple
import sys
import wx

import addonHandler
@@ -52,6 +53,13 @@
from .. import ContextualDialog, showContextualDialog, stripAccel
from .editor import getSummary


if sys.version_info[1] < 9:
from typing import Mapping
else:
from collections.abc import Mapping


try:
from six import iteritems
except ImportError:
@@ -73,23 +81,14 @@ def show(context, parent):
TreeItemData = namedtuple("TreeItemData", ("label", "obj", "children"))


def getGestureLabel(gesture):
source, main = inputCore.getDisplayTextForGestureIdentifier(
inputCore.normalizeGestureIdentifier(gesture)
)
if gesture.startswith("kb:"):
return main
return "{main} ({source})".format(source=source, main=main)


def getResultLabel(result):
rule = result.rule
def getCriteriaLabel(criteria):
rule = criteria.rule
label = rule.name
if len(rule.criteria) > 1:
if result.criteria.name:
label += f" - {result.criteria.name}"
if criteria.name:
label += f" - {criteria.name}"
else:
label += f" - #{rule.criteria.index(result.criteria) + 1}"
label += f" - #{rule.criteria.index(criteria) + 1}"
if rule._gestureMap:
label += " ({gestures})".format(gestures=", ".join(
inputCore.getDisplayTextForGestureIdentifier(identifier)[1]
@@ -98,6 +97,15 @@ def getResultLabel(result):
return label


def getGestureLabel(gesture):
source, main = inputCore.getDisplayTextForGestureIdentifier(
inputCore.normalizeGestureIdentifier(gesture)
)
if gesture.startswith("kb:"):
return main
return "{main} ({source})".format(source=source, main=main)


def getRuleLabel(rule):
label = rule.name
if rule._gestureMap:
@@ -171,6 +179,54 @@ def iterRulesByGesture(ruleManager, filter=None, active=False):
)


def getRulesByContext(ruleManager, filter=None, active=False):
contexts: Mapping[tuple[str, str, str], Rule] = {}
for rule in getRules(ruleManager):
if filter and filter not in rule.name.casefold():
continue
if active:
results = rule_getResults_safe(rule)
if not results:
continue
alternatives = (result.criteria for result in results)
else:
alternatives = (criteria for criteria in rule.criteria)
for criteria in alternatives:
contexts.setdefault((
criteria.contextPageTitle or "", # Avoiding None eases later sorting
criteria.contextPageType or "",
criteria.contextParent or "",
), []).append(TreeItemData(
label=getCriteriaLabel(criteria),
obj=rule,
children=[]
))
for context, tids in sorted(
contexts.items(),
key=lambda item: (item[0] == ("", "", ""), item[0]) # Move "General" to the end
):
parts = []
if context[0]:
# Translators: A part of a context grouping label on the Rules Manager
parts.append(_("Page Title: {contextPageTitle}").format(contextPageTitle=context[0]))
if context[1]:
# Translators: A part of a context grouping label on the Rules Manager
parts.append(_("Page Type: {contextPageTitle}").format(contextPageTitle=context[1]))
if context[2]:
# Translators: A part of a context grouping label on the Rules Manager
parts.append(_("Parent: {contextPageTitle}").format(contextPageTitle=context[2]))
if parts:
label = ", ".join(parts)
else:
# Translators: A context grouping label on the Rules Manager
label = "General"
yield TreeItemData(
label=label,
obj=None,
children=sorted(tids, key=lambda tid: tid.label)
)


def getRulesByName(ruleManager, filter=None, active=False):
return sorted(
(
@@ -210,7 +266,7 @@ def getRulesByPosition(ruleManager, filter=None, active=True):
if layer and rule.layer != layer:
continue
tid = TreeItemData(
label=getResultLabel(result),
label=getCriteriaLabel(result.criteria),
obj=result,
children=[]
)
@@ -273,6 +329,12 @@ def getRulesByType(ruleManager, filter=None, active=False):
label=pgettext("webAccess.rulesGroupBy", "&Type"),
func=getRulesByType
),
GroupBy(
id="type",
# Translator: Grouping option on the RulesManager dialog.
label=pgettext("webAccess.rulesGroupBy", "&Context"),
func=getRulesByContext
),
GroupBy(
id="gestures",
# Translator: Grouping option on the RulesManager dialog.