| 29 | |
| 30 | |
| 31 | class DamagePattern: |
| 32 | instance = None |
| 33 | |
| 34 | @classmethod |
| 35 | def getInstance(cls): |
| 36 | if cls.instance is None: |
| 37 | cls.instance = DamagePattern() |
| 38 | |
| 39 | return cls.instance |
| 40 | |
| 41 | @staticmethod |
| 42 | def getUserDamagePatternList(): |
| 43 | return eos.db.getDamagePatternList() |
| 44 | |
| 45 | @staticmethod |
| 46 | def getBuiltinDamagePatternList(): |
| 47 | return es_DamagePattern.getBuiltinList() |
| 48 | |
| 49 | @staticmethod |
| 50 | def getDamagePattern(name): |
| 51 | return eos.db.getDamagePattern(name) |
| 52 | |
| 53 | @staticmethod |
| 54 | def newPattern(name): |
| 55 | p = es_DamagePattern(0, 0, 0, 0) |
| 56 | p.rawName = name |
| 57 | eos.db.save(p) |
| 58 | return p |
| 59 | |
| 60 | @staticmethod |
| 61 | def renamePattern(p, newName): |
| 62 | p.rawName = newName |
| 63 | eos.db.save(p) |
| 64 | |
| 65 | @staticmethod |
| 66 | def deletePattern(p): |
| 67 | eos.db.remove(p) |
| 68 | |
| 69 | @staticmethod |
| 70 | def copyPattern(p): |
| 71 | newP = copy.deepcopy(p) |
| 72 | eos.db.save(newP) |
| 73 | return newP |
| 74 | |
| 75 | @staticmethod |
| 76 | def saveChanges(p): |
| 77 | eos.db.save(p) |
| 78 | |
| 79 | def importPatterns(self, text): |
| 80 | imports, num = es_DamagePattern.importPatterns(text) |
| 81 | lenImports = len(imports) |
| 82 | |
| 83 | if lenImports == 0: |
| 84 | raise ImportError("No patterns found for import") |
| 85 | if lenImports != num: |
| 86 | raise ImportError("%d patterns imported from clipboard; %d had errors" % (num, num - lenImports)) |
| 87 | |
| 88 | def exportPatterns(self): |
no outgoing calls
no test coverage detected