Commit Graph

103 Commits

Author SHA1 Message Date
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
Alx Sa d087c1a84e plug-ins: Port Save as CSS GUI from 2.10
This plug-in has a partial GUI (a FileChooser dialog is launched).
However, you could only save the active gradient rather than choosing
any of them like the 2.10 version of this plug-in.
This patch ports the original UI so you can choose both the gradient
and file in interactive mode.
2023-01-14 21:14:45 +00:00
Alx Sa 506b324112 plug-ins: Show GUI for Palette to Gradient
Also shows GUI for Palette to Repeating Gradient function
2023-01-14 21:14:45 +00:00
Jehan c9b1ce8fa9 plug-ins: make test-dialog runnable even with no image.
It's a test plug-in which doesn't actually need an image to work, so it's
annoying that it currently requires one (making testing more cumbersome).

Also cleaning up a bit the coding style.
2023-01-14 20:17:57 +01:00
Jehan f99bdcd008 plug-ins: use generated widget for GimpPalette arg.
Also make the start checks a bit more robust to broken core code by
double-checking that the palette is valid from the start, even though getting an
invalid palette should normally not happen anymore (at least I fixed one such
case with a palette with a NULL id in my previous commit; but it looks like our
core code is not perfectly robust and we should push the code to extensive
testing).

Note that the generated widget is currently ugly (no label and terrible UX), but
this is meant to improve soon.
2023-01-14 19:27:08 +01:00
lloyd konneker e00f2d7f50 Fix plugins to use new GimpResource. 2023-01-14 17:43:26 +01:00
lloyd konneker d59a7af38c libgimp: API refactor GUI for GimpResource
Simplifies chooser widgets (e.g. GimpBrushSelect) by eliminating attributes (e.g. opacity) of chosen resource.
See #8745, but this commit fixes that by first refactoring the code.

Refactors GUI widgets (e.g. GimpBrushSelectButton and GimpBrushSelect etc.)

Refactor by "Extract class" GimpResourceSelectButton from GimpBrushSelectButton etc.
This moves common code into an inherited class (formerly called GimpSelectButton)
but the subclasses still exist.
The subclasses mainly just do drawing now.

Refactor by "Extract module" GimpResourceSelect from GimpBrushSelect etc.
Moves common code into one file, generic at runtime on type of GimpResource,
that is, the new code dispatches on type i.e. switch statements.
In the future, when core is changed some of that can be deleted.
The files gimpbrushselect.[c,h] etc. are deleted.
The module adapts the API from core to the API of callbacks to libgimp.

Note that core is running the resource chooser (select) widgets remotely.
Core is still calling back over the wire via PDB with more attributes
than necessary.
The new design gets the attributes from the resource themselves,
instead of receiving them from core callback.
The libgimp side adapts by discarding unneeded attributes.
In the future, core (running choosers for plugins) can be simplified also.

Fix gimp_prop_chooser_brush_new same as other resources.

Finish changes, and clean style.

Annotations
2023-01-14 16:38:40 +00:00
lloyd konneker d720375e97 2.99 libgimp: add GimpResource, GimpBrush, GimpPropWidgetBrush
So procedures can declare args and GimpProcedureDialog show chooser
widgets

Fix so is no error dialog on id_is_valid for resources

Palette.pdb changes and testing

Memory mgt changes

Gradient pdb

Font and Pattern tests

Test  brush, palette

Cleanup, remove generator

Rebase, edit docs, install test-dialog.py

Whitespace, and fix failed distcheck

Fix some clang-format, fix fail distcheck

Fix distcheck

Cleanup from review Jehan
2023-01-14 12:58:05 +00:00
Alx Sa 8dcc397498 plug-ins: Show Palette Sort GUI
Recreates GUI so this plug-in matches the
2.10 version.
2023-01-11 16:13:17 +00: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 ca230cb770 meson: fix warnings of deprecated features.
Now that we bumped our meson requirement, meson is complaining about
several features now deprecated even in the minimum required meson
version:

s/meson.source_root/meson.project_source_root/ to fix:

> WARNING: Project targets '>=0.56.0' but uses feature deprecated since '0.56.0': meson.source_root. use meson.project_source_root() or meson.global_source_root() instead.

s/meson.build_root/meson.project_build_root/ to fix:

> WARNING: Project targets '>=0.56.0' but uses feature deprecated since '0.56.0': meson.build_root. use meson.project_build_root() or meson.global_build_root() instead.

Fixing using path() on xdg_email and python ExternalProgram variables:

> WARNING: Project targets '>=0.56.0' but uses feature deprecated since '0.55.0': ExternalProgram.path. use ExternalProgram.full_path() instead

s/get_pkgconfig_variable *(\([^)]*\))/get_variable(pkgconfig: \1)/ to
fix:

> WARNING: Project targets '>=0.56.0' but uses feature deprecated since '0.56.0': dependency.get_pkgconfig_variable. use dependency.get_variable(pkgconfig : ...) instead
2022-08-31 01:29:37 +02:00
Jehan 31df4c2bf1 Issue #8498: Quirky text to translate in gradients-save-as-css.py.
Just duplicate the blurb into the help string. I'll leave it to someone
else to write a dedicated, longer help text if needed.

Also fixing the call s/Gimp.init/GimpUi.init/.
2022-08-16 21:18:51 +02:00
Alx Sa ff1766be08 plug-ins: Fix Color XHTML export and GUI crash
Fixes some syntax and makes the plug-in aware of multi-layer selection,
so that the dialog actually appears when exporting as .html.
2022-08-06 15:10:41 +00:00
Alx Sa 388a5a3b4c plug-ins: Fix crash in histogram-export
As noted by @Ofnuts, histogram-export still expected to receive
a single layer from GIMP. The parameters have been updated to
reflect receiving multiple layers/drawables, and the active layer
is selected. The parameter was left in case multi-layer support
is added in the future.
2022-07-20 12:51:03 +00:00
Jehan 69f6f5748a plug-ins: use list() variants in bindings.
Cf. previous commit.
2022-06-27 22:30:42 +02:00
Jehan 18c37f7084 plug-ins, libgimp: override set_i18n() for all our core plug-ins.
Hence avoiding the stderr messages. These are going to be localized with
centrally installed catalogs "gimp*-std-plugins", "gimp*-script-fu" and
"gimp*-python".

We now handle core plug-in localizations differently and in particular,
with kind of a reverse logic:

- We don't consider "gimp*-std-plugins" to be the default catalog
  anymore. It made sense in the old world where we would consider the
  core plug-ins to be the most important and numerous ones. But we want
  to push a world where people are even more encouraged to develop their
  own plug-ins. These won't use the standard catalog anymore (because
  there are nearly no reasons that the strings are the same, it's only a
  confusing logic). So let's explicitly set the standard catalogs with
  DEFINE_STD_SET_I18N macro (which maps to a different catalog for
  script-fu plug-ins).
- Doing something similar for Python plug-ins which have again their own
  catalog.
- Getting rid of the INIT_I18N macro since now all the locale domain
  binding is done automatically by libgimp when using the set_i18n()
  method infrastructure.
2022-06-05 01:57:02 +02:00
Jehan 208d415a1a plug-ins: properly localize core Python plug-ins.
- Set the "gimp30-python" Gettext domain and bind it to the proper
  locale directory as installed by GIMP.
- Localize various strings with gettext.
- Remove calls to self.set_translation_domain() in
  do_query_procedures(). This is technically wrong right now but I am
  going to get rid of the menu item localization for plug-ins done by
  the core.
2022-06-04 14:52:14 +02:00
Jehan de1d71bb3f app, libgimp, pdb, plug-ins: batch CLI options now interpreter aware.
The CLI options now know which procedures are batch procedures or not.
First it means that it won't just randomly try any procedure name one
may pass and will properly output an error if you pass a non-existing
interpreter procedure.

Secondly, there is no default interpreter anymore (unless only one
interpreter exists). If you don't set an interpreter procedure with
--batch-interpreter or if you pass a wrong one, it will output the list
of available batch procedure, thus helping you understanding how to use
the --batch option.
2022-04-16 23:28:05 +02:00
Jehan 752cbd1377 plug-ins: port python-fu-eval to GimpBatchProcedure. 2022-04-16 18:50:29 +02:00
Jehan 65077a605f plug-ins: update foggigy after changes in GimpProcedureDialog.
The default for color properties (GimpRGB) is now to be editable. So
let's remove the formerly specific call for this.

Also fixing a clashing mnemonics ('c' both for '_Color' and '_Cancel').
2022-02-17 23:13:43 +01:00
Jehan d25b7301d6 plug-ins: fix the ORA thumbnail load procedure.
- Fix return value in error case: s/GObject.Error/GLib.Error/ and anyway
  in this form, the error should be a string. Using the easier form
  procedure.new_return_values() instead.
- "file-png-load" uses a GFile now (like all load procedures).
2022-02-09 22:56:42 +01:00
Jehan 387d97437d plug-ins: use the new function Gimp.context_enable_dynamics(). 2022-02-04 14:04:46 +01:00
Nikc 6a16779365 Issue #6683: Set turbulence max-value to 7 per GEGL specs (Port) 2022-02-02 18:26:00 +00:00
Jehan 488e3c4a0a plug-ins: use GimpUi.ProcedureDialog() instead of…
… GimpUi.ProcedureDialog.new()
The old way is still working and acceptable as far as I am concerned.
Just switching to the recommended (by upstream) syntax to show it works
as expected and as a good example of code.
2021-08-03 19:54:55 +02:00
Michael Schumacher 7f0dafe571 plug-ins: use #!/usr/bin/env python3 shebang line in python-console.py
Fixes #7035.
2021-07-07 17:47:15 +02:00
Jacob Boerema 6ec20e6ed0 plug-ins: adapt file-openraster to API changes.
I only fixed the changes that made it fail.
I have not updated it to the sensitivity API.
2021-04-21 13:04:46 -04:00
Jehan 2a1555b082 plug-ins: fix spyro-plus.
- Now using multi-drawable run() signature, but sensitive only with a
  single drawable.
- width|height() calls are now get_width|height().
- PDB call to 'plug-in-sel2path' now expects a drawable array as well.
2021-04-20 22:17:28 +02:00
bootchk e960f1a296 Fix #5915, Python Console Apply button fail. 2021-04-20 16:03:05 +00:00
Jehan 077f2d4e25 plug-ins: remove now useless/ugly workaround.
See previous commit.
2021-04-20 17:16:32 +02:00
Jehan f15d16150e plug-ins: update foggify to latest API and add a GUI.
The following changes were made:
- run() signature now moved to multi-drawables.
- sensitivity mask now enables the plug-in when one or several drawables
  are selected. When several, a fog layer will be created over each
  selected layer.
- Mnemonics added to properties.
- Color property finally used now that our API has support for boxed
  parameters with GimpRGB value type.
- Use a config object instead of ordered GimpValueArray and use the
  begin|en_run() API to store values between runs.
- Add a graphical interface generated with the new GimpProcedureDialog
  API.
2021-04-20 16:54:40 +02:00
Jehan 623ce4a9e3 plug-ins: move benchmark-foreground-extract to gimp-data-extras.
We did port it to the new API but we are doubting it is useful at all.
It might have been, historically, when foreground extract algorithm was
first introduced, but probably not anymore, even more as the algorithm
is now implemented mostly on GEGL side anyway. So if any benchmark were
to be done, it should probably be added as GEGL tests.

Also as we are planning to update even more the API lately, it feels
really like a waste of time to also fix this plug-in while we currently
believe it to be useless.

Still we move it to the gimp-data-extras repository for being able to
easily bring it back in case we missed some use.
2021-04-19 18:10:54 +02:00
Jacob Boerema d8009a000b plug-ins: Remove gamma parameter in openraster call to file-png-save.
Commit d57eafd189 removed the
gamma parameter for file-png-save so we have to remove it here too.
2021-01-30 13:18:50 -05:00
Jacob Boerema d87cd48f02 plug-ins: check for run_procedure SUCCESS in openraster
The Openraster plug-in calls file-png-load and
gimp-file-load-layer but didn't check if the result
was SUCCESS. Even though I haven't seen any
failures let's improve error checking by adding
a check for a correct result.
2021-01-27 19:07:51 -05:00
Jacob Boerema 9a19cf3b81 plug-ins: add missing parameters to file-png-save in openraster save_ora 2021-01-27 19:07:51 -05:00
Jacob Boerema 9d9f6e6240 plug-ins: add progress updates to openraster load and save.
Since openraster load and save is not very fast for multi layer
images it seems like a good idea to add progress update
support.
2021-01-27 19:07:51 -05:00
Jacob Boerema 6d6b7e90c2 plug-ins: improve exporting of layer modes for openraster.
The current openraster specification only has a limited
number of layer modes. Let's improve things a little bit
by mapping both the current and legacy layer modes
to the same openraster composite-op where available.

For the other layer modes we could examine what the
closest composite-op is, or add a GIMP specific op
(which is what Krita seems to do). For now we set
all these to the openraster equivalent of NORMAL.
2021-01-27 19:07:51 -05:00
Jacob Boerema 304c7d6bc8 plug-ins: don't use the legacy layer modes in openraster load/save
Let's use the non legacy layer modes when importing/exporting
openraster images. That way we are more likely to be able to
import the correct layer modes since openraster only has a
limited number of layer modes defined.
2021-01-27 19:07:51 -05:00
Jacob Boerema 7650767ad3 plug-ins: loading and saving of group layers failed in openraster plug-in. 2021-01-27 19:07:51 -05:00
Jacob Boerema d001e4b38b Issue #5984 file-openraster-save throws CRITICAL at Gimp.ObjectArray.new() 2021-01-27 19:07:51 -05:00
Jehan 0f7c6285ca plug-ins: move py-slice.py to gimp-data-extras.
Per polls on Twitter, Reddit, Patreon and Tipeee, most people were
willing to drop this plug-in as not being relevant anymore (247 for
dropping and 63 for keeping it, so nearly 80% out of 310 participants).

So let's move it to gimp-data-extras allowing it to still have a
possible life, and who knows, maybe to even evolve.

See also corresponding commit beffc6b to gimp-data-extras repository.
2020-12-15 01:46:46 +01:00
luz paz bb322d94d7 Fix typos
Found via:
```
codespell -q 3 -S ./ChangeLog*,*.po,./.git,./NEWS* -L als,ang,ba,chello,daa,doubleclick,foto,hist,iff,inport,klass,mut,nd,ower,paeth,params,pard,pevent,sinc,thru,tim,uint
```
2020-11-19 21:56:25 +01:00
Jacob Boerema dbc198001e plug-ins: Fix incomplete port of file-openraster.
This fixes #5838 which was caused by an incomplete port
of this plug-in to the new introspection API.

For now we do keep the n_drawables parameter of save_ora until
issue #5312 is fixed. Not doing this would cause saving to fail.
2020-10-31 12:49:54 -04:00
Jehan c86d909dda plug-ins: fix parameters of Gimp.file_save().
It now requires a list of drawables (even though still mostly useless,
but this comes with the change of multi-selected layers).
2020-10-23 15:20:21 +02:00
Jehan 02cb754b4a plug-ins: run gimp_displays_flush() in foggify.
Without this call, the display is not properly updated and does not show
the newly added fog layer.
2020-10-18 00:41:22 +02:00
Jehan 2e73e30afd libgimp: 'gimp_ui' as priority prefix for GimpUi introspected module.
Since meson 0.43.0 (below our current requirement), 'symbol_prefix'
argument of gnome.generate_gir() allows an ordered list. If I prepend
'gimp_ui', it makes any gimp_ui_*() function to not start with 'ui_'.

In particular, GimpUi.ui_init() becomes GimpUi.init() which is much less
redundant.
2020-09-26 22:11:53 +02:00
Jehan 2271b5bbdb Issue #4368: remove 2 more outdated Python plug-ins.
shadow_bevel.py and sphere.py are unfinished and have been in the
"Unstable" only builds for years. This is probably not worth porting
them. Let's just delete them.

I have actually move these (as well clothify and whirlpinch removed
yesterday) to the gimp-data-extras repository so if anyone wants to
revive them, and port them to GIMP 3, they can start off from there.
2020-09-21 17:14:51 +02:00
Jehan e154cd220d plug-ins: delete Python whirlpinch and clothify without porting them.
Following Elad Shahar advice (cf. #4368), let's delete whirlpinch.py and
clothify.py.

The rational is that whirlpinch.py does the same thing as the existing
"plug-in-whirl-pinch" which is itself a compat plug-in to
"gegl:whirl-pinch" operation. Also the Python file has an explicit
command saying it is exactly the same algorithm, yet with no preview and
slower. Finally it was not even installed on stable build. It doesn't
look like there is any reason to keep it (it was probably a demo/test
Python plug-in).

As for clothify.py, a quick look at the short code shows it is exactly
the same algorithm as clothify.scm, with the same arguments and
installed on the same `Filters > Artistic` menu (except that the Python
version is not installed on stable builds).
So let's just keep the script-fu version as it has been the used version
until now, and there is no deprecation going on in one side or another.
So let's keep what already works.
2020-09-21 01:44:51 +02:00
Jehan a455c72929 plug-ins: update previous commit to API changes.
Since the patch was initially contributed, some parts of the
introspection changed. First all GUI-related code is in a GimpUi module
now.
Also Gimp.get_pdb().run_procedure() is now using a list instead of a
GimpValueArray.
2020-09-21 00:52:30 +02:00
Elad Shahar 12b4d9b097 Port histogram-export plugin to python 3 2020-09-21 00:38:29 +02:00
Elad Shahar 33085b5182 plug-ins: Port python-eval.py plugin to python 3.
To test that this works, run gimp in batch mode:

% gimp2.99 -i -b -

And then type: (python-fu-eval "print (2)") .
2020-09-21 00:30:41 +02:00