Ejemplo n.º 1
0
    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)
Ejemplo n.º 2
0
    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)
Ejemplo n.º 3
0
    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)
Ejemplo n.º 4
0
    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)