From 457e9d225853bffef5e6b70fd483511257b24ee1 Mon Sep 17 00:00:00 2001 From: masarray Date: Mon, 20 Jul 2026 10:07:14 +0700 Subject: [PATCH 1/6] Apply caption-based IED capability row --- .../apply-caption-capabilities-temp.yml | 346 ++++++++++++++++++ 1 file changed, 346 insertions(+) create mode 100644 .github/workflows/apply-caption-capabilities-temp.yml diff --git a/.github/workflows/apply-caption-capabilities-temp.yml b/.github/workflows/apply-caption-capabilities-temp.yml new file mode 100644 index 000000000..bdf2d751d --- /dev/null +++ b/.github/workflows/apply-caption-capabilities-temp.yml @@ -0,0 +1,346 @@ +name: Temporary apply caption-based IED capabilities + +on: + push: + branches: [ fix/ied-card-caption-capabilities ] + +permissions: + contents: write + +jobs: + patch: + if: github.actor != 'github-actions[bot]' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: fix/ied-card-caption-capabilities + fetch-depth: 0 + + - name: Patch IED card capability UX + shell: python + run: | + from pathlib import Path + import re + + xaml_path = Path('MainWindow.xaml') + xaml = xaml_path.read_text(encoding='utf-8') + xaml = xaml.replace('', '', 1) + + action_pattern = re.compile( + r'\s* + + + + + + + + +''' + xaml, count = action_pattern.subn(action_replacement, xaml, count=1) + if count != 1: + raise SystemExit('Primary IED action block was not found') + xaml_path.write_text(xaml, encoding='utf-8') + + behavior_path = Path('FaultRecordUxBehavior.cs') + text = behavior_path.read_text(encoding='utf-8') + text = text.replace( + ' private const string CapabilityPanelMarker = "ARSAS_IED_CAPABILITIES";\n', + ' private const string CapabilityPanelMarker = "ARSAS_IED_CAPABILITIES";\n' + ' private const string ActionPanelMarker = "ARSAS_IED_PRIMARY_ACTIONS";\n', 1) + + old = ''' var actionPanel = FindDescendants(item) + .FirstOrDefault(panel => + panel.Orientation == Orientation.Horizontal && + panel.HorizontalAlignment == HorizontalAlignment.Right && + FindDescendants - - - - - -''' - xaml, count = action_pattern.subn(action_replacement, xaml, count=1) - if count != 1: - raise SystemExit('Primary IED action block was not found') - xaml_path.write_text(xaml, encoding='utf-8') - - behavior_path = Path('FaultRecordUxBehavior.cs') - text = behavior_path.read_text(encoding='utf-8') - text = text.replace( - ' private const string CapabilityPanelMarker = "ARSAS_IED_CAPABILITIES";\n', - ' private const string CapabilityPanelMarker = "ARSAS_IED_CAPABILITIES";\n' - ' private const string ActionPanelMarker = "ARSAS_IED_PRIMARY_ACTIONS";\n', 1) - - old = ''' var actionPanel = FindDescendants(item) - .FirstOrDefault(panel => - panel.Orientation == Orientation.Horizontal && - panel.HorizontalAlignment == HorizontalAlignment.Right && - FindDescendants