Commit graph

9 commits

Author SHA1 Message Date
Jehan
70da73ee0d plug-ins: implement Ctrl-R and Ctrl-S in Python Console for searching.
These are the common shell shortcuts for respectively searching backward
and forward in command history. I use the Python Console plug-in so much
for testing that it started to weigh on me on how ineffective it was not
to be able to search through the history and laboriously hit Up/Down
buttons instead.

While doing a search, most navigation keys would trigger to stop the
search (and stay at the current history item followed by whatever the
key was supposed to do, such as changing cursor position, etc.). Esc in
particular would just stop the search and do nothing else.

Ctrl-C though would reset the search and get the text back to what it
was before search started.
2024-12-17 23:53:34 +01:00
Jehan
9588132849 plug-ins: do not cycle through Python Console history.
When you want to get back to the latest command, it is very confusing
when it starts cycling from the oldest history command!
2024-12-17 23:15:53 +01:00
Jehan
7b4211b24e plug-ins: PageUp/Down is also commonly used same as Up/Down arrows in terminals. 2024-12-06 15:42:55 +09:00
Jehan
94c7ca6809 plug-ins: support saving the history of commands.
Since I use the Python console a lot myself to test GIMP API, the
ability to recall previously ran commands is extremely useful. Let's
just add support for this as an AUX argument. This was already done in
the Script-fu console, now in the Python console too!
2024-09-22 23:26:33 +02:00
Anders Jonsson
221f8ab14d plug-ins: fix pyconsole syntax for Python 3.12
With Python 3.12, every run of the Python console shows
a SyntaxWarning about invalid escape sequence unless the
string is marked as a raw string.
2024-07-13 20:09:25 +00:00
Alx Sa
f66c6e9681 python: Use theme colors for console font color
Previously, the console's font color was hardcoded to #006000.
This did not stand out well on darker theme.
This patch pulls the widget's foreground color from GtkStyleContext
to ensure it contrasts sufficiently with the console background color.
2024-01-04 17:51:02 +00:00
Jehan
851ddad2ee plug-ins: add back the prompt when "clearing" the Python console.
This code is taken from Massimo's comment in #1786 and MR !834. It doesn't fix
a crash as this was already handled in !404, yet the missing prompt after
hitting "clear" was clearly not consistent with how one expect a clear feature
to work.

At least now, we've got a prompt back immediately after clearing.
2023-02-13 13:17:30 +01:00
Jehan
2080abf0a3 Issue #8734: Python-fu misses sys.stdout.flush.
Just add a no-op flush() as I think it's actually unneeded in the context of a
GtkTextView GUI. At least it doesn't cause issues with copy-pasted code or when
using external libraries using the sys.stdout.flush() interface.
2022-10-12 23:40:04 +02:00
Jehan
62d87f15d9 plug-ins: port python-console to new GObject-introspected API.
I may have missed things. That is the problem of non-compiled script
languages. There is also a known warning:
> DeprecationWarning: Gtk.Dialog.set_alternative_button_order_from_array is deprecated
I'll see later about this one.

Push-time note: calling various functions is actually broken right now
in the console since the late API changes (it was working fine yesterday
evening when I tested the same python-console code). Pushing anyway for
now.
2019-07-30 12:57:59 +02:00
Renamed from plug-ins/pygimp/plug-ins/pyconsole.py (Browse further)