Feature request #6558
Split-pane entry and output for PyQGIS console
|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
#2 Updated by Salvatore Larosa almost 7 years ago
- File newlookconsole.png added
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  !
#3 Updated by Larry Shaffer almost 7 years ago
- Status changed from Open to Feedback
- File console_nosplitter.png added
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 almost 7 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.