Namespace missmatch growth

So I started to do something and I started to notice a lack of pattern where there should be one. At least I would imagine myself to see one with the name spaces. But considering Krita is created by so many people I think it is to be expected.

so the names have been changing back and forth over the years and some kind of clean up to standardize the names into some kinda of convention I will show what is currently and what I mean as what I would expect at least without knowing nothing before hand.

I know changing this is like a tons and tons of work. but it should kinda not be forgotten as things go along. In hindsight grouping things is easier than when things are freshly created I think.


Current State

Tool Python Call Icon ToolTip
Select Shapes Tool InteractionTool select name
Text Tool SvgTextTool draw-text name
Edit Shapes Tool PathTool shape_handling name
Calligraphy KarbonCalligraphyTool calligraphy name
Freehand Brush Tool KritaShape/KisToolBrush krita_tool_freehand name
Line Tool KritaShape/KisToolLine krita_tool_line name
Rectangle Tool KritaShape/KisToolRectangle krita_tool_rectangle name
Ellipse Tool KritaShape/KisToolEllipse krita_tool_ellipse name
Polygon Tool KisToolPolygon krita_tool_polygon Name + Note
Polyline Tool KisToolPolyline polyline Name + Note
Bezier Curve Tool KisToolPath krita_draw_path Name + Note
Freehand Path Tool KisToolPencil krita_tool_freehandvector name
Dynamic Brush Tool KritaShape/KisToolDyna krita_tool_dyna name
Multibrush Tool KritaShape/KisToolMultiBrush krita_tool_multihand name
Transform a layer or a selection KisToolTransform krita_tool_transform description
Move a Layer KritaTransform/KisToolMove krita_tool_move description
Crop the image to an area KisToolCrop tool_crop description
Draw a Gradient KritaFill/KisToolGradient krita_tool_gradient description
Sample a Color from the current image or layer KritaSelected/KisToolColorSampler krita_tool_color_sampler description
Colorize Mask KritaShape/KisToolLazyBrush krita_tool_lazybrush name
Smart Patch KritaShape/KisToolSmartPatch krita_tool_smart_patch name
Fill a contiguous area of a color with a color, or fill a selection KritaFill/KisToolFill krita_tool_color_fill description
Enclose and Fill Tool KisToolEncloseAndFill krita_tool_enclose_and_fill name
Assistant Tool KisAssistantTool krita_tool_assistant name
Measure the distance between two points KritaShape/KisToolMeasure krita_tool_measure description
Reference Images Tool ToolReferenceImages krita_tool_reference_images name
Rectangular Selection Tool KisToolSelectRectangular tool_rect_selection name
Elliptical Selection Tool KisToolSelectElliptical tool_elliptical_selection name
Polygonal Selection Tool KisToolSelectPolygonal tool_polygonal_selection name
Freehand Selection Tool KisToolSelectOutline tool_outline_selection name
Contiguous Selection Tool KisToolSelectContiguous tool_contiguous_selection name
Similar Color Selection Tool KisToolSelectSimilar tool_similar_selection name
Bezier Curve Selection Tool KisToolSelectPath tool_path_selection name
Magnetic Curve Selection Tool KisToolSelectMagnetic tool_magnetic_selection name
Zoom Tool ZoomTool tool_zoom name
Pan Tool PanTool tool_pan name

my suggestions would be to:

  • shorten tool names to not be long and 2 words at most so they are icon and easy to remember. trying to explain the function with a long name defeats easy memory calls. short words easy catalogation in a persons mind.
  • Replacing names with description works if all tooltips do the same and the majority leans to have a tool tip with name of the tool that is the same as in the shortcut keys area.
  • there is polygon and polygonal and also rectangle and rectangular Should be one or the other
  • adding a krita tag to something inside krita always sounds redundant to me and make a name space needlessly long and instead should be using keywords that actually sort the name out and not in from where ever it maybe in the code. So “krita_tool” something can easily be reduce to “tool_”.
  • I understand some names seem like legacy names for older versions but Krita currently seems too big for them to just be in the side lines I think.
  • I find it really odd to some times divide the string with “-” other times with “_” and other times with “/” and their use also seems randomly used between each terms.
  • there is a duality between “Brush” and “Selection” and those terms probably should replace the keyword “Tool” where they need something to differentiate them from each other.
  • keywords like “and” or “or” should not be present in the toolbar but this is merely personal opinion there. Just naming a tool with a word is better I think. I choose the keywords for each that seemed more striking for each case and rolled with it.

My Suggestion

Tool Python Call Icon ToolTip
Select Tool tool_vector_select icon_vector_select name
Text Tool tool_vector_text icon_vector_text name
Edit Tool tool_vector_edit icon_vector_edit name
Calligraphy Tool tool_vector_calligraphy icon_vector_calligraphy name
Freehand Brush tool_brush_freehand icon_brush_freehand name
Line Brush tool_brush_line icon_brush_line name
Rectangle Brush tool_brush_rectangle icon_brush_rectangle name
Ellipse Brush tool_brush_ellipse icon_brush_ellipse name
Polygon Brush tool_brush_polygon icon_brush_polygon name
Polyline Brush tool_brush_polyline icon_brush_polyline name
Bezier Brush tool_brush_bezier icon_brush_bezier name
Path Brush tool_brush_path icon_brush_path name
Dynamic Brush tool_brush_dynamic icon_brush_dynamic name
Multi Brush tool_brush_multi icon_brush_multi name
Transform Tool tool_transform_transform icon_transform_transform name
Move Tool tool_transform_move icon_transform_move name
Crop Tool tool_transform_crop icon_transform_crop name
Gradient Tool tool_color_gradient icon_color_gradient name
Sampler Tool tool_color_sampler icon_color_sampler name
Colorize Tool tool_color_colorize icon_color_colorize name
Patch Tool tool_color_patch icon_color_patch name
Fill Tool tool_color_fill icon_color_fill name
Enclose Tool tool_color_enclose icon_color_enclose name
Assistant Tool tool_overlay_assistant icon_overlay_assistant name
Measure Tool tool_overlay_measure icon_overlay_measure name
Reference Tool tool_overlay_reference icon_overlay_reference name
Rectangle Selection tool_select_rectangle icon_select_rectangle name
Elliptical Selection tool_select_elliptical icon_select_elliptical name
Polygon Selection tool_select_polygon icon_select_polygon name
Freehand Selection tool_select_freehand icon_select_freehand name
Contiguous Selection tool_select_contiguous icon_select_contiguous name
Color Selection tool_select_color icon_select_color name
Bezier Selection tool_select_bezier icon_select_bezier name
Magnetic Selection tool_select_magnetic icon_select_magnetic name
Zoom Tool tool_camera_zoom icon_camera_zoom name
Pan Tool tool_camera_pan icon_camera_pan name

Either way this is just a suggestion considering all the variation that exists. Any other solution would be welcomed at least on my part.

7 Likes

This is an amazing bit of work you’ve done. I can imagine many plugin developers would love to have that first chart (not to take attention away from your naming convention chart – that’s brilliant, too).

2 Likes

Well this is only for the toolbar really there is like a lot more than this that suffers from this problem. And this table is just to compare things in contrast.

But something that is so local to one thing like the toolbar and not be able to search it because the tool has some random off the wall names makes it very hard to even find it or query it. One would think that searching “tool” would find all tools or writing the name of the tool you could find it, but sadley that does not happen in either case because of the mismatch of names. And the difference between the action and the icon names does not help either. Having some internal logic when giving names to stuff would sort things a lot.

But currently you are able to find things easily if you use the “krita plugin developer tools” that is able to bypass all of this and is one of the best plugins Krita has. And strangely people don’t even talk about it. It is like one of the biggest contributions like ever ever. What I did was just use the search and compare results but even so you need to do more than a couple of tries to find some things even if you know what they are.

3 Likes

On the Scripting School Website there’s lists for the action names (with id and tooltip) and icon names (with no additional context).

From my point of view, having to look up the names of actions and icons is a minor inconvenience, but renaming them would be a HUGE hassle and not worth the trouble.
And, not only would it break existing scripts (should be done with caution), renaming actions would break existing custom toolbars (and menus), which should be avoided.

If you really want to avoid the existing names, you could define your own convenience functions or constant variables in a file somewhere and use those.

def activateFreehandBrush():
    Krita.action("KritaShape/KisToolBrush").trigger()

or

FREEHAND_BRUSH_ACTION = "KritaShape/KisToolBrush"
Krita.action(FREEHAND_BRUSH_ACTION).trigger()

In fact, the Shortcut Composer plugin already has enums like the latter defined for actions and more: https://github.com/wojtryb/Shortcut-Composer/tree/main/shortcut_composer/api_krita/enums

1 Like

That is why I am speaking about what I am speaking… Krita tool-tips, Krita Action names, Python API and Icon names for the same thing are randomly different all throughout the table. The Selection tools are probably the only ones that are matching properly but the rest does not follow their unity.

I know this is a situation of too many chefs in the same kitchen but attention to detail brings consistency and polish to whatever is being done.

01 02

As for myself I already created a way to replace the names, I will be using simple lists in my case. It is really not a problem, nothing will stop because of it.

But is it really something to uphold and maintain for the future? or to fix when even more people are using it?

As for python plugins it was a bigger expectation for people to adopt the new python version in Krita 5.2.1 than changing a couple of string names that refer to some actions. All my plugins died in one go and I can say it was no fun. Changing the internal math of things is a much bigger problem than changing some string names to a new set or placing some ints around.

And It is not like any IDE does not have a search and replace to change a unique string. Well unless the names are all mixed up.

Hopefully I did convey I am not advocating for any particular scheme just internal compliance.

1 Like