edwardvmills / Silk

NURBS Surface modeling tools focused on low degree and seam continuity (FreeCAD Workbench)
https://edwardvmills.github.io/Silk/
62 stars 11 forks source link

Tooltips: format spacing for readability #32

Closed luzpaz closed 1 year ago

luzpaz commented 1 year ago

Added formatting for tooltips as demonstrated in https://github.com/edwardvmills/Silk/blob/master/AddNewCommand.py#L35-L37

luzpaz commented 1 year ago

It's weird how the tabs display differently in the IDE in comparison to github

In vscode

Screenshot_20230416_074334

In Github

Screenshot_20230416_074403

luzpaz commented 1 year ago

Is there a way to tell github to show tabs as 4 whitespaces ?

edit: :point_down:

luzpaz commented 1 year ago

@edwardvmills can you set the tab whitespace to 4 whitespaces in https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-personal-account-settings/managing-your-tab-size-rendering-preference please ?

edwardvmills commented 1 year ago

hi luzpaz, i'm actually working on some of these as well. in addition, i'm also going to break out the tooltip and paths as variables to allow clearer multiline, like so

def GetResources(self):
        # prepare a multiline tooltip
        tooltip = ("\n"
            "\n"
            "\n"
            "\n"
            "\n"
            "\n"
            "\n"
            )

        toolbarIconPath = FreeCAD.getUserAppDataDir()+"Mod" + "/Examples_WB/Resources/Icons/Werner_fp_makeOctahedron.svg"

        return {'MenuText': 'Werner_fp_Octahedron', 
                'ToolTip': tooltip,
                'Pixmap' :  toolbarIconPath}

i'd like to accept your commit, but i'm afraid it might clash with what i'm already doing.

edwardvmills commented 1 year ago

as far as the tab and spaces...is this a github.com display thing, or does it modify the actual files in the repo?

edwardvmills commented 1 year ago

ok, it seems like just a display thing. i set it to 4 as requested.

edwardvmills commented 1 year ago

here's a better example of the style i'm going for, now that AndyK has supplied the contents:

(github not rendering correctly, all the comment string lines are left justified correctly)

class Werner_fp_makeBox():
    def Activated(self):
        try:
            a=FreeCAD.ActiveDocument.addObject("Part::FeaturePython","Box")
        except:
            print ('create or open a document first')
            return

        Box(a)
        ViewProviderBox(a.ViewObject)
        FreeCAD.ActiveDocument.recompute()

    def GetResources(self):
        tooltip = ("Werner_fp_makeBox \n"
            "a document object is created,\n"
            "then passed to the Box() class\n"
            "and the result passed to the ViewProviderBox() class\n"
            "\n"
            "Box() makes the shape from Part.makeBox() \n"
            "with custom parameters for Length, Width, and Height \n"
            "(as Length type) under data tab \n"
            "also, data parameter changes echo to report view\n"
            "\n"
            "ViewProviderBox() sets a custom icon in XPM format\n"
            "here also, view parameter changes echo to report view\n"
            "\n"
            "note that the toolbal icon does not carry over to the \n"
            "model tree icon, where the view provider icon takes priority")

        toolbarIconPath = FreeCAD.getUserAppDataDir()+"Mod" + "/Examples_WB/Resources/Icons/Werner_fp_makeBox.svg"

        return {'MenuText': 'Werner_fp_makeBox', 
                'ToolTip': tooltip,
                'Pixmap' :  toolbarIconPath}

Gui.addCommand('Werner_fp_makeBox', Werner_fp_makeBox())

As you may have noticed, i am on a side quest, and not actually doing Silk right now. planning on wrapping this up soon.

edwardvmills commented 1 year ago

i saw a few different ways to do multiline, and i think this one is a nice combination of simple, but still provides feedback on final rendering.

edwardvmills commented 1 year ago

I got 8 done and pushed. still a lot to do....hopefully by the end of this week.