WorkBench creation wiki page has some unusable code.

Discussions about the wiki documentation of FreeCAD and its translation.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
onekk
Veteran
Posts: 6144
Joined: Sat Jan 17, 2015 7:48 am
Contact:

WorkBench creation wiki page has some unusable code.

Post by onekk »

Hello. a little thing.

I was trying to create a WB from scratch, but documentation on the Wiki, is incomplete and simply copying examples (modifying the correct things) is not working.

QT_TR_NOOP_.... give some errors.

Code: Select all

class My_Command_Class():
    """My new command"""

    def GetResources(self):
        return {'Pixmap'  : 'My_Command_Icon', # the name of a svg file available in the resources
                'Accel' : "Shift+S", # a default shortcut (optional)
                'MenuText': QT_TR_NOOP("My New Command"),
                'ToolTip' : QT_TR_NOOP("What my new command does")}
Analyzing some other WB I see that some other writings are used like setting and __ini__ class instead of:

Code: Select all

class MyWorkbench (Workbench):

    MenuText = "My Workbench"
    ToolTip = "A description of my workbench"
    Icon = """paste here the contents of a 16x16 xpm icon"""


I could cope with these things.

But to reduce frustration of new users, some "reasonable working" code should be put in pages that "teach users to do things".

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
User avatar
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

Re: WorkBench creation wiki page has some unusable code.

Post by Roy_043 »

I have updated the My_Command_Class code on the Workbench_creation page. I have removed the calls to QT_TR_NOOP.
User avatar
onekk
Veteran
Posts: 6144
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: WorkBench creation wiki page has some unusable code.

Post by onekk »

Roy_043 wrote: Fri Dec 17, 2021 9:49 am I have updated the My_Command_Class code on the Workbench_creation page. I have removed the calls to QT_TR_NOOP.
How fast!!

Many many Thanks.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
Post Reply