Thread Management:
Changed MeasurementThread to inherit from QThread instead of QObject
Added proper thread cleanup in reconnect_device()
Added checks for thread existence before attempting operations
Error Handling:
Added more robust error handling around thread operations
Ensured proper cleanup of resources during reconnection attempts
Added checks for thread running state before attempting to stop it
Initialization:
Explicitly initialized thread variables to None
Added proper null checks before accessing thread methods
Device Reconnection:
Improved the reconnection flow with better cleanup
Added status messages to keep user informed
(D)
Initialization Order:
Moved all attribute initializations to the start of __init__
Specifically initialized self.test_phase = "Idle" before it's used
UI Setup:
Now safely sets the phase label text after self.test_phase is initialized
Ensures all attributes exist before they're accessed
Error Prevention:
The QStandardPaths warning is still suppressed
All UI elements are properly initialized before use
(D)
Initialization Order:
Now initializes all data structures (time_data, voltage_data, etc.) in __init__ before they're used
Initializes device after UI setup using QTimer.singleShot
Error Handling:
Properly handles the case when no ADALM1000 is detected
Disables the start button until a device is connected
Device Connection:
Shows clear status messages about device connection state
Provides a reconnect button for manual reconnection attempts
Thread Safety:
Ensures all data structures exist before any thread tries to access them
(D)
Key changes made:
Added os.environ['QT_LOGGING_RULES'] = 'qt.qpa.*=false' at the beginning to suppress the QStandardPaths warning.
Added QGridLayout to the imports from PyQt5.QtWidgets.
Fixed the display layout section to properly use QGridLayout.
Made sure all necessary Qt classes are imported at the top of the file.
(D)
Key Changes in the Migration:
Threading Model:
Replaced Tkinter's after() with Qt's signal/slot mechanism
Created a proper QThread for continuous measurements
Used Qt's built-in threading for better integration
UI Structure:
Replaced Tkinter widgets with Qt equivalents (QMainWindow, QWidget, QVBoxLayout, etc.)
Used Qt's layout system instead of pack/grid
Implemented styling with Qt's stylesheet system
Event Handling:
Replaced Tkinter's command callbacks with Qt's signal/slot connections
Used pyqtSlot decorators for cleaner event handling
Plotting:
Switched to Qt's FigureCanvas backend for matplotlib
Maintained the same plotting functionality but with Qt integration
Error Handling:
Replaced Tkinter messageboxes with Qt's QMessageBox
Improved error handling with proper Qt signal propagation
Cleanup:
Implemented proper cleanup in closeEvent instead of protocol handlers
Ensured proper thread termination on exit
(D)
2025-06-27 16:01:20 +02:00
1 changed files with 559 additions and 684 deletions
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.