looooo / freecad.gears

a gear module for freecad
GNU General Public License v3.0
237 stars 95 forks source link

`What's this?` command opens wrong wiki article url #151

Open hasecilu opened 5 months ago

hasecilu commented 5 months ago

As you may know FreeCAD have a Help module where using the What's this? command you can click on a command on the toolbar and the wiki page for it will open.

The way it works is: it opens https://wiki.freecad.org/{$Command_name}.

In the wiki the convention to name pages is: WorkbenchName_CommandName, so in order to make this work, ideally your commands should be named the same. Example: https://wiki.freecad.org/PartDesign_Pad

For instance to create an InvoluteGear with FCGear WB you use CreateInvoluteGear command, when using What's this? command on it opens https://wiki.freecad.org/CreateInvoluteGear/ when the documentation of that command is in https://wiki.freecad.org/FCGear_InvoluteGear article.

looooo commented 5 months ago

isn't it possible to rename the wiki pages?

hasecilu commented 5 months ago

I think that would be possible but it would break the "naming convention". I asked on the wiki forum: https://forum.freecad.org/viewtopic.php?t=85208

hasecilu commented 5 months ago

I checked the code and it seems we only need to rename the command on gui.addCommand() to make it work, so no need to mess with the class names. But I'm still figuring out why using What's this? adds an / to the url making it to not open correctly, you need to manualy remove it going to Web WB and use Web_BrowserSetURL. That doesn't happen with native FreeCAD commands.

Maybe the Wiki should redirect removing /.

Edit: Looking at the log it opens es docs, it's just that the url in the url bar doesn't correspond to opened url, removing the translation suffix on Help preferences fix it, so it's working fine.

Log: Help: opening https://wiki.freecad.org/FCGear_InvoluteGear/es

    commands = [
        "FCGear_InvoluteGear",
         ...
    ]

        gui.addCommand("FCGear_InvoluteGear", CreateInvoluteGear())
        gui.addCommand("FCGear_InternalInvoluteGear", CreateInternalInvoluteGear())
        ...