Ticket #6055 (closed: fixed)
Alias the python threadsafe_call method
Reported by: | Martyn Gigg | Owned by: | Martyn Gigg |
---|---|---|---|
Priority: | major | Milestone: | Release 2.3 |
Component: | Mantid | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Tester: | Roman Tolchenov |
Description
Any GUI interaction from within an asynchronous Python script will freeze Mantid. Under the surface our own plots use a function called threadsafe_call to ensure the GUI interaction happens on the correct thread.
There is no reason why users can't use this function for if they require matplotlib or some other GUI from a python script. It could do with a better name though for users as they will not generally understand what a thread is.
The alias will be gui_cmd
Change History
comment:2 Changed 8 years ago by Martyn Gigg
Tester: Matplotlib is a good test
This will crash/freeze mantid, there is no general way of avoiding it unfortunately.
from matplotlib.pyplot import plot, show x = [1,2,3,4,5,6,7,8,9,10] plot(x) show()
This will be safe.
from matplotlib.pyplot import plot, show x = [1,2,3,4,5,6,7,8,9,10] gui_cmd(plot,x) gui_cmd(show)
Instructions will appear on the wiki soon.
comment:3 Changed 8 years ago by Martyn Gigg
Alias for threadsafe_call. More user friendly as gui_cmd. Refs #6055
Changeset: 7adbeaf66c4cb519dcff9312bde68f529c54605b
comment:4 Changed 8 years ago by Martyn Gigg
- Status changed from accepted to verify
- Resolution set to fixed
comment:5 Changed 8 years ago by Roman Tolchenov
- Status changed from verify to verifying
- Tester set to Roman Tolchenov
comment:6 Changed 8 years ago by Roman Tolchenov
- Status changed from verifying to closed
Confirm that the first script crashes mantid while the second one doesn't.
comment:7 Changed 8 years ago by Martyn Gigg
Alias for threadsafe_call. More user friendly as gui_cmd. Refs #6055
Changeset: 7adbeaf66c4cb519dcff9312bde68f529c54605b
comment:8 Changed 8 years ago by Martyn Gigg
Alias for threadsafe_call. More user friendly as gui_cmd. Refs #6055
Changeset: 7adbeaf66c4cb519dcff9312bde68f529c54605b