c-koi / gmic-qt

G'MIC-Qt is a versatile front-end to the image processing framework G'MIC.
GNU General Public License v3.0
206 stars 53 forks source link

Is there a more elegant way to solve this problem? #158

Closed Reptorian1125 closed 1 year ago

Reptorian1125 commented 2 years ago

Crossposting from discuss.pixls.us forum - https://discuss.pixls.us/t/gmic-exercises/6774/1014?u=reptorian

image

The use of this is to allow users to delete color using dynamic gui code. However, it looks messy as you can see in the image.

One idea to solve this problem is to have buttons next to color(), somehow.

This is the code to that image:

#@gui Transfer Color [Reduced Colors]: fx_rep_transfer_color_reduced,fx_rep_transfer_color_reduced_preview
#@gui:_=separator()
#@gui:_=note("<b>Preliminary Setup</b>")
#@gui:Style of Dithering=choice(0,"Indexing","Ordered")
#@gui:Special Effect=choice(0,"None","Horizontal","Vertical")_0
#@gui:Special Effect Factor (%)=float(50,0,100)_0
#@gui:_=separator()
#@gui:_=note("<b>Palette</b>")
#@gui:Palette Method=choice(0,"Premade","Auto","Import","Custom")
#@gui:Palette to Use=choice(10,"BW-{2}","RGB-{3}","B-RGB-{4}","BW-RGB-{5}","CMY-{3}","CMYK-{4}","WCMYK-{5}","RGBCMY-{6}","1-Bit RGB-{8}","Aurora-{256}","Zenit-241","Game Builder Garage: Texture-Sprite Editor Palette-{117}","Duel-{256}","Hocus Pocus-{256}","PLAYPAl-{249}","Sonic Robo Blast 2-{256}","Uzebox-{256}","Andrew Kensler - 16","Andrew Kensler - 32","Andrew Kensler - 54","AAP-Micro 12","AAP-16","AAP-64","AAP-RadiantPLUS-{96}","AAP-SPLENDOR128","AAP-DGA16","Cheerful-32","DB8","DB16","DB32","DB-ISO22","DimWiddy 17","DimWiddy 23","Endesga-4","Endesga-8","Endesga-16","Endesga-32","Endesga-36","Endesga-64","Famicube","Juicy-32","Juicy-56","XAIUE-22","15P-DX","20P-DX","24P-DX","Cabana-64","Fantasy 16","Fantasy 24","Tranquil Fantasy 23","Tranquility Plus 39","Faraway 48","Fleja Master Palette","Koni32","Linear Color Palette Basic","LEGO colors-{43}","Lego Colours 2021-{40}","Vines Flexible Linear Ramps-{38}","Arcade Standard 29","ARQ16","Atom-8","BLK 36","BLK-NEO","Broken Facility-{40}","Bubblegum-16","CPC BOY-{32}","Cade 15","Calder 8","CD-BAC-{16}","CG Arne-{16}","Dinoknight 16","||||-22","FZT Ethereal 16","Indecision-{17}","Island Joy 16","Journey-{64}","Shallowmarsh26","Lago Nenufar [Lake Water Lily]-{19}","Juicy 17","ChocolateGanache-{96}","Bright Winter 1-{74}","Bright Winter 2-{83}","Kawaii16","0xdb-01-{17}","GZXP-{11}","Chromatic16","Piet-{20}","Matrix-{96}","Material Design-{96}","Rainbow A-{88}","Rainbow B-{96}","SCRJ-XXXVI-{36}","Pxls Default-{32}","Moderna-{24}","Oak21-{21}","Nature's Embrace 55","RBYPGO-{94}","New Worlds 46","Nauris-16","Dynamite-{40}","Interstate 28","Downgraded 32","Pear 36","Pineapple 32","Peachy Pop 16","Resurrect 32","Rosy 42","SLSO-CLR17","Softy 15","SPEC12","The Roarin 80s-{8}","Starmancer-{52}","SuperFuture25","SUNSHINE 35","Sweetie 16","Calm 48","Optimism-{32}","Taffy 16","Todayland Palette V2-{25}","TriRampo-{12}","r\place 2022-{32}","Tropical Cone 24","Vivid-17","SHIDO50+-{72}","Intacto14","Itatsi-{23}","ENOS16","Grixel Grotto-{16}","Superb 8","Undertones-17","Tango-{28}","Cheese Palette-{28}","Equpix 15","Zughy 32","Voodo34","Franzston 30","Night 16","Star 29","Star 34","Still-Life-{14}","SimpleJPC-16","Acid 15","Battery 24","Clumpy 18","Cthulhu-{16}","Crimso 11-{16}","Copper-Tech-{16}","DRZ15A-{15}","Eggy 15","Europa 16","GreyT-bit-{8}","Jewel-{15}","Polar 11","Sheltzy 32","Wyrm 24","Yume Nikki-{24}","Rube-Goldberg-{9}","BoomBoom-{7}","Generic-8","Crayola Blind-{9}","Matriax8c","NT1H-{26}","JerryPie 22","Nineties Nine-{9}","On70-{35}","ANB16","Retrocal-8","Punolit-{21}","Luap 40","Autum Villan 6","Autum 15","Autum 15 [Yellow]","Galaxy Flame-{16}","Antiquity16","Mushroom-{14}","Aerugo-{32}","Hotel Paintings 6","Nopal-12","Brightness GPY-{3}","Blessing-{5}","Fairydust 8","Fuzzy Four-{4}","Fairy Tales-{8}","Naji 16","Easter Island-{16}","Pastel and Darks 58","17 Pastels","NOSTALGIA15","Ocaso-{17}","Oh Hell Pastel-{15}","Pollen-8","KULE-16","Hydrangea 11","Fluffy8","ST 8 R&B Remake","Neon Space-{10}","Cyclope6","Sy17","Syz15","TUI-15","Cave-{8}","Psygnosia-{16}","MarshMellow32","Lost Century 24","Finlal 11","Industrial Factory 16","Murder Mystery 16","Fate & Destiny 12","Vinik 24","YKB-22","Halloween-{7}","Graveyard-21","Steam Lords-{16}","Frostical-{18}","DeuteroSpill-{9}","Cool Bone 7","Muted Ally 6","EPHEMERA-{12}","Ink-{5}","Violet Dreams-{8}","Tinyfolks-{5}","Old Gold 7","Rosemoss-8","AAP-RadiantXV-{15}","AAP-Majesty XVII-{17}","Dead Weight-8","Mojave20","Petite-8","Petite-8 Afterdark","XAIUE-Radiant-{22}","Daruda 22","Firestorm-{9}","Borkfest-{8}","Spicy 07","Rust-6","Apricot-{6}","SuperNova 7","Pastry-{5}","Sandy 06","Illumination-{5}","NYX8","Dream Haze 8","OIL6","Regal10","Soft Demon 7","SGM-Palette 2-{17}","Midnight ablaze-{7}","Black Cherry-{5}","Sunset Red-{5}","INKPINK-{6}","Brash Pink-{5}","Pink Neon Sign 6","Enchanted Purple-{12}","Arch-{11}","Spacey Easter-{17}","Fornax Void I-{256}","Fornax Void II-{128}","Pixelwave-{12}","S1-6","Berry Nebula-{8}","ABYSS-9","Moonlight 15","Moonlit-39","H2O-{10}","Magic Waters 9","Bluem0ld-{4}","Moss-{5}","DEEP MAZE-{7}","Toxic Slime-{5}","Lush Green-{6}","Tsunami-{5}","Cryptic Ocean-{6}","Marsh Madness-{5}","OXYD-{8}","Pink&Green-{8}","Walking in the Woods 8","Paper 8","Sahara Pastell-{7}","Sunflower Painting 7","Art Hoe Aesthetic 7","Sky5-{8}","Ocean Glass-{8}","RoyalGuard-{6}","Eulbink-{8}","Winter Wonderland-{8}","Moon Squid 7","Stratus-{5}","Arctic Dust-{5}","CL8UDS","Lilac Skies 5","Sea of Fire-{6}","Autochrome 3","Autochrome 5","GB Default 1-{4}","GB Default 2-{4}","GB Andrade-{4}","GB Blue Seni-{4}","GB Blackzone-{4}","GB Suburb-{4}","GB Crimson-{4}","GB Didi-{4}","GB Dirty-{4}","GB Arne-{4}","GB Easy-{4}","GB Forest-{4}","GB Harsh Green-{4}","GB Light Green-{4}","GB Nostalgia-{4}","GB Platinum-{4}","GB Kirokaze-{4}","GB Cyber-{4}","GB Wish-{4}","GB Grapefruit-{4}","GB Ice Cream-{4}","GB Red_Blue-{4}","Gold GB-{4}","GB Chocolate-{4}","GB Gray-{4}","GB Spacehaze-{4}","GB Purple Dawn-{4}","Moon Crystal-{4}","ARNE4","Autumn Chill-{4}","CherryMelon-{4}","HallowPumpkin-{4}","Hollow-{4}","Lavender4","MAW-{4}","Voltage Warning-{4}","Tritanopia-{4}","Rabbit 7-{4}","Amiga 2600 NTSC-{128}","Amiga 2600 PAL-{108}","Amiga 2600 SECAM-{8}","Amiga 7800 M.E.S.S-{256}","Amiga 7800-{256}","Amstrad CPC-{27}","Apple II-{15}","Atari 8-Bit Series-{256}","CGA-{16}","CGA Mode 0 [Low]-{4}","CGA Mode 0 [High]-{4}","CGA Mode 1 [Low]-{4}","CGA Mode 1 [High]-{4}","CGA Mode 2 [Low]-{4}","CGA Mode 2 [High]-{4}","C64[Pepto]-{16}","C64[Colodore]-{16}","Commodore VIC-20-{16}","Colecovision-{15}","Japanese Machine Palette-{16}","Macintosh II-{16}","Macintosh 8-Bit System-{256}","MSX-{15}","NES-{55}","PICO-8-{16}","RISC OS-{16}","SAM Coupe-{128}","Thomson MO5-{16}","TRS-80 Color Computer Palette-{4}","Virtual Boy interpreted-{4}","VGA-{256}","Win95-{256}","ZX Spectrum-{15}","GNOME 32","Electronic Crayon 22","Chip16","Deluxe Paint-{222}","FlatUI-{20}","MakeCode Arcade Palette-{15}","Oekaki-{20}","Legacy Paint-{16}","XP Paint-{28}","Vista Paint-{28}","Human Faces-{94}","MadjikHSV-{96}","ST24 Christmas","Reds-{24}","Dullish Rainbow-{6}")
#@gui:Send to Custom Palette=button()
#@gui:Import Palette File=file()
#@gui:Number of Color=int(8,2,256)
#@gui:Display Custom Palette Colors=bool(1)
#@gui:Color 1=color(247,244,191)
#@gui:Delete Color 1=button()
#@gui:Color 2=color(255,240,43)
#@gui:Delete Color 2=button()
#@gui:Color 3=color(255,207,5)
#@gui:Delete Color 3=button()
#@gui:Color 4=color(255,177,8)
#@gui:Delete Color 4=button()
#@gui:Color 5=color(233,134,39)
#@gui:Delete Color 5=button()
#@gui:Color 6=color(191,90,62)
#@gui:Delete Color 6=button()
#@gui:Color 7=color(156,51,39)
#@gui:Delete Color 7=button()
#@gui:Color 8=color(114,28,3)
#@gui:Delete Color 8=button()
#@gui:Color 9=color(255,226,207)
#@gui:Delete Color 9=button()
#@gui:Color 10=color(212,174,170)
#@gui:Delete Color 10=button()

My recommendation is to allow syntax like:

#@gui:Color 6=color(191,90,62):(+)
#@gui:Color 6=color(191,90,62):(-)

Next to color(), these are the symbol/text buttons will have, and they will be placed next to color(). They should behave the very same way as button().

This can also give rise to allowing user to reset parameters via dynamic code. Also, on the part of dynamic gui coding, their visibility status should be linked to the parameter they're next to rather than by themselves.

Another suggestion is to just have (+), and it will join GUI elements. This also enables the grid request I wanted before.

dtschump commented 2 years ago

Use button(0) to align the button to the left.

Reptorian1125 commented 2 years ago

That worked though the idea of joining GUI elements to create variables grid is up there though. I'll be leaving this open for that part.