def machineLoadButtonPressed(self, loadButton):
        filePath = filedialog.askopenfilename(filetypes=[('Python file','*.py')])
        
        if filePath != '':
            components = filePath.split('/')
            fileName = components[-1]

            if os.path.isfile(os.getcwd()+'/machineConfig/'+fileName) == False:
                # [isValid, errorString] = MachineConfigTest(filePath).runTests() //TODO
                isValid = 1

                if isValid:
                    loadButton.config(text=filePath)

                    groupDesctiptionNotebook = Notebook(self)
                    groupDesctiptionNotebook.grid(row=2, column=0, columnspan=4, sticky=E+W)
                    

                    tabNameList = jsonHelper.getAllGroups()
                    groupDescriptionFrameList = [];

                    for tabName in tabNameList:
                        groupDescriptionFrame = GroupDescriptionCheckboxFrame(groupDesctiptionNotebook, tabName)
                        groupDescriptionFrameList.append(groupDescriptionFrame)
                        groupDescriptionFrame.pack(fill=BOTH, expand=True)
                        groupDesctiptionNotebook.add(groupDescriptionFrame, text=tabName)
                      

                    Button(self, text='Apply & Close', relief=RAISED, command=lambda: self.applyMachineButtonPressed(filePath, groupDescriptionFrameList)).grid(row=3,column=1,columnspan=1,sticky=S+E)
                
                else:
                    messagebox.showinfo("Error", errorString)

            else:
                messagebox.showinfo("Error", "File already exists in machineConfig directory: " + fileName)
    def setupSelectedFilterType(self, selectedFilterFileName, filterType):

        groupDesctiptionNotebook = Notebook(self)
        groupDesctiptionNotebook.grid(row=3, column=0, columnspan=4, sticky=E + W)

        groupNameList = jsonHelper.getAllGroups()

        groupDescriptionFrameList = []

        for groupName in groupNameList:
            groupDescriptionFrame = GroupDescriptionCheckboxFrame(groupDesctiptionNotebook, groupName)
            # get selected filters for groupname
            selectedFilterList = []

            if filterType == "Head":
                selectedFilterList = jsonHelper.getHeadFiltersListForGroup(groupName)
            else:
                selectedFilterList = jsonHelper.getJawFiltersListForGroup(groupName)

            isEnabled = selectedFilterFileName in selectedFilterList
            groupDescriptionFrame.enableCheckButtonInt.set(isEnabled)
            groupDescriptionFrameList.append(groupDescriptionFrame)
            groupDescriptionFrame.pack(fill=BOTH, expand=True)
            groupDesctiptionNotebook.add(groupDescriptionFrame, text=groupName)

        Button(
            self,
            text="Apply & Close",
            relief=RAISED,
            command=lambda: self.applyFilterTypeButtonPressed(
                selectedFilterFileName, groupDescriptionFrameList, filterType
            ),
        ).grid(row=4, column=1, columnspan=1, sticky=S + E)
    def setupSelectedModuleConfig(self, selectedModuleFileName):

        groupDesctiptionNotebook = Notebook(self)
        groupDesctiptionNotebook.grid(row=3, column=0, columnspan=4, sticky=E + W)

        groupNameList = jsonHelper.getAllGroups()

        groupDescriptionFrameList = []

        for groupName in groupNameList:
            groupDescriptionFrame = GroupDescriptionCheckboxFrame(groupDesctiptionNotebook, groupName)

            modulesForGroupList = jsonHelper.getModuleListForGroup(groupName)
            isEnabled = selectedModuleFileName in modulesForGroupList
            groupDescriptionFrame.enableCheckButtonInt.set(isEnabled)

            groupDescriptionFrameList.append(groupDescriptionFrame)
            groupDescriptionFrame.pack(fill=BOTH, expand=True)
            groupDesctiptionNotebook.add(groupDescriptionFrame, text=groupName)

        Button(
            self,
            text="Apply & Close",
            relief=RAISED,
            command=lambda: self.applyModuleButtonPressed(selectedModuleFileName, groupDescriptionFrameList),
        ).grid(row=4, column=1, columnspan=1, sticky=S + E)
    def setupEditGroupDropdown(self):

        groupNameList = jsonHelper.getAllGroups()
        dropGroupTitle = StringVar()
        dropGroupTitle.set("Select Group")
        groupDropMenu = OptionMenu(self, dropGroupTitle, *groupNameList, command=self.groupSelectedFromOptionsMenu)
        groupDropMenu.grid(row=1, column=0, columnspan=4, sticky="ew")
    def applyGroupButtonPressed(self,groupName, groupCheckboxFrame):

        groupNameList = jsonHelper.getAllGroups()

        if groupName in groupNameList:
            messagebox.showinfo("Error", DUPLICATE_NAME_ERROR)
        else:
            headFilterFilenameList = groupCheckboxFrame.getEnabledHeadFilenames() 
            jawFilterFilenameList = groupCheckboxFrame.getEnabledJawFilenames() 
            moduleFilenameList = groupCheckboxFrame.getEnabledModuleFilenames() 
            jsonHelper.addGroupToJSON(groupName,headFilterFilenameList,jawFilterFilenameList,moduleFilenameList)
            self.parent.destroy()
    def filterTypeLoadButtonPressed(self, filePath,filterType):
        groupDesctiptionNotebook = Notebook(self)
        groupDesctiptionNotebook.grid(row=2, column=0, columnspan=4, sticky=E+W)

        tabNameList = jsonHelper.getAllGroups()
        groupDescriptionFrameList = [];

        for tabName in tabNameList:
            groupDescriptionFrame = GroupDescriptionCheckboxFrame(groupDesctiptionNotebook, tabName)
            groupDescriptionFrameList.append(groupDescriptionFrame)
            groupDescriptionFrame.pack(fill=BOTH, expand=True)
            groupDesctiptionNotebook.add(groupDescriptionFrame, text=tabName)
          
        Button(self, text='Apply & Close',relief=RAISED,command=lambda:self.applyFilterTypeButtonPressed(filePath, groupDescriptionFrameList, filterType)).grid(row=3,column=1,columnspan=1,sticky=S+E)