Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion addon/globalPlugins/webAccess/gui/rule/criteriaEditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,8 @@ def initData(self, context):
else:
for index in range(nbAlternatives):
self.sequenceOrderChoice.Append(str(index + 1))
index = data.get("criteriaIndex", nbAlternatives + 1)
# Default to the last position (append) if unset, e.g. when adding a new alternative.
index = data.get("criteriaIndex", nbAlternatives - 1)
self.sequenceOrderChoice.SetSelection(index)
if self.getRuleType() == ruleTypes.ZONE:
key = "convert.single" if isDualNode(data) else "convert.dual"
Expand Down
12 changes: 9 additions & 3 deletions addon/globalPlugins/webAccess/gui/rule/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,12 @@ def onCriteriaChange(self, change: Change, index: int):
parent = self.Parent
dlg = parent.Parent.Parent
if change is Change.CREATION:
dlg.switchToFullEditor()
# The new alternative has already been inserted into the rule's criteria
# list. Do not flush the currently shown single-node panel: it still holds
# the widget values of the previous sole alternative and, since indices may
# have shifted, could otherwise overwrite the newly created alternative's
# data with stale data (e.g. when it is reordered to the first position).
dlg.switchToFullEditor(updateData=False)
return
parent.switchToAppropriatePanel()
parent.shownPanel.initData(self.context)
Expand Down Expand Up @@ -1417,11 +1422,12 @@ def onCharHook(self, evt):
return
super().onCharHook(evt)

def switchToFullEditor(self):
def switchToFullEditor(self, updateData=True):
if not self.simpleMode:
wx.Bell()
return
self.currentCategory.updateData()
if updateData:
self.currentCategory.updateData()
tree = self.catListCtrl
treePath = []
child = tree.GetSelection()
Expand Down