| 87 | |
| 88 | |
| 89 | class CharacterEntityEditor(EntityEditor): |
| 90 | def __init__(self, parent): |
| 91 | EntityEditor.__init__(self, parent, _t("Character")) |
| 92 | self.SetEditorValidator(CharacterTextValidor) |
| 93 | |
| 94 | def getEntitiesFromContext(self): |
| 95 | sChar = Character.getInstance() |
| 96 | charList = sorted(sChar.getCharacterList(), key=lambda c: (not c.ro, c.name)) |
| 97 | |
| 98 | # Do some processing to ensure that we have All 0 and All 5 at the top |
| 99 | all5 = sChar.all5() |
| 100 | all0 = sChar.all0() |
| 101 | |
| 102 | charList.remove(all5) |
| 103 | charList.remove(all0) |
| 104 | |
| 105 | charList.insert(0, all5) |
| 106 | charList.insert(0, all0) |
| 107 | |
| 108 | return charList |
| 109 | |
| 110 | def DoNew(self, name): |
| 111 | sChar = Character.getInstance() |
| 112 | return sChar.new(name) |
| 113 | |
| 114 | def DoRename(self, entity, name): |
| 115 | sChar = Character.getInstance() |
| 116 | |
| 117 | if entity.alphaCloneID: |
| 118 | trimmed_name = re.sub('[ \\(\u03B1\\)]+$', '', name) |
| 119 | sChar.rename(entity, trimmed_name) |
| 120 | else: |
| 121 | sChar.rename(entity, name) |
| 122 | |
| 123 | def DoCopy(self, entity, name): |
| 124 | sChar = Character.getInstance() |
| 125 | copy = sChar.copy(entity) |
| 126 | sChar.rename(copy, name) |
| 127 | return copy |
| 128 | |
| 129 | def DoDelete(self, entity): |
| 130 | sChar = Character.getInstance() |
| 131 | sChar.delete(entity) |
| 132 | |
| 133 | |
| 134 | class CharacterEditor(AuxiliaryFrame): |