Skip to content

workbench

freecad.datamanager_wb.entrypoints.workbench

FreeCAD workbench registration for DataManager.

Defines the Gui.Workbench subclass used by FreeCAD to create menus/toolbars and activate the workbench.

DataManagerWorkbench

class which gets initiated at startup of the gui

Icon = os.path.join(ICONPATH, 'Logo.svg') class-attribute instance-attribute

MenuText = _translate('Workbench', 'Data Manager') class-attribute instance-attribute

ToolTip = _translate('Workbench', 'a simple data manager workbench') class-attribute instance-attribute

toolbox = ['DataManagerVarsetManagement', 'DataManagerAliasManagement'] class-attribute instance-attribute

Activated()

code which should be computed when a user switch to this workbench

Source code in freecad/datamanager_wb/entrypoints/workbench.py
def Activated(self):
    """
    code which should be computed when a user switch to this workbench
    """
    get_port().message(_translate("Log", "Workbench datamanager_wb activated. ;-)") + "\n")

Deactivated()

code which should be computed when this workbench is deactivated

Source code in freecad/datamanager_wb/entrypoints/workbench.py
def Deactivated(self):
    """
    code which should be computed when this workbench is deactivated
    """
    get_port().message(_translate("Log", "Workbench datamanager_wb de-activated.") + "\n")

GetClassName()

Return the class name of the workbench

Source code in freecad/datamanager_wb/entrypoints/workbench.py
def GetClassName(self):
    """
    Return the class name of the workbench
    """
    return "Gui::PythonWorkbench"

Initialize()

This function is called at the first activation of the workbench. here is the place to import all the commands

Source code in freecad/datamanager_wb/entrypoints/workbench.py
def Initialize(self):
    """
    This function is called at the first activation of the workbench.
    here is the place to import all the commands
    """

    import FreeCAD as App  # pylint: disable=import-error

    get_port().message(_translate("Log", "Switching to datamanager_wb") + "\n")

    qt_translate_noop = App.Qt.QT_TRANSLATE_NOOP

    # NOTE: Context for this commands must be "Workbench"
    self.appendToolbar(qt_translate_noop("Workbench", "Data Manager"), self.toolbox)
    self.appendMenu(qt_translate_noop("Workbench", "Data Manager"), self.toolbox)