MCPcopy Create free account
hub / github.com/pyfa-org/Pyfa / SkillBackupThread

Class SkillBackupThread

service/character.py:106–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104
105
106class SkillBackupThread(threading.Thread):
107 def __init__(self, path, saveFmt, activeFit, callback):
108 threading.Thread.__init__(self)
109 self.name = "SkillBackup"
110 self.path = path
111 self.saveFmt = saveFmt
112 self.activeFit = activeFit
113 self.callback = callback
114 self.running = True
115
116 def run(self):
117 path = self.path
118 sCharacter = Character.getInstance()
119
120 backupData = None
121 if self.running:
122 if self.saveFmt == "xml" or self.saveFmt == "emp":
123 backupData = sCharacter.exportXml()
124 else:
125 backupData = sCharacter.exportText()
126
127 if self.running and backupData is not None:
128 if self.saveFmt == "emp":
129 with gzip.open(path, mode='wb') as backupFile:
130 backupFile.write(backupData.encode())
131 else:
132 with open(path, mode='w', encoding='utf-8') as backupFile:
133 backupFile.write(backupData)
134
135 wx.CallAfter(self.callback)
136
137 def stop(self):
138 self.running = False
139
140
141class Character:

Callers 1

backupSkillsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected