Ticket #9060 (closed: fixed)
Expose Dock/ Float for windows to Python
Reported by: | Nick Draper | Owned by: | Martyn Gigg |
---|---|---|---|
Priority: | major | Milestone: | Release 3.2 |
Component: | Python | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Tester: | Michael Reuter |
Description
My instrument view is large enough so that I want to as a default kick it out of the tiny dark grey window in MantidPlot. I am preparing a script for users that would do this automatically, and would like to use this script to change a window to ‘floating.’ This feature can be done from using mantidplot, windows menu, change to floating, but I’d rather this be done automatically, regardless of user settings on MantidPlot, for ease of use.
I think we want something like the following on all mdisubwindows:
- float()
- isFloating()
- dock()
- isDocked()
Change History
comment:3 Changed 7 years ago by Martyn Gigg
Add methods to MdiSubWindow for controlling dock/undocked status. Refs #9060
Changeset: c2d040e996ab6d19497c6adafe1aa56cbd1171ee
comment:4 Changed 7 years ago by Martyn Gigg
Turn off close confirmations for unittests Refs #9060
Changeset: 0fd1c97590abd77fbeae8256844fdd8fa4f6658e
comment:5 Changed 7 years ago by Martyn Gigg
Formatting changes to MDISubWindow Refs #9060
Changeset: 8c2403ee126fb3a2d04c17c42ca872859c6d7bf6
comment:6 Changed 7 years ago by Martyn Gigg
- Status changed from inprogress to verify
- Resolution set to fixed
Branch: feature/9060_float_windows_python
Tester: All windows that are dockable, anything inheriting from MdiSubWindow, now have 4 methods attached to them:
- dock()
- isDocked()
- undock()
- isFloating()
The following script demonstrates the desired behaviour:
import numpy as np import math X1 = np.linspace(0,10, 100) Y1 = 1000*(np.sin(X1)**2) + X1*10 X1 = np.append(X1, 10.1) X2 = np.linspace(2,12, 100) Y2 = 500*(np.cos(X2/2.)**2) + 20 X2 = np.append(X2, 12.10) X = np.append(X1, X2) Y = np.append(Y1, Y2) E = np.sqrt(Y) CreateWorkspace(OutputWorkspace="fake", DataX=list(X), DataY=list(Y), DataE=list(E), NSpec=2, UnitX="TOF", YUnitLabel="Counts", WorkspaceTitle="Faked data Workspace") pl = plotSpectrum("fake",0) print "Floating: ",pl.isFloating() print "Docked: ",pl.isDocked() pl.undock() print "Floating: ",pl.isFloating() print "Docked: ",pl.isDocked() pl.dock() print "Floating: ",pl.isFloating() print "Docked: ",pl.isDocked()
Try similar things, from Python, for 2D graphs, instrument view, matrices.
The original description had float() as an additional method rather than undock() but float is a reserved keyword in C++ so the compiler won't accept it has a method name. It could be changed on the way out to Python but I think it's preferable to keep them matched when they are just pass through methods.
There is also some documentation here: http://www.mantidproject.org/MantidPlot:_Docking_Windows_From_Python
comment:7 Changed 7 years ago by Michael Reuter
- Status changed from verify to verifying
- Tester set to Michael Reuter
comment:8 Changed 7 years ago by Michael Reuter
- Status changed from verifying to closed
Merge remote-tracking branch 'origin/feature/9060_float_windows_python'
Full changeset: ef9dcb38e19df81d53623b9cc4c15a1d2afd2da3