Compare commits

...

2 commits

Author SHA1 Message Date
9edadc2c16 Merge branch 'main' of https://git.him-tools.de/HIM-public/webdrop-bridge
Some checks are pending
Tests & Quality Checks / Test on Python 3.11 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.10 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-2 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-2 (push) Waiting to run
Tests & Quality Checks / Build Artifacts (push) Blocked by required conditions
Tests & Quality Checks / Build Artifacts-1 (push) Blocked by required conditions
2026-04-14 10:36:13 +02:00
d6e0957797 refactor: Remove remote debugging dependency and enhance DeveloperToolsWidget integration 2026-03-30 09:16:09 +02:00
3 changed files with 27 additions and 15 deletions

View file

@ -7,10 +7,6 @@ import sys
# This ensures CSS media queries (hover: hover) evaluate correctly for desktop applications
os.environ["QTWEBENGINE_CHROMIUM_FLAGS"] = "--touch-events=disabled"
# Enable Qt WebEngine Remote Debugging Protocol (Chromium Developer Tools)
# Allows debugging via browser DevTools at http://localhost:9222 or edge://inspect
os.environ["QTWEBENGINE_REMOTE_DEBUGGING"] = "9222"
from PySide6.QtWidgets import QApplication
from webdrop_bridge.config import Config, ConfigurationError

View file

@ -1,9 +1,13 @@
"""Developer Tools for WebDrop Bridge - using Chromium Remote Debugging Protocol."""
"""Developer Tools for WebDrop Bridge.
Uses Qt WebEngine's built-in inspector wiring instead of the remote debugging
HTTP endpoint. This avoids localhost/port timing issues that can differ between
development runs and frozen MSI installations.
"""
import logging
from typing import Any
from PySide6.QtCore import QTimer, QUrl
from PySide6.QtWebEngineWidgets import QWebEngineView
from PySide6.QtWidgets import QVBoxLayout, QWidget
@ -15,8 +19,7 @@ __all__ = ["DeveloperToolsWidget"]
class DeveloperToolsWidget(QWidget):
"""Embedded Chromium Developer Tools Inspector.
Loads the Chromium DevTools UI using the Remote Debugging Protocol
running on localhost:9222.
Attaches a dedicated DevTools page directly to the inspected web page.
Features:
- Real HTML/CSS Inspector with live editing
@ -45,10 +48,7 @@ class DeveloperToolsWidget(QWidget):
self.dev_tools_view = QWebEngineView()
layout.addWidget(self.dev_tools_view)
# Load DevTools after delay to let debugger start
QTimer.singleShot(500, self._load_devtools)
def _load_devtools(self) -> None:
"""Load the DevTools targets page from localhost:9222."""
logger.info("Loading DevTools from http://localhost:9222")
self.dev_tools_view.load(QUrl("http://localhost:9222"))
# Directly attach DevTools to the existing page.
# This is more robust than relying on the remote debugging HTTP endpoint.
self.dev_tools_view.page().setInspectedPage(self.web_view.page())
logger.info("Developer Tools attached via QWebEnginePage.setInspectedPage")

View file

@ -0,0 +1,16 @@
"""Unit tests for DeveloperToolsWidget."""
from PySide6.QtWebEngineWidgets import QWebEngineView
from webdrop_bridge.ui.developer_tools import DeveloperToolsWidget
def test_developer_tools_widget_attaches_inspected_page(qtbot):
"""DeveloperToolsWidget should inspect the provided web view page directly."""
web_view = QWebEngineView()
qtbot.addWidget(web_view)
dev_tools = DeveloperToolsWidget(web_view)
qtbot.addWidget(dev_tools)
assert dev_tools.dev_tools_view.page().inspectedPage() is web_view.page()