Skip to content

ENH: Made Python interactor a docking widget

Problem: It was always necessary to rearrange windows after showing the Python interactor so that both the console and Slicer screen. This has to be repeated every time Slicer is started, since the Python interactor window's position was not saved.

Implemented solution:

  1. Made Python interactor a docking widget (if Slicer starts with main window visible). For single-screen configuration this allows sharing of the screen between the Python interactor and other Slicer windows. On multi-screen configurations the interactor can be dragged to the second screen.
  2. The position (which screen, where), size, and state (docked/undocked, shown/hidden) of the Python interactor window is now also saved, so there is no need for any repositioning of the windows between sessions.
  3. Ctrl-3 shows/hides the interactor (not just shows as before) and when the interactor is shown it gets keyboard focus. It allows easy opening of the interactor, typing some text, and closing it, without the need of taking the mouse to reposition any windows.

Also cleaned up deletion of ctkPythonConsole. As the ctkPythonConsole widget can be owned by a widget (docking window), it is not possible to create it on the stack anymore. Instead, qSlicerApplication creates the ctkPythonConsole (similarly to qSlicerPythonManager) and destroys it if it is not owned by a widget.

Merge request reports