Skip to content

Commit fad5331

Browse files
committed
fixed some btns and enhanced CI tests
1 parent 7889fe1 commit fad5331

25 files changed

+982
-261
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
name: CI
22

3-
# on:
4-
# push:
5-
# branches: [ main ]
6-
# paths-ignore:
7-
# - '**.md'
8-
# - 'docs/**'
9-
# - 'LICENSE'
10-
# - '.github/ISSUE_TEMPLATE/**'
11-
# pull_request:
12-
# branches: [ main ]
13-
# paths-ignore:
14-
# - '**.md'
15-
# - 'docs/**'
16-
# - 'LICENSE'
17-
# - '.github/ISSUE_TEMPLATE/**'
183
on:
4+
push:
5+
branches: [ main ]
6+
paths-ignore:
7+
- '**.md'
8+
- 'docs/**'
9+
- 'LICENSE'
10+
- '.github/ISSUE_TEMPLATE/**'
11+
pull_request:
12+
branches: [ main ]
13+
paths-ignore:
14+
- '**.md'
15+
- 'docs/**'
16+
- 'LICENSE'
17+
- '.github/ISSUE_TEMPLATE/**'
1918
workflow_dispatch:
2019

2120
concurrency:
@@ -26,10 +25,14 @@ jobs:
2625
test:
2726
name: Run Tests
2827
runs-on: ${{ matrix.os }}
28+
# Python 3.15 only on main branch push (not PRs) to save time
29+
if: |
30+
matrix.python-version == '3.14' ||
31+
(matrix.python-version == '3.15' && github.event_name == 'push' && github.ref == 'refs/heads/main')
2932
strategy:
3033
matrix:
3134
os: [ubuntu-latest, windows-latest]
32-
python-version: ["3.11", "3.12"]
35+
python-version: ["3.14", "3.15"]
3336

3437
steps:
3538
- uses: actions/checkout@v6
@@ -49,6 +52,8 @@ jobs:
4952
- name: Run Tests
5053
run: |
5154
export PYTHONPATH=$PYTHONPATH:$(pwd)/src:$(pwd)/src/switchcraft:$(pwd)/src/switchcraft_advanced:$(pwd)/src/switchcraft_ai:$(pwd)/src/switchcraft_winget:$(pwd)/src/switchcraft_debug
55+
export CI=true
56+
export GITHUB_ACTIONS=true
5257
python -m pytest tests
5358
shell: bash
5459

.github/workflows/docs_preview.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ jobs:
5151
source-dir: docs/.vitepress/dist
5252
preview-branch: gh-pages
5353
umbrella-dir: pr-preview
54+
pages-base-path: /SwitchCraft
5455
action: auto
5556

5657
cleanup-preview:

.github/workflows/test.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,17 @@ on:
1010
jobs:
1111
test-backend:
1212
runs-on: windows-latest
13-
if: inputs.component == 'backend'
13+
if: |
14+
inputs.component == 'backend' &&
15+
(
16+
matrix.python-version == '3.14' ||
17+
(matrix.python-version == '3.15' && github.event_name == 'push' && github.ref == 'refs/heads/main')
18+
)
1419
strategy:
1520
fail-fast: true
1621
max-parallel: 1
1722
matrix:
18-
python-version: ["3.13", "3.14"]
23+
python-version: ["3.14", "3.15"]
1924

2025
steps:
2126
- uses: actions/checkout@v6
@@ -35,6 +40,8 @@ jobs:
3540
pytest tests/ -v --tb=short
3641
env:
3742
PYTHONPATH: ${{ github.workspace }}/src
43+
CI: true
44+
GITHUB_ACTIONS: true
3845

3946
test-cli-core:
4047
runs-on: windows-latest
@@ -45,7 +52,7 @@ jobs:
4552
- name: Set up Python
4653
uses: actions/setup-python@v6
4754
with:
48-
python-version: "3.13"
55+
python-version: "3.14"
4956

5057
- name: Install Core (No GUI)
5158
run: |

docs/.vitepress/config.mts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ export default defineConfig({
149149

150150
vite: {
151151
publicDir: 'public',
152+
server: {
153+
cors: false
154+
},
152155
build: {
153156
rollupOptions: {
154157
output: {

docs/INTUNE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Pro-Users can enable the **"All-in-One"** button in the Analyzer result pane to
1515
## ⚙️ Configuration & Settings
1616

1717
SwitchCraft supports extensive configuration via the GUI or Registry/GPO for enterprise environments.
18-
w
18+
1919
> [!IMPORTANT]
2020
> **Intune OMA-URI Configuration**: For detailed instructions on configuring Intune Custom Profiles (OMA-URI), please refer to the **[Intune Configuration Guide](Intune_Configuration_Guide.md)**.
2121
> **Critical**: Ensure you use the **String (XML)** Data Type for all ADMX-backed policies.

docs/Intune_Configuration_Guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ All settings below use the base path:
191191

192192
---
193193

194-
### Top Level Settings
194+
### Top-Level Settings
195195

196196
#### 1. Debug Mode (`DebugMode_Enf`)
197197
- **OMA-URI**: `./User/Vendor/MSFT/Policy/Config/SwitchCraft~Policy~SwitchCraft~Enforced/DebugMode_Enf`

scripts/build_release.ps1

Lines changed: 26 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,35 @@ function Run-PyInstaller {
225225
exit 1
226226
}
227227
}
228+
228229
else {
229230
Write-Error "Spec file not found: $SpecFile"
230231
}
231232
}
232233

234+
function Get-InnoSetupPath {
235+
$IsccPath = (Get-Command "iscc" -ErrorAction SilentlyContinue).Source
236+
if ($IsccPath) {
237+
Write-Host "Found Inno Setup in PATH: $IsccPath" -ForegroundColor Gray
238+
return $IsccPath
239+
}
240+
241+
# Search in common installation paths for Inno Setup (multiple versions)
242+
$PossiblePaths = @(
243+
"${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe",
244+
"$env:ProgramFiles\Inno Setup 6\ISCC.exe",
245+
"${env:ProgramFiles(x86)}\Inno Setup 5\ISCC.exe",
246+
"$env:ProgramFiles\Inno Setup 5\ISCC.exe"
247+
)
248+
foreach ($p in $PossiblePaths) {
249+
if (Test-Path $p) {
250+
Write-Host "Found Inno Setup at: $p" -ForegroundColor Gray
251+
return $p
252+
}
253+
}
254+
return $null
255+
}
256+
233257
# --- 0. PREPARE ASSETS ---
234258
if ($LocalDev) {
235259
Write-Host "`nGenerating Bundled Addons (Local Dev Mode)..." -ForegroundColor Cyan
@@ -327,29 +351,7 @@ if ($Pip) {
327351
# --- 5. INSTALLERS (Windows Only) ---
328352
if ($Installer -and $IsWinBuild) {
329353
Write-Host "`nBuilding Modern Installer..." -ForegroundColor Cyan
330-
$IsccPath = (Get-Command "iscc" -ErrorAction SilentlyContinue).Source
331-
if (-not $IsccPath) {
332-
# Search in common installation paths for Inno Setup (multiple versions)
333-
$PossiblePaths = @(
334-
"C:\Program Files (x86)\Inno Setup 6\ISCC.exe",
335-
"C:\Program Files\Inno Setup 6\ISCC.exe",
336-
"C:\Program Files (x86)\Inno Setup 5\ISCC.exe",
337-
"C:\Program Files\Inno Setup 5\ISCC.exe",
338-
"${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe",
339-
"$env:ProgramFiles\Inno Setup 6\ISCC.exe",
340-
"${env:ProgramFiles(x86)}\Inno Setup 5\ISCC.exe",
341-
"$env:ProgramFiles\Inno Setup 5\ISCC.exe"
342-
)
343-
foreach ($p in $PossiblePaths) {
344-
if (Test-Path $p) {
345-
$IsccPath = $p
346-
Write-Host "Found Inno Setup at: $IsccPath" -ForegroundColor Gray
347-
break
348-
}
349-
}
350-
} else {
351-
Write-Host "Found Inno Setup in PATH: $IsccPath" -ForegroundColor Gray
352-
}
354+
$IsccPath = Get-InnoSetupPath
353355

354356
if ($IsccPath) {
355357
$ModernExe = Join-Path $DistDir "SwitchCraft.exe"
@@ -401,26 +403,7 @@ if ($Legacy -and $IsWinBuild) {
401403

402404
if ($Installer) {
403405
Write-Host "`nBuilding Legacy Installer..." -ForegroundColor Cyan
404-
$IsccPath = (Get-Command "iscc" -ErrorAction SilentlyContinue).Source
405-
if (-not $IsccPath) {
406-
# Search in common installation paths for Inno Setup (multiple versions)
407-
$PossiblePaths = @(
408-
"C:\Program Files (x86)\Inno Setup 6\ISCC.exe",
409-
"C:\Program Files\Inno Setup 6\ISCC.exe",
410-
"C:\Program Files (x86)\Inno Setup 5\ISCC.exe",
411-
"C:\Program Files\Inno Setup 5\ISCC.exe",
412-
"${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe",
413-
"$env:ProgramFiles\Inno Setup 6\ISCC.exe",
414-
"${env:ProgramFiles(x86)}\Inno Setup 5\ISCC.exe",
415-
"$env:ProgramFiles\Inno Setup 5\ISCC.exe"
416-
)
417-
foreach ($p in $PossiblePaths) {
418-
if (Test-Path $p) {
419-
$IsccPath = $p
420-
break
421-
}
422-
}
423-
}
406+
$IsccPath = Get-InnoSetupPath
424407
if ($IsccPath -and (Test-Path "switchcraft_legacy.iss")) {
425408
& $IsccPath "/DMyAppVersion=$AppVersion" "/DMyAppVersionNumeric=$AppVersionNumeric" "switchcraft_legacy.iss" | Out-Null
426409
Write-Host "Installer Created: SwitchCraft-Legacy-Setup.exe" -ForegroundColor Green

src/switchcraft/gui_modern/app.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -191,18 +191,12 @@ def _toggle_notification_drawer(self, e):
191191
self.page.update()
192192
except Exception as ex:
193193
logger.exception(f"Error opening notification drawer: {ex}")
194-
# Try again with simpler approach
195-
try:
196-
self._open_notifications_drawer(e)
197-
self.page.update()
198-
except Exception as ex2:
199-
logger.error(f"Failed to open drawer after retry: {ex2}")
200-
self.page.snack_bar = ft.SnackBar(
201-
content=ft.Text(f"Failed to open notifications: {ex2}"),
202-
bgcolor="RED"
203-
)
204-
self.page.snack_bar.open = True
205-
self.page.update()
194+
self.page.snack_bar = ft.SnackBar(
195+
content=ft.Text(f"Failed to open notifications: {ex}"),
196+
bgcolor="RED"
197+
)
198+
self.page.snack_bar.open = True
199+
self.page.update()
206200
except Exception as ex:
207201
logger.exception(f"Error toggling notification drawer: {ex}")
208202
# Try to open anyway
@@ -281,13 +275,13 @@ def _open_notifications_drawer(self, e):
281275
on_dismiss=self._on_drawer_dismiss
282276
)
283277

284-
# Set drawer and open it
278+
# Set drawer on page FIRST
285279
self.page.end_drawer = drawer
286280

287-
# Force update BEFORE setting open to ensure drawer is attached
281+
# Force update to attach drawer to page
288282
self.page.update()
289283

290-
# Now set open and update again
284+
# Now set open BEFORE updating (Flet needs this order)
291285
drawer.open = True
292286
self.page.update()
293287

@@ -299,9 +293,17 @@ def _open_notifications_drawer(self, e):
299293
except Exception as ex:
300294
logger.debug(f"page.open() not available or failed: {ex}, using direct assignment")
301295

296+
# Final verification and update
297+
if not drawer.open:
298+
logger.warning("Drawer open flag is False, forcing it to True")
299+
drawer.open = True
300+
self.page.update()
301+
302302
# Final update to ensure drawer is visible
303303
self.page.update()
304304

305+
logger.info(f"Notification drawer should now be visible. open={drawer.open}, page.end_drawer={self.page.end_drawer is not None}")
306+
305307
# Mark all as read after opening
306308
self.notification_service.mark_all_read()
307309
logger.debug("Notification drawer opened successfully")
@@ -1003,10 +1005,8 @@ def nav_to_analyzer():
10031005
self.page.add(
10041006
ft.Column(layout_controls, expand=True, spacing=0)
10051007
)
1006-
# Force multiple updates to ensure UI is visible and rendered
1008+
# Force update to ensure UI is visible and rendered
10071009
self.page.update()
1008-
self.page.update() # Second update to ensure rendering
1009-
self.page.update() # Third update for good measure
10101010

10111011
# Setup responsive UI (hide/show sidebar and menu button based on window size)
10121012
self._update_responsive_ui()

src/switchcraft/gui_modern/views/analyzer_view.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,11 @@ def _show_results(self, result: AnalysisResult):
489489
ft.Container(
490490
content=ft.Column([
491491
ft.Row([ft.Icon(ft.Icons.INFO_OUTLINE, color="WHITE"), ft.Text("7-ZIP SFX DETECTED", weight=ft.FontWeight.BOLD)]),
492-
ft.Text(i18n.get("sfx_notice_msg") or "This is a self-extracting archive. Silent switches might apply to the wrapper or the content inside.", size=12),
492+
ft.Container(
493+
content=ft.Text(i18n.get("sfx_notice_msg") or "This is a self-extracting archive. Silent switches might apply to the wrapper or the content inside.", size=12),
494+
expand=True,
495+
width=None
496+
),
493497
]),
494498
bgcolor="BLUE_900", padding=10, border_radius=5
495499
)

src/switchcraft/gui_modern/views/intune_store_view.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -211,17 +211,23 @@ def _update_ui():
211211
logger.exception(f"Error in _update_ui: {ex}")
212212
self._show_error(f"Error updating UI: {ex}")
213213

214-
# Always call directly - Flet's update() is thread-safe
215-
try:
216-
_update_ui()
217-
except Exception as ex:
218-
logger.exception(f"Failed to update UI: {ex}")
219-
# Try with run_task as fallback
220-
if hasattr(self.app_page, 'run_task'):
214+
# Use run_task as primary method to marshal UI updates to the page event loop
215+
if hasattr(self.app_page, 'run_task'):
216+
try:
217+
self.app_page.run_task(_update_ui)
218+
except Exception as ex:
219+
logger.exception(f"Error in run_task for UI update: {ex}")
220+
# Fallback to direct call if run_task fails
221221
try:
222-
self.app_page.run_task(_update_ui)
223-
except Exception:
224-
pass
222+
_update_ui()
223+
except Exception as ex2:
224+
logger.exception(f"Failed to update UI directly: {ex2}")
225+
else:
226+
# Fallback to direct call if run_task is not available
227+
try:
228+
_update_ui()
229+
except Exception as ex:
230+
logger.exception(f"Failed to update UI: {ex}")
225231

226232
threading.Thread(target=_bg, daemon=True).start()
227233

0 commit comments

Comments
 (0)