Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GGR from Image
#29
(10-07-2022, 08:50 AM)rich2005 Wrote: To make it more portable comment out line 39 and add a line as;

Code:
gradient_folder = os.path.join(gimp.directory, "gradients", "")

That is working here, linux Gimp 2.10.32 also in a Win10 VM both for regular Gimp and Samj portable.

Definitely the way... works for any OS, Gimp version, and GIMP2_DIRECTORYenvironment setting.

For the nitpicking crowd, the final ,'' is not necessary, it is used to add a final /, but this thing should be done else where, for instance

Code:
newfilename = gradient_folder + gradient_name + ".svg"

should be

Code:
newfilename = os.path.join(gradient_folder,gradient_name + ".svg")

(lines 67, 107 and 175) and the various calls to os.path.expanduser() are not necessary because the directory returned by gimp.directory() is already fully resolved. In fact one wonders why this was not done once for all when initializing the gradient_folder variable, and the DRY principle demands that you would have some gradientFileFromName() function that would handle all this in a single place.
Reply


Messages In This Thread
GGR from Image - by meetdilip - 10-10-2021, 04:13 PM
RE: ggr from Image - by PixLab - 10-10-2021, 04:51 PM
RE: ggr from Image - by rich2005 - 10-10-2021, 05:00 PM
RE: ggr from Image - by Logansfury - 08-07-2024, 02:06 PM
RE: ggr from Image - by rich2005 - 08-07-2024, 02:59 PM
RE: ggr from Image - by meetdilip - 10-10-2021, 05:23 PM
RE: ggr from Image - by meetdilip - 10-10-2021, 07:45 PM
RE: ggr from Image - by rich2005 - 10-10-2021, 08:25 PM
RE: ggr from Image - by PixLab - 10-11-2021, 04:38 AM
RE: ggr from Image - by meetdilip - 10-11-2021, 06:23 AM
RE: ggr from Image - by PixLab - 10-11-2021, 06:49 AM
RE: ggr from Image - by meetdilip - 10-11-2021, 06:52 AM
RE: ggr from Image - by Krikor - 10-11-2021, 04:25 PM
RE: ggr from Image - by rich2005 - 10-11-2021, 07:15 AM
RE: ggr from Image - by meetdilip - 10-11-2021, 08:07 AM
RE: ggr from Image - by PixLab - 10-11-2021, 07:38 AM
RE: ggr from Image - by PixLab - 10-11-2021, 08:21 AM
RE: ggr from Image - by meetdilip - 10-11-2021, 08:26 AM
RE: ggr from Image - by rich2005 - 10-11-2021, 08:35 AM
RE: ggr from Image - by meetdilip - 10-11-2021, 08:44 AM
RE: ggr from Image - by rich2005 - 10-11-2021, 09:34 AM
RE: ggr from Image - by meetdilip - 10-11-2021, 09:40 AM
RE: GGR from Image - by Krikor - 10-06-2022, 03:08 AM
RE: GGR from Image - by Ofnuts - 10-06-2022, 08:22 AM
RE: GGR from Image - by rickk - 10-10-2022, 08:52 PM
RE: GGR from Image - by PixLab - 10-06-2022, 04:19 AM
RE: GGR from Image - by rich2005 - 10-06-2022, 08:12 AM
RE: GGR from Image - by rich2005 - 10-06-2022, 02:17 PM
RE: GGR from Image - by Krikor - 10-06-2022, 07:45 PM
RE: GGR from Image - by Krikor - 10-07-2022, 12:15 AM
RE: GGR from Image - by rich2005 - 10-07-2022, 08:50 AM
RE: GGR from Image - by Ofnuts - 10-07-2022, 11:49 AM
RE: GGR from Image - by rich2005 - 10-07-2022, 12:02 PM
RE: GGR from Image - by Krikor - 10-11-2022, 01:12 AM

Forum Jump: