import os
import FreeCAD
import FreeCADGui


class MCPhotonsWorkbench(Workbench):

    MenuText = "MCPhotons"
    ToolTip = "A description of MCPhotons workbench"
    from mcphotonslib import __dir__
    Icon = ":/MCPhotons/icons/MCPhotons.svg"

    def Initialize(self):
        "This function is executed when FreeCAD starts"
        print('this is initilize')
        import generalSettings
        import elementsSettings
        import geometrySettings
        import incidentPhotonSettings
        import multithreadingSettings
        import randomNumberSettings
        import saveSettings
        import solveSettings

        # import MyModuleA, MyModuleB # import here all the needed files that create your FreeCAD commands
        self.list = ['generalSettings', 'elementsSettings', 'geometrySettings', 'incidentPhotonSettings', 'multithreadingSettings', 'randomNumberSettings', 'saveSettings', 'solveSettings']  # A list of command names created in the line above
        # self.appendToolbar("My Commands", self.list)  # creates a new toolbar with your commands
        self.appendMenu("MCPhotons", self.list)  # creates a new menu

        # self.appendMenu(["An existing Menu", "My submenu"], self.list)  # appends a submenu to an existing menu

    def Activated(self):
        "This function is executed when the workbench is activated"
        return

    def Deactivated(self):
        "This function is executed when the workbench is deactivated"
        return

    def ContextMenu(self, recipient):
        "This is executed whenever the user right-clicks on screen"
        # "recipient" will be either "view" or "tree"
        self.appendContextMenu("My commands",self.list) # add commands to the context menu

    def GetClassName(self):
        # this function is mandatory if this is a full python workbench
        return "Gui::PythonWorkbench"


Gui.addWorkbench(MCPhotonsWorkbench())