def getTemplateMenu(self, file_name, user_path=False): """ Get the template menu file to be modified by the different methods Arguments file_name {string} -name of the file including the extension user_path {boolean} -- True: get file from Packages/Deviot/Preset --False: get file from Packages/User/Deviot/Preset (Defaul:False) """ file_path = Paths.getTemplateMenuPath(file_name, user_path) preset_file = JSONFile(file_path) preset_data = preset_file.getData() return preset_data
def saveTemplateMenu(self, data, file_name, user_path=False): """ Save the menu template in json format Arguments: data {json} -- st json object with the data of the menu file_name {string} -- name of the file including the extension user_path {boolean} -- True: save file in Packages/Deviot/Preset --False: save file in Packages/User/Deviot/Preset (Defaul:False) """ file_path = Paths.getTemplateMenuPath(file_name, user_path) preset_file = JSONFile(file_path) preset_file.setData(data) preset_file.saveData()
def generateFiles(install=False): # Creates new menu api_boards = Paths.getTemplateMenuPath('platformio_boards.json', user_path=True) # create main files PlatformioCLI().saveAPIBoards(install=install) Menu().createMainMenu() Tools.createCompletions() Tools.createSyntaxFile() Menu().createLibraryImportMenu() Menu().createLibraryExamplesMenu() # Run serial port listener Serial = SerialListener(func=Menu().createSerialPortsMenu) Serial.start()