-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathREADME
30 lines (26 loc) · 2.14 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
A library for monitoring application-wide events in pyqt and playing them back for testing purposes.
Try the example to get a feel for it:
$ cd examples
$ PYTHONPATH=.. python demo_app.py --record
# Do some stuff in the app
# Then use the recording window to save a recording script.
# Then quit.
# If you saved the recording to e.g. /tmp/demo_recording.py, then try this:
$ PYTHONPATH=.. python demo_app.py --playback /tmp/demo_recording.py
Documentation TODO:
- top-level widgets must be given unique names
- children without unique names will be forcibly renamed
- All objects must accept a new Qt property called unique_child_index
- model/view list widgets, etc. *must* use persistent editors to be recorded correctly. Non-persistent editors cannot be used with this system.
- RECORD SLOWLY. In particular, don't make extraneous mouse movements when selecting a menu/combobox item.
- Don't touch the app while a recording is playing. Even mouse movements can cause widgets to be accessed out of order, which can corrupt default names.
Implementation gotchas TODO:
- top-level widgets that are closed may not be deleted immediately, and therefore are included when calling QApplication.topLevelWidgets(). For that reason, only visible top-level widgets receive events. Shouldn't be a big deal, but could conceivably be a problem in special scenarios
- Talk about how events are shoveled into the main thread
- Decide which mouse events to save, which to ignore, and when to ignore "object not found" errors during playback.
- Explain difference between spontaneous events and non-spontaneous.
- Explain the importance of providing both relative and GLOBAL mouse coordinates for QMouseEvents
- Explain why we have to use a QApplication subclass instead of merely adding an eventFilter to the app.
- Discuss the fact that QMenu is a special case: It has a parent, but is "top-level" anyway. And to make matters worse, there seems to be a bug in sip.isdeleted() when it comes to QMenu.
Solution: Always exclude QMenus from the list of top-level widgets. They will be found in the 'normal' hierarchy.
- Talk about the importance of garbage collection during recording and playback.