Feature request #6558

Split-pane entry and output for PyQGIS console

Added by Larry Shaffer about 11 years ago. Updated almost 8 years ago.

Assignee:Salvatore Larosa
Pull Request or Patch supplied:No Resolution:fixed/implemented
Easy fix?:No Copied to github as #:15758


A nice feature for the new PyQGIS console would be to have two panes (upper for output and lower for command input) instead of just one. See split-console_pycharm.png for example of how PyCharm implements its console.

This would have the following benefits:

  • Command prompt would always be visible
  • Any part of output history is readily available while inputting new commands at prompt
  • No need to have output history scroll on keyboard input
  • Only prompt needs to be a QScintilla2 widget, while the output widget can be a more generic QTextEdit
  • Output to QTextEdit can be simple HTML, with associated CSS stylesheet
  • If output to QTextEdit is HTML, a function could be added to export the output history to file, for pastebin.com, or display on web site; and, possibly for reloading or restoring into console output frame (the latter would be similar to saving both prompt history and output, i.e. a work session)
  • Drag/Drop from output history to prompt could replay any commands that started with a prompt's >>> or continuation ...

split-console_pycharm.png - PyCharm 2.6 split-pane console (17.9 KB) Larry Shaffer, 2012-10-22 01:15 PM

newlookconsole.png (204 KB) Salvatore Larosa, 2012-10-26 06:32 AM

console_nosplitter.png (123 KB) Larry Shaffer, 2012-10-26 02:01 PM


#1 Updated by Salvatore Larosa about 11 years ago

This is a great feature!
I'll work to do it!

It would be nice to get more feedback from other users, also !

#2 Updated by Salvatore Larosa about 11 years ago

Hi Larry,
the attached image is as looks the console by applying your suggestions (it seems to me very nice!)

I used QScintilla editor for command output !

I pushed it in my fork [1] !

[1] - https://github.com/slarosa/Quantum-GIS/commit/f15b4e12c7fa9b76bb7b23997ed11971186d4156

#3 Updated by Larry Shaffer about 11 years ago

Hi Salvatore,

It's looking good! The pull request I made ( https://github.com/slarosa/Quantum-GIS/pull/2 ) does a couple of things:

  • Removes splitter in favor of a simple vertical layout where the input widget always stays at 32 pixels high, while the output widget above expands as needed. Since the input widget is not ever going to get bigger than the largest font chosen by the user, and since it only has one line, in my opinion there was no need for the splitter.
  • Removes the text from above the input line. that init text should probably go at the top of the output on new launch of the console, or on clear (like before). This removes any excess vertical space for the console (important on laptops).
  • Increased the line number column to to comfortably handle numbers up to 9999. I got rid of the pink background and made it a subdued gray, with blue numbers. This increases readability of the output.
  • Got rid of the caret line background for the input line (there is already a active cursor). I left it for the output area and made is a light peach color, instead of the bright pink. That caret background should be fairly light, so users can see their additional selection background, when selecting text, as well.

A couple of notes about some improvements:

  • When in the output area, any keystroke should immediately switch focus to the input area.
  • When using the import class menu, the pasted text should be auto-entered at the prompt as well (otherwise an unnecessary extra click or keystroke is required).
  • Unlike previous version (before split view) there is no notation in the output area for what was entered at the prompt as a command and what was returned by running the command. Maybe a single '>' to start every line that was entered and a single '.' for continuation command lines. (BTW: I like how the prompt turns to a '...' for continuations.)
  • Another nice feature would be a custom contextual menu for the output area. One menu action could be 'Enter selected', which would copy the selected text, paste it at the prompt and enter it (faster than drag/drop and click).

#4 Updated by Larry Shaffer about 11 years ago

Another feature (for other devs and plugin authors) is to move the toolbar and input/output widgets into a single parent that can be instantiated via a PyQGIS call to iface (like maybe, iface.consoleWidget() ). This would allow the widget to be added to a dock window (as is done now), or embedded anywhere a custom app dev or plugin author wants.

For example, in my Plugin Editor the toolbar doesn't show up, and I would have to recreate it. Basically, encapsulate the whole console so that it can be instantiated with one call, without it being tied to the main app's window.

#5 Updated by Jürgen Fischer over 9 years ago

  • Target version changed from Version 2.0.0 to Future Release - Lower Priority

#6 Updated by Médéric RIBREUX almost 8 years ago

Hello, bug triage...

I think we can close this feature request because every point is covered in the Python console. Is there anything that is not implemented ?

#7 Updated by Médéric RIBREUX almost 8 years ago

  • Resolution set to fixed/implemented
  • Status changed from Feedback to Closed
  • % Done changed from 0 to 100

Hello, bug triage...

I am closing this feature request for lack of feedback and because every point seems to be covered in the Python console.

Also available in: Atom PDF