Skip to content

Commit

Permalink
Zone: Step towards zones not bound to a single node (#43)
Browse files Browse the repository at this point in the history
Remaining stumble points:
 - AutoAction: Based on controlID
 - Context: Based on nodes
  • Loading branch information
JulienCochuyt committed Oct 15, 2024
1 parent 5feed64 commit e633c86
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 99 deletions.
4 changes: 2 additions & 2 deletions addon/globalPlugins/webAccess/gui/criteriaEditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@



__version__ = "2024.07.19"
__version__ = "2024.07.25"
__authors__ = (
"Shirley Noël <[email protected]>",
"Julien Cochuyt <[email protected]>",
Expand Down Expand Up @@ -616,7 +616,7 @@ def initData(self, context):
rule = result.rule
if (
rule.type in (ruleTypes.PARENT, ruleTypes.ZONE)
and node in result.node
and result.containsNode(node)
):
parents.insert(0, rule.name)
self.contextParentCombo.Set(parents)
Expand Down
8 changes: 4 additions & 4 deletions addon/globalPlugins/webAccess/overlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,10 +504,10 @@ def _caretMovementScriptHelper(
msg += _("Press escape to cancel zone restriction.")
ui.message(msg)
if posConstant == textInfos.POSITION_FIRST:
pos = zone.startOffset
pos = zone.result.startOffset
posConstant = textInfos.offsets.Offsets(pos, pos)
elif posConstant == textInfos.POSITION_LAST:
pos = max(zone.endOffset - 1, zone.startOffset)
pos = max(zone.result.endOffset - 1, zone.result.startOffset)
posConstant = textInfos.offsets.Offsets(pos, pos)
super()._caretMovementScriptHelper(
gesture,
Expand Down Expand Up @@ -556,12 +556,12 @@ def _iterNodesByType(self, itemType, direction="next", pos=None):
direction
):
if zone:
if item.textInfo._startOffset < zone.startOffset:
if item.textInfo._startOffset < zone.result.startOffset:
if direction == "next":
continue
else:
return
elif item.textInfo._startOffset >= zone.endOffset:
elif item.textInfo._startOffset >= zone.result.endOffset:
if direction == "previous":
continue
else:
Expand Down
Loading

0 comments on commit e633c86

Please sign in to comment.