generic constructor. @param map_name filename of the map to use. eeprom_map.json if not specifie @param working_directory drectory containing the map file name
(self, map_name=None, working_directory=None)
| 28 | return eeprom_reader |
| 29 | |
| 30 | def __init__(self, map_name=None, working_directory=None): |
| 31 | """ generic constructor. |
| 32 | @param map_name filename of the map to use. eeprom_map.json if not specifie |
| 33 | @param working_directory drectory containing the map file name |
| 34 | """ |
| 35 | self._log = logging.getLogger(self.__class__.__name__) |
| 36 | self.map_name = map_name if map_name else makerbot_driver.EEPROM.constants.eeprom_map_name % ( |
| 37 | makerbot_driver.EEPROM.constants.default_version, |
| 38 | makerbot_driver.EEPROM.constants.default_software_variant |
| 39 | ) |
| 40 | self.working_directory = working_directory if working_directory else os.path.abspath(os.path.dirname(__file__)) |
| 41 | #Load the eeprom map |
| 42 | path = os.path.join(self.working_directory, self.map_name) |
| 43 | try: |
| 44 | with open(path) as f: |
| 45 | self.eeprom_map = json.load(f) |
| 46 | except IOError as e: |
| 47 | self._log.error("Could not find %s", path) |
| 48 | raise makerbot_driver.EEPROM.MissingEepromMapError(path) |
| 49 | #We always start with the main map |
| 50 | self.main_map = 'eeprom_map' |
| 51 | |
| 52 | #TODO: Test me |
| 53 | def read_entire_map(self): |