Refactor drag handling and update tests
- Renamed `initiate_drag` to `handle_drag` in MainWindow and updated related tests. - Improved drag handling logic to utilize a bridge for starting file drags. - Updated `_on_drag_started` and `_on_drag_failed` methods to match new signatures. - Modified test cases to reflect changes in drag handling and assertions. Enhance path validation and logging - Updated `PathValidator` to log warnings for nonexistent roots instead of raising errors. - Adjusted tests to verify the new behavior of skipping nonexistent roots. Update web application UI and functionality - Changed displayed text for drag items to reflect local paths and Azure Blob Storage URLs. - Added debug logging for drag operations in the web application. - Improved instructions for testing drag and drop functionality. Add configuration documentation and example files - Created `CONFIG_README.md` to provide detailed configuration instructions for WebDrop Bridge. - Added `config.example.json` and `config_test.json` for reference and testing purposes. Implement URL conversion logic - Introduced `URLConverter` class to handle conversion of Azure Blob Storage URLs to local paths. - Added unit tests for URL conversion to ensure correct functionality. Develop download interceptor script - Created `download_interceptor.js` to intercept download-related actions in the web application. - Implemented logging for fetch calls, XMLHttpRequests, and Blob URL creations. Add download test page and related tests - Created `test_download.html` for testing various download scenarios. - Implemented `test_download.py` to verify download path resolution and file construction. - Added `test_url_mappings.py` to ensure URL mappings are loaded correctly. Add unit tests for URL converter - Created `test_url_converter.py` to validate URL conversion logic and mapping behavior.
This commit is contained in:
parent
c9704efc8d
commit
88dc358894
21 changed files with 1870 additions and 432 deletions
|
|
@ -162,20 +162,26 @@
|
|||
<div class="drag-items">
|
||||
<div class="drag-item" draggable="true" id="dragItem1">
|
||||
<div class="icon">🖼️</div>
|
||||
<h3>Sample Image</h3>
|
||||
<h3>Local Z:\ Image</h3>
|
||||
<p id="path1">Z:\data\test-image.jpg</p>
|
||||
</div>
|
||||
|
||||
<div class="drag-item" draggable="true" id="dragItem2">
|
||||
<div class="icon">📄</div>
|
||||
<h3>Sample Document</h3>
|
||||
<h3>Local Z:\ Document</h3>
|
||||
<p id="path2">Z:\data\API_DOCUMENTATION.pdf</p>
|
||||
</div>
|
||||
|
||||
<div class="drag-item" draggable="true" id="dragItem3">
|
||||
<div class="icon">📊</div>
|
||||
<h3>Sample Data</h3>
|
||||
<p id="path3">C:\Users\Public\data.csv</p>
|
||||
<div class="icon">☁️</div>
|
||||
<h3>Azure Blob Storage Image</h3>
|
||||
<p id="path3">https://wpsagravitystg.file.core.windows.net/wpsagravitysync/aN5PysnXIuRECzcRbvHkjL7g0/Hintergrund_Agravity.png</p>
|
||||
</div>
|
||||
|
||||
<div class="drag-item" draggable="true" id="dragItem4">
|
||||
<div class="icon">☁️</div>
|
||||
<h3>Azure Blob Storage Document</h3>
|
||||
<p id="path4">https://wpsagravitystg.file.core.windows.net/wpsagravitysync/test/document.pdf</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -183,15 +189,59 @@
|
|||
<h4>How to test:</h4>
|
||||
<ol>
|
||||
<li>Open InDesign, Word, or Notepad++</li>
|
||||
<li>Drag one of the items below to the application</li>
|
||||
<li>The file path should be converted to a real file drag</li>
|
||||
<li>Drag one of the items above to the application</li>
|
||||
<li>Local Z:\ paths and Azure URLs will be converted to file drags</li>
|
||||
<li>Azure URLs will be mapped to Z:\ paths automatically</li>
|
||||
<li>Check the browser console (F12) for debug info</li>
|
||||
</ol>
|
||||
<p><strong>Note:</strong> When dragging images from web apps like Agravity, the browser may not provide text/plain data. Press <kbd>ALT</kbd> while dragging to force text drag mode.</p>
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
<p>WebDrop Bridge v1.0.0 | Built with Qt and PySide6</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Debug logging for drag operations
|
||||
document.addEventListener('dragstart', function(e) {
|
||||
var statusEl = document.getElementById('statusMessage');
|
||||
|
||||
// Log what's being dragged
|
||||
var dt = e.dataTransfer;
|
||||
var path = dt.getData('text/plain') || dt.getData('text/uri-list');
|
||||
|
||||
if (!path && e.target.tagName === 'IMG') {
|
||||
path = e.target.src;
|
||||
} else if (!path && e.target.tagName === 'A') {
|
||||
path = e.target.href;
|
||||
} else if (!path) {
|
||||
var card = e.target.closest('.drag-item');
|
||||
if (card) {
|
||||
var pathEl = card.querySelector('p');
|
||||
if (pathEl) path = pathEl.textContent.trim();
|
||||
}
|
||||
}
|
||||
|
||||
if (path) {
|
||||
statusEl.className = 'status-message info';
|
||||
statusEl.textContent = 'Dragging: ' + path;
|
||||
console.log('[WebDrop] Drag started:', path);
|
||||
}
|
||||
}, false);
|
||||
|
||||
document.addEventListener('dragend', function(e) {
|
||||
var statusEl = document.getElementById('statusMessage');
|
||||
statusEl.className = 'status-message success';
|
||||
statusEl.textContent = 'Drag completed!';
|
||||
console.log('[WebDrop] Drag ended');
|
||||
|
||||
// Reset after 2 seconds
|
||||
setTimeout(function() {
|
||||
statusEl.className = 'status-message info';
|
||||
statusEl.textContent = 'Ready to test drag and drop';
|
||||
}, 2000);
|
||||
}, false);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue