class Project(object): """ The main entry point into the application (called by main.py) """ def __init__(self, filename, config_file, config_is_object=False): """ Create a new Project with specified Rom Filename and configuration :type filename: str """ self.filename = filename self.rom = Rom(self.filename) if config_is_object: #If configs passed as object [needed for openCopy()] self.config = config_file #Use the objects else: #Otherwise, use the filenames. self.config = Config(config_file) romconfig = Config( filename, rom=True ) # TODO: Doesn't this negate the purpose of the previous self.config lines? if romconfig.get(['Database', 'Auto-Upgrade']): updb.doUpgrade(self.filename) self.database = Database(self.filenameBase() + '.awakedb') self.disasm = Z80Disasm(self) self.flow = ProcedureFlowCache(self) self.debug_symbols = None def filenameBase(self): """ Get the location of the rom file (without the rom filename) :return: string holding the location of the rom file """ return os.path.splitext(self.filename)[0] def importDebugSymbols(self, filename): self.debug_symbols = DebugSymbols(filename, exclude_pattern='^label_*') if self.debug_symbols: for (address, label) in self.debug_symbols.symbols.items(): self.database.setNameForAddress(address, label) def close(self): """ Close the awakedb database when you finish using it """ self.database.close() def openCopy(self): """Create a project mirror for safe use from different thread""" return Project(self.filename, self.config, True)
class Project(object): def __init__(self, filename, config_file, config_is_object=False): self.filename = filename self.rom = Rom(self.filename) if config_is_object: #If configs passed as object [needed for openCopy()] self.config = config_file #Use the objects else: #Otherwise, use the filenames. self.config = Config(config_file) romconfig = Config(filename, rom=True) if romconfig.get(['Database', 'Auto-Upgrade']): updb.doUpgrade(self.filename) self.database = Database(self.filenameBase() + '.awakedb') self.disasm = Z80Disasm(self) self.flow = ProcedureFlowCache(self) def filenameBase(self): return os.path.splitext(self.filename)[0] def close(self): self.database.close() def openCopy(self): """Create a project mirror for safe use from different thread""" return Project(self.filename, self.config, True)
class Project(object): def __init__(self, filename, config_file, config_is_object=False): self.filename = filename self.rom = Rom(self.filename) if config_is_object: #If configs passed as object [needed for openCopy()] self.config=config_file #Use the objects else: #Otherwise, use the filenames. self.config = Config(config_file) romconfig=Config(filename, rom=True) if romconfig.get(['Database','Auto-Upgrade']): updb.doUpgrade(self.filename) self.database = Database(self.filenameBase()+'.awakedb') self.disasm = Z80Disasm(self) self.flow = ProcedureFlowCache(self) def filenameBase(self): return os.path.splitext(self.filename)[0] def close(self): self.database.close() def openCopy(self): """Create a project mirror for safe use from different thread""" return Project(self.filename, self.config, True)