lua-scripts icon indicating copy to clipboard operation
lua-scripts copied to clipboard

Some GUI proposal for the script manager

Open TurboGit opened this issue 2 years ago • 12 comments

The current script manager looks like:

image

I find it hard to read each line and do proper separation between the script name and the status.

A proposal would be to left align the script name and right align the status and possibly use some symbol for started / stopped.

TurboGit avatar Dec 20 '23 20:12 TurboGit

Let's work on status first...

The buttons can be styled using CSS.

Add this to your user.css to control the color of the labels (red for stopped, green for running):

button#sm_started label { color: rgb(50,210,50); }
button#sm_stopped label { color: rgb(210,50,50); }

colorlabels

or if you'd rather have the button background turn colors:

button#sm_started label { background: rgb(0,128,0);
			 font-weight: bold; }

button#sm_stopped label { color: rgb(128,0,0);
			 font-weight: bold; }

colorbkgd

You also need to drop down the start/stop scripts combobox and select configure, then click the use color interface? checkbox. colorinf

The buttons in the lua API currently only support ellipsize as an argument. I'd have to change the API and add halign. I agree that they are hard to read with each line starting in a different place.

Probably the best solution to the just text configuration would be a table on each button with the name left aligned and the status right aligned. I'll play with it and see if I can pass a widget to the button creation.

wpferguson avatar Dec 21 '23 00:12 wpferguson

Added left align

leftalign

with color

leftaligncolor

EDIT: Probably need to change the colors a little bit with the default theme :)

wpferguson avatar Dec 21 '23 19:12 wpferguson

I'm not convinced with the color :)

What about just making the background as "selected" button on dt interface?

TurboGit avatar Dec 21 '23 21:12 TurboGit

I was initially thinking about something like this:

292300579-42eabdbe-0f7b-4609-ab8c-dd0f200a7ae8

TurboGit avatar Dec 21 '23 21:12 TurboGit

More thoughts....

Changed the color to shades of gray to show on/off

grays

I also added an image option to button so that I can do a box with a button on the left and a label on the right

|--------------------------------------|
| image button | label             |
|--------------------------------------|

that looks like this...

poweroff

poweron

the problem being that the box isn't fixed size and my GTK CSS skills suck :)

wpferguson avatar Dec 24 '23 18:12 wpferguson

Another try...

If I turn off box padding and fill I can get

latest

Looks like another API change.... :)

wpferguson avatar Dec 26 '23 19:12 wpferguson

Oh yes, I love this last version. It fits really well into darktable GUI.

I really think that the Lua plug-ins should be more first class citizen and we should put effort on making it more integrated. So there is the GUI, hence my proposal here and the translation.

The fact that there is no translation make some label in English and all lower case in the now capitalized French UI (and of course this is true for all languages I suppose).

What can we do to improve this? (maybe need another issue to discuss this).

TurboGit avatar Dec 26 '23 20:12 TurboGit

For Lua being a first class citizen, I'd propose the following:

  1. make the tooltip describing the script structured, we have:

image

or

image

That is, the section (USAGE) is surrounded by -- or nothing. We have paragraphs starting with * or 1)...

So maybe we need a structured way to describe a modules (like dt modules) and have the Lua manager use the same layout.

In dt each IOP give a set of strings but the layout is done by dt. For example in Crop module we have:

const char **description(struct dt_iop_module_t *self)
{
  return dt_iop_set_description(self,
                                _("change the framing"),
                                _("corrective or creative"),
                                _("linear, RGB, scene-referred"),
                                _("geometric, RGB"),
                                _("linear, RGB, scene-referred"));
}

Maybe something similar would work too for Lua.

For the translation, I'm not sure yet but maybe if we set the lua Git repository as sub-project we can use the main dt translation support also for Lua. Would that be ok with you? I can experiment and see if it works.

TurboGit avatar Jan 17 '24 08:01 TurboGit

@wpferguson : For the translation, how to tell the Lua scripts to look for the darktable .mo files?

TurboGit avatar Jan 17 '24 08:01 TurboGit

The way I get the current tooltip is by grabbing the comments at the start of the file and using a regular expression to pull out the description.

I've thought about using a table to organize the information, but in order to access the table I'd have to run the script. I just had a thought to see if there is a way to load the script without running it which might make the data available. I'd like to keep the scripts self documenting if at all possible.

wpferguson avatar Jan 17 '24 19:01 wpferguson

I figured out a way to get the data from the script.

I can create a code snippet in the file like

script_data.description = {
	name = "this is the name",
        purpose = "this is the purpose",
        author = "this is the author",
        something_else = "this is something_else",
}

I can grab that out of the script and write it to a temporary file, then import it using dofile("tmpfile")to fill in whatever information we need.

wpferguson avatar Jan 17 '24 21:01 wpferguson

progress

Got the button interface working.

Figured out how to pass the description

script_data.metadata = {
  name = "clear_GPS",
  purpose = _("remove GPS data from selected image(s)"),
  author = "Bill Ferguson <[email protected]",
  help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/clear_gps/"
}

I'm using user.css to hold the css. Should I add it to the themes?

wpferguson avatar Apr 05 '24 02:04 wpferguson

Actually closed by #479

wpferguson avatar Jun 09 '24 23:06 wpferguson